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

1 line
No EOL
1.6 MiB

{"version":3,"sources":["../../loot-design/src/components/common.js","../../loot-design/src/components/tooltips.js","../../loot-core/src/client/constants.js","../../loot-design/src/svg/v1/Checkmark.web.js","../../loot-core/src/client/actions/app.js","../../loot-design/src/components/Text.js","../../loot-design/src/svg/Delete.web.js","../../loot-design/src/svg/ExpandArrow.web.js","../../loot-core/src/client/actions/prefs.js","../../loot-core/src/client/actions/user.js","../../loot-core/src/client/actions/notifications.js","../../loot-core/src/shared/errors.js","../../loot-core/src/client/query-helpers.js","../../loot-core/src/shared/async.js","../../loot-core/src/client/actions/tutorial.js","../../loot-design/src/components/useProperFocus.js","components/LoggedInUser.js","components/Notifications.js","../../loot-design/src/components/modals/LoadBackup.js","../../loot-design/src/components/useResizeObserver.js","../../loot-design/src/components/KeyHandlers.js","../../loot-design/src/style.js","components/modals/CreateEncryptionKey.js","components/modals/FixEncryptionKey.js","../../loot-core/src/client/actions/account.js","../../loot-core/src/client/actions/debug.js","../../loot-core/src/client/actions/backups.js","../../loot-core/src/client/actions/sync.js","../../loot-core/src/client/actions/index.js","../../loot-design/src/components/Stack.js","../../loot-design/src/components/useSelected.js","components/Background.js","components/AppBackground.js","../../loot-core/src/platform/client/fetch/index.browser.js","../../loot-design/src/components/spreadsheet/format.js","../../loot-core/src/client/reducers/queries.js","browser-server.js","components/App.js","polyfills.js","components/FatalError.js","../../loot-design/src/components/FixedSizeList.js","../../loot-design/src/components/DateSelect.left.png","../../loot-design/src/components/DateSelect.right.png","../../loot-core/src/client/upgrade-notifications.js","../../loot-design/src/util/keys.js","components/manager/bg.svg","components/MobileWebMessage.js","global-events.js","../../loot-design/src/components/spreadsheet/useSheetValue.js","../../loot-core/src/client/shared-listeners.js","../../loot-core/src/client/SpreadsheetProvider.js","../../loot-design/src/svg/v1/Refresh.web.js","components/AnimatedRefresh.js","components/BankSyncStatus.js","../../loot-design/src/components/budget/BudgetMonthCountContext.js","components/Page.js","util/location-state.js","components/ActiveLocation.js","../../loot-core/src/client/data-hooks/payees.js","../../loot-core/src/client/data-hooks/accounts.js","../../loot-core/src/client/queries.js","../../loot-design/src/svg/v2/Calendar.web.js","components/budget/MonthCountSelector.js","../../loot-design/src/svg/v2/ArrowButtonRight1.web.js","../../loot-design/src/svg/v2/NavigationMenu.web.js","../../loot-design/src/svg/v1/ArrowLeft.web.js","../../loot-design/src/svg/v2/AlertTriangle.web.js","../../loot-design/src/svg/v1/ExclamationOutline.web.js","plaid.js","components/accounts/AccountSyncCheck.js","../../loot-design/src/components/spreadsheet/CellValue.js","../../loot-design/src/svg/v1/Add.web.js","../../loot-design/src/svg/v1/Wallet.web.js","../../loot-design/src/svg/v1/Reports.web.js","../../loot-design/src/svg/v2/ArrowButtonLeft1.web.js","../../loot-design/src/svg/v1/PiggyBank.web.js","../../loot-design/src/svg/v1/Cog.web.js","../../loot-design/src/components/sort.js","../../loot-design/src/components/sidebar.js","components/SidebarWithData.js","components/FloatableSidebar.js","components/Titlebar.js","../../loot-design/src/components/TutorialPoint.js","../../loot-design/src/svg/v2/Pencil1.web.js","../../loot-design/src/svg/v2/SearchAlternate.web.js","../../loot-design/src/svg/v2/DownloadThickBottom.web.js","../../loot-design/src/svg/v1/CheveronDown.web.js","../../loot-design/src/svg/v2/CheckCircle1.web.js","../../loot-design/src/svg/v2/ArrowsExpand3.web.js","../../loot-design/src/svg/v2/ArrowsShrink3.web.js","../../loot-core/src/client/query-hooks.js","../../loot-core/src/shared/transactions.js","../../loot-design/src/svg/v2/Remove.web.js","../../loot-design/src/components/Autocomplete.js","../../loot-design/src/svg/split.web.js","../../loot-design/src/components/CategorySelect.js","../../loot-design/src/components/PayeeAutocomplete.js","../../loot-design/src/components/AccountAutocomplete.js","../../loot-design/src/svg/RightArrow2.web.js","../../loot-design/src/svg/LeftArrow2.web.js","../../loot-design/src/svg/v2/Hyperlink2.web.js","../../loot-design/src/svg/v2/ArrowsSynchronize.web.js","../../loot-core/src/shared/arithmetic.js","../../loot-design/src/svg/v2/EditSkull1.web.js","../../loot-design/src/svg/v2/ValidationCheck.web.js","../../loot-design/src/svg/v2/FavoriteStar.web.js","components/schedules/StatusBadge.js","../../loot-core/src/shared/schedules.js","../../loot-core/src/client/data-hooks/schedules.js","components/accounts/TransactionsTable.js","../../loot-design/src/components/useMergedRefs.js","components/accounts/TransactionList.js","../../loot-core/src/shared/rules.js","../../loot-design/src/svg/v2/SettingsSliderAlternate.web.js","../../loot-design/src/svg/Subtract.web.js","../../loot-design/src/svg/Add.web.js","../../loot-design/src/components/RecurringSchedulePicker.js","components/util/GenericInput.js","../../loot-design/src/svg/v1/InformationOutline.web.js","components/modals/ManageRules.js","components/accounts/Filters.js","components/accounts/Account.js","../../loot-design/src/components/budget/MonthsContext.js","../../loot-design/src/components/budget/util.js","../../loot-design/src/components/budget/constants.js","../../loot-design/src/components/budget/rollover/TransferTooltip.js","../../loot-design/src/svg/v1/ArrowThinRight.web.js","../../loot-design/src/components/budget/BalanceWithCarryover.js","../../loot-design/src/svg/v2/ArrowButtonDown1.web.js","../../loot-design/src/svg/v2/ArrowButtonUp1.web.js","../../loot-design/src/components/budget/rollover/RolloverContext.js","../../loot-design/src/components/budget/rollover/HoldTooltip.js","../../loot-design/src/svg/v2/CustomNotesPaper.web.js","../../loot-design/src/components/NotesButton.js","../../loot-design/src/components/budget/rollover/BudgetSummary.js","../../loot-design/src/components/budget/rollover/rollover-components.js","../../loot-design/src/components/budget/report/ReportContext.js","../../loot-design/src/components/budget/report/BudgetSummary.js","../../loot-design/src/components/budget/report/components.js","../../loot-design/src/components/ElementQuery.js","../../loot-design/src/svg/v1/ArrowThinLeft.web.js","../../loot-design/src/components/budget/BudgetSummaries.js","../../loot-design/src/components/budget/index.js","../../loot-design/src/components/budget/DynamicBudgetTable.js","../../loot-core/src/shared/categories.js","components/budget/index.js","components/reports/util.js","components/reports/chart-theme.js","components/reports/Container.js","components/reports/Tooltip.js","components/reports/useReport.js","components/reports/graphs/net-worth-spreadsheet.js","components/reports/graphs/cash-flow-spreadsheet.js","components/reports/graphs/NetWorthGraph.js","components/reports/Change.js","components/reports/DateRange.js","components/reports/Overview.js","components/reports/Header.js","components/reports/NetWorth.js","components/reports/graphs/CashFlowGraph.js","components/reports/CashFlow.js","components/reports/index.js","../../loot-design/src/svg/v2/Check.web.js","components/util/DisplayId.js","components/schedules/SchedulesTable.js","components/schedules/index.js","../../loot-design/src/components/forms.js","components/accounts/SimpleTransactionsTable.js","../../loot-design/src/svg/v1/Subtract.web.js","components/util/AmountInput.js","components/modals/EditRule.js","components/schedules/EditSchedule.js","components/schedules/LinkSchedule.js","components/schedules/DiscoverSchedules.js","components/schedules/PostsOfflineNotification.js","components/tools/FixSplitsTool.js","../../loot-design/src/components/alerts.js","components/Settings.js","components/modals/CreateAccount.js","../../loot-core/src/shared/accounts.js","../../loot-design/src/components/modals/CreateLocalAccount.js","../../loot-design/src/components/modals/CloseAccount.js","../../loot-design/src/components/modals/SelectLinkedAccounts.js","../../loot-design/src/components/modals/ConfigureLinkedAccounts.js","../../loot-design/src/svg/merge.web.js","../../loot-design/src/components/payees.js","components/payees/ManagePayeesWithData.js","components/modals/MergeUnusedPayees.js","../../loot-design/src/components/modals/PlaidExternalMsg.js","components/modals/ConfirmCategoryDelete.js","components/modals/WelcomeScreen.js","../../loot-design/src/components/modals/ImportTransactions.js","../../loot-design/src/components/modals/EditField.js","components/Modals.js","components/GlobalKeys.js","components/FinancesApp.js","components/manager/ServerURL.js","../../loot-design/src/svg/v1/CloudCheck.web.js","../../loot-design/src/svg/v1/CloudDownload.web.js","../../loot-design/src/svg/v2/CloudUnknown.web.js","../../loot-design/src/svg/v1/FileDouble.web.js","../../loot-design/src/svg/v2/Key.web.js","../../loot-design/src/svg/v2/RefreshArrow.web.js","../../loot-design/src/components/manager/BudgetList.js","../../loot-design/src/components/manager/Import.js","../../loot-design/src/components/manager/ImportYNAB4.js","../../loot-design/src/components/manager/ImportYNAB5.js","../../loot-design/src/components/manager/DeleteFile.js","components/manager/Modals.js","components/manager/subscribe/common.js","components/manager/subscribe/Login.js","components/manager/subscribe/ConfirmPasswordForm.js","components/manager/subscribe/Bootstrap.js","components/manager/subscribe/Error.js","components/manager/subscribe/ChangePassword.js","components/manager/ConfigServer.js","components/manager/ManagementApp.js","../../loot-design/src/svg/v1/Close.web.js","components/UpdateNotification.js","browser-preload.browser.js","../../loot-core/src/platform/exceptions/index.browser.js","../../loot-design/src/components/View.js","../../loot-core/src/client/actions/modals.js","../../loot-core/src/client/platform.js","../../loot-core/src/client/reducers/app.js","../../loot-core/src/client/reducers/account.js","../../loot-core/src/client/reducers/debug.js","../../loot-core/src/client/reducers/profile.js","../../loot-core/src/client/reducers/prefs.js","../../loot-core/src/client/reducers/modals.js","../../loot-core/src/client/reducers/notifications.js","../../loot-core/src/client/reducers/budgets.js","../../loot-core/src/client/reducers/tutorial.js","../../loot-core/src/client/reducers/user.js","../../loot-core/src/client/reducers/index.js","index.js","../../loot-core/src/client/actions/budgets.js","../../loot-design/src/components/table.js","../../loot-core/src/platform/client/undo/index.web.js","../../loot-core/src/client/actions/queries.js","../../loot-design/src/components/spreadsheet/SpreadsheetContext.js","../../loot-design/src/svg/v1/Loading.web.js","../../loot-design/src/svg/v1/AnimatedLoading.web.js","../../loot-design/src/components/spreadsheet/NamespaceContext.js","../../loot-core/src/shared/query.js","../../loot-design/src/svg/v1/DotsHorizontalTriple.web.js","../../loot-design/src/components/DateSelect.js","../../loot-core/src/shared/months.js","../../loot-core/src/shared/util.js","../../loot-design/src/components/spreadsheet/SheetValue.js","../../loot-core/src/platform/uuid/index.web.js"],"names":["useStableCallback","callback","callbackRef","useRef","memoCallback","useCallback","args","current","useLayoutEffect","Block","props","style","innerRef","restProps","_objectWithoutProperties","_excluded","react__WEBPACK_IMPORTED_MODULE_0___default","a","createElement","Object","assign","ref","className","css","textDecoration","color","styles","text","backgroundColor","border","cursor","padding","font",":hover","Link","_ref45","children","nativeProps","_excluded2","_ref","smallText","AnchorLink","staticContext","to","exact","activeStyle","useHistory","createHref","pathname","match","useRouteMatch","path","react_router_dom__WEBPACK_IMPORTED_MODULE_6__","ExternalLink","React","forwardRef","onClick","e","preventDefault","window","Actual","openURLInBrowser","href","asAnchor","Button","bare","ButtonLink","withRouter","_ref46","history","location","_excluded3","react_router_dom__WEBPACK_IMPORTED_MODULE_5__","push","_ref47","pressed","primary","hover","disabled","hoveredStyle","_ref47$as","as","_excluded4","boxShadow","shadow","transform","transition","Component","buttonStyle","_objectSpread","alignItems","justifyContent","flexShrink","margin","overflow","display","borderRadius","colors","n7","p5","n9","n6","n1",":active","position","top","left","right","bottom","width","height","ButtonWithLoading","loading","buttonProps","_excluded5","_ref2","_View__WEBPACK_IMPORTED_MODULE_13__","_ref3","_svg_v1_AnimatedLoading__WEBPACK_IMPORTED_MODULE_11__","_ref4","opacity","flexDirection","defaultInputStyle","outline",":focus","b5","b7","::placeholder","Input","_ref48","inputRef","onEnter","onUpdate","focused","_excluded6","useProperFocus","mergeRefs","_ref5","onKeyDown","keyCode","onChange","target","value","flex","&, &:focus, &:hover","InputWithContent","_ref49","leftContent","rightContent","inputStyle","getStyle","_excluded7","_useState2","_slicedToArray","useState","setFocused","_ref6","_ref7","_ref8","onFocus","onBlur","fontSize","Select","_ref50","_excluded8","_ref9","lineHeight","borderWidth","paddingTop","zIndex","CustomSelect","options","_reach_listbox__WEBPACK_IMPORTED_MODULE_7__","_ref10","_ref11","arrow","loot_design_src_svg_ExpandArrow__WEBPACK_IMPORTED_MODULE_12__","_ref12","_ref13","map","label","key","Keybinding","keyName","_Text__WEBPACK_IMPORTED_MODULE_14__","_ref14","borderTop","n10","textTransform","Menu","header","footer","items","allItems","onMenuSelect","el","filter","x","_useState4","hoveredIndex","setHoveredIndex","useEffect","focus","filteredItems","item","line","type","currentIndex","indexOf","transformIndex","idx","Math","max","min","length","name","addEventListener","removeEventListener","_ref15","tabIndex","_ref16","_ref17","_ref18","lastItem","marginTop","_ref19","_ref20","onMouseEnter","onMouseLeave","_ref21","icon","iconSize","marginRight","_ref22","Symbol","textAlign","AlignedText","_ref51","leftStyle","rightStyle","_ref51$truncate","truncate","_excluded9","truncateStyle","textOverflow","whiteSpace","_ref23","_ref24","_ref25","marginBottom","P","_ref52","isLast","_excluded10","_ref27","_ref28","ModalContent","size","noAnimation","isCurrent","stackIndex","contentRef","mounted","rotateFactor","random","setProps","pointerEvents","setTimeout","_ref30","n2","alignSelf","fontWeight","Modal","title","isHidden","showHeader","showTitle","showClose","showOverlay","focusAfterClose","parent","contentStyle","overlayStyle","onClose","prevScope","hotkeys","getScope","setScope","react_modal__WEBPACK_IMPORTED_MODULE_4___default","isOpen","onRequestClose","shouldCloseOnOverlayClick","shouldFocusAfterRender","global","IS_DESIGN_MODE","shouldReturnFocusAfterClose","appElement","document","querySelector","parentSelector","content","overlay","willChange","minWidth","minHeight","shadowLarge","lightScrollbar","_ref31","_ref32","_ref33","_ref34","_ref35","_ref36","_svg_Delete__WEBPACK_IMPORTED_MODULE_10__","_ref37","_ref38","ModalButtons","focusButton","containerRef","button","_ref39","data-hidden","_ref40","_ref41","InlineField","labelWidth","paddingRight","FormError","_ref42","InitialFocus","node","setSelectionRange","cloneElement","HoverTarget","[object Object]","super","this","state","hovered","setState","componentDidUpdate","prevProps","render","_this$props","renderContent","IntersectionBoundary","createContext","useTooltip","setIsOpen","getOpenEvents","events","stopPropagation","close","Tooltip","constructor","createRef","setup","layout","mousedownHandler","documentElement","dataset","testid","reachPopover","parentNode","cleanup","componentDidMount","getContainer","forceUpdate","console","log","targetRect","forceTop","forceLayout","_this$props$ignoreBou","ignoreBoundary","context","body","getBoundsContainer","container","_this$props$offset","offset","contentEl","box","getBoundingClientRect","anchorEl","anchorRect","containerRect","boxHeight","testTop","testBottom","getOppositePosition","scrollTop","getStyleForPosition","componentWillUnmount","boxRect","Error","_this$props2","ReactDOM","createPortal","darkScrollbar","data-testid","contextType","__webpack_exports__","LOAD_TRANSACTIONS","SET_NEW_TRANSACTIONS","UPDATE_NEW_TRANSACTIONS","SET_LAST_TRANSACTION","MARK_ACCOUNT_READ","LOAD_ACCOUNTS","UPDATE_ACCOUNT","LOAD_CATEGORIES","ADD_CATEGORY","DELETE_CATEGORY","LOAD_PAYEES","LOAD_BANKS","SET_PROFILE","SET_PREFS","MERGE_LOCAL_PREFS","MERGE_GLOBAL_PREFS","SET_BUDGETS","SET_REMOTE_FILES","SET_ALL_FILES","SET_AVAILABLE_IMPORTS","CLOSE_BUDGET","SET_APP_STATE","DEBUG_CELL","PUSH_MODAL","REPLACE_MODAL","HIDE_MODALS","SHOW_MODALS","CLOSE_MODAL","POP_MODAL","ADD_NOTIFICATION","REMOVE_NOTIFICATION","GET_USER_DATA","SET_LAST_UNDO_STATE","SET_LAST_SPLIT_STATE","SET_ACCOUNTS_SYNCING","ACCOUNT_SYNC_STATUS","ACCOUNT_SYNC_FAILURES","SIGN_OUT","SET_TUTORIAL_STAGE","DEACTIVATE_TUTORIAL","SvgCheckmark","viewBox","d","fill","__webpack_require__","setAppState","updateApp","setLastUndoState","uploadFile","_platform_client_fetch__WEBPACK_IMPORTED_MODULE_0__","_constants__WEBPACK_IMPORTED_MODULE_1__","constants","async","applyAppUpdate","dispatch","updateInfo","undoState","filename","contents","send","Text","numberOfLines","Delete","_ref$color","version","xmlns","stroke","strokeWidth","strokeLinecap","strokeMiterlimit","x1","y1","x2","y2","ExpandArrow","loadPrefs","savePrefs","loadGlobalPrefs","saveGlobalPrefs","_constants__WEBPACK_IMPORTED_MODULE_0__","_modals__WEBPACK_IMPORTED_MODULE_1__","_platform_client_fetch__WEBPACK_IMPORTED_MODULE_2__","getState","prefs","currentPrefs","local","id","closeModal","globalPrefs","getUserData","loggedIn","signOut","_prefs__WEBPACK_IMPORTED_MODULE_2__","_budgets__WEBPACK_IMPORTED_MODULE_3__","data","loadAllFiles","closeBudget","uuid","require","addNotification","notification","v4Sync","addGenericErrorNotification","message","removeNotification","getUploadError","reason","meta","isMissingKey","getDownloadError","fileName","fileId","getCreateKeyError","error","getTestKeyError","runQuery","liveQuery","pagedQuery","query_helpers_LiveQuery","query_helpers_PagedQuery","q","query","serialize","onData","opts","LiveQuery","run","PagedQuery","prevData","i","listeners","tables","dependencies","find","table","has","subscribe","_fetchData","reqId","inflightRequestId","_await$makeRequest","makeRequest","Set","_unsubscribe","mappedData","mapData","listen","onlySync","unsubscribe","mapper","getQuery","getData","getNumListeners","isRunning","_optimisticUpdate","dataFunc","mappedDataFunc","optimisticUpdate","prevMappedData","inflight","restart","addListener","func","l","_fetchCount","calculate","$count","then","totalCount","runPromise","done","limit","pageCount","refetchUpToRow","defaultOrderBy","orderDesc","getPrimaryOrderBy","field","order","result","select","fullRow","concat","_fetchNext","previousData","mapped","onPageData","fetchNext","fn","promise","finally","once","isFinished","getTotalCount","startTutorialFirstTime","_platform_client_fetch__WEBPACK_IMPORTED_MODULE_1__","_platform__WEBPACK_IMPORTED_MODULE_2__","_modals__WEBPACK_IMPORTED_MODULE_3__","seenTutorial","Platform","env","pushModal","AvoidRefocusScrollProvider","react__WEBPACK_IMPORTED_MODULE_0__","n","AvoidRefocusScrollContext","keyRef","useMemo","onKeyChange","Provider","shouldFocus","useContext","prevShouldFocus","prev","view","selector","focusEl","matches","refocusContext","focusKey","getFocusedKey","preventScroll","tagName","focusElement","n5","fontStyle","connect","userData","user","files","budgets","allFiles","budgetId","actions","setLoading","menuOpen","setMenuOpen","loot_design_src_components_common__WEBPACK_IMPORTED_MODULE_5__","offline","__history","onChangePassword","Notification","onRemove","messageActions","sticky","internal","overlayLoading","setOverlayLoading","positive","processedMessage","loot_design_src_components_common__WEBPACK_IMPORTED_MODULE_4__","spacing","split","paragraph","parts","part","_match","actionName","slice","compileMessage","g3","r3","align","direction","g11","r11","y10","g5","r5","y4","maxWidth","& a","action","r4","y3","&:hover, &:active","g9","r10","y9","loot_design_src_svg_Delete__WEBPACK_IMPORTED_MODULE_5__","loot_design_src_svg_v1_AnimatedLoading__WEBPACK_IMPORTED_MODULE_6__","notifications","bindActionCreators","note","_common__WEBPACK_IMPORTED_MODULE_1__","_table__WEBPACK_IMPORTED_MODULE_2__","_style__WEBPACK_IMPORTED_MODULE_3__","maxHeight","paddingLeft","BackupTable","hoveredBackup","onHover","backups","onSelect","backup","collapsed","date","valueStyle","marginLeft","LoadBackup","backupDisabled","modalProps","latestBackup","isLatest","previousBackups","loadBackup","makeBackup","useResizeObserver","observer","ResizeObserver","entries","contentRect","disconnect","observe","KeyHandlers","hotkeys_js__WEBPACK_IMPORTED_MODULE_0__","react__WEBPACK_IMPORTED_MODULE_1__","react__WEBPACK_IMPORTED_MODULE_1___default","KeyScopeContext","KeyHandler","eventType","handler","scope","_handler","event","hk","keyup","unbind","method","keys","srcElement","metaKey","isContentEditable","readOnly","hasHiddenScrollbars","loot_core_src_client_platform__WEBPACK_IMPORTED_MODULE_0__","y5","y6","y7","y8","y11","r1","r2","r6","r7","r8","r9","b1","b2","b3","b4","b6","b8","b9","b10","b11","n3","n4","n8","n11","g1","g2","g4","g6","g7","g8","g10","p1","p2","p3","p4","p6","p7","p8","p9","p10","p11","selected","resolve","veryLargeText","largeText","letterSpacing","mediumText","verySmallText","page","pageHeader","borderBottomWidth","borderColor","purple2","borderStyle","grey4","paddingBottom","pageContent","staticText","userSelect","tnum","fontFeatureSettings","notFixed","hiddenScrollbars","onScrollbarChange","& ::-webkit-scrollbar","& ::-webkit-scrollbar-thumb","backgroundClip","& ::-webkit-scrollbar-thumb:vertical","scrollbarWidth","testScrollbars","innerHTML","appendChild","testNode","childNodes","offsetWidth","clientWidth","& li","CreateEncryptionKey","password","setPassword","_useState6","_useState8","setError","_useState10","showPassword","setShowPassword","isRecreating","recreate","loot_design_src_components_common__WEBPACK_IMPORTED_MODULE_2__","popModal","Fragment","onSubmit","res","sync","onCreateKey","FixEncryptionKey","hasExistingKey","cloudFileId","onSuccess","onUpdateKey","loot_design_src_components_common__WEBPACK_IMPORTED_MODULE_1__","onBack","setAccountsSyncing","markAccountFailed","errorType","errorCode","failed","markAccountSuccess","setFailedAccounts","syncErrors","unlinkAccount","getAccounts","linkAccount","institution","publicToken","accountId","upgradingId","getPayees","connectAccounts","accountIds","offbudgetIds","ids","syncAccounts","account","accountsSyncing","queries","accounts","_await$send","errors","newTransactions","matchedTransactions","updatedAccounts","category","code","forEach","setLastTransaction","transaction","parseTransactions","filepath","importTransactions","transactions","_await$send2","_await$send2$errors","added","updated","updateNewTransactions","changedId","markAccountRead","getBanks","banks","debugCell","sheet","backupId","loadBudget","unregister","profile","resetSync","alert","syncAndDownload","syncState","hasDownloaded","hasUpdated","modals","actions_prefs","app","tutorial","_View__WEBPACK_IMPORTED_MODULE_1__","_Text__WEBPACK_IMPORTED_MODULE_2__","Stack","justify","debug","isReversed","endsWith","isHorizontal","startsWith","validChildren","getChildren","Children","toArray","reduce","list","child","index","marginProp","isLastChild","iterateRange","range","from","start","end","useSelected","initialSelectedIds","_useReducer2","useReducer","selectedRange","selectedItems","hasModifierKey","deleteUntil","findIndex","p","startIdx","endIdx","add","delete","prevItems","every","filtered","prevState","undo","lastUndoState","useSelector","onUndo","messages","undoTag","tagged","deletedIds","msg","column","row","setItems","setSelectedItems","SelectedDispatch","SelectedItems","useSelectedDispatch","useSelectedItems","SelectedProvider","instance","fetchAllIds","latestItems","SelectedProviderWithItems","registerDispatch","background","BG","backgroundSize","Background","react_default","AppBackground","initializing","loadingText","components_Background","common","AppBackground_ref","AnimatedLoading_web","_require","captureException","captureBreadcrumb","replyHandlers","Map","messageQueue","globalWorker","ReconstructedError","stack","url","defineProperty","get","_stack","set","connectWorker","worker","onOpen","onError","postMessage","exc","includes","mutated","gc","listens","JSON","stringify","handleMessage","MessagePort","module","exports","init","Promise","reject","catchErrors","v4","snapshot","sendCatch","cb","arr","cb_","unlisten","format","loot_core_src_shared_util__WEBPACK_IMPORTED_MODULE_0__","val","charAt","formatted","integerToCurrency","parsed","parseFloat","isNaN","initialState","lastTransaction","categories","grouped","payees","earliestTransaction","update","group","groupId","cat","getAccountsById","memoizeOne","groupById","getPayeesById","getCategoriesById","categoryGroups","getActivePayees","accountsById","payee","transfer_acct","closed","Worker_fn","Worker","react_redux__WEBPACK_IMPORTED_MODULE_1__","glamor__WEBPACK_IMPORTED_MODULE_2__","loot_core_src_client_actions__WEBPACK_IMPORTED_MODULE_3__","loot_core_src_platform_client_fetch__WEBPACK_IMPORTED_MODULE_4__","_polyfills__WEBPACK_IMPORTED_MODULE_5__","loot_design_src_style__WEBPACK_IMPORTED_MODULE_6__","_FatalError__WEBPACK_IMPORTED_MODULE_7__","_manager_ManagementApp__WEBPACK_IMPORTED_MODULE_8__","_FinancesApp__WEBPACK_IMPORTED_MODULE_9__","_AppBackground__WEBPACK_IMPORTED_MODULE_10__","_UpdateNotification__WEBPACK_IMPORTED_MODULE_11__","_MobileWebMessage__WEBPACK_IMPORTED_MODULE_12__","showingTutorial","stage","fatalError","socketName","getServerSocket","initConnection","remoteFile","f","deleted","all","installPolyfills","checkScrollbars","componentDidCatch","errorInfo","SentryClient","extra","updateAppMenu","_this$state","buttonText","bind","loot_design_src_style__WEBPACK_IMPORTED_MODULE_2__","FatalError","showError","renderSimple","IDBFailure","relaunch","IS_SCROLLING_DEBOUNCE_INTERVAL","defaultItemKey","onResize","FixedSizeList","PureComponent","_outerRef","_resetIsScrollingTimeoutId","setRowAnimation","flag","animationEnabled","outerRef","classList","remove","onHeaderResize","rect","getItemOffset","itemSize","getItemSize","getEstimatedTotalSize","itemCount","getOffsetForIndexAndAlignment","scrollOffset","lastItemOffset","maxOffset","minOffset","middleOffset","round","ceil","floor","getStartIndexForOffset","getStopIndexForStartIndex","startIndex","numVisibleItems","_callOnItemsRendered","overscanStartIndex","overscanStopIndex","visibleStartIndex","visibleStopIndex","onItemsRendered","_callOnScroll","scrollDirection","scrollUpdateWasRequested","onScroll","_getItemStyle","itemStyleCache","_getItemStyleCache","hasOwnProperty","_","__","___","_onScrollVertical","_event$currentTarget","currentTarget","clientHeight","scrollHeight","isScrolling","_resetIsScrollingDebounced","_outerRefSetter","clearTimeout","_resetIsScrolling","lastPositions","needsAnimationRerender","initialScrollOffset","scrollTo","requestScrollUpdateHandled","scrollToItem","_callPropsCallbacks","getAnchoredScrollPos","anchored","indexForKey","baseOffset","anchoredPos","rerenderTimeout","_this$props3","innerElementType","innerTagName","renderRow","_this$props3$itemKey","itemKey","outerElementType","outerTagName","useIsScrolling","_this$_getRangeToRend2","_getRangeToRender","stopIndex","positions","lastPosition","animating","undefined","isAnimating","estimatedTotalSize","OuterElement","InnerElement","headerRef","_common__WEBPACK_IMPORTED_MODULE_3__","anchor","unanchor","isAnchored","_this$_getRangeToRend4","_this$state2","_this$props4","overscanCount","_this$state3","overscanBackward","overscanForward","defaultProps","headerHeight","checkForUpgradeNotifications","_platform__WEBPACK_IMPORTED_MODULE_1__","types","IS_BETA","locationPtr","ESC","TAB","ENTER","SHIFT","ALT","META","CTRL","SPACE","UP","DOWN","J","K","X","_keyHandlers","_modifierState","shift","ctrl","alt","modifier","handlers","toUpperCase","MobileWebMessage","appStoreURL","ua","navigator","userAgent","iOS","webkit","isOSX","innerWidth","cookie","show","setShow","Date","setTime","getTime","toGMTString","handleGlobalEvents","loot_core_src_platform_client_fetch__WEBPACK_IMPORTED_MODULE_0__","loot_core_src_platform_client_undo__WEBPACK_IMPORTED_MODULE_1__","loot_core_src_client_shared_listeners__WEBPACK_IMPORTED_MODULE_2__","store","onEventFromMain","info","status","updateStatusText","orphanedIds","updatedPayeeIds","payeeIds","targetPayeeId","sharedListeners","promises","getCategories","openModal","modalStack","replaceModal","closeBudgetUI","useSheetValue","binding","IS_TESTING","toString","sheetName","NamespaceContext","unresolved","unresolveName","spreadsheet","SpreadsheetContext","setResult","latestOnChange","latestValue","createQuery","newResult","listenForSyncEvent","attemptedSyncRepair","subtype","notif","learnMore","makeKey","uploadBudget","_store$getState$prefs","upload","closeAndDownloadBudget","SpreadsheetProvider","cellObservers","LRUValueCache","LRU","cellCache","observersDisabled","observeCell","disableObservers","enableObservers","prewarmCache","nodes","observers","fields","resolvedName","req","getCellNames","makeSpreadsheet","react","SvgRefresh","spin","keyframes","0%","100%","AnimatedRefresh","iconStyle","animation","Refresh_web","AnimatedRefresh_objectSpread","transitions","useTransition","enter","leave","unique","BankSyncStatus_ref","web","div","BankSyncStatus_ref3","BudgetMonthCountContext","BudgetMonthCountProvider","displayMax","setDisplayMax","mitt","useBudgetMonthCount","PageTypeContext","PageTypeProvider","usePageType","PageTitle","Page_ref","Page","modalSize","_usePageType","goBack","Page_ref2","VERSION","now","getLocationState","subfield","_version","ActiveLocationContext","ActiveLocationProvider","PayeesContext","PayeesProvider","payees_slicedToArray","setData","usePayees","CachedPayees","idKey","useCachedPayees","AccountsContext","AccountsProvider","accounts_slicedToArray","useAccounts","CachedAccounts","useCachedAccounts","getAccountFilter","is_parent","$or","payee.transfer_acct.offbudget","payee.transfer_acct","accountBalance","acct","splits","$sum","budgetedAccountBalance","account.offbudget","account.closed","offbudgetAccountBalance","uncategorizedQuery","rolloverBudget","incomeAvailable","lastMonthOverspent","forNextMonth","totalBudgeted","toBudget","fromLastMonth","totalIncome","totalSpent","totalBalance","groupSumAmount","groupIncomeReceived","groupBudgeted","groupBalance","catBudgeted","catSumAmount","catBalance","catCarryover","reportBudget","totalBudgetedExpense","totalBudgetedIncome","totalBudgetedSaved","totalSaved","totalLeftover","SvgCalendar","Calendar_web_objectSpread","Calendar","Calendar_web","& svg","& svg:hover","MonthCountSelector","maxMonths","calendars","MonthCountSelector_ref","SvgArrowButtonRight1","ArrowButtonRight1_web_objectSpread","SvgNavigationMenu","NavigationMenu_web_objectSpread","y","rx","ry","SvgArrowLeft","ArrowLeft_web_objectSpread","SvgAlertTriangle","AlertTriangle_web_objectSpread","SvgExclamationOutline","ExclamationOutline_web_objectSpread","_authorize","plaidToken","onMoveExternal","token","authorizeBank","metadata","failedAccounts","AccountSyncCheck_slicedToArray","open","setOpen","showAuth","unlink","AccountSyncCheck_ref","ExclamationOutline_web","AccountSyncCheck_ref2","AccountSyncCheck_ref3","AccountSyncCheck_ref4","getErrorMessage","AccountSyncCheck_ref6","bankId","linkToken","reauthorizeBank","AccountSyncCheck_ref7","CellValue","formatter","SheetValue","data-cellname","SvgAdd","Add_web_objectSpread","SvgWallet","Wallet_web_objectSpread","SvgReports","Reports_web_objectSpread","SvgArrowButtonLeft1","ArrowButtonLeft1_web_objectSpread","SvgPiggyBank","PiggyBank_web_objectSpread","clipPath","SvgCog","Cog_web_objectSpread","useDraggable","makePreview","canDrag","onDragChange","_onDragChange","_useDrag2","sort_slicedToArray","useDrag","collect","monitor","isDragging","begin","dragRef","useDroppable","onDrop","onLongHover","dropPos","setDropPos","_useDrop2","useDrop","accept","drop","hoverBoundingRect","hoverMiddleY","hoverClientY","getClientOffset","isOver","dropRef","timeout","ref1","ref2","DropHighlightPosContext","DropHighlight","pos","itemPos","topOffset","bottomOffset","posStyle","sort_ref","SIDEBAR_WIDTH","borderLeft","Item","onButtonPress","showButton","sidebar_ref","sidebar_ref2","sidebar_ref3","sidebar_ref4","sidebar_ref5","sidebar_ref6","Add_web","sidebar_ref7","sidebar_ref8","accountNameStyle","& .dot","Account","connected","outerStyle","offbudget","_useDroppable","sidebar_ref9","sidebar_ref10","sidebar_ref11","sidebar_ref12","spreadsheet_CellValue","Accounts","getAccountPath","budgetedAccountPath","offBudgetAccountPath","getBalanceQuery","getOnBudgetBalance","getOffBudgetBalance","showClosedAccounts","onAddAccount","onToggleClosedAccounts","onReorder","sidebar_slicedToArray","setIsDragging","offbudgetAccounts","budgetedAccounts","closedAccounts","drag","makeDropPadding","sidebar_ref16","sidebar_ref17","sidebar_ref18","ToggleButton","onFloat","ArrowButtonLeft1_web","MenuButton","useDispatch","sidebar_ref22","DotsHorizontalTriple_web","Sidebar","budgetName","isFloating","hasWindowButtons","isBrowser","OS","& .float","&:hover .float","WebkitAppRegion","_ref26","Cog_web","_ref29","sidebar_MenuButton","Wallet_web","Reports_web","PiggyBank_web","EditableBudgetName","SidebarWithData_slicedToArray","editing","setEditing","SidebarWithData_ref","defaultValue","trim","SidebarWithData_ref2","SidebarWithData_ref3","floatingSidebar","targetId","ui.showClosedAccounts","SidebarWithData_ref4","SidebarContext","SidebarProvider","emitter","emit","hide","on","listener","off","useSidebar","FloatableSidebar_slicedToArray","hidden","setHidden","sidebar","cleanups","onMouseOver","components_SidebarWithData","FloatableSidebar_ref","TitlebarContext","TitlebarProvider","sendEvent","UncategorizedButton","num","Titlebar_ref","SyncButton","localPrefs","onSync","Titlebar_slicedToArray","syncing","setSyncing","setSyncState","syncDisabled","AlertTriangle_web","Titlebar_ref2","Titlebar_ref3","BudgetTitlebar","showTooltip","setShowTooltip","reportBudgetEnabled","budgetType","Titlebar_ref4","Titlebar_ref5","Titlebar_ref6","Titlebar_ref7","Titlebar_ref8","Titlebar_ref9","& *","& .arrow-right","& .menu","&:hover .arrow-right","&:hover .menu","syncError","Titlebar_ref10","Titlebar_ref11","Titlebar_ref12","Titlebar_ref13","ArrowButtonRight1_web","Titlebar_ref14","NavigationMenu_web","Titlebar_ref15","react_router","ArrowLeft_web","Titlebar_ref16","accounts_AccountSyncCheck","params","Titlebar_ref17","Titlebar_ref18","LoggedInUser","Titlebar_ref19","TutorialPoint","setTutorialNode","expand","contextTypes","PropTypes","SvgPencil1","Pencil1_web_objectSpread","SvgSearchAlternate","SearchAlternate_web_objectSpread","SvgDownloadThickBottom","DownloadThickBottom_web_objectSpread","SvgCheveronDown","CheveronDown_web_objectSpread","SvgCheckCircle1","CheckCircle1_web_objectSpread","SvgArrowsExpand3","ArrowsExpand3_web_objectSpread","SvgArrowsShrink3","ArrowsShrink3_web_objectSpread","makeContext","queryState","QueryClass","Context","query_hooks_slicedToArray","useQuery","queryData","SplitTransactionError","total","difference","amount","makeChild","prefix","transactions_objectSpread","cleared","starting_balance_flag","is_child","parent_id","recalculateSplit","trans","subtransactions","acc","t","ungroupTransactions","groupTransaction","ungroupTransaction","replaceTransactions","transactionsCopy","parentIndex","findParentIndex","diff","curr","getSplit","newSplit","_deleted","splice","diffItems","newTransaction","newTrans","addSplitTransaction","prevSub","last","sort_order","updateTransaction","sub","deleteTransaction","splitTransaction","SvgRemove","Remove_web_objectSpread","findItem","strict","suggestions","getItemName","getItemId","getInitialState","embedded","initialFilterSuggestions","selectedItem","filteredSuggestions","originalItem","highlightedIndex","defaultFilterSuggestion","suggestion","toLowerCase","defaultFilterSuggestions","fireUpdate","sug","onInputValueChange","multi","highlightFirst","filterSuggestions","getHighlightedIndex","changes","hasFocus","Downshift","stateChangeTypes","controlledPropUpdatedSelectedItem","clickItem","defaultGetHighlightedIndex","onStateChange","inst","stateAndHelpers","tableBehavior","mouseUp","newState","keyDownArrowUp","keyDownArrowDown","lastChangeType","clearAfterSelect","onSelectAfter","input","inputProps","shouldSaveFromKey","defaultShouldSaveFromKey","isNulled","itemMouseEnter","defaultRenderInput","defaultRenderItems","getItemProps","openOnFocus","_props$inputProps","preventDownshiftDefault","originalValue","Autocomplete_objectSpread","defaultItemToString","SingleAutocomplete","lively","containerProps","tooltipStyle","onItemClick","tooltipProps","renderInput","renderItems","itemToString","updater","downshift_esm","inputValue","getInputProps","getRootProps","Autocomplete_ref","Autocomplete_ref2","Autocomplete_getInitialState","componentWillReceiveProps","bag","nextProps","_nextProps$filterSugg","_nextProps$itemToStri","currValue","updates","updateValue","MultiItem","Autocomplete_ref4","Autocomplete_ref5","Remove_web","Autocomplete_ref6","flexWrap","MultiAutocomplete","Autocomplete_objectWithoutProperties","Autocomplete_excluded","Autocomplete_slicedToArray","lastSelectedItems","onRemoveItem","Autocomplete","Autocomplete_ref7","Autocomplete_ref8","prevOnKeyDown","Autocomplete_ref9","AutocompleteFooterButton","Autocomplete_ref10","Autocomplete_ref11","AutocompleteFooter","Autocomplete_ref12","Autocomplete_ref13","Autocomplete_ref14","onMouseDown","Split","split_web_objectWithoutProperties","split_web_excluded","NativeCategorySelect","emptyLabel","CategorySelect_objectWithoutProperties","CategorySelect_excluded","CategoryList","lastGroup","CategorySelect_ref","CategorySelect_ref2","CategorySelect_ref3","split_web","CategorySelect_ref4","showGroup","cat_group","CategorySelect_ref5","groupName","CategoryAutocomplete","showSplitOption","onSplit","CategorySelect_excluded2","categorySuggestions","CategorySelect_objectSpread","getPayeeSuggestions","focusTransferPayees","activePayees","makeNew","rawPayee","stripNew","PayeeList","isFiltered","createNew","_items2","_toArray","first","rest","lastType","PayeeAutocomplete_ref","PayeeAutocomplete_ref2","PayeeAutocomplete_ref3","PayeeAutocomplete_ref4","showMoreMessage","PayeeAutocomplete_ref5","PayeeAutocomplete_ref6","PayeeAutocomplete","_ref10$showMakeTransf","showMakeTransfer","_ref10$showManagePaye","showManagePayees","_ref10$defaultFocusTr","defaultFocusTransferPayees","onManagePayees","PayeeAutocomplete_objectWithoutProperties","PayeeAutocomplete_excluded","PayeeAutocomplete_slicedToArray","setFocusTransferPayees","payeeSuggestions","PayeeAutocomplete_objectSpread","create","createPayee","Array","isArray","v","sort","r1exact","r2exact","isf","PayeeAutocomplete_ref7","PayeeAutocomplete_ref8","PayeeAutocomplete_ref9","AccountList","AccountAutocomplete_ref","AccountAutocomplete_ref2","AccountAutocomplete_ref3","AccountAutocomplete","AccountAutocomplete_objectWithoutProperties","AccountAutocomplete_excluded","RightArrow2","RightArrow2_web_objectWithoutProperties","RightArrow2_web_excluded","LeftArrow2","LeftArrow2_web_objectWithoutProperties","LeftArrow2_web_excluded","SvgHyperlink2","Hyperlink2_web_objectSpread","SvgArrowsSynchronize","ArrowsSynchronize_web_objectSpread","fail","str","char","next","ch","nextOperator","op","parseParens","expr","parseOperator","isNegative","numberStr","thousandsSep","getNumberFormat","separator","number","replace","parsePrimary","ops","prevParser","makeOperatorParser","evalArithmetic","expression","evaluate","ast","pow","parse","SvgEditSkull1","EditSkull1_web_objectSpread","SvgValidationCheck","ValidationCheck_web_objectSpread","SvgFavoriteStar","FavoriteStar_web_objectSpread","getStatusProps","Icon","EditSkull1","AlertTriangle","CalendarIcon","ValidationCheck","FavoriteStar","CheckCircle1","StatusBadge","_getStatusProps2","StatusBadge_ref","StatusBadge_ref2","titleFirst","getStatus","nextDate","completed","hasTrans","today","monthUtils","makeNumberSuffix","prettyDayName","day","SU","MO","TU","WE","TH","FR","SA","getRecurringDescription","config","interval","frequency","desc","patterns","typeOrder","valOrder","strs","uniqueDays","isSameDay","pattern","dayName","join","extractScheduleConds","conditions","cond","getScheduledAmount","num1","num2","loadStatuses","schedules","filters","schedule","dateCond","_conditions","c","$and","$gte","next_date","orderBy","groupBy","getHasTransactionsQuery","Boolean","s","useSchedules","schedules_slicedToArray","scheduleQuery","statusQuery","statuses","SchedulesContext","SchedulesProvider","useCachedSchedules","serializeTransaction","showZeroInDeposit","dateFormat","isPreviewId","debit","credit","isDateValid","parseISO","TransactionsTable_objectSpread","getParentTransaction","fromIndex","parentIdx","SplitsExpandedContext","useSplitsExpanded","expanded","mode","SplitsExpandedProvider","initialMode","cachedState","lastSplitState","reduxDispatch","TransactionsTable_slicedToArray","transitionId","splitState","TransactionHeader","memo","hasSelected","showAccount","showCategory","showBalance","dispatchSelected","components_table","TransactionsTable_ref","exposed","visibility","StatusCell","isChild","onEdit","isClearedField","statusProps","TransactionsTable_ref4","plain","TransactionsTable_ref5","PayeeCell","payeeId","inherited","transferAcct","importedPayee","isPreview","onCreatePayee","isCreatingPayee","TransactionsTable_ref6","TransactionsTable_ref2","TransactionsTable_ref3","getPayeePretty","onExpose","onSave","CellWithScheduleIcon","scheduleId","recurring","_date","TransactionsTable_ref7","ArrowsSynchronize_web","borderLeftWidth","&:hover","Transaction","originalTransaction","_props$backgroundColo","highlighted","matched","inheritedFields","focusedField","balance","_props$dateFormat","onDelete","onToggleSplit","prevShowZero","setPrevShowZero","prevTransaction","setPrevTransaction","setTransaction","deserialized","realTransaction","TransactionsTable_objectWithoutProperties","TransactionsTable_excluded","amountToInteger","currentDay","deserializeTransaction","imported_payee","notes","isParent","_transaction$_unmatch","_unmatched","isBudgetTransfer","isOffBudget","backgroundFocus","TransactionsTable_ref9","TransactionsTable_ref10","TransactionsTable_ref11","TransactionsTable_ref12","isTemporaryId","TransactionsTable_ref13","TransactionsTable_ref14","TransactionsTable_ref15","Hyperlink2_web","TransactionsTable_ref16","formatDate","DateSelect","acctId","cell","TransactionsTable_ref17","TransactionsTable_ref19","TransactionsTable_ref20","TransactionsTable_ref21","CheveronDown_web","TransactionsTable_ref22","TransactionsTable_ref23","obj","getDisplayValue","TransactionsTable_ref24","TransactionsTable_ref25","TransactionsTable_ref26","TransactionError","isDeposit","onAddSplit","TransactionsTable_ref27","TransactionsTable_ref28","TransactionsTable_ref29","TransactionsTable_ref30","makeTemporaryTransactions","currentAccountId","lastDate","borderBottom","NewTransaction","editingTransaction","hoveredTransaction","onAdd","TransactionsTable_ref31","TransactionsTable_Transaction","TransactionsTable_ref32","TransactionsTable_ref33","TransactionTable_","highlightedRows","focusedFied","balances","_this$props$dateForma","tableNavigator","isNew","isMatched","isExpanded","getParent","isChildDeposit","highlight","isAdding","newNavigator","_cachedParent","tableRef","_props$dateFormat2","renderEmpty","TransactionsTable_ref37","getNavigatorProps","onCheckNewEnter","editingId","onCloseAddTransaction","onAddTemporary","renderItem","loadMore","loadMoreTransactions","isSelected","onCheckEnter","TransactionTable","setNewTransactions","setHoveredTransaction","_useState12","prevIsAdding","setPrevIsAdding","splitsExpanded","prevSplitsExpanded","mergedRef","useMergedRefs","useTableNavigator","getFields","shouldAdd","latestState","savePending","afterSaveFunc","_useState14","forceRerender","afterSave","onApplyRules","_splitTransaction","newId","_addSplitTransaction","TransactionsTable_TransactionTable_","shiftKey","getLastTransaction","isSplit","saveDiff","remoteUpdates","TransactionList_objectSpread","learnCategories","saveDiffAndApply","remoteDiff","groupedTrans","applyChanges","applyTransactionDiff","TransactionList","allTransactions","headerContent","animated","onRefetch","onRefetchUpToRow","transactionsLatest","clearScrollTo","realizeTempTransactions","afterRules","getChangedValues","TransactionList_ref","TYPE_INFO","nullable","string","boolean","FIELD_TYPES","amountInflow","amountOutfow","mapField","inflow","outflow","friendlyOp","getFieldError","integerToAmount","rules_objectSpread","unparse","inputKey","rules_objectWithoutProperties","rules_excluded","unparsed","makeValue","currencyToAmount","SvgSettingsSliderAlternate","SettingsSliderAlternate_web_objectSpread","Subtract","Subtract_web_objectWithoutProperties","Subtract_web_excluded","Add","Add_web_objectWithoutProperties","Add_web_excluded","MAX_DAY_OF_WEEK_INTERVAL","FREQUENCY_OPTIONS","DAY_OF_MONTH_OPTIONS","DAY_OF_WEEK_OPTIONS","parseConfig","createMonthlyRecurrence","unparseConfig","RecurringSchedulePicker_objectSpread","validInterval","startDate","parseInt","reducer","recurrence","boundedRecurrence","SchedulePreview","previewDates","RecurringSchedulePicker_ref","RecurringSchedulePicker_ref2","RecurringSchedulePicker_ref3","intInterval","Number","isInteger","MonthlyPatterns","updateRecurrence","RecurringSchedulePicker_ref4","RecurringSchedulePicker_ref5","RecurringSchedulePicker_ref6","parsePatternValue","opt","RecurringSchedulePicker_ref7","RecurringSchedulePicker_ref8","Subtract_web","RecurringSchedulePicker_ref9","RecurringSchedulePicker_ref10","svg_Add_web","RecurringSchedulePicker_ref11","RecurringScheduleTooltip","currentConfig","RecurringSchedulePicker_slicedToArray","setPreviewDates","updateField","_await$sendCatch","count","RecurringSchedulePicker_ref12","RecurringSchedulePicker_ref13","htmlFor","RecurringSchedulePicker_ref14","placeholder","RecurringSchedulePicker_ref15","RecurringSchedulePicker_ref16","RecurringSchedulePicker_ref17","RecurringSchedulePicker_ref18","RecurringSchedulePicker_ref19","RecurringSchedulePicker_ref20","RecurringSchedulePicker","_useTooltip","RecurringSchedulePicker_ref21","GenericInput","_useSelector","showPlaceholder","GenericInput_objectSpread","getMonthYearFormat","GenericInput_ref","GenericInput_ref2","SvgInformationOutline","InformationOutline_web_objectSpread","SchedulesQuery","Value","inline","dataProp","describe","ManageRules_slicedToArray","setExpanded","formatValue","ManageRules_ref","ManageRules_ref2","displayed","numHidden","ManageRules_ref3","ManageRules_ref4","ManageRules_ref5","ManageRules_ref6","ManageRules_ref7","ManageRules_ref8","ManageRules_ref9","ConditionExpression","ManageRules_ref10","ManageRules_ref11","ManageRules_ref12","ScheduleValue","byId","ActionExpression","ManageRules_ref13","ManageRules_ref14","ManageRules_ref15","ManageRules_ref16","ManageRules_ref17","Rule","rule","onEditRule","ManageRules_ref18","ManageRules_ref19","ManageRules_ref20","ManageRules_ref21","ManageRules_ref22","RightArrow2_web","ManageRules_ref23","ManageRules_ref24","ManageRules_ref25","ManageRules_ref26","CellButton","& .animated .animated-row","SimpleTable","onHoverLeave","ManageRules_objectWithoutProperties","ManageRules_excluded","contentHeight","scrollRef","ManageRules_ref27","ManageRules_ref28","RulesHeader","RulesList","rules","hoveredRule","borderCollapsed","onCollapse","ManageRules","allRules","setAllRules","setRules","selectedInst","setHoveredRule","loadRules","loadedRules","onDeleteSelected","someDeletionsFailed","newRules","initiallyLoadPayees","loadData","newIdx","newRule","onCreateRule","ManageRules_ref29","ManageRules_ref30","ManageRules_ref31","ManageRules_ref32","ManageRules_ref33","ManageRules_ref34","ManageRules_ref35","ManageRules_ref36","filterFields","subfieldToOptions","month","year","ScopeTab","scopeTab","&,:hover,:active","OpButton","Filters_ref","Filters_ref2","ConfigureField","onApply","Filters_slicedToArray","setSubfield","prevOp","Filters_ref3","Filters_ref4","Filters_ref5","Filters_ref6","currOp","Filters_ref7","Filters_ref8","FilterButton","Filters_objectSpread","fieldsOpen","condOpen","deserializeField","SettingsSliderAlternate_web","Filters_ref9","Filters_ref10","parseDate","conditionErrors","FilterExpression","originalField","customName","Filters_ref11","Filters_ref12","Filters_ref13","Filters_ref14","Filters_ref15","Delete_web","Filters_ref16","AppliedFilters","editingFilter","Filters_ref17","borderTopWidth","EmptyMessage","Account_ref","Account_ref2","Account_ref3","Account_ref4","Account_ref5","ReconcilingMessage","balanceQuery","targetBalance","onDone","targetDiff","Account_ref6","Account_ref7","Account_ref8","CheckCircle1_web","Account_ref9","Account_ref10","Account_ref11","Account_ref12","Account_ref13","ReconcileTooltip","onReconcile","Account_ref14","elements","currencyToInteger","Account_ref15","Account_ref16","MenuTooltip","Account_ref17","AccountMenu","canSync","syncEnabled","showBalances","canShowBalances","Account_slicedToArray","tooltip","setTooltip","CategoryMenu","DetailedBalance","Account_ref18","Account_ref19","SelectedBalance","setBalance","rows","$oneof","r","finalIds","MoreBalances","uncleared","Account_ref20","Balances","showExtraBalances","onToggleExtraBalances","Account_ref21","&:hover svg","Account_objectSpread","Account_ref22","SelectedTransactionsButton","getTransaction","onShow","onUnlink","onScheduleAction","preview","linked","keyHandlers","firstId","transactionIds","& input::placeholder","AccountHeader","editingName","isNameEditable","workingHard","accountName","showEmptyMessage","reconcileAmount","canCalculateBalance","search","onSearch","onAddTransaction","onShowTransactions","onDoneReconciling","onSaveName","onExposeName","onImport","onBatchDelete","onBatchEdit","onBatchUnlink","onApplyFilter","onDeleteFilter","searchInput","account_id","mod+f","Account_ref23","Account_ref24","Account_ref25","Account_ref26","Pencil1_web","Account_ref27","Account_ref28","Account_ref29","Account_ref30","DownloadThickBottom_web","Account_ref31","Account_ref32","SearchAlternate_web","Account_ref33","Account_ref34","Account_ref35","Account_ref36","Account_ref37","Account_ref38","getScrolledItem","expand-splits","ArrowsShrink3_web","Account_ref39","ArrowsExpand3_web","Account_MenuButton","AllTransactions","scheduleData","prependTransactions","_payee","_account","_amount","AccountInternal","paged","refetchTransactions","fetchTransactions","makeRootQuery","rootQuery","currentQuery","updateQuery","locationState","onSearchDone","debounce","parsedDate","getDayMonthRegex","test","getDayMonthFormat","getShortYearRegex","getShortYearFormat","payee.name","$like","category.name","account.name","dayFromDate","$transform","$eq","$abs","$idiv","openFileDialog","extensions","onImported","didChange","onExport","exportedTransactions","saveFile","onTransactionsChange","updateAccount","openAccountCloseModal","reopenAccount","getAccountTitle","calculateBalances","selectedPayee","edit","idSet","parentId","applyFilters","customFilters","transactionCount","transactionsCount","latestDate","maybeRefetch","focusId","focusableMsgs","unlistens","modalShowing","firstLoad","splitsExpandedDispatch","expandSplits","transactionsFiltered","scrollToTop","$sumOver","filterName","_ref43","AccountHack","Account_AccountInternal","tutorialStage","actionCreators","useParams","useLocation","activeLocation","_account.closed","getValidMonthBounds","bounds","startMonth","endMonth","MonthsContext","MonthsProvider","numMonths","monthBounds","months","CategoryGroupsContext","addToBeBudgetedGroup","groups","makeAmountGrey","makeAmountStyle","greyed","makeAmountFullStyle","findSortDown","MONTH_BOX_SHADOW","TransferTooltip","initialAmount","initialAmountName","showToBeBudgeted","g","is_income","TransferTooltip_slicedToArray","setAmount","setCategory","submit","parsedAmount","TransferTooltip_ref","TransferTooltip_ref2","TransferTooltip_ref3","TransferTooltip_ref4","TransferTooltip_ref5","SvgArrowThinRight","ArrowThinRight_web_objectSpread","BalanceWithCarryover","carryover","carryoverValue","balanceValue","BalanceWithCarryover_ref","BalanceWithCarryover_ref2","BalanceWithCarryover_ref3","ArrowThinRight_web","BalanceWithCarryover_objectSpread","SvgArrowButtonDown1","ArrowButtonDown1_web_objectSpread","SvgArrowButtonUp1","ArrowButtonUp1_web_objectSpread","RolloverContext","summaryCollapsed","onBudgetAction","onToggleSummaryCollapse","currentMonth","RolloverContext_Context","HoldTooltip","HoldTooltip_slicedToArray","HoldTooltip_ref","HoldTooltip_ref2","HoldTooltip_ref3","HoldTooltip_ref4","SvgCustomNotesPaper","CustomNotesPaper_web_objectSpread","NotesTooltip","defaultNotes","NotesButton_slicedToArray","setNotes","NotesButton_ref","& button, & .hover-visible","NotesButton","defaultColor","tooltipPosition","live","useLiveQuery","hasNotes","NotesButton_ref2","NotesButton_ref3","NotesButton_ref4","CustomNotesPaper_web","TotalsList","prevMonthName","BudgetSummary_ref","BudgetSummary_ref2","BudgetSummary_ref3","BudgetSummary_ref4","BudgetSummary_ref5","BudgetSummary_ref6","BudgetSummary_ref7","BudgetSummary_ref8","BudgetSummary_ref9","BudgetSummary_ref10","ToBudget","initialValue","availableValue","BudgetSummary_ref11","component_es","BudgetSummary_ref13","& .hover-visible","&:hover .hover-visible","textDecorationSkip","_useRollover","BudgetSummary_slicedToArray","onMenuClose","ExpandOrCollapseIcon","ArrowButtonDown1","ArrowButtonUp1","BudgetSummary_ref14","BudgetSummary_ref15","BudgetSummary_ref16","BudgetSummary_ref17","BudgetSummary_ref18","BudgetSummary_ref19","BudgetSummary_ref20","BudgetSummary_ref21","BudgetSummary_ref22","BudgetSummary_ref23","BudgetSummary_ref24","BudgetSummary_ref25","BudgetSummary_ref26","BudgetSummary_ref27","CoverTooltip","rollover_components_slicedToArray","rollover_components_ref","rollover_components_ref2","rollover_components_ref3","rollover_components_ref4","BalanceTooltip","categoryId","monthIndex","menu","setMenu","rollover_components_ref5","toCategory","fromCategory","headerLabelStyle","BudgetTotalsMonth","rollover_components_ref6","rollover_components_ref7","rollover_components_ref8","rollover_components_ref9","rollover_components_ref10","rollover_components_ref11","rollover_components_ref12","IncomeHeaderMonth","rollover_components_ref13","rollover_components_ref14","ExpenseGroupMonth","rollover_components_ref15","rollover_components_ref16","valueProps","rollover_components_ref17","rollover_components_ref18","ExpenseCategoryMonth","onShowActivity","balanceTooltip","rollover_components_ref19","rollover_components_ref20","rollover_components_ref21","rollover_components_ref22","getValueStyle","formatExpr","unformatExpr","rollover_components_ref23","rollover_components_ref24","rollover_components_ref25","IncomeGroupMonth","rollover_components_ref26","rollover_components_ref27","IncomeCategoryMonth","rollover_components_ref28","rollover_components_ref29","rollover_components_ref30","rollover_components_ref31","ReportProvider","ReportContext_Context","PieProgress","progress","circum","PI","dash","gap","cx","cy","radius","strokeDasharray","fraction","denom","IncomeProgress","over","frac","report_BudgetSummary_ref","ExpenseProgress","report_BudgetSummary_ref2","BudgetTotal","ProgressComponent","report_BudgetSummary_ref3","report_BudgetSummary_ref4","report_BudgetSummary_ref5","report_BudgetSummary_ref6","IncomeTotal","projected","ExpenseTotal","Saved","budgetedSaved","saved","report_BudgetSummary_ref7","report_BudgetSummary_ref8","report_BudgetSummary_ref9","report_BudgetSummary_ref10","_useReport","report_BudgetSummary_slicedToArray","report_BudgetSummary_ref11","BudgetSummary_ref12","report_BudgetSummary_ref13","report_BudgetSummary_ref14","report_BudgetSummary_ref15","report_BudgetSummary_ref16","report_BudgetSummary_ref17","report_BudgetSummary_ref18","report_BudgetSummary_ref19","report_BudgetSummary_ref20","report_BudgetSummary_ref21","report_BudgetSummary_ref22","report_BudgetSummary_ref23","report_BudgetSummary_ref24","report_BudgetSummary_ref25","components_ref","components_ref2","components_ref3","components_ref4","components_ref5","components_ref6","components_ref7","components_ref8","components_ref9","components_ref10","GroupMonth","components_ref11","components_ref12","components_ref13","components_ref14","components_ref15","CategoryMonth","budgeted","currentSum","components_ref16","components_ref17","components_ref18","components_ref19","components_ref20","components_ref21","components_ref22","components_BalanceTooltip","findMatch","element","sizes","entry","SvgArrowThinLeft","ArrowThinLeft_web_objectSpread","BudgetSummaries","SummaryComponent","BudgetSummaries_slicedToArray","widthState","setWidthState","spring","scrollerRef","prevMonth0","allMonths","unshift","monthWidth","Spring","stiffness","damping","mass","fromValue","currentValue","prevMonth","reversed","offsetX","updateConfig","toValue","BudgetSummaries_ref","BudgetSummaries_ref2","BudgetSummaries_ref4","getScrollbarWidth","overflowY","overflowAnchor","BudgetTable","onEditMonth","onEditName","onReorderCategory","findSortUp","targetGroup","budget_objectSpread","onReorderGroup","moveVertically","dir","flattened","isGroup","nextIdx","catName","catId","resolveMonth","budgetCategoriesRef","draggingState","clearEditing","prewarmStartMonth","setCollapsed","newCategoryForGroup","dataComponents","isAddingGroup","onSaveCategory","onSaveGroup","onDeleteCategory","onDeleteGroup","onShowNewCategory","onHideNewCategory","onShowNewGroup","onHideNewGroup","budget_ref","budget_ref2","budget_ref3","budget_ref4","budget_BudgetTotals","MonthComponent","BudgetTotalsComponent","budget_ref5","budgetDataNode","BudgetCategories","editingCell","WebkitUserSelect","& button","&:hover button","SidebarCategory","dragPreview","dragging","temporary","budget_slicedToArray","budget_ref6","budget_ref7","budget_ref8","budget_ref9","budget_ref10","budget_ref11","budget_ref12","budget_ref13","budget_ref14","budget_ref15","budget_ref16","budget_ref17","budget_ref18","budget_ref19","SidebarGroup","onToggleCollapse","budget_ref20","ExpandArrow_web","budget_ref21","budget_ref22","budget_ref23","budget_ref24","budget_ref25","budget_ref26","budget_ref27","budget_ref28","budget_ref29","RenderMonths","component","editingIndex","_useContext","budget_ref30","budget_ref31","BudgetTotals","budget_ref32","budget_ref33","ExpenseGroup","dragState","_useDroppable2","catDropRef","catDropPos","budget_ref34","ROW_HEIGHT","ExpenseCategory","budgetArray","_useDroppable3","budget_ref35","IncomeGroup","budget_ref36","IncomeCategory","_useDroppable4","_separateGroups2","separateGroups","expenseGroups","incomeGroup","prototype","apply","setDragState","savedCollapsed","setSavedCollapsed","newDragState","hoveredId","hoveredPos","id_","budget_ref37","budget_ref38","ExpenseGroupComponent","ExpenseCategoryComponent","budget_ref39","IncomeHeader","IncomeHeaderComponent","IncomeGroupComponent","IncomeCategoryComponent","budget_ref40","budget_ref41","budget_ref42","budget_ref43","_ref44","BudgetPageHeader","onMonthSelect","budget_MonthPicker","numDisplayed","getValidMonth","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderRight","MonthPicker","getCurrentMonthName","monthNames","currentMonthName","selectedIndex","components_ElementQuery","monthName","lastSelectedIndex","getMonth","isMonthBudgeted","_ref53","_ref54","_ref55","_ref56","_ref57","ArrowThinLeft_web","DynamicBudgetTableInner","_ref$maxMonths","onMonthSelect_","onPreload","DynamicBudgetTable_objectWithoutProperties","DynamicBudgetTable_excluded","numPossible","estimatedTableWidth","getNumPossibleMonths","budget_BudgetTable","index_esm","addCategory","categories_objectSpread","updateCategory","moveCategory","moveCat","cats","moveCategoryGroup","moveGroup","deleteCategory","addGroup","updateGroup","deleteGroup","_initialBudgetMonth","Budget","prewarmMonth","values","warmingMonth","createCategory","components_budget_objectSpread","mustTransfer","transferCategory","createGroup","applyBudgetAction","categoryName","sortInfo","budget.summaryCollapsed","onTitlebarEvent","newType","prewarmAllMonths","initialized","collapsedPrefs","titlebar","loadCategories","budget.collapsed","onCopy","copyPreviousMonthInto","reportComponents","rolloverComponents","DynamicBudgetTable","components_budget_ref","report","rollover","components_budget_ref2","budget_Budget","useArgsMemo","fromDateRepr","fromDateReprToDay","runAll","baseLabelStyles","fontFamily","chart_theme","chart_theme_objectSpread","blueFadeStart","blueFadeEnd","redFadeStart","redFadeEnd","red","blue","area","strokeLinejoin","axis","grid","ticks","tickLabels","dependentAxis","independentAxis","bar","chart","Container","Container_ref","portalHost","active","scale","datum","_this$props$offsetX","offsetY","light","forceActive","xPos","labelPosition","before","premadeLabel","defaultEvents","VictoryTooltip","useReport","useReport_slicedToArray","results","setResults","createSpreadsheet","accountBalances","starting","hasNegative","startNetWorth","endNetWorth","graphData","debt","assets","change","net_worth_spreadsheet_ref","net_worth_spreadsheet_ref2","netWorth","totalChange","recalculate","_await$Promise$all2","net_worth_spreadsheet_slicedToArray","$lt","$lte","$month","simpleCashFlow","makeQuery","$gt","income","expense","cashFlowByDate","isConcise","where","_data","cash_flow_spreadsheet_slicedToArray","startingBalance","dates","incomes","expenses","totalExpenses","cash_flow_spreadsheet_ref","cash_flow_spreadsheet_ref2","Area","zero","startX","endX","gradientUnits","stopColor","theme","NetWorthGraph","compact","Chart","VictoryGroup","VictoryChart","reports_Container","NetWorthGraph_ref","domainPadding","containerComponent","victory_voronoi_container","voronoiDimension","VictoryBar","VictoryArea","labelComponent","reports_Tooltip","labels","victory_area","NetWorthGraph_ref2","victory_axis","tickFormat","tickValues","tickCount","crossAxis","Change","DateRange","getYear","DateRange_ref","Card","NetWorthCard","netWorthSpreadsheet","Overview_ref","Overview_ref2","Overview_ref3","Overview_ref4","reports_DateRange","Overview_ref5","Overview_ref6","reports_Change","Overview_ref7","graphs_NetWorthGraph","Overview_ref8","CashFlowCard","Overview_ref9","Overview_ref10","Overview_ref11","Overview_ref12","Overview_ref13","Overview_ref14","Overview_ref15","victory_group","colorScale","domain","Overview_ref16","victory_bar","Overview_ref17","Overview_ref18","Overview_ref19","Overview_ref20","Overview_ref21","boundedRange","earliest","latest","getLatestRange","Header","show1Month","onChangeDates","Header_ref","Header_ref2","Header_ref3","Header_ref4","Header_ref5","validateStart","pretty","Header_ref6","validateEnd","Header_ref7","Header_ref8","Header_ref9","Header_ref10","Header_ref11","getFullRange","NetWorth_slicedToArray","setEarliestMonth","setAllMonths","setStart","setEnd","earliestMonth","yearAgo","reverse","NetWorth_ref","reports_Header","NetWorth_ref2","NetWorth_ref3","NetWorth_ref4","NetWorth_ref5","CashFlowGraph","victory_chart","CashFlowGraph_ref","victory_line","CashFlowGraph_ref2","CashFlow","CashFlow_slicedToArray","setIsConcise","CashFlow_ref","endDay","CashFlow_ref2","CashFlow_ref3","CashFlow_ref4","CashFlow_ref5","CashFlow_ref6","CashFlow_ref7","CashFlow_ref8","graphs_CashFlowGraph","CashFlow_ref9","Reports","reports_ref","Overview","NetWorth","SvgCheck","Check_web_objectSpread","DisplayId","noneColor","DataComponent","OverflowMenu","onAction","SchedulesTable_slicedToArray","SchedulesTable_ref","SchedulesTable_ref2","ScheduleAmountCell","abs","isApprox","SchedulesTable_ref3","SchedulesTable_ref4","SchedulesTable","minimal","allowCompleted","showCompleted","setShowCompleted","inset","SchedulesTable_ref11","SchedulesTable_ref12","rowHeight","SchedulesTable_ref13","SchedulesTable_ref9","SchedulesTable_ref10","SchedulesTable_ref5","SchedulesTable_ref6","_amountOp","SchedulesTable_ref7","Check_web","SchedulesTable_ref8","renderSchedule","allowPopupsEscape","Schedules","flexBasis","resetNextDate","schedules_ref","schedules_ref2","SectionLabel","forms_ref","FormLabel","forms_ref2","FormField","appearance",":checked","::after","&.focus-visible:focus","::before","Checkbox","forms_ref3","TransactionRow","SimpleTransactionsTable_ref","SimpleTransactionsTable_ref2","SimpleTransactionsTable_ref3","SimpleTransactionsTable","memoFields","serializedTransactions","SimpleTransactionsTable_objectSpread","SimpleTransactionsTable_TransactionRow","headers","SimpleTransactionsTable_ref4","SvgSubtract","Subtract_web_objectSpread","fillRule","AmountInput","AmountInput_slicedToArray","negative","setNegative","setValue","fireChange","neg","AmountInput_ref","v1_Subtract_web","AmountInput_ref2","AmountInput_ref3","AmountInput_ref4","AmountInput_ref5","BetweenAmountInput","setNum1","setNum2","AmountInput_ref6","AmountInput_ref7","array","applyErrors","errorsArray","EditRule_objectSpread","getTransactionFields","FieldSelect","EditRule_ref","OpSelect","formatOp","EditorButtons","EditRule_ref2","EditRule_ref3","EditRule_ref4","EditRule_ref5","FieldError","EditRule_ref6","Editor","EditRule_ref7","ConditionEditor","conditionFields","condition","editorStyle","valueEditor","EditRule_ref8","ScheduleDescription","EditRule_ref9","EditRule_slicedToArray","EditRule_ref10","EditRule_ref11","EditRule_ref12","EditRule_ref13","EditRule_ref14","EditRule_ref15","EditRule_ref16","actionFields","ActionEditor","_action$inputKey","EditRule_ref17","EditRule_ref18","EditRule_ref19","StageInfo","EditRule_ref20","InformationOutline_web","EditRule_ref21","EditRule_ref22","StageButton","EditRule_ref23","EditRule_ref24","newInput","ConditionsList","onChangeConditions","addCondition","copy","EditRule_ref25","newCond","prevType","updateCondition","removeCondition","flexGrow","EditRule","defaultRule","originalOnSave","setConditions","setActions","setStage","setTransactions","scrollableEl","setUndoEnabled","addInitialAction","addAction","onChangeStage","EditRule_ref26","EditRule_ref27","EditRule_ref28","EditRule_ref29","EditRule_ref30","EditRule_ref31","EditRule_ref32","EditRule_ref33","conds","EditRule_ref34","EditRule_ref35","EditRule_ref36","onChangeAction","onRemoveAction","EditRule_ref37","EditRule_ref38","EditRule_ref39","EditRule_ref40","EditRule_ref41","EditRule_ref42","actionErrors","mergeFields","defaults","initial","EditSchedule_objectSpread","updateScheduleConditions","updateCond","amountOp","ScheduleDetails","_useParams","initialFields","adding","globalDispatch","EditSchedule_slicedToArray","condsSet","isCustom","_actions","posts_transaction","repeats","upcomingDates","transactionsMode","loadSchedule","_updateScheduleCondit","onLinkTransactions","onSwitchTransactions","EditSchedule_ref","EditSchedule_ref2","EditSchedule_ref3","EditSchedule_ref4","EditSchedule_ref5","EditSchedule_ref6","EditSchedule_ref7","EditSchedule_ref8","EditSchedule_ref9","EditSchedule_ref10","EditSchedule_ref11","EditSchedule_ref12","EditSchedule_ref13","checked","for","EditSchedule_ref14","EditSchedule_ref15","EditSchedule_ref16","EditSchedule_ref17","EditSchedule_ref18","EditSchedule_ref19","EditSchedule_ref20","ruleId","EditSchedule_ref21","EditSchedule_ref22","EditSchedule_ref23","EditSchedule_ref24","EditSchedule_ref25","EditSchedule_ref26","EditSchedule_ref27","onUnlinkTransactions","EditSchedule_ref28","EditSchedule_ref29","EditSchedule_ref30","EditSchedule_ref31","_updateScheduleCondit2","ScheduleLink","LinkSchedule_ref","DiscoverSchedulesTable","DiscoverSchedules_ref2","DiscoverSchedules_ref3","DiscoverSchedules_ref4","DiscoverSchedules_ref5","recurDescription","DiscoverSchedules_ref","DiscoverSchedules","DiscoverSchedules_slicedToArray","setSchedules","creating","setCreating","DiscoverSchedules_ref6","PostsOfflineNotification","plural","PostsOfflineNotification_ref","PostsOfflineNotification_ref2","FixSplitsTool","FixSplitsTool_slicedToArray","FixSplitsTool_ref3","FixSplitsTool_ref4","FixSplitsTool_ref5","FixSplitsTool_ref6","numBlankPayees","numCleared","numDeleted","FixSplitsTool_ref","fixed","FixSplitsTool_ref2","renderResults","Alert","& a, & a:active, & a:visited","alerts_ref","alerts_ref2","Information","InformationOutline","alerts_ref3","ExclamationOutline","dateFormats","Title","Settings_ref","Advanced","Settings_slicedToArray","resetting","setResetting","resettingCache","setResettingCache","Settings_ref2","Settings_ref3","Settings_ref4","Settings_ref5","Settings_ref6","Settings_ref7","Settings_ref8","Settings_ref9","::-webkit-scrollbar","GlobalSettings","documentDirChanged","setDirChanged","dirScrolled","Settings_ref10","Settings_ref11","Settings_ref12","documentDir","properties","Settings_ref13","Settings_ref14","Settings_ref15","autoUpdate","Settings_ref16","Settings_ref17","Settings_ref18","Settings_ref19","Settings_ref20","trackUsage","Settings_ref21","Settings_ref22","Settings_ref23","FileSettings","localServerURL","numberFormat","Settings_ref24","Settings_ref25","Settings_ref26","Settings_ref27","numberFormats","Settings_ref28","Settings_ref29","Settings_ref30","Settings_ref31","encryptKeyId","Settings_ref32","Settings_ref33","Settings_ref34","Settings_ref35","Settings_ref36","Settings_ref37","SettingsLink","Settings_ref38","Settings_ref39","Settings_ref40","Settings_ref41","Settings_ref42","currentModal","onConnect","onCreateLocalAccount","CreateAccount_ref","CreateAccount_ref2","CreateAccount_ref3","CreateAccount_ref4","CreateAccount_ref5","fromPlaidAccountType","prettyAccountType","determineOffBudget","CreateLocalAccount","showBack","formik_es6","validateOnChange","initialValues","validate","setErrors","createAccount","toRelaxedNumber","touched","handleChange","handleBlur","handleSubmit","isSubmitting","setFieldValue","CreateLocalAccount_ref","CreateLocalAccount_ref2","CreateLocalAccount_ref3","CreateLocalAccount_ref4","CreateLocalAccount_ref5","CreateLocalAccount_ref6","CreateLocalAccount_ref7","CreateLocalAccount_ref8","needsCategory","currentTransfer","CategorySelect","CloseAccount_objectWithoutProperties","CloseAccount_excluded","CloseAccount","canDelete","CloseAccount_slicedToArray","onbudget","CloseAccount_ref","transfer","closeAccount","CloseAccount_ref2","CloseAccount_ref3","CloseAccount_ref4","CloseAccount_ref5","CloseAccount_ref6","CloseAccount_ref7","forceCloseAccount","CloseAccount_ref8","CloseAccount_ref9","CloseAccount_ref10","selectedStyle","SelectLinkedAccounts_ref","SelectLinkedAccounts_ref2","SelectLinkedAccounts_ref3","SelectLinkedAccounts_ref4","SelectLinkedAccounts_ref5","SelectLinkedAccounts_ref6","mask","SelectLinkedAccounts","SelectLinkedAccounts_slicedToArray","selectedAccounts","setSelectedAccounts","onNext","SelectLinkedAccounts_ref7","SelectLinkedAccounts_ref8","SelectLinkedAccounts_EmptyMessage","SelectLinkedAccounts_Account","toggleAccount","SelectLinkedAccounts_ref9","SelectLinkedAccounts_ref10","ConfigureLinkedAccounts_ref","ConfigureLinkedAccounts_ref2","ConfigureLinkedAccounts_ref3","ConfigureLinkedAccounts_ref4","ConfigureLinkedAccounts_ref5","ConfigureLinkedAccounts_ref6","ConfigureLinkedAccounts_ref7","Checkmark_web","ConfigureLinkedAccounts_ref8","ConfigureLinkedAccounts_ref9","ConfigureLinkedAccounts","ConfigureLinkedAccounts_slicedToArray","setOffbudgetAccounts","hash","ConfigureLinkedAccounts_ref10","ConfigureLinkedAccounts_ref11","ConfigureLinkedAccounts_ref12","ConfigureLinkedAccounts_EmptyMessage","ConfigureLinkedAccounts_Account","ConfigureLinkedAccounts_ref13","ConfigureLinkedAccounts_ref14","Merge","merge_web_objectWithoutProperties","merge_web_excluded","singleText","pluralText","RuleButton","ruleCount","payees_ref","payees_ref2","payees_ref3","payees_ref4","Payee","onViewRules","ruleActions","payees_ref5","payees_ref6","data-focus-key","payees_ref7","PayeeTable","ruleCounts","components_payees_slicedToArray","setHovered","firstSelected","payees_ref8","PayeeTableHeader","payees_ref9","payees_ref10","PayeeMenu","payeesById","selectedPayees","onMerge","isDisabled","some","payees_ref11","payees_ref12","ManagePayees","tableNavigatorOpts","onBatchChange","payees_objectWithoutProperties","payees_excluded","setHighlightedRows","setFilter","resetAnimation","filteredPayees","applyFilter","_scrollTo","useImperativeHandle","selectRows","scroll","highlightRow","getSelectableIds","buttonsDisabled","payees_ref13","payees_ref14","payees_ref15","payees_ref16","payees_ref17","payees_ref18","payees_ref19","payees_ref20","payees_EmptyMessage","payees_ref21","initialPayees","ManagePayeesWithData_slicedToArray","setPayees","setRuleCounts","payeesRef","refetchRuleCounts","counts","mergeIds","highlightStyle","MergeUnusedPayees","allPayees","isEditingRule","m","MergeUnusedPayees_slicedToArray","shouldCreateRule","setShouldCreateRule","flashRef","targetPayee","fromNames","onMergeAndCreateRule","MergeUnusedPayees_ref","MergeUnusedPayees_ref2","MergeUnusedPayees_ref3","MergeUnusedPayees_ref4","MergeUnusedPayees_ref5","MergeUnusedPayees_ref6","MergeUnusedPayees_ref7","MergeUnusedPayees_ref8","MergeUnusedPayees_ref9","& a, & a:visited","PlaidExternalMsg","originalOnClose","PlaidExternalMsg_slicedToArray","waiting","setWaiting","success","setSuccess","onJump","onContinue","PlaidExternalMsg_ref2","PlaidExternalMsg_ref3","alerts_Error","PlaidExternalMsg_ref","renderError","PlaidExternalMsg_ref4","PlaidExternalMsg_ref5","PlaidExternalMsg_ref6","PlaidExternalMsg_ref7","PlaidExternalMsg_ref8","PlaidExternalMsg_ref10","PlaidExternalMsg_ref11","PlaidExternalMsg_ref12","ConfirmCategoryDelete","ConfirmCategoryDelete_ref","isIncome","ConfirmCategoryDelete_ref2","ConfirmCategoryDelete_ref3","ConfirmCategoryDelete_ref4","ConfirmCategoryDelete_ref5","ConfirmCategoryDelete_objectSpread","WelcomeScreen_ref","WelcomeScreen_ref2","pad","formatDate_","getFileType","ParsedDate","parseDateFormat","showParsed","ImportTransactions_ref","getInitialDateFormat","mappings","found","getInitialMappings","dateField","amountField","payeeField","notesField","applyFieldMappings","ImportTransactions_slicedToArray","parseAmount","looselyParseAmount","parseAmountFields","splitMode","flipAmount","rawTransaction","fieldMappings","_parseAmountFields","amountToCurrency","ImportTransactions_ref2","payee_name","ImportTransactions_ref3","ImportTransactions_ref4","ImportTransactions_ref5","SubLabel","ImportTransactions_ref6","SelectField","DateFormatSelect","delimiter","ImportTransactions_ref7","FlipAmountOption","ImportTransactions_ref8","SplitOption","ImportTransactions_ref9","ImportTransactions_ref10","FieldMappings","ImportTransactions_ref11","ImportTransactions_ref12","ImportTransactions_ref13","ImportTransactions_ref14","ImportTransactions_ref15","ImportTransactions_ref16","ImportTransactions_ref17","ImportTransactions_ref18","ImportTransactions_ref19","ImportTransactions_ref20","loadingState","setLoadingState","setFilename","filetype","setFileType","setFieldMappings","setSplitMode","_useState16","setFlipAmount","_useState18","csvDelimiter","setCsvDelimiter","_useState20","setParseDateFormat","_await$parseTransacti","initialSplitMode","ImportTransactions_ref21","ImportTransactions_ref22","ImportTransactions_ref23","ImportTransactions_ref24","ImportTransactions_ref25","getItemKey","ImportTransactions_ref26","ImportTransactions_Transaction","ImportTransactions_ref27","ImportTransactions_ref28","onNewFile","ImportTransactions_ref29","ImportTransactions_objectSpread","ImportTransactions_ref30","ImportTransactions_ref31","ImportTransactions_ref32","newFieldMappings","ImportTransactions_ref33","ImportTransactions_ref34","ImportTransactions_ref35","ImportTransactions_ref36","errorMessage","finalTransactions","_trans","finalTransaction","ImportTransactions_objectWithoutProperties","ImportTransactions_excluded","editor","autocompleteProps","EditField_ref","EditField_ref2","EditField_ref3","createLocation","modals_ImportTransactions","modals_CreateAccount","modals_CreateLocalAccount","modals_CloseAccount","modals_ConfirmCategoryDelete","didMount","willUnmount","payees_ManagePayeesWithData","modals_EditField","modals_WelcomeScreen","handleKeys","cleanupListeners","PageRoute","Routes","EditSchedule","LinkSchedule","Account_Account","Settings","StackedRoutes","locations","base","FinancesApp","createBrowserHistory","oldPush","call","location_state_objectSpread","makeLocationState","FinancesApp_ref2","components_GlobalKeys","FinancesApp_ref3","FloatableSidebar","FinancesApp_ref4","components_Titlebar","FinancesApp_ref5","FinancesApp_ref6","Notifications","components_BankSyncStatus","components_Modals","FinancesApp_FinancesApp","DndProvider","backend","Backend","ServerURL","setUrl","SvgCloudCheck","SvgCloudDownload","CloudDownload_web_objectSpread","SvgCloudUnknown","CloudUnknown_web_objectSpread","SvgFileDouble","FileDouble_web_objectSpread","SvgKey","Key_web_objectSpread","SvgRefreshArrow","RefreshArrow_web_objectSpread","getFileDescription","file","hasKey","FileMenu","onUpload","onDownload","DetailButton","BudgetList_slicedToArray","BudgetList_ref","BudgetList_ref2","FileState","CloudUnknown","CloudDownload","FileDouble","CloudCheck","BudgetList_ref4","File","selecting","_onSelect","Key_web","RefreshButton","onRefresh","Loading","RefreshArrow","BudgetList","onCreate","testMode","createBudget","_this$props2$files","BudgetList_BudgetTable","process","Import","availableImports","Import_slicedToArray","onSelectType","itemStyle","Import_ref","Import_ref2","Import_ref3","Import_ref4","Import_ref5","Import_ref6","Import_ref7","Import_ref8","Import_ref11","Import_ref12","Import_ref13","ImportYNAB4_slicedToArray","importing","setImporting","importBudget","err","ImportYNAB4_ref","ImportYNAB4_ref2","ImportYNAB4_ref3","ImportYNAB4_ref4","ImportYNAB4_ref5","ImportYNAB4_ref6","ImportYNAB4_ref7","& > div","ImportYNAB5_slicedToArray","ImportYNAB5_ref","ImportYNAB5_ref2","ImportYNAB5_ref3","ImportYNAB5_ref4","ImportYNAB5_ref5","ImportYNAB5_ref6","ImportYNAB5_ref7","DeleteMenu","DeleteFile_slicedToArray","onDeleteCloud","deleteBudget","onDeleteLocal","isRemote","DeleteFile_ref","DeleteFile_ref2","DeleteFile_ref3","DeleteFile_ref4","DeleteFile_ref5","DeleteFile_ref6","isLoggedIn","onPush","manager_BudgetList","downloadBudget","manager_Import","ImportYNAB4","ImportYNAB5","Modals_objectSpread","Modals_ref","useBootstrapped","common_slicedToArray","setChecked","ensure","bootstrapped","common_ref","common_ref2","Login","Login_slicedToArray","Login_ref","Login_ref2","Login_ref3","Login_ref4","autoFocus","Login_ref5","Login_ref6","Login_ref7","Login_ref8","demoMode","ConfirmPasswordForm","buttons","onSetPassword","ConfirmPasswordForm_slicedToArray","password1","setPassword1","password2","setPassword2","ConfirmPasswordForm_ref","ConfirmPasswordForm_ref2","ConfirmPasswordForm_ref3","ConfirmPasswordForm_ref4","ConfirmPasswordForm_ref5","Bootstrap","Bootstrap_slicedToArray","Bootstrap_ref","Bootstrap_ref2","Bootstrap_ref3","Bootstrap_ref4","Error_ref","Error_ref2","Error_ref3","ChangePassword","ChangePassword_slicedToArray","setMessage","ChangePassword_ref","ChangePassword_ref2","ChangePassword_ref3","ChangePassword_ref4","ChangePassword_ref5","ConfigServer","ConfigServer_slicedToArray","currentUrl","setCurrentUrl","ConfigServer_ref","ConfigServer_ref2","ConfigServer_ref3","ConfigServer_ref4","ConfigServer_ref5","ConfigServer_ref6","ConfigServer_ref7","Version","ManagementApp_ref","ACTUAL_VERSION","managerHasInitialized","currentModals","modal","alreadyLoading","showModal","ManagementApp_objectSpread","ManagementApp_ref2","ManagementApp_ref3","ManagementApp_ref4","ManagementApp_ref5","ManagementApp_ref6","Modals","ManagementApp_ref7","SvgClose","showUpdateNotification","releaseNotes","closeNotification","Close_web","_sentry_browser__WEBPACK_IMPORTED_MODULE_0__","_sentry_browser__WEBPACK_IMPORTED_MODULE_1__","_jlongster_sentry_metrics_actual__WEBPACK_IMPORTED_MODULE_2__","absurd_sql_dist_indexeddb_main_thread__WEBPACK_IMPORTED_MODULE_3__","worker_loader_browser_server__WEBPACK_IMPORTED_MODULE_4__","IS_DEV","IS_PERF_BUILD","PERF_BUILD","createBackendWorker","BackendWorker","initSQLBackend","isDev","activity","original","getComputedStyle","listenForPerfData","Sentry","dsn","release","ignoreErrors","integrations","SentryMetricIntegration","metric","dimensions","platform","__startProfile","__stopProfile","IS_FAKE_WEB","REACT_APP_RELEASE_TYPE","logToTerminal","reload","ext","dispatchEvent","MouseEvent","bubbles","cancelable","reader","FileReader","readAsArrayBuffer","onload","ev","__actionsForMenu","onerror","defaultFilename","dialogTitle","temp","download","rel","blob","Blob","URL","createObjectURL","isBudgetOpen","ipcConnect","reloadBackend","ctrlKey","redo","breadcrumb","addBreadcrumb","View","nativeStyle","hideModals","showModals","isWindows","isMac","isProbablySafari","isReactNativeWeb","selectedCell","debug_objectSpread","modals_objectSpread","reconcileFiles","localFiles","remoteFiles","reconciled","localFile","budgets_objectSpread","remote","sorted","name1","name2","fromYNAB","reducers","account_objectSpread","failures","profile_objectSpread","setNumberFormat","prefs_objectSpread","notifications_objectSpread","budgetes","imports","tutorial_objectSpread","deactivated","user_objectSpread","appReducer","combineReducers","createStore","src_objectSpread","initialAppState","applyMiddleware","thunk","boundActions","$send","$query","$q","es","App","getElementById","loadBudgets","loadRemoteFiles","confirm","_await$send4","getYNAB4Imports","TABLE_BACKGROUND_COLOR","fireBlur","CellContext","CellProvider","Field","oldBorderColor","_ref27$truncate","_common__WEBPACK_IMPORTED_MODULE_10__","Cell","viewProps","mouseCoords","viewRef","_useContext2","widthStyle","cellStyle","clientX","clientY","onMouseUp","Row","_ref29$backgroundColo","_ref29$borderColor","_ref29$inset","shouldHighlight","setShouldHighlight","prevHighlighted","rowRef","timer","&.animated .animated-cell","inputCellStyle","readonlyInputStyle","::selection","InputValue","InputCell","targetHeight","CustomCell","prevDefaultValue","setPrevDefaultValue","onBlur_","_ref33$props","dateSelectProps","_dateSelectProps$inpu","_DateSelect__WEBPACK_IMPORTED_MODULE_13__","DeleteCell","_svg_Delete__WEBPACK_IMPORTED_MODULE_6__","clickBehavior","SelectCell","partial","_svg_v1_Checkmark__WEBPACK_IMPORTED_MODULE_7__","SheetCell","_spreadsheet_SheetValue__WEBPACK_IMPORTED_MODULE_12__","activate","transitionDuration","activated","highlightOff","TableHeader","rowProps","_excluded11","SelectedItemsButton","_KeyHandlers__WEBPACK_IMPORTED_MODULE_11__","_svg_ExpandArrow__WEBPACK_IMPORTED_MODULE_8__","rowStyle","TableWithNavigator","_excluded12","Table","contentHeader","_ref39$rowHeight","_ref39$backgroundColo","listRef","_ref39$version","_excluded13","_navigator","listContainer","scrollContainer","initialScrollTo","listInitialized","--pos","getScrollOffset","alignment","shouldScroll","_svg_v1_AnimatedLoading__WEBPACK_IMPORTED_MODULE_9__","isEmpty","empty","getEmptyContent","react_virtualized_auto_sizer__WEBPACK_IMPORTED_MODULE_3__","_useProperFocus__WEBPACK_IMPORTED_MODULE_16__","_FixedSizeList__WEBPACK_IMPORTED_MODULE_4__","initialEditingId","initialFocusedField","moveKeys","setEditingId","setFocusedField","useStore","modalStackLength","flashInput","moveHorizontally","onFocusPrevious","onFocusNext","onMove","userProps","isPropagationStopped","fieldKeys","prevNumModals","numModals","relatedTarget","contains","HISTORY_SIZE","UNDO_STATE_MRU","currentUndoState","setUndoState","getUndoState","getTaggedState","transferId","rawGroup","offBudget","numTransactions","transferAccountId","forced","_undo","throttle","_redo","_undoEnabled","SvgLoading","_props$color","gradientId","stopOpacity","animationName","animationDuration","animationTimingFunction","animationIterationCount","AnimatedLoading","Loading_web","Query","filterExpressions","selectExpressions","groupExpressions","orderExpressions","calculation","rawMode","withDead","validateRefs","unfilter","exprs","exprSet","raw","withoutValidatedRefs","tableOptions","orderExprs","firstOrder","SvgDotsHorizontalTriple","pickerStyles","& .pika-single.actual-date-picker","& .actual-date-picker","& .pika-lendar","float","& .pika-label","& .pika-prev","backgroundImage","DateSelectLeft","& .pika-next","DateSelectRight","& .pika-table th","& abbr","& .pika-button","& .is-today .pika-button","& .is-selected .pika-button","DatePicker","picker","mountPoint","handleInputKeyDown","newDate","getDate","setDate","Pikaday","keyboardInput","defaultDate","setDefaultDate","dateString","destroy","_common__WEBPACK_IMPORTED_MODULE_11__","originalInputRef","parsedDefaultValue","selectedValue","setSelectedValue","userSelectedValue","altKey","_parse","_value$split2","monthFromDate","addMonths","subMonths","addDays","subDays","isAfter","month1","month2","_range","inclusive","rangeInclusive","_dayRange","days","dayRangeInclusive","getMonthIndex","getYearStart","getYearEnd","sheetForMonth","RegExp","regex","currencyFormatter","cleanUUID","mergeObjects","objects","composeCellChanges","merged","flattenArray","arrays","shallowEqual","b","numKeysA","numKeysB","obj1","obj2","hasChanged","hasFieldsChanged","changed","t2","partitionByField","existing","groupBySingle","_groupById","newItems","newGrouped","newItem","debugMemoFailure","setIn","getIn","throwError","fastSetMerge","set1","set2","finalSet","iter","locale","toRelaxedInteger","stringToInteger","amountToPrettyCurrency","toFixed","safeNumber","semverToNumber"],"mappings":"knHAyCO,MAAMA,EAAoBC,IAC/B,MAAMC,EAAcC,mBACdC,EAAeC,sBACnB,IAAIC,IAASJ,EAAYK,WAAWD,GACpC,IAKF,OAHAE,0BAAgB,KACdN,EAAYK,QAAUN,IAEjBG,GAGF,SAASK,EAAMC,GACsBA,EAAlCC,MAAR,MAAeC,EAA2BF,EAA3BE,SAAaC,EAA5BC,EAA0CJ,EAA1CK,GACA,OACEC,EAAAC,EAAAC,cAAA,MAAAC,OAAAC,OAAA,GACMP,EADN,CAEEQ,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EAAQxhC,KAAMwhC,EAAQnuB,OAGpD0uB,EAAYxL,KAAKoL,EAAWH,EAAS,KAAMa,IAC5CH,EAAelvC,SACjBkvC,EAAelvC,QAAQqvC,GAGrBA,EAAU9mC,QAAU4mC,EAAYnvC,SAClCivC,EAAUI,MAIhB,CAACV,EAAWH,EAAQxhC,OAGC,MAAhB+W,EAAOxb,MAAgB1G,EAASkiB,EA5BvC,WACE,MAAM,IAAI3L,MAAM,wCA2BwC,6CCpE5D,MAAMyG,EAAOC,EAAQ,KAErB6f,EAAOC,QAAU,CACfK,GAAI,WACF,OAAOH,QAAQxO,QAAQzR,EAAKogB,OAG9BhgB,OAAQ,WACN,OAAOJ,EAAKogB","file":"static/js/main.61681a37.chunk.js","sourcesContent":["import React, {\n useRef,\n useEffect,\n useLayoutEffect,\n useState,\n useCallback,\n useMemo\n} from 'react';\nimport { css } from 'glamor';\nimport mergeRefs from 'react-merge-refs';\nimport hotkeys from 'hotkeys-js';\nimport ReactModal from 'react-modal';\nimport {\n Route,\n NavLink,\n withRouter,\n useHistory,\n useRouteMatch\n} from 'react-router-dom';\nimport {\n Listbox,\n ListboxInput,\n ListboxButton,\n ListboxPopover,\n ListboxList,\n ListboxOption\n} from '@reach/listbox';\nimport { styles, colors } from '../style';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport Delete from '../svg/Delete';\nimport Loading from '../svg/v1/AnimatedLoading';\nimport ExpandArrow from 'loot-design/src/svg/ExpandArrow';\nimport View from './View';\nimport Text from './Text';\nimport Stack from './Stack';\nimport { useProperFocus } from './useProperFocus';\n\nexport View from './View';\nexport Text from './Text';\nexport Stack from './Stack';\n\nexport const useStableCallback = callback => {\n const callbackRef = useRef();\n const memoCallback = useCallback(\n (...args) => callbackRef.current(...args),\n []\n );\n useLayoutEffect(() => {\n callbackRef.current = callback;\n });\n return memoCallback;\n};\n\nexport function Block(props) {\n const { style, innerRef, ...restProps } = props;\n return (\n <div\n {...restProps}\n ref={innerRef}\n className={`${props.className || ''} ${css(props.style)}`}\n />\n );\n}\n\nexport function Link({ style, children, ...nativeProps }) {\n return (\n <button\n {...css(\n {\n textDecoration: 'none',\n color: styles.text,\n backgroundColor: 'transparent',\n border: 0,\n cursor: 'pointer',\n padding: 0,\n font: 'inherit',\n ':hover': {\n textDecoration: 'underline'\n }\n },\n styles.smallText,\n style\n )}\n {...nativeProps}\n >\n {children}\n </button>\n );\n}\n\nexport function AnchorLink({\n staticContext,\n to,\n exact,\n style,\n activeStyle,\n children\n}) {\n let history = useHistory();\n let href = history.createHref(typeof to === 'string' ? { pathname: to } : to);\n let match = useRouteMatch({ path: to, exact: true });\n\n return (\n <NavLink\n to={to}\n exact={exact}\n {...css([styles.smallText, style, match ? activeStyle : null])}\n >\n {children}\n </NavLink>\n );\n}\n\nexport const ExternalLink = React.forwardRef((props, ref) => {\n function onClick(e) {\n e.preventDefault();\n window.Actual.openURLInBrowser(props.href);\n }\n\n if (props.asAnchor) {\n // eslint-disable-next-line\n return <a ref={ref} {...props} onClick={onClick} />;\n }\n return <Button ref={ref} bare {...props} onClick={onClick} />;\n});\n\nfunction ButtonLink_({\n history,\n staticContext,\n to,\n style,\n activeStyle,\n match,\n location,\n ...props\n}) {\n return (\n <Route\n path={to}\n children={({ match }) => (\n <Button\n style={[style, match ? activeStyle : null]}\n {...props}\n onClick={e => {\n props.onClick && props.onClick(e);\n history.push(to);\n }}\n />\n )}\n />\n );\n}\n\n// eslint-disable-next-line\nexport const ButtonLink = withRouter(ButtonLink_);\n\nexport const Button = React.forwardRef(\n (\n {\n children,\n pressed,\n primary,\n hover,\n bare,\n style,\n disabled,\n hoveredStyle,\n activeStyle,\n as = 'button',\n ...nativeProps\n },\n ref\n ) => {\n hoveredStyle = [\n bare\n ? { backgroundColor: 'rgba(100, 100, 100, .15)' }\n : { boxShadow: styles.shadow },\n hoveredStyle\n ];\n activeStyle = [\n bare\n ? { backgroundColor: 'rgba(100, 100, 100, .25)' }\n : {\n transform: 'translateY(1px)',\n boxShadow:\n !bare &&\n (primary\n ? '0 1px 4px 0 rgba(0,0,0,0.3)'\n : '0 1px 4px 0 rgba(0,0,0,0.2)'),\n transition: 'none'\n },\n activeStyle\n ];\n\n let Component = as;\n let buttonStyle = [\n {\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n padding: bare ? '5px' : '5px 10px',\n margin: 0,\n overflow: 'hidden',\n display: 'flex',\n borderRadius: 4,\n backgroundColor: bare\n ? 'transparent'\n : primary\n ? disabled\n ? colors.n7\n : colors.p5\n : 'white',\n border: bare\n ? 'none'\n : '1px solid ' +\n (primary ? (disabled ? colors.n7 : colors.p5) : colors.n9),\n color: primary ? 'white' : disabled ? colors.n6 : colors.n1,\n transition: 'box-shadow .25s',\n ...styles.smallText\n },\n { ':hover': !disabled && hoveredStyle },\n { ':active': !disabled && activeStyle },\n hover && hoveredStyle,\n pressed && activeStyle,\n style\n ];\n\n return (\n <Component\n ref={ref}\n {...(typeof as === 'string'\n ? css(buttonStyle)\n : { style: buttonStyle })}\n disabled={disabled}\n {...nativeProps}\n >\n {children}\n </Component>\n );\n }\n);\n\nexport const ButtonWithLoading = React.forwardRef((props, ref) => {\n let { loading, children, ...buttonProps } = props;\n return (\n <Button\n {...buttonProps}\n style={[{ position: 'relative' }, buttonProps.style]}\n >\n {loading && (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n <Loading\n color=\"currentColor\"\n style={{ width: 20, height: 20, color: 'currentColor' }}\n />\n </View>\n )}\n <View\n style={{\n opacity: loading ? 0 : 1,\n flexDirection: 'row',\n alignItems: 'center'\n }}\n >\n {children}\n </View>\n </Button>\n );\n});\n\nconst defaultInputStyle = {\n outline: 0,\n backgroundColor: 'white',\n margin: 0,\n padding: 5,\n borderRadius: 4,\n border: '1px solid #d0d0d0'\n};\n\nexport function Input({\n style,\n inputRef,\n onEnter,\n onUpdate,\n focused,\n ...nativeProps\n}) {\n let ref = useRef();\n useProperFocus(ref, focused);\n\n return (\n <input\n ref={inputRef ? mergeRefs([inputRef, ref]) : ref}\n {...css([\n defaultInputStyle,\n {\n ':focus': {\n border: '1px solid ' + colors.b5,\n boxShadow: '0 1px 1px ' + colors.b7\n },\n '::placeholder': { color: colors.n7 }\n },\n styles.smallText,\n style\n ])}\n {...nativeProps}\n onKeyDown={e => {\n if (e.keyCode === 13 && onEnter) {\n onEnter(e);\n }\n\n nativeProps.onKeyDown && nativeProps.onKeyDown(e);\n }}\n onChange={e => {\n if (onUpdate) {\n onUpdate(e.target.value);\n }\n nativeProps.onChange && nativeProps.onChange(e);\n }}\n />\n );\n}\n\nexport function InputWithContent({\n leftContent,\n rightContent,\n inputStyle,\n style,\n getStyle,\n ...props\n}) {\n let [focused, setFocused] = useState(false);\n\n return (\n <View\n style={[\n defaultInputStyle,\n {\n padding: 0,\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center'\n },\n focused && {\n border: '1px solid ' + colors.b5,\n boxShadow: '0 1px 1px ' + colors.b7\n },\n style,\n getStyle && getStyle(focused)\n ]}\n >\n {leftContent}\n <Input\n {...props}\n style={[\n inputStyle,\n {\n flex: 1,\n '&, &:focus, &:hover': {\n border: 0,\n backgroundColor: 'transparent',\n boxShadow: 'none',\n color: 'inherit'\n }\n }\n ]}\n onFocus={e => {\n setFocused(true);\n props.onFocus && props.onFocus(e);\n }}\n onBlur={e => {\n setFocused(false);\n props.onBlur && props.onBlur(e);\n }}\n />\n {rightContent}\n </View>\n );\n}\n\nexport const Select = React.forwardRef(\n ({ style, children, ...nativeProps }, ref) => {\n return (\n <select\n ref={ref}\n {...css(\n {\n backgroundColor: 'transparent',\n height: 28,\n fontSize: 14,\n flex: 1,\n border: '1px solid #d0d0d0',\n borderRadius: 4,\n color: colors.n1,\n ':focus': {\n border: '1px solid ' + colors.b5,\n boxShadow: '0 1px 1px ' + colors.b7,\n outline: 'none'\n }\n },\n style\n )}\n {...nativeProps}\n >\n {children}\n </select>\n );\n }\n);\n\nexport function CustomSelect({ options, value, onChange, style }) {\n return (\n <ListboxInput\n value={value}\n onChange={onChange}\n style={{ lineHeight: '1em' }}\n >\n <ListboxButton\n {...css([{ borderWidth: 0, padding: 5, borderRadius: 4 }, style])}\n arrow={<ExpandArrow style={{ width: 7, height: 7, paddingTop: 3 }} />}\n />\n <ListboxPopover style={{ zIndex: 10000, outline: 0, borderRadius: 4 }}>\n <ListboxList>\n {options.map(([value, label]) => (\n <ListboxOption key={value} value={value}>\n {label}\n </ListboxOption>\n ))}\n </ListboxList>\n </ListboxPopover>\n </ListboxInput>\n );\n}\n\nexport function Keybinding({ keyName }) {\n return <Text style={{ fontSize: 10, color: colors.n6 }}>{keyName}</Text>;\n}\n\nexport function Menu({ header, footer, items: allItems, onMenuSelect }) {\n let el = useRef(null);\n let items = allItems.filter(x => x);\n let [hoveredIndex, setHoveredIndex] = useState(null);\n\n useEffect(() => {\n el.current.focus();\n\n let onKeyDown = e => {\n const UP = 38;\n const DOWN = 40;\n const ENTER = 13;\n\n let filteredItems = items.filter(\n item => item && item !== Menu.line && item.type !== Menu.label\n );\n let currentIndex = filteredItems.indexOf(items[hoveredIndex]);\n\n let transformIndex = idx => items.indexOf(filteredItems[idx]);\n\n switch (e.keyCode) {\n case UP:\n e.preventDefault();\n setHoveredIndex(\n hoveredIndex === null\n ? 0\n : transformIndex(Math.max(currentIndex - 1, 0))\n );\n break;\n case DOWN:\n e.preventDefault();\n setHoveredIndex(\n hoveredIndex === null\n ? 0\n : transformIndex(\n Math.min(currentIndex + 1, filteredItems.length - 1)\n )\n );\n break;\n case ENTER:\n e.preventDefault();\n if (hoveredIndex !== null) {\n onMenuSelect && onMenuSelect(items[hoveredIndex].name);\n }\n break;\n default:\n }\n };\n\n el.current.addEventListener('keydown', onKeyDown);\n\n return () => {\n el.current.removeEventListener('keydown', onKeyDown);\n };\n }, [hoveredIndex]);\n\n return (\n <View\n style={{ outline: 'none', borderRadius: 4, overflow: 'hidden' }}\n tabIndex={1}\n innerRef={el}\n >\n {header}\n {items.map((item, idx) => {\n if (item === Menu.line) {\n return (\n <View key={idx} style={{ margin: '3px 0px' }}>\n <View style={{ borderTop: '1px solid ' + colors.n10 }} />\n </View>\n );\n } else if (item.type === Menu.label) {\n return (\n <Text\n style={{\n color: colors.n6,\n fontSize: 11,\n lineHeight: '1em',\n textTransform: 'uppercase',\n margin: '3px 9px'\n }}\n >\n {item.name}\n </Text>\n );\n }\n\n let lastItem = items[idx - 1];\n\n return (\n <View\n key={item.name}\n style={[\n {\n cursor: 'default',\n padding: '9px 10px',\n marginTop:\n idx === 0 ||\n lastItem === Menu.line ||\n lastItem.type === Menu.label\n ? 0\n : -3,\n flexDirection: 'row',\n alignItems: 'center'\n },\n item.disabled && { color: colors.n7 },\n !item.disabled &&\n hoveredIndex === idx && { backgroundColor: colors.n10 }\n ]}\n onMouseEnter={() => setHoveredIndex(idx)}\n onMouseLeave={() => setHoveredIndex(null)}\n onClick={e =>\n !item.disabled && onMenuSelect && onMenuSelect(item.name)\n }\n >\n {/* Force it to line up evenly */}\n <Text style={{ lineHeight: 0 }}>\n {item.icon &&\n React.createElement(item.icon, {\n width: item.iconSize || 10,\n height: item.iconSize || 10,\n style: { marginRight: 7, width: 10 }\n })}\n </Text>\n <Text>{item.text}</Text>\n <View style={{ flex: 1 }} />\n {item.key && <Keybinding keyName={item.key} />}\n </View>\n );\n })}\n {footer}\n </View>\n );\n}\n\nMenu.line = Symbol('menu-line');\nMenu.label = Symbol('menu-label');\n\nexport function AlignedText({\n left,\n right,\n style,\n leftStyle,\n rightStyle,\n truncate = 'left',\n ...nativeProps\n}) {\n const truncateStyle = {\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n };\n\n return (\n <View\n style={[{ flexDirection: 'row', alignItems: 'center' }, style]}\n {...nativeProps}\n >\n <Block\n style={[\n { marginRight: 10 },\n truncate === 'left' && truncateStyle,\n leftStyle\n ]}\n >\n {left}\n </Block>\n <Block\n style={[\n { flex: 1, textAlign: 'right' },\n truncate === 'right' && truncateStyle,\n rightStyle\n ]}\n >\n {right}\n </Block>\n </View>\n );\n}\n\nexport function PlainCurrency({ amount, style }) {\n return <span style={style}>{integerToCurrency(amount)}</span>;\n}\n\nexport function PageHeader({ title, style }) {\n return (\n <View style={{ alignItems: 'flex-start' }}>\n <span style={[styles.pageHeader, style]}>{title}</span>\n </View>\n );\n}\n\nexport function P({ style, isLast, children, ...props }) {\n return (\n <div\n {...props}\n {...css(!isLast && { marginBottom: 15 }, style, { lineHeight: '1.5em' })}\n >\n {children}\n </div>\n );\n}\n\nexport function Strong({ style, children, ...props }) {\n return (\n <span {...props} {...css(style, { fontWeight: 500 })}>\n {children}\n </span>\n );\n}\n\nfunction ModalContent({\n style,\n size,\n noAnimation,\n isCurrent,\n stackIndex,\n children\n}) {\n let contentRef = useRef(null);\n let mounted = useRef(false);\n let rotateFactor = useRef(Math.random() * 10 - 5);\n\n useLayoutEffect(() => {\n if (contentRef.current == null) {\n return;\n }\n\n function setProps() {\n if (isCurrent) {\n contentRef.current.style.transform = 'translateY(0px) scale(1)';\n contentRef.current.style.pointerEvents = 'auto';\n } else {\n contentRef.current.style.transform = `translateY(-40px) scale(.95) rotate(${rotateFactor.current}deg)`;\n contentRef.current.style.pointerEvents = 'none';\n }\n }\n\n if (!mounted.current) {\n if (noAnimation) {\n contentRef.current.style.opacity = 1;\n contentRef.current.style.transform = 'translateY(0px) scale(1)';\n\n setTimeout(() => {\n if (contentRef.current) {\n contentRef.current.style.transition =\n 'opacity .1s, transform .1s cubic-bezier(.42, 0, .58, 1)';\n }\n }, 0);\n } else {\n contentRef.current.style.opacity = 0;\n contentRef.current.style.transform = 'translateY(10px) scale(1)';\n\n setTimeout(() => {\n if (contentRef.current) {\n mounted.current = true;\n contentRef.current.style.transition =\n 'opacity .1s, transform .1s cubic-bezier(.42, 0, .58, 1)';\n contentRef.current.style.opacity = 1;\n setProps();\n }\n }, 0);\n }\n } else {\n setProps();\n }\n }, [noAnimation, isCurrent, stackIndex]);\n\n return (\n <View\n innerRef={contentRef}\n style={[\n style,\n size && { width: size.width, height: size.height },\n noAnimation && !isCurrent && { display: 'none' }\n ]}\n >\n {children}\n </View>\n );\n}\n\nexport function Modal({\n title,\n isCurrent,\n isHidden,\n size,\n padding = 20,\n showHeader = true,\n showTitle = true,\n showClose = true,\n showOverlay = true,\n loading = false,\n noAnimation = false,\n focusAfterClose = true,\n stackIndex,\n parent,\n style,\n contentStyle,\n overlayStyle,\n children,\n onClose\n}) {\n useEffect(() => {\n // This deactivates any key handlers in the \"app\" scope. Ideally\n // each modal would have a name so they could each have their own\n // key handlers, but we'll do that later\n let prevScope = hotkeys.getScope();\n hotkeys.setScope('modal');\n return () => hotkeys.setScope(prevScope);\n }, []);\n\n return (\n <ReactModal\n isOpen={true}\n onRequestClose={onClose}\n shouldCloseOnOverlayClick={false}\n shouldFocusAfterRender={!global.IS_DESIGN_MODE}\n shouldReturnFocusAfterClose={focusAfterClose}\n appElement={document.querySelector('#root')}\n parentSelector={parent && (() => parent)}\n style={{\n content: {\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n overflow: 'visible',\n border: 0,\n fontSize: 14,\n backgroundColor: 'transparent',\n padding: 0,\n pointerEvents: 'auto',\n ...contentStyle\n },\n overlay: {\n zIndex: 3000,\n backgroundColor:\n showOverlay && stackIndex === 0 ? 'rgba(0, 0, 0, .1)' : 'none',\n pointerEvents: showOverlay ? 'auto' : 'none',\n ...overlayStyle,\n ...(parent\n ? {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0\n }\n : {})\n }\n }}\n >\n <ModalContent\n noAnimation={noAnimation}\n isCurrent={isCurrent}\n size={size}\n style={[\n {\n willChange: 'opacity, transform',\n minWidth: 500,\n minHeight: 0,\n boxShadow: styles.shadowLarge,\n borderRadius: 4,\n backgroundColor: 'white',\n opacity: isHidden ? 0 : 1\n },\n style,\n styles.lightScrollbar\n ]}\n >\n {showHeader && (\n <View\n style={{\n padding: 20,\n position: 'relative'\n }}\n >\n {showTitle && (\n <View\n style={{\n color: colors.n2,\n flex: 1,\n alignSelf: 'center',\n textAlign: 'center',\n // We need to force a width for the text-overflow\n // ellipses to work because we are aligning center.\n // This effectively gives it a padding of 20px\n width: 'calc(100% - 40px)'\n }}\n >\n <Text\n style={{\n fontSize: 25,\n fontWeight: 700,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }}\n >\n {title}\n </Text>\n </View>\n )}\n\n <View\n style={{\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center'\n }}\n >\n <View\n style={{\n flexDirection: 'row',\n marginRight: 15\n }}\n >\n {showClose && (\n <Button\n bare\n onClick={e => onClose()}\n style={{ padding: '10px 10px' }}\n >\n <Delete width={10} />\n </Button>\n )}\n </View>\n </View>\n </View>\n )}\n <View style={{ padding, paddingTop: 0, flex: 1 }}>\n {typeof children === 'function' ? children() : children}\n </View>\n {loading && (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(255, 255, 255, .6)',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: 1000\n }}\n >\n <Loading style={{ width: 20, height: 20 }} color={colors.n1} />\n </View>\n )}\n </ModalContent>\n </ReactModal>\n );\n}\n\nexport function ModalButtons({\n style,\n leftContent,\n focusButton = false,\n children\n}) {\n let containerRef = useRef(null);\n\n useEffect(() => {\n if (focusButton && containerRef.current) {\n let button = containerRef.current.querySelector(\n 'button:not([data-hidden])'\n );\n\n if (button) {\n button.focus();\n }\n }\n }, [focusButton]);\n\n return (\n <View\n innerRef={containerRef}\n style={[\n {\n flexDirection: 'row',\n marginTop: 30\n },\n style\n ]}\n >\n {/* Add a dummy button first so that when a user\n presses \"enter\" they do a normal submit, instead of\n activating the back button */}\n <Button data-hidden={true} style={{ display: 'none' }} />\n {leftContent}\n <View style={{ flex: 1 }} />\n {children}\n </View>\n );\n}\n\nexport function InlineField({ label, labelWidth, children, width, style }) {\n return (\n <label\n {...css(\n {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n margin: '7px 0',\n width\n },\n style\n )}\n >\n <div\n style={{\n width: labelWidth || 75,\n textAlign: 'right',\n paddingRight: 10\n }}\n >\n {label}:\n </div>\n {children}\n </label>\n );\n}\n\nexport function FormError({ style, children }) {\n return (\n <View style={[{ color: 'red', fontSize: 13 }, style]}>{children}</View>\n );\n}\n\nexport function InitialFocus({ children }) {\n let node = useRef(null);\n\n useEffect(() => {\n if (node.current && !global.IS_DESIGN_MODE) {\n // This is needed to avoid a strange interaction with\n // `ScopeTab`, which doesn't allow it to be focused at first for\n // some reason. Need to look into it.\n setTimeout(() => {\n if (node.current) {\n node.current.focus();\n node.current.setSelectionRange(0, 10000);\n }\n }, 0);\n }\n }, []);\n\n if (typeof children === 'function') {\n return children(node);\n }\n return React.cloneElement(children, { inputRef: node });\n}\n\nexport class HoverTarget extends React.Component {\n state = { hovered: false };\n\n onMouseEnter = () => {\n if (!this.props.disabled) {\n this.setState({ hovered: true });\n }\n };\n\n onMouseLeave = () => {\n if (!this.props.disabled) {\n this.setState({ hovered: false });\n }\n };\n\n componentDidUpdate(prevProps) {\n let { disabled } = this.props;\n if (disabled && this.state.hovered) {\n this.setState({ hovered: false });\n }\n }\n\n render() {\n let { style, contentStyle, children, renderContent } = this.props;\n return (\n <View style={style}>\n <View\n onMouseEnter={this.onMouseEnter}\n onMouseLeave={this.onMouseLeave}\n style={contentStyle}\n >\n {children}\n </View>\n {this.state.hovered && renderContent()}\n </View>\n );\n }\n}\n\nexport class TooltipTarget extends React.Component {\n state = { clicked: false };\n\n render() {\n return (\n <View style={[{ position: 'relative' }, this.props.style]}>\n <View\n style={{ flex: 1 }}\n onClick={() => this.setState({ clicked: true })}\n >\n {this.props.children}\n </View>\n {this.state.clicked &&\n this.props.renderContent(() => this.setState({ clicked: false }))}\n </View>\n );\n }\n}\n\nexport * from './tooltips';\nexport { useTooltip } from './tooltips';\n","import React, { useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { css, before } from 'glamor';\nimport { styles } from '../style';\n\nexport const IntersectionBoundary = React.createContext();\n\nfunction visibleBoundingRect(el) {\n let rect = el.getBoundingClientRect();\n let parentRect = el.parentNode.getBoundingClientRect();\n\n let top = Math.max(rect.top, parentRect.top);\n let left = Math.max(rect.left, parentRect.left);\n let right = Math.min(\n rect.left + rect.width,\n parentRect.left + parentRect.width\n );\n let bottom = Math.min(\n rect.top + rect.height,\n parentRect.top + parentRect.height\n );\n\n return {\n top,\n left,\n width: right - left,\n height: bottom - top\n };\n}\n\nexport function useTooltip() {\n let [isOpen, setIsOpen] = useState(false);\n\n return {\n getOpenEvents: (events = {}) => ({\n onClick: e => {\n e.stopPropagation();\n events.onClick && events.onClick(e);\n setIsOpen(true);\n }\n }),\n isOpen,\n close: () => setIsOpen(false)\n };\n}\n\nexport class Tooltip extends React.Component {\n static contextType = IntersectionBoundary;\n state = { position: null };\n\n constructor(props) {\n super(props);\n this.position = props.position || 'bottom-right';\n this.contentRef = React.createRef();\n }\n\n setup() {\n this.layout();\n\n let mousedownHandler = e => {\n let node = e.target;\n\n while (node && node !== document.documentElement) {\n // Allow clicking reach popover that mount outside of\n // tooltips. Might need to think about this more, like what\n // kind of things can be click that shouldn't close a tooltip?\n if (\n node.dataset.testid === 'tooltip' ||\n node.dataset.reachPopover != null\n ) {\n break;\n }\n\n node = node.parentNode;\n }\n\n if (node === document.documentElement) {\n this.props.onClose && this.props.onClose();\n }\n };\n\n let escHandler = e => {\n if (e.keyCode === 27) {\n this.props.onClose && this.props.onClose();\n }\n };\n\n window.document.addEventListener('mousedown', mousedownHandler, false);\n this.contentRef.current.addEventListener('keydown', escHandler, false);\n\n this.cleanup = () => {\n window.document.removeEventListener('mousedown', mousedownHandler);\n };\n }\n\n componentDidMount() {\n if (this.getContainer()) {\n this.setup();\n } else {\n // TODO: write comment :)\n this.forceUpdate(() => {\n if (this.getContainer()) {\n this.setup();\n } else {\n console.log('Warning: could not mount tooltip, container missing');\n }\n });\n }\n }\n\n componentDidUpdate(prevProps) {\n // If providing the target rect manually, we can dynamically\n // update to it. We can't do this if we are reading directly from\n // the DOM since we don't know when it's updated.\n if (\n prevProps.targetRect !== this.props.targetRect ||\n prevProps.forceTop !== this.props.forceTop ||\n this.props.forceLayout\n ) {\n this.layout();\n }\n }\n\n getContainer() {\n let { ignoreBoundary = false } = this.props;\n\n if (!ignoreBoundary && this.context) {\n return this.context.current;\n }\n return document.body;\n }\n\n getBoundsContainer() {\n // If the container is a scrollable element, we want to do all the\n // bounds checking on the parent DOM element instead\n let container = this.getContainer();\n\n if (\n container.parentNode &&\n container.parentNode.style.overflow === 'auto'\n ) {\n return container.parentNode;\n }\n return container;\n }\n\n layout() {\n let { targetRect, offset = 0 } = this.props;\n let contentEl = this.contentRef.current;\n if (!contentEl) {\n return;\n }\n\n let box = contentEl.getBoundingClientRect();\n let anchorEl = this.target.parentNode;\n\n let anchorRect = targetRect || anchorEl.getBoundingClientRect();\n\n // Copy it so we can mutate it\n anchorRect = {\n top: anchorRect.top,\n left: anchorRect.left,\n width: anchorRect.width,\n height: anchorRect.height\n };\n\n let container = this.getBoundsContainer();\n if (!container) {\n return;\n }\n\n let containerRect = container.getBoundingClientRect();\n anchorRect.left -= containerRect.left;\n anchorRect.top -= containerRect.top;\n\n // This is a hack, but allow consumers to force a top position if\n // they already know it. This allows them to provide consistent\n // updates. We should generalize this and `targetRect`\n if (this.props.forceTop) {\n anchorRect.top = this.props.forceTop;\n } else {\n let boxHeight = box.height + offset;\n let testTop = anchorRect.top - boxHeight;\n let testBottom = anchorRect.top + anchorRect.height + boxHeight;\n\n if (\n // If it doesn't fit above it, switch it to below\n (this.position.indexOf('top') !== -1 && testTop < containerRect.top) ||\n // If it doesn't fit below it, switch it above only if it does\n // fit above it\n (this.position.indexOf('bottom') !== -1 &&\n (testBottom > containerRect.height && testTop > 0))\n ) {\n // Invert the position\n this.position = this.getOppositePosition(this.position);\n }\n\n anchorRect.top += container.scrollTop;\n }\n\n const style = this.getStyleForPosition(\n this.position,\n box,\n anchorRect,\n this.getContainer().getBoundingClientRect(),\n offset\n );\n\n contentEl.style.top = style.top;\n contentEl.style.bottom = style.bottom;\n contentEl.style.left = style.left;\n contentEl.style.right = style.right;\n contentEl.style.width = style.width;\n }\n\n componentWillUnmount() {\n if (this.cleanup) {\n this.cleanup();\n }\n }\n\n getOppositePosition(position) {\n switch (position) {\n case 'top':\n case 'top-left':\n return 'bottom';\n case 'top-right':\n return 'bottom-right';\n case 'bottom':\n case 'bottom-left':\n return 'top';\n case 'bottom-right':\n return 'top-right';\n case 'bottom-stretch':\n return 'top-stretch';\n case 'top-stretch':\n return 'bottom-stretch';\n case 'bottom-center':\n return 'top-center';\n case 'top-center':\n return 'bottom-center';\n default:\n }\n }\n\n getStyleForPosition(position, boxRect, anchorRect, containerRect, offset) {\n const style = {\n top: 'inherit',\n bottom: 'inherit',\n left: 'inherit',\n right: 'inherit'\n };\n\n if (\n position === 'top' ||\n position === 'top-right' ||\n position === 'top-left'\n ) {\n style.top = anchorRect.top - boxRect.height - offset + 'px';\n if (position === 'top-right') {\n style.left =\n anchorRect.left + (anchorRect.width - boxRect.width) + 'px';\n } else {\n style.left = anchorRect.left + 'px';\n // style.right = 0;\n }\n } else if (\n position === 'bottom' ||\n position === 'bottom-right' ||\n position === 'bottom-left'\n ) {\n style.top = anchorRect.top + anchorRect.height + offset + 'px';\n if (position === 'bottom-right') {\n style.left =\n anchorRect.left + (anchorRect.width - boxRect.width) + 'px';\n } else {\n style.left = anchorRect.left + 'px';\n // style.right = 0;\n }\n } else if (position === 'bottom-center') {\n style.top = anchorRect.top + anchorRect.height + offset + 'px';\n style.left =\n anchorRect.left - (boxRect.width - anchorRect.width) / 2 + 'px';\n } else if (position === 'top-center') {\n style.top = anchorRect.top - boxRect.height - offset + 'px';\n style.left =\n anchorRect.left - (boxRect.width - anchorRect.width) / 2 + 'px';\n } else if (position === 'left-center') {\n style.top =\n anchorRect.top - (boxRect.height - anchorRect.height) / 2 + 'px';\n style.left = anchorRect.left - boxRect.width + 'px';\n } else if (position === 'top-stretch') {\n style.bottom = containerRect.height - anchorRect.top + offset + 'px';\n style.left = anchorRect.left + 'px';\n style.width = anchorRect.width + 'px';\n } else if (position === 'bottom-stretch') {\n style.top = anchorRect.top + anchorRect.height + offset + 'px';\n style.left = anchorRect.left + 'px';\n style.width = anchorRect.width + 'px';\n } else {\n throw new Error('Invalid position for Tooltip: ' + position);\n }\n return style;\n }\n\n render() {\n const { children, width, style } = this.props;\n\n const contentStyle = {\n position: 'absolute',\n zIndex: 3000,\n\n padding: 5,\n width,\n boxShadow: styles.shadowLarge,\n borderRadius: 4,\n backgroundColor: 'white'\n // opacity: 0,\n // transition: 'transform .1s, opacity .1s',\n // transitionTimingFunction: 'ease-out'\n };\n\n // const enteredStyle = { opacity: 1, transform: 'none' };\n\n if (!this.getContainer()) {\n return null;\n }\n\n return (\n <div ref={el => (this.target = el)}>\n {ReactDOM.createPortal(\n <div\n {...css(contentStyle, style, styles.darkScrollbar)}\n ref={this.contentRef}\n data-testid=\"tooltip\"\n onClick={e => {\n // Click events inside a tooltip (e.g. when selecting a menu item) will bubble up\n // through the portal to parents in the React tree (as opposed to DOM parents).\n // This is undesirable. For example, clicking on a category group on a budget sheet\n // toggles that group, and so would clicking on a menu item in the settings menu\n // of that category group if the click event wasn't stopped from bubbling up.\n // This issue could be handled in different ways, but I think stopping propagation\n // here is sane; I can't see a scenario where you would want to take advantage of\n // click propagation from a tooltip back to its React parent.\n e.stopPropagation();\n }}\n >\n {children}\n </div>,\n this.getContainer()\n )}\n </div>\n );\n }\n}\n\nexport function Pointer({\n pointerDirection = 'up',\n pointerPosition = 'left',\n backgroundColor,\n borderColor = '#c0c0c0',\n border = true,\n color,\n style,\n innerStyle,\n pointerStyle,\n children\n}) {\n return (\n <div {...css({ position: 'relative' }, style)}>\n <div\n {...css(\n {\n zIndex: 3000,\n backgroundColor: backgroundColor,\n color: color,\n padding: 10,\n boxShadow: '0 2px 6px rgba(0, 0, 0, .25)',\n border: border && '1px solid ' + borderColor,\n borderRadius: 2\n },\n before({\n position: 'absolute',\n display: 'inline-block',\n backgroundColor,\n border: border && '1px solid ' + borderColor,\n borderLeft: 0,\n borderBottom: 0,\n width: 7,\n height: 7,\n boxShadow: '1px -1px 1px rgba(0, 0, 0, .05)',\n ...(pointerDirection === 'up'\n ? {\n transform: 'rotate(-45deg)',\n top: border ? -4 : -3,\n content: '\" \"',\n ...(pointerPosition === 'center'\n ? { left: 'calc(50% - 3.5px)' }\n : pointerPosition === 'left'\n ? { left: 40 }\n : { right: 40 })\n }\n : pointerDirection === 'down'\n ? {\n transform: 'rotate(135deg)',\n bottom: border ? -4 : -3,\n content: '\" \"',\n ...(pointerPosition === 'center'\n ? { left: 'calc(50% - 3.5px)' }\n : pointerPosition === 'left'\n ? { left: 40 }\n : { right: 40 })\n }\n : pointerDirection === 'right'\n ? {\n transform: 'rotate(45deg)',\n content: '\" \"',\n top: 'calc(50% - 3.5px)',\n right: -3\n }\n : {}),\n ...pointerStyle\n }),\n innerStyle\n )}\n >\n {children}\n </div>\n </div>\n );\n}\n","export default {\n LOAD_TRANSACTIONS: 'LOAD_TRANSACTIONS',\n SET_NEW_TRANSACTIONS: 'SET_NEW_TRANSACTIONS',\n UPDATE_NEW_TRANSACTIONS: 'UPDATE_NEW_TRANSACTIONS',\n SET_LAST_TRANSACTION: 'SET_LAST_TRANSACTION',\n MARK_ACCOUNT_READ: 'MARK_ACCOUNT_READ',\n LOAD_ACCOUNTS: 'LOAD_ACCOUNTS',\n UPDATE_ACCOUNT: 'UPDATE_ACCOUNT',\n LOAD_CATEGORIES: 'LOAD_CATEGORIES',\n ADD_CATEGORY: 'ADD_CATEGORY',\n DELETE_CATEGORY: 'DELETE_CATEGORY',\n LOAD_PAYEES: 'LOAD_PAYEES',\n LOAD_BANKS: 'LOAD_BANKS',\n SET_PROFILE: 'SET_PROFILE',\n SET_PREFS: 'SET_PREFS',\n MERGE_LOCAL_PREFS: 'MERGE_LOCAL_PREFS',\n MERGE_GLOBAL_PREFS: 'MERGE_GLOBAL_PREFS',\n SET_BUDGETS: 'SET_BUDGETS',\n SET_REMOTE_FILES: 'SET_REMOTE_FILES',\n SET_ALL_FILES: 'SET_ALL_FILES',\n SET_AVAILABLE_IMPORTS: 'SET_AVAILABLE_IMPORTS',\n CLOSE_BUDGET: 'CLOSE_BUDGET',\n SET_APP_STATE: 'SET_APP_STATE',\n DEBUG_CELL: 'DEBUG_CELL',\n PUSH_MODAL: 'PUSH_MODAL',\n REPLACE_MODAL: 'REPLACE_MODAL',\n HIDE_MODALS: 'HIDE_MODALS',\n SHOW_MODALS: 'SHOW_MODALS',\n CLOSE_MODAL: 'CLOSE_MODAL',\n POP_MODAL: 'POP_MODAL',\n ADD_NOTIFICATION: 'ADD_NOTIFICATION',\n REMOVE_NOTIFICATION: 'REMOVE_NOTIFICATION',\n GET_USER_DATA: 'GET_USER_DATA',\n SET_LAST_UNDO_STATE: 'SET_LAST_UNDO_STATE',\n SET_LAST_SPLIT_STATE: 'SET_LAST_SPLIT_STATE',\n SET_ACCOUNTS_SYNCING: 'SET_ACCOUNTS_SYNCING',\n ACCOUNT_SYNC_STATUS: 'ACCOUNT_SYNC_STATUS',\n ACCOUNT_SYNC_FAILURES: 'ACCOUNT_SYNC_FAILURES',\n SIGN_OUT: 'SIGN_OUT',\n\n SET_TUTORIAL_STAGE: 'SET_TUTORIAL_STAGE',\n DEACTIVATE_TUTORIAL: 'DEACTIVATE_TUTORIAL'\n};\n","import React from 'react';\n\nconst SvgCheckmark = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path d=\"M0 11l2-2 5 5L18 3l2 2L7 18z\" fill=\"currentColor\" />\n </svg>\n);\n\nexport default SvgCheckmark;\n","import { send } from '../../platform/client/fetch';\nimport constants from '../constants';\n\nexport function setAppState(state) {\n return {\n type: constants.SET_APP_STATE,\n state\n };\n}\n\nexport function updateApp() {\n return async dispatch => {\n global.Actual.applyAppUpdate();\n dispatch(setAppState({ updateInfo: null }));\n };\n}\n\nexport function setLastUndoState(undoState) {\n return {\n type: constants.SET_LAST_UNDO_STATE,\n undoState\n };\n}\n\n// This is only used in the fake web version where everything runs in\n// the browser. It's a way to send a file to the backend to be\n// imported into the virtual filesystem.\nexport function uploadFile(filename, contents) {\n return dispatch => {\n return send('upload-file-web', { filename, contents });\n };\n}\n\nexport function focused() {\n return dispatch => {\n return send('app-focused');\n };\n}\n","import React from 'react';\nimport { css } from 'glamor';\n\nfunction Text(props) {\n // Pull `numberOfLines` off since it's only used in React Native\n const { numberOfLines, style, innerRef, ...restProps } = props;\n return (\n <span\n {...restProps}\n ref={innerRef}\n className={`${props.className || ''} ${css(props.style)}`}\n />\n );\n}\n\nexport default Text;\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction Delete({ width, height, style, color = \"currentColor\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 24 24\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <line\n fill=\"none\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"4\"\n strokeLinecap=\"round\"\n strokeMiterlimit=\"10\"\n x1=\"2\"\n y1=\"2\"\n x2=\"22\"\n y2=\"22\"\n />\n <line\n fill=\"none\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"4\"\n strokeLinecap=\"round\"\n strokeMiterlimit=\"10\"\n x1=\"22\"\n y1=\"2\"\n x2=\"2\"\n y2=\"22\"\n />\n </svg>\n );\n}\n\nexport default Delete;\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction ExpandArrow({ width, height, style, color = \"currentColor\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 25 15\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill={color}\n className=\"path\"\n 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\"\n />\n </svg>\n );\n}\n\nexport default ExpandArrow;\n","import constants from '../constants';\nimport { closeModal } from './modals';\nimport { send } from '../../platform/client/fetch';\n\nexport function loadPrefs() {\n return async (dispatch, getState) => {\n let prefs = await send('load-prefs');\n\n // Remove any modal state if switching between budgets\n let currentPrefs = getState().prefs.local;\n if (prefs && prefs.id && !currentPrefs) {\n dispatch(closeModal());\n }\n\n dispatch({\n type: constants.SET_PREFS,\n prefs,\n globalPrefs: await send('load-global-prefs')\n });\n\n return prefs;\n };\n}\n\nexport function savePrefs(prefs) {\n return async dispatch => {\n await send('save-prefs', prefs);\n dispatch({\n type: constants.MERGE_LOCAL_PREFS,\n prefs\n });\n };\n}\n\nexport function loadGlobalPrefs() {\n return async (dispatch, getState) => {\n let globalPrefs = await send('load-global-prefs');\n dispatch({\n type: constants.SET_PREFS,\n prefs: getState().prefs.local,\n globalPrefs\n });\n return globalPrefs;\n };\n}\n\nexport function saveGlobalPrefs(prefs) {\n return async dispatch => {\n await send('save-global-prefs', prefs);\n dispatch({\n type: constants.MERGE_GLOBAL_PREFS,\n globalPrefs: prefs\n });\n };\n}\n","import { send } from '../../platform/client/fetch';\nimport constants from '../constants';\nimport { loadGlobalPrefs } from './prefs';\nimport { loadAllFiles, closeBudget } from './budgets';\n\nexport function getUserData() {\n return async dispatch => {\n const data = await send('subscribe-get-user');\n\n dispatch({\n type: constants.GET_USER_DATA,\n data\n });\n return data;\n };\n}\n\nexport function loggedIn() {\n return async dispatch => {\n await dispatch(getUserData());\n\n // We want to be careful about how we call loadAllFiles. It will\n // turn the files state from null into an array, indicating that\n // we've loaded the files at least once. This first attempt at\n // loading files is important - the manager uses files to decide\n // if it should create a new file automatically (if there are no\n // files). If we call it before we have a properly logged in\n // user, later on it could trigger the codepath which\n // automatically creates a file, but we really haven't loaded\n // their files yet.\n //\n // Since the above comment was written, We let in users even if\n // their account is invalid. So we should list all their files\n // regardless. Previously, we kicked users out to a \"need payment\n // info\" screen and we didn't want to call this.\n dispatch(loadAllFiles());\n };\n}\n\nexport function signOut() {\n return async dispatch => {\n const data = await send('subscribe-sign-out');\n\n dispatch(getUserData());\n dispatch(loadGlobalPrefs());\n dispatch(closeBudget());\n dispatch({ type: constants.SIGN_OUT });\n };\n}\n","import constants from '../constants';\nconst uuid = require('../../platform/uuid');\n\nexport function addNotification(notification) {\n return {\n type: constants.ADD_NOTIFICATION,\n notification: {\n ...notification,\n id: notification.id || uuid.v4Sync()\n }\n };\n}\n\nexport function addGenericErrorNotification() {\n return addNotification({\n type: 'error',\n message:\n 'Something internally went wrong. You may want to restart the app if anything looks wrong. ' +\n 'We have been notified of the issue and will try to fix it soon.'\n });\n}\n\nexport function removeNotification(id) {\n return {\n type: constants.REMOVE_NOTIFICATION,\n id\n };\n}\n","export function getUploadError({ reason, meta }) {\n switch (reason) {\n case 'unauthorized':\n return 'You are not logged in.';\n case 'encrypt-failure':\n if (meta.isMissingKey) {\n return 'Encrypting your file failed because you are missing your encryption key. Create your key in the next step.';\n }\n return '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.';\n case 'file-has-reset':\n // Something really weird happened - during reset a sanity\n // check on the server failed. The user just needs to\n // restart the whole process.\n return 'Something went wrong while resetting your file. Please try again.';\n case 'file-has-new-key':\n return 'Unable to encrypt your data because you are missing the key. Create the latest key in the next step.';\n case 'network':\n return 'Uploading the file failed. Check your network connection.';\n case 'beta-version':\n return 'You cannot perform this action in the beta version (resetting sync, deleting a file, etc).';\n default:\n return `An internal error occurred, sorry! Contact help@actualbudget.com for support. (ref: ${reason})`;\n }\n}\n\nexport function getDownloadError({ reason, meta, fileName }) {\n switch (reason) {\n case 'network':\n case 'download-failure':\n return 'Downloading the file failed. Check your network connection.';\n case 'invalid-zip-file':\n case 'invalid-meta-file':\n return 'Downloaded file is invalid, sorry! Contact help@actualbudget.com for support.';\n case 'decrypt-failure':\n return (\n 'Unable to decrypt file ' +\n (fileName || '(unknown)') +\n '. To change your key, first ' +\n 'download this file with the proper password.'\n );\n\n case 'out-of-sync-migrations':\n return (\n 'This budget cannot be loaded with this version of the app. ' +\n 'Make sure the app is up-to-date.'\n );\n\n default:\n let info = meta && meta.fileId ? `(fileId: ${meta.fileId})` : '';\n return (\n 'Something went wrong trying to download that file, sorry! Contact help@actualbudget.com for support. ' +\n info\n );\n }\n}\n\nexport function getCreateKeyError(error) {\n return getUploadError(error);\n}\n\nexport function getTestKeyError({ reason }) {\n switch (reason) {\n case 'network':\n return 'Unable to connect to the server. We need to access our server to get some information about your keys.';\n case 'old-key-style':\n return (\n 'This file is encrypted with an old unsupported key style. Recreate the key ' +\n 'on a device where the file is available, or use an older version of Actual to download ' +\n 'it.'\n );\n case 'decrypt-failure':\n return 'Unable to decrypt file with this password. Please try again.';\n default:\n return 'Something went wrong trying to create a key, sorry! Contact help@actualbudget.com for support.';\n }\n}\n\nexport function getSubscribeError({ reason }) {\n switch (reason) {\n case 'network':\n return 'Unable to reach the server. Check your internet connection';\n case 'exists':\n return 'An account with that email already exists. Did you mean to login?';\n case 'invalid-email':\n return 'Invalid email';\n default:\n return 'An error occurred. Please try again later.';\n }\n}\n","import { listen, send } from '../platform/client/fetch';\nimport { once, runAgain } from '../shared/async';\n\nimport q, { getPrimaryOrderBy } from '../shared/query';\nexport default q;\n\nexport async function runQuery(query) {\n return send('query', query.serialize());\n}\n\nexport function liveQuery(query, onData, opts) {\n let q = new LiveQuery(query, onData, opts);\n q.run();\n return q;\n}\n\nexport function pagedQuery(query, onData, opts) {\n let q = new PagedQuery(query, onData, opts);\n q.run();\n return q;\n}\n\n// Subscribe and refetch\nexport class LiveQuery {\n constructor(query, onData, opts = {}) {\n this.error = new Error();\n this.query = query;\n this.data = null;\n this.mappedData = null;\n this.dependencies = null;\n this.mapper = opts.mapper;\n this.onlySync = opts.onlySync;\n this.listeners = [];\n\n // Async coordination\n this.inflight = false;\n this.restart = false;\n\n if (onData) {\n this.addListener(onData);\n }\n }\n\n addListener(func) {\n this.listeners.push(func);\n\n return () => {\n this.listeners = this.listeners.filter(l => l !== func);\n };\n }\n\n onData = (data, prevData) => {\n for (let i = 0; i < this.listeners.length; i++) {\n this.listeners[i](data, prevData);\n }\n };\n\n onUpdate = tables => {\n // We might not know the dependencies if the first query result\n // hasn't come back yet\n if (\n this.dependencies == null ||\n tables.find(table => this.dependencies.has(table))\n ) {\n this.run();\n }\n };\n\n run = () => {\n this.subscribe();\n return this._fetchData(() => runQuery(this.query));\n };\n\n _fetchData = async makeRequest => {\n // TODO: precompile queries, or cache compilation results on the\n // backend. could give a query an id which makes it cacheable via\n // an LRU cache\n\n let reqId = Math.random();\n this.inflightRequestId = reqId;\n\n let { data, dependencies } = await makeRequest();\n\n // Regardless if this request was cancelled or not, save the\n // dependencies. The query can't change so all requests will\n // return the same deps.\n if (this.dependencies == null) {\n this.dependencies = new Set(dependencies);\n }\n\n // Only fire events if this hasn't been cancelled and if we're\n // still subscribed (`this._subscribe` will exist)\n if (this.inflightRequestId === reqId && this._unsubscribe) {\n let prevData = this.mappedData;\n this.data = data;\n this.mappedData = this.mapData(data);\n this.onData(this.mappedData, prevData);\n this.inflightRequestId = null;\n }\n };\n\n subscribe = () => {\n if (this._unsubscribe == null) {\n this._unsubscribe = listen('sync-event', ({ type, tables }) => {\n // If the user is doing optimistic updates, they don't want to\n // always refetch whenever something changes because it would\n // refetch all data after they've already updated the UI. This\n // voids the perf benefits of optimistic updates. Allow querys\n // to only react to remote syncs. By default, queries will\n // always update to all changes.\n //\n // TODO: errors?\n let syncTypes = this.onlySync ? ['success'] : ['applied', 'success'];\n\n if (syncTypes.indexOf(type) !== -1) {\n this.onUpdate(tables);\n }\n });\n }\n };\n\n unsubscribe = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n this._unsubscribe = null;\n }\n };\n\n mapData = data => {\n if (this.mapper) {\n return this.mapper(data);\n }\n return data;\n };\n\n getQuery = () => {\n return this.query;\n };\n\n getData = () => {\n return this.mappedData;\n };\n\n getNumListeners = () => {\n return this.listeners.length;\n };\n\n isRunning = () => {\n return this._unsubscribe != null;\n };\n\n _optimisticUpdate = (dataFunc, mappedDataFunc) => {\n this.data = dataFunc(this.data);\n this.mappedData = mappedDataFunc(this.mappedData);\n };\n\n optimisticUpdate = (dataFunc, mappedDataFunc) => {\n let prevMappedData = this.mappedData;\n this._optimisticUpdate(dataFunc, mappedDataFunc);\n this.onData(this.mappedData, prevMappedData);\n };\n}\n\n// Paging\nexport class PagedQuery extends LiveQuery {\n constructor(query, onData, opts = {}) {\n super(query, onData, opts);\n this.totalCount = null;\n this.pageCount = opts.pageCount || 500;\n this.runPromise = null;\n this.done = false;\n this.onPageData = opts.onPageData || (() => {});\n }\n\n _fetchCount = () => {\n return runQuery(this.query.calculate({ $count: '*' })).then(({ data }) => {\n this.totalCount = data;\n });\n };\n\n run = () => {\n this.subscribe();\n\n this.runPromise = this._fetchData(async () => {\n this.done = false;\n\n // Also fetch the total count\n this._fetchCount();\n\n // If data is null, we haven't fetched anything yet so just\n // fetch the first page\n return runQuery(\n this.query.limit(\n this.data == null\n ? this.pageCount\n : Math.max(this.data.length, this.pageCount)\n )\n );\n });\n\n return this.runPromise;\n };\n\n refetchUpToRow = async (id, defaultOrderBy) => {\n this.runPromise = this._fetchData(async () => {\n this.done = false;\n\n // Also fetch the total count\n this._fetchCount();\n\n let orderDesc = getPrimaryOrderBy(this.query, defaultOrderBy);\n if (orderDesc == null) {\n throw new Error(`refetchUpToRow requires a query with orderBy`);\n }\n\n let { field, order } = orderDesc;\n\n let result = await runQuery(this.query.filter({ id }).select(field));\n if (result.data.length === 0) {\n // This row is not part of this set anymore, we can't do\n // this. We stop early to avoid possibly pulling in a ton of\n // data that we don't need\n return;\n }\n let fullRow = result.data[0];\n\n result = await runQuery(\n this.query.filter({\n [field]: {\n [order === 'asc' ? '$lte' : '$gte']: fullRow[field]\n }\n })\n );\n let data = result.data;\n\n // Load in an extra page to make room for the UI to show some\n // data after it\n result = await runQuery(\n this.query\n .filter({\n [field]: {\n [order === 'asc' ? '$gt' : '$lt']: fullRow[field]\n }\n })\n .limit(this.pageCount)\n );\n\n return {\n data: data.concat(result.data),\n dependencies: result.dependencies\n };\n });\n\n return this.runPromise;\n };\n\n // The public version of this function is created below and\n // throttled by `once`\n _fetchNext = async () => {\n while (this.inflightRequestId) {\n await this.runPromise;\n }\n\n let previousData = this.data;\n\n if (!this.done) {\n let { data } = await runQuery(\n this.query.limit(this.pageCount).offset(previousData.length)\n );\n\n // If either there is an existing request in flight or the data\n // has already changed underneath it, we can't reliably concat\n // the data since it's different now. Need to re-run the whole\n // process again\n if (this.inflightRequestId || previousData !== this.data) {\n return this._fetchNext();\n } else {\n if (data.length === 0) {\n this.done = true;\n } else {\n this.done = data.length < this.pageCount;\n this.data = this.data.concat(data);\n\n let prevData = this.mappedData;\n let mapped = this.mapData(data);\n this.mappedData = this.mappedData.concat(mapped);\n this.onPageData(mapped);\n this.onData(this.mappedData, prevData);\n }\n }\n }\n };\n\n fetchNext = once(this._fetchNext);\n\n isFinished = () => {\n return this.done;\n };\n\n getTotalCount = () => {\n return this.totalCount;\n };\n\n optimisticUpdate = (dataFunc, mappedDataFunc) => {\n let prevData = this.data;\n let prevMappedData = this.mappedData;\n\n this._optimisticUpdate(dataFunc, mappedDataFunc);\n this.totalCount += this.data.length - prevData.length;\n\n this.onData(this.mappedData, prevMappedData);\n };\n}\n","export function sequential(fn) {\n let sequenceState = {\n running: null,\n queue: []\n };\n\n function pump() {\n if (sequenceState.queue.length > 0) {\n const next = sequenceState.queue.shift();\n run(next.args, next.resolve, next.reject);\n } else {\n sequenceState.running = null;\n }\n }\n\n function run(args, resolve, reject) {\n sequenceState.running = fn(...args);\n\n sequenceState.running.then(\n val => {\n pump();\n resolve(val);\n },\n err => {\n pump();\n reject(err);\n }\n );\n }\n\n return (...args) => {\n if (!sequenceState.running) {\n return new Promise((resolve, reject) => {\n return run(args, resolve, reject);\n });\n } else {\n return new Promise((resolve, reject) => {\n sequenceState.queue.push({ resolve, reject, args });\n });\n }\n };\n}\n\nexport function once(fn) {\n let promise = null;\n let onceFn = (...args) => {\n if (!promise) {\n promise = fn(...args).finally(() => {\n promise = null;\n });\n return promise;\n }\n\n return promise;\n };\n\n return onceFn;\n}\n","import constants from '../constants';\nimport { send } from '../../platform/client/fetch';\nimport Platform from '../platform';\nimport { pushModal } from './modals';\n\nexport function startTutorialFirstTime() {\n return (dispatch, getState) => {\n let { seenTutorial } = getState().prefs.global;\n\n if (!seenTutorial) {\n send('set-tutorial-seen');\n if (Platform.env === 'web') {\n setTimeout(() => {\n dispatch(pushModal('welcome-screen'));\n }, 500);\n\n return true;\n }\n }\n return false;\n };\n}\n","import React, { useRef, useLayoutEffect, useContext, useMemo } from 'react';\n\nfunction getFocusedKey(el) {\n let node = el;\n // Search up to 10 parent nodes\n for (let i = 0; i < 10 && node; i++) {\n let key = node.dataset && node.dataset.focusKey;\n if (key) {\n return key;\n }\n node = node.parentNode;\n }\n\n return null;\n}\n\nexport function focusElement(el, refocusContext) {\n if (refocusContext) {\n let key = getFocusedKey(el);\n el.focus({ preventScroll: key && key === refocusContext.keyRef.current });\n refocusContext.onKeyChange(key);\n } else {\n el.focus();\n }\n\n if (el.tagName === 'INPUT') {\n el.setSelectionRange(0, 10000);\n }\n}\n\nlet AvoidRefocusScrollContext = React.createContext(null);\n\nexport function AvoidRefocusScrollProvider({ children }) {\n let keyRef = useRef(null);\n\n let value = useMemo(\n () => ({\n keyRef,\n onKeyChange: key => {\n keyRef.current = key;\n }\n }),\n [keyRef]\n );\n\n return (\n <AvoidRefocusScrollContext.Provider value={value}>\n {children}\n </AvoidRefocusScrollContext.Provider>\n );\n}\n\nexport function useProperFocus(ref, shouldFocus) {\n let context = useContext(AvoidRefocusScrollContext);\n let prevShouldFocus = useRef(null);\n\n useLayoutEffect(() => {\n let prev = prevShouldFocus.current;\n let view = ref.current;\n\n if (view && shouldFocus && (prev === null || prev === false)) {\n let selector = 'input,button,div[tabindex]';\n let focusEl = view.matches(selector)\n ? view\n : view.querySelector(selector);\n\n if (shouldFocus && focusEl) {\n focusElement(focusEl, context);\n }\n }\n\n prevShouldFocus.current = shouldFocus;\n }, [shouldFocus]);\n}\n","import React, { useState, useEffect } from 'react';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router';\nimport * as actions from 'loot-core/src/client/actions';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport {\n View,\n Text,\n Button,\n Tooltip,\n Menu\n} from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\nimport ExclamationSolid from 'loot-design/src/svg/v1/ExclamationSolid';\n\nfunction LoggedInUser({\n history,\n files,\n budgetId,\n userData,\n getUserData,\n setAppState,\n signOut,\n pushModal,\n closeBudget,\n style,\n color\n}) {\n let [loading, setLoading] = useState(true);\n let [menuOpen, setMenuOpen] = useState(false);\n\n useEffect(() => {\n getUserData().then(() => setLoading(false));\n }, []);\n\n async function onChangePassword() {\n await closeBudget();\n window.__history.push('/change-password');\n }\n\n function onMenuSelect(type) {\n setMenuOpen(false);\n\n switch (type) {\n case 'change-password':\n onChangePassword();\n break;\n case 'sign-out':\n signOut();\n break;\n default:\n }\n }\n\n function onClick() {\n setMenuOpen(true);\n }\n\n if (loading) {\n return (\n <Text style={[{ color: colors.n5, fontStyle: 'italic' }, style]}>\n Loading account...\n </Text>\n );\n } else if (userData) {\n if (userData.offline) {\n return <View style={[{ color }, style]}>Offline</View>;\n }\n\n return (\n <View style={[{ flexDirection: 'row', alignItems: 'center' }, style]}>\n <Button bare onClick={onClick} style={{ color }}>\n Server\n </Button>\n\n {menuOpen && (\n <Tooltip\n position=\"bottom-right\"\n style={{ padding: 0 }}\n onClose={() => setMenuOpen(false)}\n >\n <Menu\n onMenuSelect={onMenuSelect}\n items={[\n { name: 'change-password', text: 'Change password' },\n { name: 'sign-out', text: 'Sign out' }\n ].filter(x => x)}\n />\n </Tooltip>\n )}\n </View>\n );\n } else {\n return <View style={[{ color }, style]}>Not logged in</View>;\n }\n}\n\nexport default connect(\n state => ({\n userData: state.user.data,\n files: state.budgets.allFiles,\n budgetId: state.prefs.local && state.prefs.local.id\n }),\n actions\n)(withRouter(LoggedInUser));\n","import React, { useState, useEffect, useMemo } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Button,\n ButtonWithLoading,\n Stack,\n ExternalLink\n} from 'loot-design/src/components/common';\nimport Delete from 'loot-design/src/svg/Delete';\nimport Loading from 'loot-design/src/svg/v1/AnimatedLoading';\nimport { styles, colors } from 'loot-design/src/style';\n\nfunction compileMessage(message, actions, setLoading, onRemove) {\n return (\n <Stack spacing={2}>\n {message.split(/\\n\\n/).map((paragraph, idx) => {\n let parts = paragraph.split(/(\\[[^\\]]*\\]\\([^)]*\\))/g);\n\n return (\n <Text key={idx} style={{ lineHeight: '1.4em' }}>\n {parts.map((part, idx) => {\n let match = part.match(/\\[([^\\]]*)\\]\\(([^)]*)\\)/);\n if (match) {\n let [_, text, href] = match;\n\n if (href[0] === '#') {\n let actionName = href.slice(1);\n return (\n // eslint-disable-next-line\n <a\n href=\"#\"\n onClick={async e => {\n e.preventDefault();\n if (actions[actionName]) {\n setLoading(true);\n await actions[actionName]();\n onRemove();\n }\n }}\n >\n {text}\n </a>\n );\n }\n\n return (\n <ExternalLink key={idx} asAnchor={true} href={match[2]}>\n {match[1]}\n </ExternalLink>\n );\n }\n return <Text key={idx}>{part}</Text>;\n })}\n </Text>\n );\n })}\n </Stack>\n );\n}\n\nfunction Notification({ notification, onRemove }) {\n let {\n id,\n type,\n title,\n message,\n messageActions,\n sticky,\n internal,\n button\n } = notification;\n\n let [loading, setLoading] = useState(false);\n let [overlayLoading, setOverlayLoading] = useState(false);\n\n useEffect(() => {\n if (type === 'error' && internal) {\n console.error('Internal error:', internal);\n }\n\n if (!sticky) {\n setTimeout(onRemove, 6500);\n }\n }, []);\n\n let positive = type === 'message';\n let error = type === 'error';\n\n let processedMessage = useMemo(\n () => compileMessage(message, messageActions, setOverlayLoading, onRemove),\n [message, messageActions]\n );\n\n return (\n <View\n style={{\n marginTop: 10,\n color: positive ? colors.g3 : error ? colors.r3 : colors.y2\n }}\n >\n <Stack\n align=\"center\"\n direction=\"row\"\n style={{\n padding: '14px 14px',\n fontSize: 14,\n backgroundColor: positive\n ? colors.g11\n : error\n ? colors.r11\n : colors.y10,\n borderTop: `3px solid ${\n positive ? colors.g5 : error ? colors.r5 : colors.y4\n }`,\n boxShadow: styles.shadowLarge,\n maxWidth: 550,\n\n '& a': { color: 'currentColor' }\n }}\n >\n <Stack align=\"flex-start\">\n {title && (\n <View style={{ fontWeight: 700, marginBottom: 10 }}>{title}</View>\n )}\n <View>{processedMessage}</View>\n {button && (\n <ButtonWithLoading\n bare\n loading={loading}\n onClick={async () => {\n setLoading(true);\n await button.action();\n onRemove();\n setLoading(false);\n }}\n style={{\n backgroundColor: 'transparent',\n border: `1px solid ${\n positive ? colors.g5 : error ? colors.r4 : colors.y3\n }`,\n color: 'currentColor',\n fontSize: 14,\n flexShrink: 0,\n '&:hover, &:active': {\n backgroundColor: positive\n ? colors.g9\n : error\n ? colors.r10\n : colors.y9\n }\n }}\n >\n {button.title}\n </ButtonWithLoading>\n )}\n </Stack>\n {sticky && (\n <Button\n bare\n style={{ flexShrink: 0, color: 'currentColor' }}\n onClick={onRemove}\n >\n <Delete style={{ width: 9, height: 9, color: 'currentColor' }} />\n </Button>\n )}\n </Stack>\n {overlayLoading && (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(250, 250, 250, .75)',\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n <Loading\n color=\"currentColor\"\n style={{ width: 20, height: 20, color: 'currentColor' }}\n />\n </View>\n )}\n </View>\n );\n}\n\nfunction Notifications({ notifications, removeNotification, style }) {\n return (\n <View\n style={[\n {\n position: 'absolute',\n bottom: 20,\n right: 13,\n zIndex: 10000\n },\n style\n ]}\n >\n {notifications.map(note => (\n <Notification\n key={note.id}\n notification={note}\n onRemove={() => {\n if (note.onClose) {\n note.onClose();\n }\n removeNotification(note.id);\n }}\n />\n ))}\n </View>\n );\n}\n\nexport default connect(\n state => ({ notifications: state.notifications.notifications }),\n dispatch => bindActionCreators(actions, dispatch)\n)(Notifications);\n","import React from 'react';\nimport { View, Text, Block, Modal, Button } from '../common';\nimport { Row, Cell, DeleteCell } from '../table';\nimport { styles, colors } from '../../style';\n\nclass BackupTable extends React.Component {\n state = { hoveredBackup: null };\n\n onHover = id => {\n this.setState({ hoveredBackup: id });\n };\n\n render() {\n const { backups, onSelect } = this.props;\n const { hoveredBackup } = this.state;\n\n const borderColor = '#f0f0f0';\n return (\n <View\n style={{ flex: 1, maxHeight: 200, overflow: 'auto' }}\n onMouseLeave={() => this.onHover(null)}\n >\n {backups.map((backup, idx) => (\n <Row\n key={backup.id}\n collapsed={idx !== 0}\n focused={hoveredBackup === backup.id}\n onMouseEnter={() => this.onHover(backup.id)}\n onClick={() => onSelect(backup.id)}\n style={{ cursor: 'pointer' }}\n >\n <Cell\n width=\"flex\"\n value={backup.date ? backup.date : 'Revert to Latest'}\n valueStyle={{ paddingLeft: 20 }}\n />\n </Row>\n ))}\n </View>\n );\n }\n}\n\nfunction LoadBackup({\n budgetId,\n backups,\n backupDisabled,\n actions,\n modalProps\n}) {\n const latestBackup = backups.find(backup => backup.isLatest);\n const previousBackups = backups.filter(backup => !backup.isLatest);\n\n return (\n <Modal title=\"Load Backup\" padding={0} {...modalProps} style={{ flex: 0 }}>\n {() => (\n <View style={{ marginBottom: 30 }}>\n <View\n style={{\n margin: 20,\n marginTop: 0,\n marginBottom: 15,\n lineHeight: 1.5\n }}\n >\n {latestBackup ? (\n <Block>\n <Block style={{ marginBottom: 10 }}>\n <Text style={{ fontWeight: 600 }}>\n You are currently working from a backup.\n </Text>{' '}\n You can load a different backup or revert to the original\n version below.\n </Block>\n <Button\n primary\n onClick={() => actions.loadBackup(budgetId, latestBackup.id)}\n >\n Revert to original version\n </Button>\n </Block>\n ) : (\n <View style={{ alignItems: 'flex-start' }}>\n <Block style={{ marginBottom: 10 }}>\n Select a backup to load. After loading a backup, you will have\n a chance to revert to the current version in this screen.{' '}\n <Text style={{ fontWeight: 600 }}>\n If you use a backup, you will have to setup all your devices\n to sync from the new budget.\n </Text>\n </Block>\n <Button\n primary\n disabled={backupDisabled}\n onClick={() => actions.makeBackup()}\n >\n Backup Now\n </Button>\n </View>\n )}\n </View>\n {previousBackups.length === 0 ? (\n <Block style={{ color: colors.n6, marginLeft: 20 }}>\n No backups available\n </Block>\n ) : (\n <BackupTable\n backups={previousBackups}\n onSelect={id => actions.loadBackup(budgetId, id)}\n />\n )}\n </View>\n )}\n </Modal>\n );\n}\n\nexport default LoadBackup;\n","import React, { useRef, useCallback } from 'react';\n\nexport default function useResizeObserver(func) {\n let observer = useRef(null);\n if (!observer.current) {\n observer.current = new ResizeObserver(entries => {\n func(entries[0].contentRect);\n });\n }\n\n let elementRef = useCallback(el => {\n observer.current.disconnect();\n if (el) {\n observer.current.observe(el, { box: 'border-box' });\n }\n }, []);\n\n return elementRef;\n}\n","import hotkeys from 'hotkeys-js';\nimport React, { useEffect, useContext } from 'react';\n\nlet KeyScopeContext = React.createContext('app');\n\nhotkeys.filter = event => {\n var target = event.target || event.srcElement;\n var tagName = target.tagName;\n\n // This is the default behavior of hotkeys, except we only suppress\n // key presses if the meta key is not pressed\n if (\n !event.metaKey &&\n (target.isContentEditable ||\n ((tagName === 'INPUT' ||\n tagName === 'TEXTAREA' ||\n tagName === 'SELECT') &&\n !target.readOnly))\n ) {\n return false;\n }\n\n return true;\n};\n\nexport function KeyHandler({ keyName, eventType = 'keydown', handler }) {\n let scope = useContext(KeyScopeContext);\n\n if (eventType !== 'keyup' && eventType !== 'keydown') {\n throw new Error('KeyHandler: unknown event type: ' + eventType);\n }\n\n useEffect(() => {\n function _handler(event, hk) {\n // Right now it always overrides the default behavior, but in\n // the future we can make this customizable\n event.preventDefault();\n\n if (event.type === eventType && handler) {\n return handler(event, hk);\n }\n }\n hotkeys(keyName, { scope, keyup: true }, _handler);\n\n return () => {\n hotkeys.unbind({\n key: keyName,\n scope,\n method: _handler\n });\n };\n }, [keyName, handler, scope]);\n\n return null;\n}\n\nexport function KeyHandlers({ eventType, keys = {} }) {\n let handlers = Object.keys(keys).map(key => {\n return (\n <KeyHandler\n key={key}\n keyName={key}\n eventType={eventType}\n handler={keys[key]}\n />\n );\n });\n\n return handlers;\n}\n","import Platform from 'loot-core/src/client/platform';\n\nexport const debug = { borderWidth: 1, borderColor: 'red' };\n\nexport const colors = {\n y1: '#733309',\n y2: '#87540d',\n y3: '#B88115',\n y4: '#D4A31C',\n y5: '#E6BB20',\n y6: '#F2D047',\n y7: '#F5E35D',\n y8: '#FCF088',\n y9: '#FFF7C4',\n y10: '#FFFBEA',\n y11: '#FFFEFA',\n r1: '#610316',\n r2: '#8A041A',\n r3: '#AB091E',\n r4: '#CF1124',\n r5: '#E12D39',\n r6: '#EF4E4E',\n r7: '#F86A6A',\n r8: '#FF9B9B',\n r9: '#FFBDBD',\n r10: '#FFE3E3',\n r11: '#FFF1F1',\n b1: '#034388',\n b2: '#0B5FA3',\n b3: '#1271BF',\n b4: '#1980D4',\n b5: '#2B8FED',\n b6: '#40A5F7',\n b7: '#66B5FA',\n b8: '#8BCAFD',\n b9: '#B3D9FF',\n b10: '#E3F0FF',\n b11: '#F5FCFF',\n n1: '#102A43',\n n2: '#243B53',\n n3: '#334E68',\n n4: '#486581',\n n5: '#627D98',\n n6: '#829AB1',\n n7: '#9FB3C8',\n n8: '#BCCCDC',\n n9: '#D9E2EC',\n n10: '#E8ECF0',\n n11: '#F7FAFC',\n g1: '#014D40',\n g2: '#0C6B58',\n g3: '#147D64',\n g4: '#199473',\n g5: '#27AB83',\n g6: '#3EBD93',\n g7: '#65D6AD',\n g8: '#8EEDC7',\n g9: '#C6F7E2',\n g10: '#EFFCF6',\n g11: '#FAFFFD',\n p1: '#44056E',\n p2: '#580A94',\n p3: '#690CB0',\n p4: '#7A0ECC',\n p5: '#8719E0',\n p6: '#9446ED',\n p7: '#A368FC',\n p8: '#B990FF',\n p9: '#DAC4FF',\n p10: '#F2EBFE',\n p11: '#F9F6FE'\n};\n\ncolors.border = colors.n10;\ncolors.hover = '#fafafa';\ncolors.selected = colors.b9;\n\ncolors.resolve = (name, offset) => {\n switch (name) {\n case 'border':\n return colors['n' + (8 + offset)];\n default:\n }\n throw new Error('Unknown color name: ' + name);\n};\n\nexport const styles = {\n veryLargeText: {\n fontSize: 30,\n fontWeight: 600\n },\n largeText: {\n fontSize: 20,\n fontWeight: 700,\n letterSpacing: 0.5\n },\n mediumText: {\n fontSize: 15,\n fontWeight: 500\n },\n smallText: {\n fontSize: 13\n },\n verySmallText: {\n fontSize: 13\n },\n page: {\n // This is the height of the titlebar\n paddingTop: 36,\n minWidth: 500,\n flex: 1\n },\n pageHeader: {\n fontSize: 25,\n borderBottomWidth: 5,\n borderColor: colors.purple2,\n borderStyle: 'solid',\n display: 'inline',\n flex: 0,\n color: colors.grey4,\n marginTop: 40,\n marginBottom: 20,\n paddingBottom: 5\n },\n pageContent: {\n paddingLeft: 20,\n paddingRight: 20\n },\n staticText: {\n cursor: 'default',\n userSelect: 'none'\n },\n shadow: '0 2px 4px 0 rgba(0,0,0,0.1)',\n shadowLarge: '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)',\n tnum:\n Platform.env === 'web'\n ? {\n fontFeatureSettings: '\"tnum\"'\n }\n : null,\n notFixed: { fontFeatureSettings: '' }\n};\n\nlet hiddenScrollbars = false;\n\nfunction onScrollbarChange() {\n styles.lightScrollbar = !hiddenScrollbars && {\n '& ::-webkit-scrollbar': {\n width: 11,\n backgroundColor: 'rgba(200, 200, 200, .2)'\n },\n '& ::-webkit-scrollbar-thumb': {\n width: 7,\n borderRadius: 30,\n backgroundClip: 'padding-box',\n border: '2px solid rgba(0, 0, 0, 0)'\n },\n '& ::-webkit-scrollbar-thumb:vertical': {\n backgroundColor: '#d0d0d0'\n }\n };\n\n styles.darkScrollbar = !hiddenScrollbars && {\n '& ::-webkit-scrollbar': {\n width: 7,\n backgroundColor: 'rgba(0, 0, 0, 0)'\n },\n '& ::-webkit-scrollbar-thumb:vertical': {\n backgroundColor: 'rgba(200, 200, 200, .5)'\n }\n };\n\n styles.scrollbarWidth = hiddenScrollbars ? 0 : 13;\n}\n\nif (Platform.env === 'web') {\n function testScrollbars() {\n let el = document.createElement('div');\n el.innerHTML =\n '<div style=\"width:100px;height:100px;overflow:scroll;position:absolute;top:-9999px;\"/>';\n document.body.appendChild(el);\n let testNode = el.childNodes[0];\n if (testNode.offsetWidth === testNode.clientWidth) {\n return true;\n }\n return false;\n }\n\n hiddenScrollbars = testScrollbars();\n onScrollbarChange();\n\n window.addEventListener('focus', () => {\n hiddenScrollbars = testScrollbars();\n onScrollbarChange();\n });\n}\n\nexport const hasHiddenScrollbars = () => hiddenScrollbars;\n\nexport const mobileStyles = {\n header: {\n headerStyle: {\n backgroundColor: 'white',\n borderBottomWidth: 1,\n borderBottomColor: colors.n9,\n elevation: 0\n },\n headerTintColor: colors.n1,\n headerTitleStyle: {\n color: colors.n1,\n fontSize: 15,\n fontWeight: '600'\n },\n headerBackTitle: null\n },\n text: {\n color: colors.n1,\n fontSize: 16,\n lineHeight: 22.4\n },\n smallText: {\n color: colors.n1,\n fontSize: 15,\n lineHeight: 21\n },\n shadow: {\n shadowColor: '#9594A8',\n shadowOffset: { width: 0, height: 1 },\n shadowRadius: 1,\n shadowOpacity: 1,\n elevation: 2\n },\n shadowLarge: {\n shadowColor: '#9594A8',\n shadowOffset: { width: 0, height: 10 },\n shadowRadius: 10,\n shadowOpacity: 1,\n elevation: 3\n }\n};\n\nexport function transform(spec) {\n // We've made React Native Web simulate a mobile environment so it\n // won't return \"web\" here. Explicit check for it so we can override\n // mobile behavior and return a value appropriate for the web.\n if (Platform.env !== 'web' && !Platform.isReactNativeWeb) {\n return spec;\n }\n\n let r = spec.reduce((str, prop) => {\n let name = Object.keys(prop)[0];\n let value = prop[name];\n if (typeof value === 'number') {\n value = value + 'px';\n }\n\n return `${name}(${value})`;\n }, spec);\n return r;\n}\n","import React, { useState } from 'react';\nimport { css } from 'glamor';\nimport {\n View,\n Text,\n Stack,\n Modal,\n Button,\n ButtonWithLoading,\n ExternalLink,\n P,\n ModalButtons,\n Input,\n InitialFocus\n} from 'loot-design/src/components/common';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { styles, colors } from 'loot-design/src/style';\nimport { getCreateKeyError } from 'loot-core/src/shared/errors';\n\nexport default function CreateEncryptionKey({\n modalProps,\n actions,\n budgetId,\n options = {}\n}) {\n let [enabling, setEnabling] = useState(false);\n let [password, setPassword] = useState('');\n let [loading, setLoading] = useState(false);\n let [error, setError] = useState('');\n let [showPassword, setShowPassword] = useState(false);\n\n let isRecreating = options.recreate;\n\n async function onCreateKey() {\n if (password !== '' && !loading) {\n setLoading(true);\n setError(null);\n\n let res = await send('key-make', { password });\n if (res.error) {\n setLoading(null);\n setError(getCreateKeyError(res.error));\n return;\n }\n\n actions.loadGlobalPrefs();\n actions.loadAllFiles();\n actions.sync();\n\n setLoading(false);\n actions.popModal();\n }\n }\n\n return (\n <Modal\n {...modalProps}\n style={{ width: 600 }}\n title={isRecreating ? 'Generate new key' : 'Enable encryption'}\n onClose={() => actions.popModal()}\n >\n {() => (\n <>\n {!isRecreating ? (\n <>\n <P style={{ marginTop: 5 }}>\n To enable end-to-end encryption, you need to create a key. We\n will generate a key based on a password and use it to encrypt\n from now on. <strong>This requires a sync reset</strong> and all\n other devices will have to revert to this version of your data.{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/encrypted-syncing\"\n >\n Learn more\n </ExternalLink>\n </P>\n <P>\n <ul {...css({ marginTop: 0, '& li': { marginBottom: 8 } })}>\n <li>\n <strong>Important:</strong> if you forget this password{' '}\n <em>and</em> you don't have any local copies of your data,\n you will lose access to all your data. We cannot decrypt\n your data.\n </li>\n <li>\n This key only applies to this file. You will need to\n generate a new key for each file you want to encrypt.\n </li>\n <li>\n If you've already downloaded your data on other devices, you\n will need to reset them. Actual will automatically take you\n through this process.\n </li>\n </ul>\n </P>\n </>\n ) : (\n <>\n <P style={{ marginTop: 5 }}>\n This will generate a new key for encrypting your data.{' '}\n <strong>This requires a sync reset</strong> and all other\n devices will have to revert to this version of your data. Actual\n will take you through that process on those devices.{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/encrypted-syncing\"\n >\n Learn more\n </ExternalLink>\n </P>\n <P>\n Key generation is randomized. The same password will create\n different keys, so this will change your key regardless of the\n password being different.\n </P>\n </>\n )}\n <form\n onSubmit={e => {\n e.preventDefault();\n onCreateKey();\n }}\n >\n <View style={{ alignItems: 'center' }}>\n <Text style={{ fontWeight: 600, marginBottom: 3 }}>Password</Text>\n\n {error && (\n <View\n style={{\n color: colors.r4,\n textAlign: 'center',\n fontSize: 13,\n marginBottom: 3\n }}\n >\n {error}\n </View>\n )}\n\n <InitialFocus>\n <Input\n type={showPassword ? 'text' : 'password'}\n style={{ width: 300 }}\n onChange={e => setPassword(e.target.value)}\n />\n </InitialFocus>\n <Text style={{ marginTop: 5 }}>\n <label style={{ userSelect: 'none' }}>\n <input\n type=\"checkbox\"\n onClick={() => setShowPassword(!showPassword)}\n />{' '}\n Show password\n </label>\n </Text>\n </View>\n\n <ModalButtons style={{ marginTop: 20 }}>\n <ButtonWithLoading loading={loading} primary>\n Enable\n </ButtonWithLoading>\n </ModalButtons>\n </form>\n </>\n )}\n </Modal>\n );\n}\n","import React, { useState } from 'react';\nimport {\n View,\n Text,\n Modal,\n Button,\n ButtonWithLoading,\n P,\n ModalButtons,\n Input,\n InitialFocus,\n ExternalLink\n} from 'loot-design/src/components/common';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { styles, colors } from 'loot-design/src/style';\nimport { getTestKeyError } from 'loot-core/src/shared/errors';\n\nexport default function FixEncryptionKey({\n modalProps,\n actions,\n options = {}\n}) {\n let { hasExistingKey, cloudFileId, onSuccess } = options;\n\n let [password, setPassword] = useState('');\n let [error, setError] = useState('');\n let [loading, setLoading] = useState(false);\n let [showPassword, setShowPassword] = useState(false);\n\n async function onUpdateKey() {\n if (password !== '' && !loading) {\n setLoading(true);\n setError(null);\n\n let { error } = await send('key-test', {\n password,\n fileId: cloudFileId\n });\n if (error) {\n setError(getTestKeyError(error));\n setLoading(false);\n return;\n }\n\n actions.popModal();\n onSuccess && onSuccess();\n }\n }\n\n return (\n <Modal {...modalProps} showHeader={false} style={{ width: 600 }}>\n {() => (\n <View style={{ flex: 1 }}>\n <Text\n style={{\n fontSize: 25,\n fontWeight: 700,\n color: colors.n2,\n margin: '20px 0'\n }}\n >\n {hasExistingKey\n ? 'Unable to decrypt file'\n : 'This file is encrypted'}\n </Text>\n {hasExistingKey ? (\n <P>\n This file was encrypted with a different key than you are\n currently using. This probably means you changed your password.\n Enter your current password to update your key.{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/encrypted-syncing\"\n >\n Learn more\n </ExternalLink>\n </P>\n ) : (\n <P>\n We don{\"'\"}t have a key that encrypts or decrypts this file. Enter\n the password for this file to create the key for encryption.{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/encrypted-syncing\"\n >\n Learn more\n </ExternalLink>\n </P>\n )}\n <form\n onSubmit={e => {\n e.preventDefault();\n onUpdateKey();\n }}\n >\n <View\n style={{\n marginTop: 15,\n flexDirection: 'column',\n alignItems: 'center'\n }}\n >\n <Text style={{ fontWeight: 600, marginBottom: 5 }}>Password</Text>{' '}\n {error && (\n <View\n style={{\n color: colors.r4,\n textAlign: 'center',\n fontSize: 13,\n marginBottom: 3\n }}\n >\n {error}\n </View>\n )}\n <InitialFocus>\n <Input\n type={showPassword ? 'text' : 'password'}\n style={{ width: '50%' }}\n onChange={e => setPassword(e.target.value)}\n />\n </InitialFocus>\n <Text style={{ marginTop: 5 }}>\n <label style={{ userSelect: 'none' }}>\n <input\n type=\"checkbox\"\n onClick={() => setShowPassword(!showPassword)}\n />{' '}\n Show password\n </label>\n </Text>\n </View>\n\n <ModalButtons style={{ marginTop: 20 }}>\n <Button\n style={{ marginRight: 10 }}\n onClick={() => modalProps.onBack()}\n type=\"button\"\n >\n Back\n </Button>\n <ButtonWithLoading\n loading={loading}\n primary\n onClick={onUpdateKey}\n >\n {hasExistingKey ? 'Update key' : 'Create key'}\n </ButtonWithLoading>\n </ModalButtons>\n </form>\n </View>\n )}\n </Modal>\n );\n}\n","import { send } from '../../platform/client/fetch';\nimport constants from '../constants';\nimport { getPayees, getAccounts, filterTransactions } from './queries';\nimport { addNotification } from './notifications';\n\nexport function setAccountsSyncing(name) {\n return {\n type: constants.SET_ACCOUNTS_SYNCING,\n name\n };\n}\n\nexport function markAccountFailed(id, errorType, errorCode) {\n return {\n type: 'ACCOUNT_SYNC_STATUS',\n id,\n failed: true,\n errorType,\n errorCode\n };\n}\nexport function markAccountSuccess(id) {\n return {\n type: 'ACCOUNT_SYNC_STATUS',\n id,\n failed: false\n };\n}\nexport function setFailedAccounts(syncErrors) {\n return {\n type: 'ACCOUNT_SYNC_FAILURES',\n syncErrors\n };\n}\n\nexport function unlinkAccount(id) {\n return async dispatch => {\n await send('account-unlink', { id });\n dispatch(markAccountSuccess(id));\n dispatch(getAccounts());\n };\n}\n\nexport function linkAccount(institution, publicToken, accountId, upgradingId) {\n return async dispatch => {\n await send('accounts-link', {\n institution,\n publicToken,\n accountId,\n upgradingId\n });\n await dispatch(getPayees());\n await dispatch(getAccounts());\n };\n}\n\nexport function connectAccounts(\n institution,\n publicToken,\n accountIds,\n offbudgetIds\n) {\n return async dispatch => {\n let ids = await send('accounts-connect', {\n institution,\n publicToken,\n accountIds,\n offbudgetIds\n });\n await dispatch(getPayees());\n await dispatch(getAccounts());\n return ids;\n };\n}\n\nexport function syncAccounts(id) {\n return async (dispatch, getState) => {\n if (getState().account.accountsSyncing) {\n return false;\n }\n\n if (id) {\n let account = getState().queries.accounts.find(a => a.id === id);\n dispatch(setAccountsSyncing(account.name));\n } else {\n dispatch(setAccountsSyncing('__all'));\n }\n\n const {\n errors,\n newTransactions,\n matchedTransactions,\n updatedAccounts\n } = await send('accounts-sync', { id });\n dispatch(setAccountsSyncing(null));\n\n if (id) {\n let error = errors.find(error => error.accountId === id);\n\n if (error) {\n // We only want to mark the account as having problem if it\n // was a real syncing error.\n if (error.type === 'SyncError') {\n dispatch(markAccountFailed(id, error.category, error.code));\n }\n } else {\n dispatch(markAccountSuccess(id));\n }\n } else {\n dispatch(\n setFailedAccounts(\n errors\n .filter(error => error.type === 'SyncError')\n .map(error => ({\n id: error.accountId,\n type: error.category,\n code: error.code\n }))\n )\n );\n }\n\n errors.forEach(error => {\n if (error.type === 'SyncError') {\n dispatch(\n addNotification({\n type: 'error',\n message: error.message\n })\n );\n } else {\n dispatch(\n addNotification({\n type: 'error',\n message: error.message,\n internal: error.internal\n })\n );\n }\n });\n\n dispatch({\n type: constants.SET_NEW_TRANSACTIONS,\n newTransactions,\n matchedTransactions,\n updatedAccounts\n });\n\n return newTransactions.length > 0 || matchedTransactions.length > 0;\n };\n}\n\n// Remember the last transaction manually added to the system\nexport function setLastTransaction(transaction) {\n return {\n type: constants.SET_LAST_TRANSACTION,\n transaction\n };\n}\n\nexport function parseTransactions(filepath, options) {\n return async dispatch => {\n return await send('transactions-parse-file', {\n filepath,\n options\n });\n };\n}\n\nexport function importTransactions(id, transactions) {\n return async dispatch => {\n let { errors = [], added, updated } = await send('transactions-import', {\n accountId: id,\n transactions\n });\n\n errors.forEach(error => {\n dispatch(\n addNotification({\n type: 'error',\n message: error.message,\n internal: error.internal\n })\n );\n });\n\n dispatch({\n type: constants.SET_NEW_TRANSACTIONS,\n newTransactions: added,\n matchedTransactions: updated,\n updatedAccounts: added.length > 0 ? [id] : []\n });\n\n return added.length > 0 || updated.length > 0;\n };\n}\n\nexport function updateNewTransactions(changedId) {\n return {\n type: constants.UPDATE_NEW_TRANSACTIONS,\n changedId\n };\n}\n\nexport function markAccountRead(accountId) {\n return {\n type: constants.MARK_ACCOUNT_READ,\n accountId: accountId\n };\n}\n\nexport function getBanks() {\n return async dispatch => {\n dispatch({\n type: constants.LOAD_BANKS,\n banks: await send('banks')\n });\n };\n}\n","import constants from '../constants';\n\nexport function debugCell(sheet, name) {\n return {\n type: constants.DEBUG_CELL,\n sheet,\n name\n }\n}\n","import { send } from '../../platform/client/fetch';\nimport { closeBudget, loadBudget } from './budgets';\n\n// Take in the budget id so that backups can be loaded when a budget\n// isn't opened\nexport function loadBackup(budgetId, backupId) {\n return async (dispatch, getState) => {\n const prefs = getState().prefs.local;\n if (prefs && prefs.id) {\n await dispatch(closeBudget());\n }\n\n await send('backup-load', { id: budgetId, backupId });\n dispatch(loadBudget(budgetId));\n };\n}\n\nexport function makeBackup() {\n return async (dispatch, getState) => {\n const prefs = getState().prefs.local;\n if (prefs && prefs.id) {\n await send('backup-make', { id: prefs.id });\n }\n };\n}\n","import { send } from '../../platform/client/fetch';\nimport constants from '../constants';\nimport { loadPrefs } from './prefs';\nimport { createBudget, loadBudget } from './budgets';\nimport { getCategories, getAccounts, getPayees } from './queries';\nimport { syncAccounts } from './account';\nimport { setAppState } from './app';\nimport { pushModal } from './modals';\nimport { getUploadError } from '../../shared/errors';\n\nexport function unregister() {\n return async dispatch => {\n const profile = await send('unregister');\n dispatch({\n type: constants.SET_PROFILE,\n profile\n });\n };\n}\n\nexport function resetSync() {\n return async (dispatch, getState) => {\n let { error } = await send('sync-reset');\n\n if (error) {\n alert(getUploadError(error));\n\n if (\n (error.reason === 'encrypt-failure' && error.meta.isMissingKey) ||\n error.reason === 'file-has-new-key'\n ) {\n dispatch(\n pushModal('fix-encryption-key', {\n onSuccess: () => {\n // TODO: There won't be a loading indicator for this\n dispatch(resetSync());\n }\n })\n );\n } else if (error.reason === 'encrypt-failure') {\n dispatch(pushModal('create-encryption-key', { recreate: true }));\n }\n } else {\n await dispatch(sync());\n await dispatch(loadPrefs());\n }\n };\n}\n\nexport function sync() {\n return async (dispatch, getState) => {\n const prefs = getState().prefs.local;\n if (prefs && prefs.id) {\n let { error } = await send('sync');\n return { error };\n }\n };\n}\n\nexport function syncAndDownload(accountId) {\n return async (dispatch, getState) => {\n // It is *critical* that we sync first because of transaction\n // reconciliation. We want to get all transactions that other\n // clients have already made, so that imported transactions can be\n // reconciled against them. Otherwise, two clients will each add\n // new transactions from the bank and create duplicate ones.\n let syncState = await dispatch(sync());\n if (syncState.error) {\n return { error: syncState.error };\n }\n\n let hasDownloaded = await dispatch(syncAccounts(accountId));\n\n if (hasDownloaded) {\n // Sync again afterwards if new transactions were created\n let syncState = await dispatch(sync());\n if (syncState.error) {\n return { error: syncState.error };\n }\n\n // `hasDownloaded` is already true, we know there has been\n // updates\n return true;\n }\n return { hasUpdated: hasDownloaded || syncState.updated };\n };\n}\n","export * from './queries';\nexport * from './account';\nexport * from './debug';\nexport * from './modals';\nexport * from './notifications';\nexport * from './prefs';\nexport * from './budgets';\nexport * from './app';\nexport * from './tutorial';\nexport * from './backups';\nexport * from './sync';\nexport * from './user';\n","import React from 'react';\nimport View from './View';\nimport Text from './Text';\n\nfunction getChildren(key, children) {\n return React.Children.toArray(children).reduce((list, child) => {\n if (child) {\n if (child.type === React.Fragment) {\n return list.concat(getChildren(child.key, child.props.children));\n }\n list.push({ key: key + child.key, child });\n return list;\n }\n return list;\n }, []);\n}\n\nconst Stack = React.forwardRef(\n (\n {\n direction = 'column',\n align,\n justify,\n spacing = 3,\n children,\n debug,\n style\n },\n ref\n ) => {\n const isReversed = direction.endsWith('reverse');\n const isHorizontal = direction.startsWith('row');\n const validChildren = getChildren('', children);\n\n return (\n <View\n style={[\n {\n flexDirection: direction,\n alignItems: align,\n justifyContent: justify\n },\n style\n ]}\n innerRef={ref}\n >\n {validChildren.map(({ key, child }, index) => {\n let isLastChild = validChildren.length === index + 1;\n\n let marginProp;\n if (isHorizontal) {\n marginProp = isReversed ? 'marginLeft' : 'marginRight';\n } else {\n marginProp = isReversed ? 'marginTop' : 'marginBottom';\n }\n\n return React.cloneElement(\n typeof child === 'string' ? <Text>{child}</Text> : child,\n {\n key,\n style: [\n debug && { borderWidth: 1, borderColor: 'red' },\n isLastChild ? null : { [marginProp]: spacing * 5 },\n child.props ? child.props.style : null\n ]\n }\n );\n })}\n </View>\n );\n }\n);\n\nexport default Stack;\n","import React, {\n useContext,\n useReducer,\n useCallback,\n useEffect,\n useRef\n} from 'react';\nimport { hasModifierKey } from '../util/keys';\nimport { useSelector } from 'react-redux';\nimport * as undo from 'loot-core/src/platform/client/undo';\nimport { listen } from 'loot-core/src/platform/client/fetch';\n\nfunction iterateRange(range, func) {\n let from = Math.min(range.start, range.end);\n let to = Math.max(range.start, range.end);\n\n for (let i = from; i <= to; i++) {\n func(i);\n }\n}\n\nexport default function useSelected(name, items, initialSelectedIds) {\n let [state, dispatch] = useReducer(\n (state, action) => {\n switch (action.type) {\n case 'select': {\n let { selectedRange } = state;\n let selectedItems = new Set(state.selectedItems);\n let { id } = action;\n\n if (hasModifierKey('shift') && selectedRange) {\n let idx = items.findIndex(p => p.id === id);\n let startIdx = items.findIndex(p => p.id === selectedRange.start);\n let endIdx = items.findIndex(p => p.id === selectedRange.end);\n let range;\n let deleteUntil;\n\n if (endIdx === -1) {\n range = { start: startIdx, end: idx };\n } else if (endIdx < startIdx) {\n if (idx <= startIdx) {\n range = { start: startIdx, end: idx };\n\n if (idx > endIdx) {\n deleteUntil = { start: idx - 1, end: endIdx };\n }\n } else {\n // Switching directions\n range = { start: endIdx, end: idx };\n }\n } else {\n if (idx >= startIdx) {\n range = { start: startIdx, end: idx };\n\n if (idx < endIdx) {\n deleteUntil = { start: idx + 1, end: endIdx };\n }\n } else {\n // Switching directions\n range = { start: endIdx, end: idx };\n }\n }\n\n iterateRange(range, i => selectedItems.add(items[i].id));\n\n if (deleteUntil) {\n iterateRange(deleteUntil, i => selectedItems.delete(items[i].id));\n }\n\n return {\n ...state,\n selectedItems,\n selectedRange: {\n start: items[range.start].id,\n end: items[range.end].id\n }\n };\n } else {\n let range = null;\n if (!selectedItems.delete(id)) {\n selectedItems.add(id);\n range = { start: id, end: null };\n }\n\n return {\n ...state,\n selectedItems,\n selectedRange: range\n };\n }\n }\n\n case 'select-none':\n return { ...state, selectedItems: new Set() };\n\n case 'select-all':\n return {\n ...state,\n selectedItems: new Set(action.ids || items.map(item => item.id)),\n selectedRange:\n action.ids && action.ids.length === 1\n ? { start: action.ids[0], end: null }\n : null\n };\n\n default:\n throw new Error('Unexpected action: ' + action.type);\n }\n },\n null,\n () => ({\n selectedItems: new Set(initialSelectedIds || []),\n selectedRange:\n initialSelectedIds && initialSelectedIds.length === 1\n ? { start: initialSelectedIds[0], end: null }\n : null\n })\n );\n\n let prevItems = useRef(items);\n useEffect(() => {\n if (state.selectedItems.size > 0) {\n // We need to make sure there are no ids in the selection that\n // aren't valid anymore. This happens if the item has been\n // deleted or otherwise removed from the current view. We do\n // this by cross-referencing the current selection with the\n // available item ids\n //\n // This effect may run multiple times while items is updated, we\n // need to make sure that we don't remove selected ids until the\n // items array *actually* changes. A component may render with\n // new `items` arrays that are the same, just fresh instances, but\n // we need to wait until the actual array changes. This solves\n // the case where undo-ing adds back items, but we remove the\n // selected item too early (because the component rerenders\n // multiple times)\n\n let ids = new Set(items.map(item => item.id));\n let isSame =\n prevItems.current.length === items.length &&\n prevItems.current.every(item => ids.has(item.id));\n\n if (!isSame) {\n let selected = [...state.selectedItems];\n let filtered = selected.filter(id => ids.has(id));\n\n // If the selected items has changed, update the selection\n if (selected.length !== filtered.length) {\n dispatch({ type: 'select-all', ids: filtered });\n }\n }\n }\n\n prevItems.current = items;\n }, [items, state.selectedItems]);\n\n useEffect(() => {\n let prevState = undo.getUndoState('selectedItems');\n undo.setUndoState('selectedItems', { name, items: state.selectedItems });\n return () => undo.setUndoState('selectedItems', prevState);\n }, [state.selectedItems]);\n\n let lastUndoState = useSelector(state => state.app.lastUndoState);\n\n useEffect(() => {\n function onUndo({ messages, undoTag }) {\n let tagged = undo.getTaggedState(undoTag);\n\n let deletedIds = new Set(\n messages\n .filter(msg => msg.column === 'tombstone' && msg.value === 1)\n .map(msg => msg.row)\n );\n\n if (\n tagged &&\n tagged.selectedItems &&\n tagged.selectedItems.name === name\n ) {\n dispatch({\n type: 'select-all',\n // Coerce the Set into an array\n ids: [...tagged.selectedItems.items].filter(id => !deletedIds.has(id))\n });\n }\n }\n\n if (lastUndoState && lastUndoState.current) {\n onUndo(lastUndoState.current);\n }\n\n return listen('undo-event', onUndo);\n }, []);\n\n return {\n items: state.selectedItems,\n setItems: state.setSelectedItems,\n dispatch\n };\n}\n\nlet SelectedDispatch = React.createContext(null);\nlet SelectedItems = React.createContext(null);\n\nexport function useSelectedDispatch() {\n return useContext(SelectedDispatch);\n}\n\nexport function useSelectedItems() {\n return useContext(SelectedItems);\n}\n\nexport function SelectedProvider({ instance, fetchAllIds, children }) {\n let latestItems = useRef(null);\n\n useEffect(() => {\n latestItems.current = instance.items;\n }, [instance.items]);\n\n let dispatch = useCallback(\n async action => {\n if (action.type === 'select-all') {\n if (latestItems.current && latestItems.current.size > 0) {\n return instance.dispatch({ type: 'select-none' });\n } else {\n if (fetchAllIds) {\n return instance.dispatch({\n type: 'select-all',\n ids: await fetchAllIds()\n });\n }\n return instance.dispatch({ type: 'select-all' });\n }\n }\n return instance.dispatch(action);\n },\n [instance.dispatch, fetchAllIds]\n );\n\n return (\n <SelectedItems.Provider value={instance.items}>\n <SelectedDispatch.Provider value={dispatch}>\n {children}\n </SelectedDispatch.Provider>\n </SelectedItems.Provider>\n );\n}\n\n// This can be helpful in class components if you cannot use the\n// custom hook\nexport function SelectedProviderWithItems({\n name,\n items,\n initialSelectedIds,\n fetchAllIds,\n registerDispatch,\n children\n}) {\n let selected = useSelected(name, items, initialSelectedIds);\n\n useEffect(() => {\n registerDispatch && registerDispatch(selected.dispatch);\n }, [registerDispatch]);\n\n return (\n <SelectedProvider\n instance={selected}\n fetchAllIds={fetchAllIds}\n children={children}\n />\n );\n}\n","import React from 'react';\nimport { css } from 'glamor';\n\nimport BG from './manager/bg.svg';\n\nfunction Background({ selected }) {\n return (\n <div\n {...css({\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n background: `url(${BG}) no-repeat center center fixed`,\n backgroundSize: '100% 100%'\n })}\n ></div>\n );\n}\n\nexport default Background;\n","import React, { useState } from 'react';\nimport { View, Block } from 'loot-design/src/components/common';\nimport { css } from 'glamor';\nimport Background from './Background';\nimport AnimatedLoading from 'loot-design/src/svg/v1/AnimatedLoading';\nimport { colors } from 'loot-design/src/style';\n\nfunction AppBackground({ initializing, loadingText }) {\n return (\n <React.Fragment>\n <Background />\n\n {(loadingText != null || initializing) && (\n <View\n {...css({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n padding: 50,\n paddingTop: 200,\n color: colors.n1,\n alignItems: 'center'\n })}\n >\n <Block style={{ marginBottom: 20, fontSize: 18 }}>\n {loadingText}\n </Block>\n <AnimatedLoading width={25} color={colors.n1} />\n </View>\n )}\n </React.Fragment>\n );\n}\n\nexport default AppBackground;\n","const undo = require('../undo');\nconst { captureException, captureBreadcrumb } = require('../../exceptions');\nconst uuid = require('../../uuid');\nlet replyHandlers = new Map();\nlet listeners = new Map();\nlet messageQueue = [];\n\nlet globalWorker = null;\n\nclass ReconstructedError extends Error {\n constructor(message, stack, url, line, column) {\n super(message);\n this.name = this.constructor.name;\n this.message = message;\n\n Object.defineProperty(this, 'stack', {\n get: function() {\n return 'extended ' + this._stack;\n },\n set: function(value) {\n this._stack = value;\n }\n });\n\n this.stack = stack;\n this.url = url;\n this.line = line;\n this.column = column;\n }\n}\n\nfunction handleMessage(msg) {\n if (msg.type === 'error') {\n // An error happened while handling a message so cleanup the\n // current reply handler. We don't care about the actual error -\n // generic backend errors are handled separately and if you want\n // more specific handling you should manually forward the error\n // through a normal reply.\n const { id } = msg;\n replyHandlers.delete(id);\n } else if (msg.type === 'reply') {\n const { id, result, mutated, undoTag } = msg;\n\n const handler = replyHandlers.get(id);\n if (handler) {\n replyHandlers.delete(id);\n\n if (!mutated) {\n undo.gc(undoTag);\n }\n\n handler.resolve(result);\n }\n } else if (msg.type === 'push') {\n const { name, args } = msg;\n\n const listens = listeners.get(name);\n if (listens) {\n for (let i = 0; i < listens.length; i++) {\n let stop = listens[i](args);\n if (stop === true) {\n break;\n }\n }\n }\n } else {\n // Ignore internal messages that start with __\n if (!msg.type.startsWith('__')) {\n throw new Error('Unknown message type: ' + JSON.stringify(msg));\n }\n }\n}\n\n// Note that this does not support retry. If the worker\n// dies, it will permanently be disconnected. That should be OK since\n// I don't think a worker should ever die due to a system error.\nfunction connectWorker(worker, onOpen, onError) {\n globalWorker = worker;\n\n worker.addEventListener('message', event => {\n let msg = event.data;\n\n // The worker implementation implements its own concept of a\n // 'connect' event because the worker is immediately\n // available, but we don't know when the backend is actually\n // ready to handle messages.\n if (msg.type === 'connect') {\n // Send any messages that were queued while closed\n if (messageQueue.length > 0) {\n messageQueue.forEach(msg => worker.postMessage(msg));\n messageQueue = [];\n }\n\n onOpen();\n } else if (msg.type === 'app-init-failure') {\n onError(msg);\n } else if (msg.type === 'capture-exception') {\n captureException(\n msg.stack\n ? new ReconstructedError(\n msg.message,\n msg.stack,\n msg.url,\n msg.line,\n msg.column\n )\n : msg.exc\n );\n\n if (msg.message && msg.message.includes('indexeddb-quota-error')) {\n alert(\n 'We hit a limit on the local storage available. ' +\n 'Edits may not be saved. Please contact help@actualbudget.com to help debug this.'\n );\n }\n } else if (msg.type === 'capture-breadcrumb') {\n captureBreadcrumb(msg.data);\n } else {\n handleMessage(msg);\n }\n });\n\n // In browsers that don't support wasm in workers well (Safari),\n // we run the server on the main process for now. This might not\n // actually be a worker, but instead a message port which we\n // need to start.\n if (worker instanceof MessagePort) {\n worker.start();\n }\n}\n\nmodule.exports.init = async function init(worker) {\n return new Promise((resolve, reject) =>\n connectWorker(worker, resolve, reject)\n );\n};\n\nmodule.exports.send = function send(name, args, { catchErrors = false } = {}) {\n return new Promise((resolve, reject) => {\n uuid.v4().then(id => {\n replyHandlers.set(id, { resolve, reject });\n if (globalWorker) {\n globalWorker.postMessage({\n id,\n name,\n args,\n undoTag: undo.snapshot(),\n catchErrors\n });\n } else {\n messageQueue.push({\n id,\n name,\n args,\n undoTag: undo.snapshot(),\n catchErrors\n });\n }\n });\n });\n};\n\nmodule.exports.sendCatch = function send(name, args) {\n return module.exports.send(name, args, { catchErrors: true });\n};\n\nmodule.exports.listen = function listen(name, cb) {\n if (!listeners.get(name)) {\n listeners.set(name, []);\n }\n listeners.get(name).push(cb);\n\n return () => {\n let arr = listeners.get(name);\n listeners.set(name, arr.filter(cb_ => cb_ !== cb));\n };\n};\n\nmodule.exports.unlisten = function unlisten(name) {\n listeners.set(name, []);\n};\n","import { integerToCurrency } from 'loot-core/src/shared/util';\n\nexport default function format(value, type = 'string') {\n switch (type) {\n case 'string':\n const val = JSON.stringify(value);\n if (val.charAt(0) === '\"' && val.charAt(val.length - 1) === '\"') {\n return val.slice(1, -1);\n }\n return val;\n case 'number':\n return '' + value;\n case 'financial-with-sign':\n let formatted = format(value, 'financial');\n if (value >= 0) {\n return '+' + formatted;\n }\n return formatted;\n case 'financial':\n if (value == null || value === '') {\n return integerToCurrency(0);\n } else if (typeof value === 'string') {\n const parsed = parseFloat(value);\n value = isNaN(parsed) ? 0 : parsed;\n }\n\n if (typeof value !== 'number') {\n throw new Error(\n 'Value is not a number (' + typeof value + '): ' + value\n );\n }\n\n return integerToCurrency(value);\n default:\n throw new Error('Unknown format type: ' + type);\n }\n}\n","import constants from '../constants';\nimport memoizeOne from 'memoize-one';\nimport { groupById } from '../../shared/util';\n\nconst initialState = {\n newTransactions: [],\n matchedTransactions: [],\n lastTransaction: null,\n updatedAccounts: [],\n accounts: [],\n categories: {\n grouped: [],\n list: []\n },\n payees: [],\n earliestTransaction: null\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.SET_NEW_TRANSACTIONS:\n return {\n ...state,\n newTransactions: action.newTransactions || [],\n matchedTransactions: action.matchedTransactions || [],\n updatedAccounts: action.updatedAccounts || []\n };\n case constants.UPDATE_NEW_TRANSACTIONS:\n return {\n ...state,\n newTransactions: state.newTransactions.filter(\n id => id !== action.changedId\n ),\n matchedTransactions: state.matchedTransactions.filter(\n id => id !== action.changedId\n )\n };\n case constants.SET_LAST_TRANSACTION:\n return {\n ...state,\n lastTransaction: action.transaction\n };\n case constants.MARK_ACCOUNT_READ:\n return {\n ...state,\n updatedAccounts: state.updatedAccounts.filter(\n id => id !== action.accountId\n )\n };\n case constants.LOAD_ACCOUNTS:\n return {\n ...state,\n accounts: action.accounts\n };\n case constants.UPDATE_ACCOUNT: {\n return {\n ...state,\n accounts: state.accounts.map(account => {\n if (account.id === action.account.id) {\n return { ...account, ...action.account };\n }\n return account;\n })\n };\n }\n case constants.LOAD_CATEGORIES:\n return {\n ...state,\n categories: action.categories\n };\n case constants.LOAD_PAYEES:\n return {\n ...state,\n payees: action.payees\n };\n case constants.ADD_CATEGORY: {\n let category = { id: 'temp', name: action.name };\n\n return {\n ...state,\n categories: {\n grouped: state.categories.grouped.map(group => {\n if (group.id === action.groupId) {\n return { ...group, categories: [category, ...group.categories] };\n }\n return group;\n }),\n list: [category, ...state.categories.list]\n }\n };\n }\n case constants.DELETE_CATEGORY: {\n return {\n ...state,\n categories: {\n grouped: state.categories.grouped.map(group => {\n return {\n ...group,\n categories: group.categories.filter(cat => cat.id !== action.id)\n };\n }),\n list: state.categories.list.filter(cat => cat.id !== action.id)\n }\n };\n }\n\n default:\n }\n return state;\n}\n\nexport const getAccountsById = memoizeOne(accounts => groupById(accounts));\nexport const getPayeesById = memoizeOne(payees => groupById(payees));\nexport const getCategoriesById = memoizeOne(categoryGroups => {\n let res = {};\n categoryGroups.forEach(group => {\n group.categories.forEach(cat => {\n res[cat.id] = cat;\n });\n });\n return res;\n});\n\nexport const getActivePayees = memoizeOne((payees, accounts) => {\n let accountsById = getAccountsById(accounts);\n\n return payees.filter(payee => {\n if (payee.transfer_acct) {\n let account = accountsById[payee.transfer_acct];\n return account != null && !account.closed;\n }\n return true;\n });\n});\n","export default function Worker_fn() {\n return new Worker(__webpack_public_path__ + \"static/js/browser-server.06b54be5.worker.js\");\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport { css } from 'glamor';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n init as initConnection,\n send\n} from 'loot-core/src/platform/client/fetch';\nimport installPolyfills from '../polyfills';\nimport { styles, hasHiddenScrollbars } from 'loot-design/src/style';\nimport FatalError from './FatalError';\nimport ManagementApp from './manager/ManagementApp';\nimport FinancesApp from './FinancesApp';\nimport AppBackground from './AppBackground';\nimport UpdateNotification from './UpdateNotification';\nimport MobileWebMessage from './MobileWebMessage';\n\nclass App extends React.Component {\n state = {\n fatalError: null,\n initializing: true,\n hiddenScrollbars: hasHiddenScrollbars()\n };\n\n async init() {\n const socketName = await global.Actual.getServerSocket();\n\n try {\n await initConnection(socketName);\n } catch (e) {\n if (e.type === 'app-init-failure') {\n this.setState({ initializing: false, fatalError: e });\n return;\n } else {\n throw e;\n }\n }\n\n // Load any global prefs\n let globalPrefs = await this.props.loadGlobalPrefs();\n\n // Open the last opened budget, if any\n const budgetId = await send('get-last-opened-backup');\n if (budgetId) {\n await this.props.loadBudget(budgetId);\n\n // Check to see if this file has been remotely deleted (but\n // don't block on this in case they are offline or something)\n send('get-remote-files').then(files => {\n if (files) {\n let remoteFile = files.find(f => f.fileId === this.props.cloudFileId);\n if (remoteFile && remoteFile.deleted) {\n this.props.closeBudget();\n }\n }\n });\n }\n }\n\n async componentDidMount() {\n await Promise.all([installPolyfills(), this.init()]);\n\n this.setState({ initializing: false });\n\n let checkScrollbars = () => {\n if (this.state.hiddenScrollbars !== hasHiddenScrollbars()) {\n this.setState({ hiddenScrollbars: hasHiddenScrollbars() });\n }\n };\n window.addEventListener('focus', checkScrollbars);\n this.cleanup = () => window.removeEventListener('focus', checkScrollbars);\n }\n\n componentDidCatch(error, errorInfo) {\n if (process.env.NODE_ENV !== 'development') {\n window.SentryClient.captureException(error, { extra: errorInfo });\n }\n this.setState({ fatalError: error });\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.budgetId !== prevProps.budgetId) {\n global.Actual.updateAppMenu(!!this.props.budgetId);\n }\n }\n\n render() {\n const { budgetId, loadingText, showingTutorial } = this.props;\n const { fatalError, initializing, hiddenScrollbars } = this.state;\n\n return (\n <div\n key={hiddenScrollbars ? 'hidden-scrollbars' : 'scrollbars'}\n {...css([\n {\n height: '100%',\n backgroundColor: '#E8ECF0',\n overflow: 'hidden'\n },\n styles.lightScrollbar\n ])}\n >\n {fatalError ? (\n <React.Fragment>\n <AppBackground />\n <FatalError error={fatalError} buttonText=\"Restart app\" />\n </React.Fragment>\n ) : initializing ? (\n <AppBackground\n initializing={initializing}\n loadingText={loadingText}\n />\n ) : budgetId ? (\n <FinancesApp />\n ) : (\n <React.Fragment>\n <AppBackground\n initializing={initializing}\n loadingText={loadingText}\n />\n <ManagementApp />\n </React.Fragment>\n )}\n\n <UpdateNotification />\n <MobileWebMessage />\n </div>\n );\n }\n}\n\nexport default connect(\n state => ({\n budgetId: state.prefs.local && state.prefs.local.id,\n cloudFileId: state.prefs.local && state.prefs.local.cloudFileId,\n loadingText: state.app.loadingText,\n showingTutorial: state.tutorial.stage !== null\n }),\n actions\n)(App);\n","export default async function installPolyfills() {\n if ('ResizeObserver' in window === false) {\n const module = await import('@juggle/resize-observer');\n window.ResizeObserver = module.ResizeObserver;\n }\n}\n","import React from 'react';\nimport {\n View,\n Stack,\n Text,\n Block,\n Modal,\n P,\n Link,\n Button\n} from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\n\nclass FatalError extends React.Component {\n state = { showError: false };\n\n renderSimple(error) {\n let msg;\n if (error.IDBFailure) {\n // IndexedDB wasn't able to open the database\n msg = (\n <Text>\n Your browser doesn{\"'\"}t support IndexedDB in this environment, a\n feature that Actual requires to run. This might happen if you are in\n private browsing mode. Please try a different browser or turn off\n private browsing.\n </Text>\n );\n } else {\n // This indicates the backend failed to initialize. Show the\n // user something at least so they aren't looking at a blank\n // screen\n msg = (\n <Text>\n There was a problem loading the app in this browser version. If this\n continues to be a problem, you can{' '}\n <a href=\"https://actualbudget.com/download\">\n download the desktop app\n </a>\n .\n </Text>\n );\n }\n\n return (\n <View\n style={{\n alignItems: 'center',\n justifyContent: 'center',\n height: '100%'\n }}\n >\n <Stack\n style={{\n paddingBottom: 100,\n maxWidth: 500,\n color: colors.r4,\n lineHeight: '1.5em',\n fontSize: 15,\n '& a': { color: colors.r4 }\n }}\n >\n <Text>{msg}</Text>\n <Text>\n Contact{' '}\n <a href=\"mailto:help@actualbudget.com\">help@actualbudget.com</a> for\n support\n </Text>\n </Stack>\n </View>\n );\n }\n\n render() {\n const { buttonText, error } = this.props;\n const { showError } = this.state;\n\n if (error.type === 'app-init-failure') {\n return this.renderSimple(error);\n }\n\n return (\n <Modal isCurrent={true} showClose={false} title=\"Fatal Error\">\n {() => (\n <View style={{ maxWidth: 500 }}>\n <P>\n There was an unrecoverable error in the UI. Sorry! This error has\n been reported and hopefully will be fixed soon.\n </P>\n <P>\n If you want to talk about what happened or give any feedback, send\n an email to{' '}\n <a\n href=\"mailto:help@actualbudget.com\"\n style={{ color: colors.p4 }}\n >\n help@actualbudget.com\n </a>\n .\n </P>\n <P>\n <Button onClick={() => window.Actual.relaunch()}>{buttonText}</Button>\n </P>\n <P isLast={true} style={{ fontSize: 11 }}>\n <Link\n onClick={() => this.setState({ showError: true })}\n style={{ color: colors.p4 }}\n >\n Show Error\n </Link>\n {showError && (\n <Block\n style={{\n marginTop: 5,\n height: 100,\n overflow: 'auto'\n }}\n >\n {error.stack}\n </Block>\n )}\n </P>\n </View>\n )}\n </Modal>\n );\n }\n}\nexport default FatalError;\n","import React from 'react';\nimport memoizeOne from 'memoize-one';\nimport useResizeObserver from './useResizeObserver';\nimport { View } from './common';\n\nconst IS_SCROLLING_DEBOUNCE_INTERVAL = 150;\n\nconst defaultItemKey = (index, data) => index;\n\nfunction ResizeObserver({ onResize, children }) {\n let ref = useResizeObserver(onResize);\n return children(ref);\n}\n\nexport class FixedSizeList extends React.PureComponent {\n _outerRef;\n _resetIsScrollingTimeoutId = null;\n\n static defaultProps = {\n direction: 'ltr',\n renderRow: undefined,\n layout: 'vertical',\n overscanCount: 2,\n useIsScrolling: false,\n headerHeight: 0\n };\n\n constructor(props) {\n super(props);\n\n this.lastPositions = React.createRef();\n this.lastPositions.current = new Map();\n this.needsAnimationRerender = React.createRef();\n this.needsAnimationRerender.current = false;\n this.animationEnabled = false;\n\n this.state = {\n instance: this,\n isScrolling: false,\n scrollDirection: 'forward',\n scrollOffset:\n typeof this.props.initialScrollOffset === 'number'\n ? this.props.initialScrollOffset\n : 0,\n scrollUpdateWasRequested: false\n };\n }\n\n scrollTo(scrollOffset) {\n scrollOffset = Math.max(0, scrollOffset);\n\n this.setState(prevState => {\n if (prevState.scrollOffset === scrollOffset) {\n return null;\n }\n\n this.requestScrollUpdateHandled = false;\n return {\n scrollDirection:\n prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',\n scrollOffset: scrollOffset,\n scrollUpdateWasRequested: true\n };\n }, this._resetIsScrollingDebounced);\n }\n\n scrollToItem(index, align = 'auto') {\n const { itemCount } = this.props;\n const { scrollOffset } = this.state;\n\n index = Math.max(0, Math.min(index, itemCount - 1));\n\n this.scrollTo(\n this.getOffsetForIndexAndAlignment(index, align, scrollOffset)\n );\n }\n\n componentDidMount() {\n const { direction, initialScrollOffset, layout } = this.props;\n\n if (typeof initialScrollOffset === 'number' && this._outerRef != null) {\n let outerRef = this._outerRef;\n outerRef = this._outerRef;\n outerRef.scrollTop = initialScrollOffset;\n }\n\n this._callPropsCallbacks();\n }\n\n getAnchoredScrollPos() {\n if (this.anchored && this.props.indexForKey && this._outerRef != null) {\n let index = this.props.indexForKey(this.anchored.key);\n let baseOffset = this.getOffsetForIndexAndAlignment(index, 'start');\n let outerRef = this._outerRef;\n return baseOffset + this.anchored.offset;\n }\n return null;\n }\n\n componentDidUpdate() {\n const { scrollOffset, scrollUpdateWasRequested } = this.state;\n\n let anchoredPos = this.getAnchoredScrollPos();\n if (anchoredPos != null) {\n const outerRef = this._outerRef;\n outerRef.scrollTop = anchoredPos;\n } else if (\n scrollUpdateWasRequested &&\n !this.requestScrollUpdateHandled &&\n this._outerRef != null\n ) {\n this.requestScrollUpdateHandled = true;\n const outerRef = this._outerRef;\n outerRef.scrollTop = scrollOffset;\n }\n\n if (this.needsAnimationRerender.current) {\n this.needsAnimationRerender.current = false;\n this.rerenderTimeout = setTimeout(() => {\n this.forceUpdate();\n }, 10);\n }\n\n this._callPropsCallbacks();\n }\n\n componentWillUnmount() {\n if (this._resetIsScrollingTimeoutId !== null) {\n clearTimeout(this._resetIsScrollingTimeoutId);\n }\n }\n\n render() {\n const {\n className,\n height,\n header,\n innerRef,\n innerElementType,\n innerTagName,\n itemCount,\n renderRow,\n itemKey = defaultItemKey,\n outerElementType,\n outerTagName,\n style,\n useIsScrolling,\n width,\n version\n } = this.props;\n const { isScrolling } = this.state;\n\n const [startIndex, stopIndex] = this._getRangeToRender();\n const positions = new Map();\n\n const items = [];\n if (itemCount > 0) {\n for (let index = startIndex; index <= stopIndex; index++) {\n let key = itemKey(index);\n let style = this._getItemStyle(index);\n let lastPosition = this.lastPositions.current.get(key);\n let animating = false;\n positions.set(key, style.top);\n\n if (\n this.animationEnabled &&\n lastPosition != null &&\n lastPosition !== style.top\n ) {\n // A reorder has happened. Render it in the old place, then\n // animate it to the new one\n style = { ...style, top: lastPosition };\n this.needsAnimationRerender.current = true;\n animating = true;\n }\n\n items.push(\n renderRow({\n index,\n key,\n style,\n isScrolling: useIsScrolling ? isScrolling : undefined,\n isAnimating: animating\n })\n );\n }\n }\n\n this.lastPositions.current = positions;\n\n // Read this value AFTER items have been created,\n // So their actual sizes (if variable) are taken into consideration.\n let estimatedTotalSize = this.getEstimatedTotalSize();\n\n let OuterElement = outerElementType || outerTagName || 'div';\n let InnerElement = innerElementType || innerTagName || 'div';\n\n return (\n <ResizeObserver onResize={this.onHeaderResize}>\n {headerRef => (\n <OuterElement\n className={className}\n onScroll={this._onScrollVertical}\n ref={this._outerRefSetter}\n style={{\n height,\n width,\n overflow: 'auto',\n ...style\n }}\n >\n <View innerRef={headerRef}>{header}</View>\n <InnerElement\n ref={innerRef}\n style={{\n position: 'relative',\n height: estimatedTotalSize,\n width: '100%',\n pointerEvents: isScrolling ? 'none' : undefined\n }}\n >\n {items}\n </InnerElement>\n </OuterElement>\n )}\n </ResizeObserver>\n );\n }\n\n setRowAnimation = flag => {\n this.animationEnabled = flag;\n\n let outerRef = this._outerRef;\n if (outerRef) {\n if (this.animationEnabled) {\n outerRef.classList.add('animated');\n } else {\n outerRef.classList.remove('animated');\n }\n }\n };\n\n onHeaderResize = rect => {\n // this.setState({ headerHeight: rect.height });\n };\n\n anchor() {\n let itemKey = this.props.itemKey || defaultItemKey;\n\n let outerRef = this._outerRef;\n let scrollOffset = outerRef ? outerRef.scrollTop : 0;\n let index = this.getStartIndexForOffset(scrollOffset);\n let key = itemKey(index);\n\n this.anchored = {\n key,\n offset: scrollOffset - this.getItemOffset(index)\n };\n }\n\n unanchor() {\n this.anchored = null;\n }\n\n isAnchored() {\n return this.anchored != null;\n }\n\n getItemOffset = index => index * this.props.itemSize;\n getItemSize = index => this.props.itemSize;\n getEstimatedTotalSize = () => this.props.itemSize * this.props.itemCount;\n\n getOffsetForIndexAndAlignment = (index, align, scrollOffset) => {\n const size = this.props.height;\n const lastItemOffset = Math.max(\n 0,\n this.props.itemCount * this.props.itemSize - size\n );\n const maxOffset = Math.min(lastItemOffset, index * this.props.itemSize);\n const minOffset = Math.max(\n 0,\n index * this.props.itemSize - size + this.props.itemSize\n );\n\n if (align === 'smart') {\n if (\n scrollOffset >= minOffset - size &&\n scrollOffset <= maxOffset + size\n ) {\n align = 'auto';\n } else {\n align = 'center';\n }\n }\n\n switch (align) {\n case 'start':\n return maxOffset;\n case 'end':\n return minOffset;\n case 'center': {\n // \"Centered\" offset is usually the average of the min and max.\n // But near the edges of the list, this doesn't hold true.\n const middleOffset = Math.round(\n minOffset + (maxOffset - minOffset) / 2\n );\n if (middleOffset < Math.ceil(size / 2)) {\n return 0; // near the beginning\n } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {\n return lastItemOffset; // near the end\n } else {\n return middleOffset;\n }\n }\n case 'auto':\n default:\n if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {\n return scrollOffset;\n } else if (scrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n };\n\n getStartIndexForOffset = offset =>\n Math.max(\n 0,\n Math.min(\n this.props.itemCount - 1,\n Math.floor(offset / this.props.itemSize)\n )\n );\n\n getStopIndexForStartIndex = (startIndex, scrollOffset) => {\n const offset = startIndex * this.props.itemSize;\n const size = this.props.width;\n const numVisibleItems = Math.ceil(\n (size + scrollOffset - offset) / this.props.itemSize\n );\n return Math.max(\n 0,\n Math.min(\n this.props.itemCount - 1,\n startIndex + numVisibleItems - 1 // -1 is because stop index is inclusive\n )\n );\n };\n\n _callOnItemsRendered = memoizeOne(\n (\n overscanStartIndex,\n overscanStopIndex,\n visibleStartIndex,\n visibleStopIndex\n ) =>\n this.props.onItemsRendered({\n overscanStartIndex,\n overscanStopIndex,\n visibleStartIndex,\n visibleStopIndex\n })\n );\n\n _callOnScroll = memoizeOne(\n (scrollDirection, scrollOffset, scrollUpdateWasRequested) =>\n this.props.onScroll({\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n })\n );\n\n _callPropsCallbacks() {\n if (typeof this.props.onItemsRendered === 'function') {\n const { itemCount } = this.props;\n if (itemCount > 0) {\n const [\n overscanStartIndex,\n overscanStopIndex,\n visibleStartIndex,\n visibleStopIndex\n ] = this._getRangeToRender();\n this._callOnItemsRendered(\n overscanStartIndex,\n overscanStopIndex,\n visibleStartIndex,\n visibleStopIndex\n );\n }\n }\n\n if (typeof this.props.onScroll === 'function') {\n const {\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n } = this.state;\n this._callOnScroll(\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n );\n }\n }\n\n // Lazily create and cache item styles while scrolling,\n // So that pure component sCU will prevent re-renders.\n // We maintain this cache, and pass a style prop rather than index,\n // So that List can clear cached styles and force item re-render if necessary.\n _getItemStyle = index => {\n const { direction, itemSize, layout } = this.props;\n\n const itemStyleCache = this._getItemStyleCache(itemSize, layout, direction);\n\n let style;\n if (itemStyleCache.hasOwnProperty(index)) {\n style = itemStyleCache[index];\n } else {\n const offset = this.getItemOffset(index);\n const size = this.getItemSize(index);\n\n itemStyleCache[index] = style = {\n position: 'absolute',\n left: 0,\n top: offset,\n height: size,\n width: '100%'\n };\n }\n\n return style;\n };\n\n _getItemStyleCache = memoizeOne((_, __, ___) => ({}));\n\n _getRangeToRender() {\n let { itemCount, overscanCount } = this.props;\n let { isScrolling, scrollDirection, scrollOffset } = this.state;\n\n let anchoredPos = this.getAnchoredScrollPos();\n if (anchoredPos != null) {\n scrollOffset = anchoredPos;\n }\n\n if (itemCount === 0) {\n return [0, 0, 0, 0];\n }\n\n const startIndex = this.getStartIndexForOffset(scrollOffset);\n const stopIndex = this.getStopIndexForStartIndex(startIndex, scrollOffset);\n\n // Overscan by one item in each direction so that tab/focus works.\n // If there isn't at least one extra item, tab loops back around.\n const overscanBackward =\n !isScrolling || scrollDirection === 'backward'\n ? Math.max(1, overscanCount)\n : 1;\n const overscanForward =\n !isScrolling || scrollDirection === 'forward'\n ? Math.max(1, overscanCount)\n : 1;\n\n return [\n Math.max(0, startIndex - overscanBackward),\n Math.max(0, Math.min(itemCount - 1, stopIndex + overscanForward)),\n startIndex,\n stopIndex\n ];\n }\n\n _onScrollVertical = event => {\n let { clientHeight, scrollHeight, scrollTop } = event.currentTarget;\n\n this.setState(prevState => {\n if (prevState.scrollOffset === scrollTop) {\n // Scroll position may have been updated by cDM/cDU,\n // In which case we don't need to trigger another render,\n // And we don't want to update state.isScrolling.\n return null;\n }\n\n let scrollOffset = scrollTop;\n\n return {\n isScrolling: true,\n scrollDirection:\n prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',\n scrollOffset,\n scrollUpdateWasRequested: false\n };\n }, this._resetIsScrollingDebounced);\n };\n\n _outerRefSetter = ref => {\n const { outerRef } = this.props;\n\n this._outerRef = ref;\n\n if (typeof outerRef === 'function') {\n outerRef(ref);\n } else if (\n outerRef != null &&\n typeof outerRef === 'object' &&\n outerRef.hasOwnProperty('current')\n ) {\n outerRef.current = ref;\n }\n };\n\n _resetIsScrollingDebounced = () => {\n if (this._resetIsScrollingTimeoutId !== null) {\n clearTimeout(this._resetIsScrollingTimeoutId);\n }\n\n this._resetIsScrollingTimeoutId = setTimeout(\n this._resetIsScrolling,\n IS_SCROLLING_DEBOUNCE_INTERVAL\n );\n };\n\n _resetIsScrolling = () => {\n this._resetIsScrollingTimeoutId = null;\n\n this.setState({ isScrolling: false }, () => {\n // Clear style cache after state update has been committed.\n // This way we don't break pure sCU for items that don't use isScrolling param.\n this._getItemStyleCache(-1, null);\n });\n };\n}\n","module.exports = __webpack_public_path__ + \"static/media/DateSelect.left.1ae92674.png\";","module.exports = __webpack_public_path__ + \"static/media/DateSelect.right.2a470dc0.png\";","import { send } from '../platform/client/fetch';\nimport Platform from './platform';\n\nexport default function checkForUpgradeNotifications(\n addNotification,\n resetSync,\n // Note: history is only available on desktop\n history\n) {\n // TODO: Probably should only show one of these at at time?\n send('get-upgrade-notifications').then(types => {\n types.forEach(type => {\n switch (type) {\n case 'schedules': {\n let message =\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' +\n (global.IS_BETA\n ? 'NOTE: You are using the beta version, and this will not reset your sync data. This is safe to do.'\n : '');\n\n if (Platform.env === 'mobile') {\n message =\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.';\n }\n\n addNotification({\n type: 'message',\n title: 'Scheduled transactions are now available!',\n message,\n sticky: true,\n id: 'find-schedules',\n button: Platform.env !== 'mobile' && {\n title: 'Find schedules',\n action: async () => {\n // eslint-disable-next-line\n __history &&\n // eslint-disable-next-line\n __history.push('/schedule/discover', {\n // eslint-disable-next-line\n locationPtr: __history.location\n });\n }\n },\n onClose: () => {\n send('seen-upgrade-notification', { type: 'schedules' });\n }\n });\n break;\n }\n\n case 'repair-splits':\n if (history) {\n addNotification({\n type: 'message',\n title: 'Split transactions now support transfers & payees',\n message:\n '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)',\n sticky: true,\n id: 'repair-splits',\n button: {\n title: 'Repair splits...',\n action: () =>\n history.push('/tools/fix-splits', {\n locationPtr: history.location\n })\n },\n onClose: () => {\n send('seen-upgrade-notification', { type: 'repair-splits' });\n }\n });\n }\n break;\n\n default:\n }\n });\n });\n}\n","// TODO: This is a barebones module for now, need to think about a\n// generic way keys are handled across the app\n\nexport const keys = {\n ESC: 27,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n ALT: 18,\n META: 91,\n CTRL: 17,\n SPACE: 32,\n UP: 38,\n DOWN: 40,\n J: 74,\n K: 75,\n X: 88\n};\n\nlet _keyHandlers = {};\n\nlet _modifierState = {\n shift: false,\n ctrl: false,\n alt: false,\n meta: false\n};\n\nexport function hasModifierKey(modifier) {\n return !!_modifierState[modifier];\n}\n\nexport function registerKeyHandler(key, func) {\n if (!_keyHandlers[key]) {\n _keyHandlers[key] = [];\n }\n _keyHandlers[key].push(func);\n\n return () => {\n _keyHandlers[key] = _keyHandlers[key].filter(f => f !== func);\n };\n}\n\ndocument.addEventListener('keydown', e => {\n if (e.keyCode === keys.SHIFT) {\n _modifierState.shift = true;\n }\n if (e.keyCode === keys.CTRL) {\n _modifierState.ctrl = true;\n }\n if (e.keyCode === keys.ALT) {\n _modifierState.alt = true;\n }\n if (e.keyCode === keys.META) {\n _modifierState.meta = true;\n }\n\n if (!(e.target && e.target.matches('input'))) {\n let handlers = _keyHandlers[e.key.toUpperCase()];\n if (handlers && handlers.length > 0) {\n handlers[handlers.length - 1](_modifierState);\n e.preventDefault();\n e.stopPropagation();\n }\n }\n});\n\ndocument.addEventListener('keyup', e => {\n if (e.keyCode === keys.SHIFT) {\n _modifierState.shift = false;\n }\n if (e.keyCode === keys.CTRL) {\n _modifierState.ctrl = false;\n }\n if (e.keyCode === keys.ALT) {\n _modifierState.alt = false;\n }\n if (e.keyCode === keys.META) {\n _modifierState.meta = false;\n }\n});\n","module.exports = __webpack_public_path__ + \"static/media/bg.ad9dce3b.svg\";","import React, { useState } from 'react';\nimport {\n View,\n Text,\n Button,\n ExternalLink\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\n\nfunction isOSX() {\n var ua = window.navigator.userAgent;\n var iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);\n var webkit = !!ua.match(/WebKit/i);\n return iOS && webkit && !ua.match(/CriOS/i);\n}\n\nfunction isMobile() {\n // Simple detection: if the screen width it too small\n return window.innerWidth < 600;\n}\n\nlet buttonStyle = { border: 0, fontSize: 15, padding: '10px 13px' };\n\nexport default function MobileWebMessage() {\n let appStoreURL = isOSX()\n ? 'https://itunes.apple.com/us/app/actual-budget-your-finances/id1444818585'\n : 'https://play.google.com/store/apps/details?id=com.shiftreset.actual';\n\n let [show, setShow] = useState(\n isMobile() && !document.cookie.match(/hideMobileMessage=true/)\n );\n\n function onTry() {\n setShow(false);\n\n // Set a cookie for 5 minutes\n let d = new Date();\n d.setTime(d.getTime() + 1000 * 60 * 5);\n document.cookie =\n 'hideMobileMessage=true;path=/;expires=' + d.toGMTString();\n }\n\n if (!show) {\n return null;\n }\n\n return (\n <View\n style={{\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n backgroundColor: colors.n1,\n color: 'white',\n padding: 10,\n margin: 10,\n borderRadius: 6,\n zIndex: 10000,\n fontSize: 15,\n boxShadow: styles.shadowLarge\n }}\n >\n <Text style={{ lineHeight: '1.5em' }}>\n <strong>It looks like you are using a mobile device.</strong> This app\n is built for desktop, but you can try it anyway. For the best mobile\n experience, download the app.\n </Text>\n\n <View\n style={{\n marginTop: 20,\n flexDirection: 'row',\n justifyContent: 'flex-end'\n }}\n >\n <Button style={buttonStyle} onClick={onTry}>\n Try it anyway\n </Button>\n <ExternalLink\n bare={false}\n href={appStoreURL}\n style={[buttonStyle, { marginLeft: 10 }]}\n >\n Download app\n </ExternalLink>\n </View>\n </View>\n );\n}\n","import { send, listen } from 'loot-core/src/platform/client/fetch';\nimport * as undo from 'loot-core/src/platform/client/undo';\nimport * as sharedListeners from 'loot-core/src/client/shared-listeners';\n\nexport function handleGlobalEvents(actions, store) {\n global.Actual.onEventFromMain('update-downloaded', (event, info) => {\n actions.setAppState({ updateInfo: info });\n });\n\n global.Actual.onEventFromMain('update-error', msg => {\n // Ignore errors. We don't want to constantly bug the user if they\n // always have a flaky connection or have intentionally disabled\n // updates. They will see the error in the about page if they try\n // to update.\n });\n\n listen('server-error', info => {\n actions.addGenericErrorNotification();\n });\n\n listen('update-loading-status', status => {\n switch (status) {\n case 'updating':\n actions.updateStatusText('Updating...');\n break;\n default:\n }\n });\n\n listen('orphaned-payees', ({ orphanedIds, updatedPayeeIds }) => {\n // Right now, it prompts to merge into the first payee\n actions.pushModal('merge-unused-payees', {\n payeeIds: orphanedIds,\n targetPayeeId: updatedPayeeIds[0]\n });\n });\n\n listen('schedules-offline', ({ payees }) => {\n let history = window.__history;\n if (history) {\n history.push(`/schedule/posts-offline-notification`, {\n locationPtr: history.location,\n payees\n });\n }\n });\n\n async function onManage() {\n let tempId = await send('make-user-temp-id');\n let url = 'https://actualbudget.com/account?tempId=' + tempId;\n window.Actual.openURLInBrowser(url);\n }\n\n // This is experimental: we sync data locally automatically when\n // data changes from the backend\n listen('sync-event', async ({ type, tables }) => {\n // We don't need to query anything until the file is loaded, and\n // sync events might come in if the file is being synced before\n // being loaded (happens when downloading)\n let prefs = store.getState().prefs.local;\n if (prefs && prefs.id) {\n if (type === 'applied') {\n if (tables.includes('payees') || tables.includes('payee_mapping')) {\n actions.getPayees();\n }\n }\n }\n });\n\n // TODO: Should this run on mobile too?\n listen('sync-event', async ({ type }) => {\n if (type === 'unauthorized') {\n actions.addNotification({\n type: 'warning',\n message: 'Unable to authenticate with server',\n sticky: true,\n id: 'auth-issue'\n });\n }\n });\n\n sharedListeners.listenForSyncEvent(actions, store);\n\n listen('undo-event', undoState => {\n let { messages, tables, undoTag } = undoState;\n let promises = [];\n\n if (\n tables.includes('categories') ||\n tables.includes('category_groups') ||\n tables.includes('category_mapping')\n ) {\n promises.push(actions.getCategories());\n }\n\n if (tables.includes('accounts')) {\n promises.push(actions.getAccounts());\n }\n\n let tagged = undo.getTaggedState(undoTag);\n\n if (tagged) {\n Promise.all(promises).then(() => {\n actions.setLastUndoState(undoState);\n\n // If a modal has been tagged, open it instead of navigating\n if (tagged.openModal) {\n let { modalStack } = store.getState().modals;\n\n if (\n modalStack.length === 0 ||\n modalStack[modalStack.length - 1].name !== tagged.openModal\n ) {\n actions.replaceModal(tagged.openModal);\n }\n } else {\n actions.closeModal();\n\n if (window.location.href !== tagged.url) {\n window.location.href = tagged.url;\n // This stops propagation of the undo event, which is\n // important because if we are changing URLs any existing\n // undo listeners on the current page don't need to be run\n return true;\n }\n }\n });\n }\n });\n\n listen('fallback-write-error', () => {\n actions.addNotification({\n type: 'error',\n title: 'Unable to save changes',\n sticky: true,\n message:\n 'This browser only supports using the app in one tab at a time, ' +\n 'and another tab has opened the app. No changes will be saved ' +\n 'from this tab; please close it and continue working in the other one.'\n });\n });\n\n listen('start-load', () => {\n actions.closeBudgetUI();\n actions.setAppState({ loadingText: '' });\n });\n\n listen('finish-load', () => {\n actions.closeModal();\n actions.setAppState({ loadingText: null });\n actions.loadPrefs();\n });\n\n listen('start-import', () => {\n actions.closeBudgetUI();\n actions.setAppState({ loadingText: 'Importing...' });\n });\n\n listen('finish-import', () => {\n actions.closeModal();\n actions.setAppState({ loadingText: null });\n actions.loadPrefs();\n });\n\n listen('show-budgets', () => {\n actions.closeBudgetUI();\n actions.setAppState({ loadingText: null });\n });\n}\n","import { useContext, useState, useRef, useLayoutEffect } from 'react';\nimport NamespaceContext from './NamespaceContext.js';\nimport SpreadsheetContext from './SpreadsheetContext';\n\nfunction unresolveName(name) {\n let idx = name.indexOf('!');\n if (idx !== -1) {\n return {\n sheet: name.slice(0, idx),\n name: name.slice(idx + 1)\n };\n }\n return { sheet: null, name };\n}\n\nexport default function useSheetValue(binding, onChange) {\n if (!binding) {\n throw new Error('SheetValue binding is required');\n }\n if (global.IS_TESTING && typeof binding !== 'string' && !binding.name) {\n binding = { ...binding, name: binding.value.toString() };\n }\n\n binding =\n typeof binding === 'string' ? { name: binding, value: null } : binding;\n\n if (binding.name == null) {\n throw new Error('Binding name is now required');\n }\n\n // Get the current sheet name, and unresolve the binding name if\n // necessary (you might pass a fully resolve name like foo!name)\n let sheetName = useContext(NamespaceContext) || '__global';\n let unresolved = unresolveName(binding.name);\n if (unresolved.sheet) {\n sheetName = unresolved.sheet;\n binding = { ...binding, name: unresolved.name };\n }\n\n let spreadsheet = useContext(SpreadsheetContext);\n let [result, setResult] = useState({\n name: sheetName + '!' + binding.name,\n value: binding.value,\n query: binding.query\n });\n let latestOnChange = useRef(onChange);\n let latestValue = useRef(result.value);\n\n useLayoutEffect(() => {\n latestOnChange.current = onChange;\n latestValue.current = result.value;\n });\n\n useLayoutEffect(\n () => {\n if (binding.query) {\n spreadsheet.createQuery(sheetName, binding.name, binding.query);\n }\n\n return spreadsheet.bind(sheetName, binding, null, newResult => {\n if (latestOnChange.current) {\n latestOnChange.current(newResult);\n }\n\n if (newResult.value !== latestValue.current) {\n setResult(newResult);\n }\n });\n },\n [sheetName, binding.name]\n );\n\n return result.value;\n}\n","import { listen, send } from '../platform/client/fetch';\n\nexport function listenForSyncEvent(actions, store) {\n let attemptedSyncRepair = false;\n\n listen('sync-event', info => {\n let { type, subtype, meta, tables } = info;\n\n let prefs = store.getState().prefs.local;\n if (!prefs || !prefs.id) {\n // Do nothing if no budget is loaded\n return;\n }\n\n if (type === 'success') {\n if (attemptedSyncRepair) {\n attemptedSyncRepair = false;\n\n actions.addNotification({\n title: 'Syncing has been fixed!',\n message: 'Happy budgeting!',\n type: 'message'\n });\n }\n\n if (tables.includes('prefs')) {\n actions.loadPrefs();\n }\n\n if (\n tables.includes('categories') ||\n tables.includes('category_groups') ||\n tables.includes('category_mapping')\n ) {\n actions.getCategories();\n }\n\n if (tables.includes('payees') || tables.includes('payee_mapping')) {\n actions.getPayees();\n }\n\n if (tables.includes('accounts')) {\n actions.getAccounts();\n }\n } else if (type === 'error') {\n let notif = null;\n let learnMore =\n '[Learn more](https://actualbudget.com/docs/overview/syncing-across-devices/#debugging-sync-issues)';\n\n switch (subtype) {\n case 'out-of-sync':\n if (attemptedSyncRepair) {\n notif = {\n title: 'Your data is still out of sync',\n message:\n 'We were unable to repair your sync state, sorry! You need to reset your sync state. ' +\n learnMore,\n sticky: true,\n id: 'reset-sync',\n button: {\n title: 'Reset sync',\n action: actions.resetSync\n }\n };\n } else {\n // A bug happened during the sync process. Sync state needs\n // to be reset.\n notif = {\n title: 'Your data is out of sync',\n message:\n 'There was a problem syncing your data. We can try to repair your sync state ' +\n 'to fix it. ' +\n learnMore,\n type: 'warning',\n sticky: true,\n id: 'repair-sync',\n button: {\n title: 'Repair',\n action: async () => {\n attemptedSyncRepair = true;\n await send('sync-repair');\n actions.sync();\n }\n }\n };\n }\n break;\n\n case 'file-old-version':\n // Tell the user something is wrong with the key state on\n // the server and the key needs to be recreated\n notif = {\n title: 'Actual has updated the syncing format',\n message:\n 'This happens rarely (if ever again). The internal syncing format ' +\n 'has changed and you need to reset sync. This will upload data from ' +\n 'this device and revert all other devices. ' +\n '[Learn more about what this means](https://actualbudget.com/docs/overview/syncing-across-devices/#what-does-resetting-sync-mean).' +\n '\\n\\nOld encryption keys are not migrated. If using ' +\n 'encryption, [reset encryption here](#makeKey).',\n messageActions: {\n makeKey: () => actions.pushModal('create-encryption-key')\n },\n sticky: true,\n id: 'old-file',\n button: {\n title: 'Reset sync',\n action: actions.resetSync\n }\n };\n break;\n\n case 'file-key-mismatch':\n // Tell the user something is wrong with the key state on\n // the server and the key needs to be recreated\n notif = {\n title: 'Your encryption key need to be reset',\n message:\n 'Something went wrong when registering your encryption key id. ' +\n 'You need to recreate your key. ' +\n learnMore,\n sticky: true,\n id: 'invalid-key-state',\n button: {\n title: 'Reset key',\n action: () => actions.pushModal('create-encryption-key')\n }\n };\n\n break;\n\n case 'file-not-found':\n notif = {\n title: 'This file is not a cloud file',\n message:\n 'You need to register it to take advantage ' +\n 'of syncing which allows you to use it across devices and never worry ' +\n 'about losing your data. ' +\n learnMore,\n type: 'warning',\n sticky: true,\n id: 'register-file',\n button: {\n title: 'Register',\n action: async () => {\n await actions.uploadBudget();\n actions.sync();\n actions.loadPrefs();\n }\n }\n };\n break;\n\n case 'file-needs-upload':\n notif = {\n title: 'File needs upload',\n message:\n 'Something went wrong when creating this cloud file. You need ' +\n 'to upload this file to fix it. ' +\n learnMore,\n sticky: true,\n id: 'upload-file',\n button: { title: 'Upload', action: actions.resetSync }\n };\n break;\n\n case 'file-has-reset':\n case 'file-has-new-key':\n // These two cases happen when the current group or key on\n // the server does not match the local one. This can mean a\n // few things depending on the state, and we try to show an\n // appropriate message and call to action to fix it.\n let { groupId, cloudFileId } = store.getState().prefs.local;\n\n notif = {\n title: 'Syncing has been reset on this cloud file',\n message:\n 'You need to revert it to continue syncing. Any unsynced ' +\n 'data will be lost. If you like, you can instead ' +\n '[upload this file](#upload) to be the latest version. ' +\n learnMore,\n messageActions: { upload: actions.resetSync },\n sticky: true,\n id: 'needs-revert',\n button: {\n title: 'Revert',\n action: () => actions.closeAndDownloadBudget(cloudFileId)\n }\n };\n break;\n case 'encrypt-failure':\n case 'decrypt-failure':\n if (meta.isMissingKey) {\n notif = {\n title: 'Missing encryption key',\n message:\n 'Unable to encrypt your data because you are missing the key. ' +\n 'Create your key to sync your data.',\n sticky: true,\n id: 'encrypt-failure-missing',\n button: {\n title: 'Create key',\n action: () =>\n actions.pushModal('fix-encryption-key', {\n onSuccess: () => actions.sync()\n })\n }\n };\n } else {\n notif = {\n message:\n 'Unable to encrypt your data. You have the correct ' +\n 'key so this is likely an internal failure. To fix this, ' +\n 'reset your sync data with a new key.',\n sticky: true,\n id: 'encrypt-failure',\n button: {\n title: 'Reset key',\n action: () =>\n actions.pushModal('create-encryption-key', {\n onSuccess: () => actions.sync()\n })\n }\n };\n }\n break;\n case 'invalid-schema':\n notif = {\n title: 'Update required',\n message:\n \"We couldn't apply changes from the server. This probably means you \" +\n 'need to update the app to support the latest database.',\n type: 'warning'\n };\n break;\n case 'apply-failure':\n notif = {\n message:\n \"We couldn't apply that change to the database. This is a bug, \" +\n 'and it has been reported.'\n };\n break;\n case 'beta-version':\n case 'network':\n // Show nothing\n break;\n default:\n notif = {\n message:\n 'We had problems syncing your changes. This is a bug, ' +\n 'and it has been reported.'\n };\n }\n\n if (notif) {\n actions.addNotification({ type: 'error', ...notif });\n }\n }\n });\n}\n","import * as React from 'react';\nimport { useEffect, useMemo } from 'react';\nimport LRU from 'lru-cache';\nimport SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext';\nimport { listen, send } from '../platform/client/fetch';\n\nfunction makeSpreadsheet() {\n const cellObservers = {};\n const LRUValueCache = new LRU({ max: 1200 });\n const cellCache = {};\n let observersDisabled = false;\n\n class Spreadsheet {\n observeCell(name, cb) {\n if (!cellObservers[name]) {\n cellObservers[name] = [];\n }\n cellObservers[name].push(cb);\n\n return () => {\n cellObservers[name] = cellObservers[name].filter(x => x !== cb);\n\n if (cellObservers[name].length === 0) {\n cellCache[name] = null;\n }\n };\n }\n\n disableObservers() {\n observersDisabled = true;\n }\n\n enableObservers() {\n observersDisabled = false;\n }\n\n prewarmCache(name, value) {\n LRUValueCache.set(name, value);\n }\n\n listen() {\n return listen('cells-changed', function(nodes) {\n if (!observersDisabled) {\n // TODO: batch react so only renders once\n nodes.forEach(node => {\n const observers = cellObservers[node.name];\n if (observers) {\n observers.forEach(func => func(node));\n cellCache[node.name] = Promise.resolve(node);\n LRUValueCache.set(node.name, node);\n }\n });\n }\n });\n }\n\n bind(sheetName = '__global', binding, fields, cb) {\n binding =\n typeof binding === 'string' ? { name: binding, value: null } : binding;\n\n let resolvedName = `${sheetName}!${binding.name}`;\n let cleanup = this.observeCell(resolvedName, cb);\n\n // Always synchronously call with the existing value if it has one.\n // This is a display optimization to avoid flicker. The LRU cache\n // will keep a number of recent nodes in memory.\n if (LRUValueCache.has(resolvedName)) {\n cb(LRUValueCache.get(resolvedName));\n }\n\n if (cellCache[resolvedName] != null) {\n cellCache[resolvedName].then(cb);\n } else {\n const req = this.get(sheetName, binding.name, fields);\n cellCache[resolvedName] = req;\n\n req.then(result => {\n // We only want to call the callback if it's still waiting on\n // the same request. If we've received a `cells-changed` event\n // for this already then it's already been called and we don't\n // need to call it again (and potentially could be calling it\n // with an old value depending on the order of messages)\n if (cellCache[resolvedName] === req) {\n LRUValueCache.set(resolvedName, result);\n cb(result);\n }\n });\n }\n\n return cleanup;\n }\n\n get(sheetName, name) {\n return send('getCell', { sheetName, name });\n }\n\n getCellNames(sheetName) {\n return send('getCellNamesInSheet', { sheetName });\n }\n\n createQuery(sheetName, name, query) {\n return send('create-query', {\n sheetName,\n name,\n query: query.serialize()\n });\n }\n }\n\n return new Spreadsheet();\n}\n\nexport function SpreadsheetProvider({ children }) {\n let spreadsheet = useMemo(() => makeSpreadsheet(), []);\n\n useEffect(() => {\n return spreadsheet.listen();\n }, [spreadsheet]);\n\n return (\n <SpreadsheetContext.Provider value={spreadsheet}>\n {children}\n </SpreadsheetContext.Provider>\n );\n}\n","import React from 'react';\n\nconst SvgRefresh = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgRefresh;\n","import React from 'react';\nimport { css } from 'glamor';\nimport { View } from 'loot-design/src/components/common';\nimport Refresh from 'loot-design/src/svg/v1/Refresh';\n\nlet spin = css.keyframes({\n '0%': { transform: 'rotateZ(0deg)' },\n '100%': { transform: 'rotateZ(360deg)' }\n});\n\nlet spinStop = css.keyframes({\n '0%': { transform: 'rotateZ(0deg)' },\n '100%': { transform: 'rotateZ(180deg)' }\n});\n\nexport default function AnimatedRefresh({ animating, iconStyle }) {\n return (\n <View\n style={[{ animation: animating ? `${spin} 1s infinite linear` : null }]}\n >\n <Refresh\n width={14}\n height={14}\n style={{ color: 'currentColor', ...iconStyle }}\n />\n </View>\n );\n}\n","import React, { useState } from 'react';\nimport { connect } from 'react-redux';\nimport { useTransition, animated } from 'react-spring';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View, Text } from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport AnimatedRefresh from './AnimatedRefresh';\n\nfunction BankSyncStatus({ accountsSyncing }) {\n let name = accountsSyncing\n ? accountsSyncing === '__all'\n ? 'accounts'\n : accountsSyncing\n : null;\n\n const transitions = useTransition(name, null, {\n from: { opacity: 0, transform: 'translateY(-100px)' },\n enter: { opacity: 1, transform: 'translateY(0)' },\n leave: { opacity: 0, transform: 'translateY(-100px)' },\n unique: true\n });\n\n return (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n marginTop: 5,\n alignItems: 'center',\n zIndex: 501\n }}\n >\n {transitions.map(\n ({ item, key, props }) =>\n item && (\n <animated.div key={key} style={props}>\n <View\n style={{\n borderRadius: 4,\n backgroundColor: colors.b9,\n color: colors.b1,\n padding: '5px 13px',\n flexDirection: 'row',\n alignItems: 'center',\n boxShadow: styles.shadow\n }}\n >\n <AnimatedRefresh\n animating={true}\n iconStyle={{ color: colors.b1 }}\n />\n <Text>Syncing {item}</Text>\n </View>\n </animated.div>\n )\n )}\n </View>\n );\n}\n\nexport default connect(\n state => ({\n accountsSyncing: state.account.accountsSyncing\n }),\n actions\n)(BankSyncStatus);\n","import React, { useContext, useState } from 'react';\nimport mitt from 'mitt';\n\nexport let BudgetMonthCountContext = React.createContext();\n\nexport function BudgetMonthCountProvider({ children }) {\n let [displayMax, setDisplayMax] = useState(1);\n let emitter = mitt();\n\n return (\n <BudgetMonthCountContext.Provider value={{ displayMax, setDisplayMax }}>\n {children}\n </BudgetMonthCountContext.Provider>\n );\n}\n\nexport function useBudgetMonthCount() {\n return useContext(BudgetMonthCountContext);\n}\n","import React from 'react';\nimport { useHistory } from 'react-router-dom';\nimport { Modal, View, Text } from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\n\nlet PageTypeContext = React.createContext({ type: 'page' });\n\nexport function PageTypeProvider({ type, current, children }) {\n return (\n <PageTypeContext.Provider value={{ type, current }}>\n {children}\n </PageTypeContext.Provider>\n );\n}\n\nexport function usePageType() {\n return React.useContext(PageTypeContext);\n}\n\nfunction PageTitle({ name }) {\n return (\n <Text style={{ fontSize: 25, fontWeight: 500, marginBottom: 15 }}>\n {name}\n </Text>\n );\n}\n\nexport function Page({ title, modalSize, children }) {\n let { type, current } = usePageType();\n let history = useHistory();\n\n if (type === 'modal') {\n let size = modalSize;\n if (typeof modalSize === 'string') {\n size =\n modalSize === 'medium' ? { width: 750, height: 600 } : { width: 600 };\n }\n\n return (\n <Modal\n title={title}\n isCurrent={current}\n size={size}\n onClose={() => history.goBack()}\n >\n {children}\n </Modal>\n );\n }\n\n return (\n <View style={[styles.page, { paddingLeft: 20, paddingRight: 20, flex: 1 }]}>\n <PageTitle name={title} />\n {children}\n </View>\n );\n}\n","let VERSION = Date.now();\n\nexport function makeLocationState(state) {\n return { ...state, _version: VERSION };\n}\n\nexport function getLocationState(location, subfield) {\n if (location.state && location.state._version === VERSION) {\n return subfield ? location.state[subfield] : location.state;\n }\n return null;\n}\n","import React, { useContext } from 'react';\n\nlet ActiveLocationContext = React.createContext(null);\n\nexport function ActiveLocationProvider({ location, children }) {\n return (\n <ActiveLocationContext.Provider value={location} children={children} />\n );\n}\n\nexport function useActiveLocation() {\n return useContext(ActiveLocationContext);\n}\n","import React, { useMemo, useEffect, useState, useContext } from 'react';\nimport q, { liveQuery, runQuery } from 'loot-core/src/client/query-helpers';\nimport { getPayeesById } from 'loot-core/src/client/reducers/queries';\n\nexport function usePayees() {\n let [data, setData] = useState(null);\n\n useEffect(() => {\n let query = liveQuery(q('payees').select('*'), async payees => {\n if (query) {\n setData(payees);\n }\n });\n\n return () => {\n query.unsubscribe();\n query = null;\n };\n }, []);\n\n return data;\n}\n\nlet PayeesContext = React.createContext(null);\n\nexport function PayeesProvider({ children }) {\n let data = usePayees();\n return <PayeesContext.Provider value={data} children={children} />;\n}\n\nexport function CachedPayees({ children, idKey }) {\n let data = useCachedPayees({ idKey });\n return children(data);\n}\n\nexport function useCachedPayees({ idKey } = {}) {\n let data = useContext(PayeesContext);\n return idKey && data ? getPayeesById(data) : data;\n}\n","import React, { useMemo, useEffect, useState, useContext } from 'react';\nimport q, { liveQuery, runQuery } from 'loot-core/src/client/query-helpers';\nimport { getAccountsById } from 'loot-core/src/client/reducers/queries';\n\nexport function useAccounts() {\n let [data, setData] = useState(null);\n\n useEffect(() => {\n let query = liveQuery(q('accounts').select('*'), async accounts => {\n if (query) {\n setData(accounts);\n }\n });\n\n return () => {\n query.unsubscribe();\n query = null;\n };\n }, []);\n\n return data;\n}\n\nlet AccountsContext = React.createContext(null);\n\nexport function AccountsProvider({ children }) {\n let data = useAccounts();\n return <AccountsContext.Provider value={data} children={children} />;\n}\n\nexport function CachedAccounts({ children, idKey }) {\n let data = useCachedAccounts({ idKey });\n return children(data);\n}\n\nexport function useCachedAccounts({ idKey } = {}) {\n let data = useContext(AccountsContext);\n return idKey && data ? getAccountsById(data) : data;\n}\n","import { parse as parseDate, isValid as isDateValid } from 'date-fns';\nimport { currencyToAmount, amountToInteger } from '../shared/util';\nimport {\n dayFromDate,\n getDayMonthRegex,\n getDayMonthFormat,\n getShortYearRegex,\n getShortYearFormat\n} from '../shared/months';\nimport q from '../shared/query';\n\nfunction isInteger(num) {\n return (num | 0) === num;\n}\n\nexport function getAccountFilter(accountId, field = 'account') {\n if (accountId) {\n if (accountId === 'budgeted') {\n return {\n [`${field}.offbudget`]: false,\n [`${field}.closed`]: false\n };\n } else if (accountId === 'offbudget') {\n return {\n [`${field}.offbudget`]: true,\n [`${field}.closed`]: false\n };\n } else if (accountId === 'uncategorized') {\n return {\n [`${field}.offbudget`]: false,\n category: null,\n is_parent: false,\n $or: [\n {\n 'payee.transfer_acct.offbudget': true,\n 'payee.transfer_acct': null\n }\n ]\n };\n } else {\n return { [field]: accountId };\n }\n }\n\n return null;\n}\n\nexport function makeTransactionsQuery(accountId) {\n let query = q('transactions').options({ splits: 'grouped' });\n\n let filter = getAccountFilter(accountId);\n if (filter) {\n query = query.filter(filter);\n }\n\n return query;\n}\n\nexport function makeTransactionSearchQuery(currentQuery, search, dateFormat) {\n let amount = currencyToAmount(search);\n\n // Support various date formats\n let parsedDate;\n if (getDayMonthRegex(dateFormat).test(search)) {\n parsedDate = parseDate(search, getDayMonthFormat(dateFormat), new Date());\n } else if (getShortYearRegex(dateFormat).test(search)) {\n parsedDate = parseDate(search, getShortYearFormat(dateFormat), new Date());\n } else {\n parsedDate = parseDate(search, dateFormat, new Date());\n }\n\n return currentQuery.filter({\n $or: {\n 'payee.name': { $like: `%${search}%` },\n notes: { $like: `%${search}%` },\n 'category.name': { $like: `%${search}%` },\n 'account.name': { $like: `%${search}%` },\n $or: [\n isDateValid(parsedDate) && { date: dayFromDate(parsedDate) },\n amount != null && {\n amount: { $transform: '$abs', $eq: amountToInteger(amount) }\n },\n amount != null &&\n isInteger(amount) && {\n amount: {\n $transform: { $abs: { $idiv: ['$', 100] } },\n $eq: amount\n }\n }\n ].filter(Boolean)\n }\n });\n}\n\nexport function accountBalance(acct) {\n return {\n name: `balance-${acct.id}`,\n query: q('transactions')\n .filter({ account: acct.id })\n .options({ splits: 'none' })\n .calculate({ $sum: '$amount' })\n };\n}\n\nexport function allAccountBalance() {\n return {\n query: q('transactions')\n .filter({ 'account.closed': false })\n .calculate({ $sum: '$amount' }),\n name: 'accounts-balance'\n };\n}\n\nexport function budgetedAccountBalance() {\n return {\n name: `budgeted-accounts-balance`,\n query: q('transactions')\n .filter({ 'account.offbudget': false, 'account.closed': false })\n .calculate({ $sum: '$amount' })\n };\n}\n\nexport function offbudgetAccountBalance() {\n return {\n name: `offbudget-accounts-balance`,\n query: q('transactions')\n .filter({ 'account.offbudget': true, 'account.closed': false })\n .calculate({ $sum: '$amount' })\n };\n}\n\nlet uncategorizedQuery = q('transactions').filter({\n 'account.offbudget': false,\n category: null,\n $or: [\n {\n 'payee.transfer_acct.offbudget': true,\n 'payee.transfer_acct': null\n }\n ]\n});\n\nexport function uncategorizedBalance() {\n return {\n name: 'uncategorized-balance',\n query: uncategorizedQuery.calculate({ $sum: '$amount' })\n };\n}\n\nexport function uncategorizedCount() {\n return {\n name: 'uncategorized-amount',\n query: uncategorizedQuery.calculate({ $count: '$id' })\n };\n}\n\nexport const rolloverBudget = {\n incomeAvailable: 'available-funds',\n lastMonthOverspent: 'last-month-overspent',\n forNextMonth: 'buffered',\n totalBudgeted: 'total-budgeted',\n toBudget: 'to-budget',\n\n fromLastMonth: 'from-last-month',\n totalIncome: 'total-income',\n totalSpent: 'total-spent',\n totalBalance: 'total-leftover',\n\n groupSumAmount: id => `group-sum-amount-${id}`,\n groupIncomeReceived: 'total-income',\n\n groupBudgeted: id => `group-budget-${id}`,\n groupBalance: id => `group-leftover-${id}`,\n\n catBudgeted: id => `budget-${id}`,\n catSumAmount: id => `sum-amount-${id}`,\n catBalance: id => `leftover-${id}`,\n catCarryover: id => `carryover-${id}`\n};\n\nexport const reportBudget = {\n totalBudgetedExpense: 'total-budgeted',\n totalBudgetedIncome: 'total-budget-income',\n totalBudgetedSaved: 'total-saved',\n\n totalIncome: 'total-income',\n totalSpent: 'total-spent',\n totalSaved: 'real-saved',\n\n totalLeftover: 'total-leftover',\n groupSumAmount: id => `group-sum-amount-${id}`,\n groupIncomeReceived: 'total-income',\n\n groupBudgeted: id => `group-budget-${id}`,\n groupBalance: id => `group-leftover-${id}`,\n\n catBudgeted: id => `budget-${id}`,\n catSumAmount: id => `sum-amount-${id}`,\n catBalance: id => `leftover-${id}`,\n catCarryover: id => `carryover-${id}`\n};\n","import React from 'react';\n\nconst SvgCalendar = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCalendar;\n","import React, { useState, useLayoutEffect } from 'react';\nimport { styles, colors } from 'loot-design/src/style';\nimport { View, Text } from 'loot-design/src/components/common';\nimport { useBudgetMonthCount } from 'loot-design/src/components/budget/BudgetMonthCountContext';\nimport CalendarIcon from 'loot-design/src/svg/v2/Calendar';\n\nfunction Calendar({ color, onClick }) {\n return (\n <CalendarIcon\n style={{ width: 13, height: 13, color: color, marginRight: 5 }}\n onClick={onClick}\n />\n );\n}\n\nexport function MonthCountSelector({ maxMonths, onChange }) {\n let { displayMax } = useBudgetMonthCount();\n\n let style = { width: 15, height: 15, color: colors.n8 };\n let activeStyle = { color: colors.n5 };\n\n // It doesn't make sense to show anything if we can only fit one\n // month\n if (displayMax <= 1) {\n return null;\n }\n\n let calendars = [];\n for (let i = 1; i <= displayMax; i++) {\n calendars.push(\n <Calendar\n key={i}\n color={maxMonths >= i ? colors.n5 : colors.n8}\n onClick={() => onChange(i)}\n />\n );\n }\n\n return (\n <View\n style={{\n flexDirection: 'row',\n marginRight: 20,\n marginTop: -1,\n '& svg': {\n transition: 'transform .15s'\n },\n '& svg:hover': {\n transform: 'scale(1.2)'\n }\n }}\n title=\"Choose the number of months shown at a time\"\n >\n {calendars}\n </View>\n );\n}\n","import React from 'react';\n\nconst SvgArrowButtonRight1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowButtonRight1;\n","import React from 'react';\n\nconst SvgNavigationMenu = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <rect\n x={0.5}\n y={2.5}\n width={23}\n height={3}\n rx={1}\n ry={1}\n fill=\"currentColor\"\n />\n <rect\n x={0.5}\n y={10.5}\n width={23}\n height={3}\n rx={1}\n ry={1}\n fill=\"currentColor\"\n />\n <rect\n x={0.5}\n y={18.5}\n width={23}\n height={3}\n rx={1}\n ry={1}\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgNavigationMenu;\n","import React from 'react';\n\nconst SvgArrowLeft = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowLeft;\n","import React from 'react';\n\nconst SvgAlertTriangle = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgAlertTriangle;\n","import React from 'react';\n\nconst SvgExclamationOutline = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgExclamationOutline;\n","import { send } from 'loot-core/src/platform/client/fetch';\n\nfunction _authorize(pushModal, plaidToken, { onSuccess, onClose }) {\n pushModal('plaid-external-msg', {\n onMoveExternal: async () => {\n let token = await send('create-web-token');\n let url = 'http://link.actualbudget.com/?token=' + token;\n // let url = 'http://localhost:8080/?token=' + token;\n if (plaidToken) {\n url = url + '&plaidToken=' + plaidToken;\n }\n window.Actual.openURLInBrowser(url);\n\n let { error, data } = await send('poll-web-token', { token });\n\n return { error, data };\n },\n\n onClose,\n onSuccess\n });\n}\n\nexport async function authorizeBank(pushModal, { upgradingId } = {}) {\n _authorize(pushModal, null, {\n onSuccess: async data => {\n pushModal('select-linked-accounts', {\n institution: data.metadata.institution,\n publicToken: data.publicToken,\n accounts: data.metadata.accounts,\n upgradingId\n });\n }\n });\n}\n\nexport async function reauthorizeBank(pushModal, bankId, onSuccess) {\n let { error, linkToken } = await send('make-plaid-public-token', {\n bankId\n });\n\n // We don't do anything with the error right now\n if (!linkToken) {\n return false;\n }\n\n // When the modal is closed here, always try to re-sync the account\n // by calling `onSuccess`\n _authorize(pushModal, linkToken, { onSuccess, onClose: onSuccess });\n return true;\n}\n","import React, { useState } from 'react';\nimport { Route, withRouter } from 'react-router-dom';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View, Text, Button, Tooltip } from 'loot-design/src/components/common';\nimport ExclamationOutline from 'loot-design/src/svg/v1/ExclamationOutline';\nimport { colors } from 'loot-design/src/style';\nimport { reauthorizeBank } from '../../plaid';\n\nfunction getErrorMessage(type, code) {\n switch (type.toUpperCase()) {\n case 'ITEM_ERROR':\n switch (code.toUpperCase()) {\n case 'NO_ACCOUNTS':\n return 'No open accounts could be found. Did you close the account? If so, unlink the account.';\n case 'ITEM_LOGIN_REQUIRED':\n return 'Your password or something else has changed with your bank and you need to login again.';\n default:\n }\n break;\n\n case 'INVALID_INPUT':\n switch (code.toUpperCase()) {\n case 'INVALID_ACCESS_TOKEN':\n return 'Item is no longer authorized. You need to login again.';\n default:\n }\n break;\n\n case 'API_ERROR':\n switch (code.toUpperCase()) {\n case 'PLANNED_MAINTENANCE':\n return 'Our servers are currently undergoing maintenance and will be available again soon.';\n default:\n }\n break;\n\n case 'RATE_LIMIT_EXCEEDED':\n return 'Rate limit exceeded for this item. Please try again later.';\n\n default:\n }\n\n return 'An internal error occurred. Try to login again, or contact help@actualbudget.com for support.';\n}\n\nfunction AccountSyncCheck({\n id,\n accounts,\n failedAccounts,\n syncAndDownload,\n markAccountSuccess,\n unlinkAccount,\n pushModal,\n closeModal,\n getAccounts,\n addNotification\n}) {\n if (!failedAccounts) {\n return null;\n }\n\n let error = failedAccounts.get(id);\n if (!error) {\n return null;\n }\n\n let [open, setOpen] = useState(false);\n\n let account = accounts.find(account => account.id === id);\n let { type, code } = error;\n let showAuth =\n (type === 'ITEM_ERROR' && code === 'ITEM_LOGIN_REQUIRED') ||\n (type === 'INVALID_INPUT' && code === 'INVALID_ACCESS_TOKEN');\n\n function reauth() {\n setOpen(false);\n\n let modalOpened = reauthorizeBank(pushModal, account.bankId, () => {\n closeModal();\n\n // Re-sync accounts. If there are multiple failed account, that\n // means all accounts were synced to resync all of them.\n // Multiple accounts can be tied to the same bank id.\n syncAndDownload(failedAccounts.size > 1 ? null : account.id);\n });\n\n if (!modalOpened) {\n addNotification({\n type: 'error',\n message: 'Unable to process this item, sorry!'\n });\n }\n }\n\n async function unlink() {\n unlinkAccount(account.id);\n setOpen(false);\n }\n\n return (\n <View>\n <Button\n bare\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n color: colors.r5,\n backgroundColor: colors.r10,\n padding: '4px 8px',\n borderRadius: 4\n }}\n onClick={() => setOpen(true)}\n >\n <ExclamationOutline\n style={{\n width: 14,\n height: 14,\n marginRight: 5,\n color: 'currentColor'\n }}\n />{' '}\n This account is experiencing connection problems. Let{\"'\"}s fix it.\n </Button>\n\n {open && (\n <Tooltip\n position=\"bottom-left\"\n onClose={() => setOpen(false)}\n style={{ fontSize: 14, padding: 15, maxWidth: 400 }}\n >\n <div style={{ marginBottom: '1.15em' }}>\n The server returned the following error:\n </div>\n\n <div style={{ marginBottom: '1.25em', color: colors.r5 }}>\n {getErrorMessage(error.type, error.code)}\n </div>\n\n <View style={{ justifyContent: 'flex-end', flexDirection: 'row' }}>\n {showAuth ? (\n <>\n <Button onClick={unlink}>Unlink</Button>\n <Button primary onClick={reauth} style={{ marginLeft: 5 }}>\n Reauthorize\n </Button>\n </>\n ) : (\n <Button onClick={unlink}>Unlink account</Button>\n )}\n </View>\n </Tooltip>\n )}\n </View>\n );\n}\n\nexport default connect(\n state => ({\n accounts: state.queries.accounts,\n failedAccounts: state.account.failedAccounts\n }),\n actions\n)(AccountSyncCheck);\n","import React from 'react';\nimport format from './format';\nimport SheetValue from './SheetValue';\nimport Text from '../Text';\nimport { styles } from '../../style';\n\nfunction CellValue({ binding, type, formatter, style, getStyle, debug }) {\n return (\n <SheetValue binding={binding} debug={debug}>\n {({ name, value }) => {\n return (\n <Text\n style={[\n type === 'financial' && styles.tnum,\n style,\n getStyle && getStyle(value)\n ]}\n numberOfLines={1}\n data-testid={name}\n data-cellname={name}\n >\n {formatter ? formatter(value) : format(value, type)}\n </Text>\n );\n }}\n </SheetValue>\n );\n}\n\nexport default CellValue;\n","import React from 'react';\n\nconst SvgAdd = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n fill=\"currentColor\"\n className=\"path\"\n 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\"\n />\n <path\n fill=\"currentColor\"\n className=\"path\"\n 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\"\n />\n </svg>\n);\n\nexport default SvgAdd;\n","import React from 'react';\n\nconst SvgWallet = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgWallet;\n","import React from 'react';\n\nconst SvgReports = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgReports;\n","import React from 'react';\n\nconst SvgArrowButtonLeft1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowButtonLeft1;\n","import React from 'react';\n\nconst SvgPiggyBank = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <g clipPath=\"url(#piggy-bank_svg__clip0)\">\n <path\n 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\"\n fill=\"currentColor\"\n />\n </g>\n <defs>\n <clipPath id=\"piggy-bank_svg__clip0\">\n <path fill=\"currentColor\" d=\"M0 0h20v20H0z\" />\n </clipPath>\n </defs>\n </svg>\n);\n\nexport default SvgPiggyBank;\n","import React from 'react';\n\nconst SvgCog = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCog;\n","import React, {\n useEffect,\n useRef,\n useLayoutEffect,\n useMemo,\n useState,\n useContext\n} from 'react';\nimport { useDrag, useDrop } from 'react-dnd';\nimport { colors } from '../style';\nimport { View } from './common';\n\nexport function useMergedRefs(ref1, ref2) {\n return useMemo(() => {\n function ref(value) {\n [ref1, ref2].forEach(ref => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n ref.current = value;\n }\n });\n }\n\n return ref;\n }, [ref1, ref2]);\n}\n\nexport function useDraggable({\n item,\n type,\n makePreview,\n children,\n canDrag,\n onDragChange\n}) {\n let _onDragChange = useRef(onDragChange);\n\n //eslint-disable-next-line\n const [{ isDragging }, dragRef] = useDrag({\n item: { type, item },\n collect: monitor => ({ isDragging: monitor.isDragging() }),\n\n begin(monitor) {\n _onDragChange.current({ state: 'start-preview', type, item });\n\n setTimeout(() => {\n _onDragChange.current({ state: 'start' });\n }, 0);\n },\n\n end(item, monitor) {\n _onDragChange.current({ state: 'end', type, item });\n },\n\n canDrag() {\n return canDrag;\n }\n });\n\n useLayoutEffect(() => {\n _onDragChange.current = onDragChange;\n });\n\n return { dragRef };\n}\n\nexport function useDroppable({ types, id, onDrop, onLongHover }) {\n let ref = useRef(null);\n let [dropPos, setDropPos] = useState(null);\n\n // eslint-disable-next-line\n let [{ isOver }, dropRef] = useDrop({\n accept: types,\n drop({ item }, monitor) {\n onDrop(item.id, dropPos, id);\n },\n hover({ item, type }, monitor) {\n let hoverBoundingRect = ref.current.getBoundingClientRect();\n let hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n let clientOffset = monitor.getClientOffset();\n let hoverClientY = clientOffset.y - hoverBoundingRect.top;\n let pos = hoverClientY < hoverMiddleY ? 'top' : 'bottom';\n\n setDropPos(pos);\n },\n collect(monitor) {\n return { isOver: monitor.isOver() };\n }\n });\n\n useEffect(() => {\n let timeout;\n if (onLongHover && isOver) {\n timeout = setTimeout(onLongHover, 700);\n }\n\n return () => timeout && clearTimeout(timeout);\n }, [isOver]);\n\n return {\n dropRef: useMergedRefs(dropRef, ref),\n dropPos: isOver ? dropPos : null\n };\n}\n\nexport const DropHighlightPosContext = React.createContext(null);\n\nexport function DropHighlight({ pos, offset = {} }) {\n if (pos == null) {\n return null;\n }\n\n let itemPos = useContext(DropHighlightPosContext);\n let topOffset = (itemPos === 'first' ? 2 : 0) + (offset.top || 0);\n let bottomOffset = (itemPos === 'last' ? 2 : 0) + (offset.bottom || 0);\n\n let posStyle =\n pos === 'top' ? { top: -2 + topOffset } : { bottom: -1 + bottomOffset };\n\n return (\n <View\n style={[\n {\n position: 'absolute',\n left: 2,\n right: 2,\n borderRadius: 3,\n height: 3,\n background: `linear-gradient(90deg, ${colors.b4} 0%, ${colors.b5} 100%)`,\n zIndex: 10000,\n pointerEvents: 'none'\n },\n posStyle\n ]}\n />\n );\n}\n","import React, { useState, useMemo } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { css } from 'glamor';\nimport {\n View,\n Block,\n AlignedText,\n AnchorLink,\n ButtonLink,\n Button,\n Menu,\n Tooltip\n} from './common';\nimport { pushModal } from 'loot-core/src/client/actions/modals';\nimport { closeBudget } from 'loot-core/src/client/actions/budgets';\nimport Platform from 'loot-core/src/client/platform';\nimport CellValue from './spreadsheet/CellValue';\nimport Add from '../svg/v1/Add';\nimport CalendarIcon from '../svg/v2/Calendar';\nimport { styles, colors } from '../style';\nimport Wallet from '../svg/v1/Wallet';\nimport Reports from '../svg/v1/Reports';\nimport ArrowButtonLeft1 from '../svg/v2/ArrowButtonLeft1';\nimport PiggyBank from 'loot-design/src/svg/v1/PiggyBank';\nimport Cog from '../svg/v1/Cog';\nimport DotsHorizontalTriple from '../svg/v1/DotsHorizontalTriple';\n\nimport { useDraggable, useDroppable, DropHighlight } from './sort.js';\n\nexport const SIDEBAR_WIDTH = 240;\n\nexport function Item({\n children,\n icon,\n title,\n style,\n to,\n exact,\n onButtonPress\n}) {\n const showButton = title === 'Accounts';\n\n return (\n <View style={style}>\n <AnchorLink\n style={[\n {\n ...styles.mediumText,\n paddingTop: 9,\n paddingBottom: 9,\n paddingLeft: 19,\n paddingRight: 10,\n textDecoration: 'none',\n color: colors.n9\n },\n { ':hover': { backgroundColor: colors.n2 } }\n ]}\n to={to}\n exact={exact}\n activeStyle={{\n borderLeft: '4px solid ' + colors.p8,\n paddingLeft: 19 - 4,\n color: colors.p8\n }}\n >\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n height: 20\n }}\n >\n {icon}\n <Block style={{ marginLeft: 8 }}>{title}</Block>\n <View style={{ flex: 1 }} />\n {showButton && (\n <Button\n bare\n onClick={e => {\n e.stopPropagation();\n e.preventDefault();\n onButtonPress();\n }}\n >\n <Add width={12} height={12} style={{ color: colors.n6 }} />\n </Button>\n )}\n </View>\n </AnchorLink>\n\n {children ? <View style={{ marginTop: 5 }}>{children}</View> : null}\n </View>\n );\n}\n\nlet accountNameStyle = [\n {\n marginTop: -2,\n marginBottom: 2,\n paddingTop: 4,\n paddingBottom: 4,\n paddingRight: 15,\n paddingLeft: 10,\n textDecoration: 'none',\n color: colors.n9\n },\n { ':hover': { backgroundColor: colors.n2 } },\n styles.smallText\n];\n\nfunction Account({\n name,\n account,\n connected,\n failed,\n updated,\n to,\n query,\n style,\n outerStyle,\n onDragChange,\n onDrop\n}) {\n let type = account\n ? account.closed\n ? 'account-closed'\n : account.offbudget\n ? 'account-offbudget'\n : 'account-onbudget'\n : 'title';\n\n let { dragRef } = useDraggable({\n type,\n onDragChange,\n item: { id: account && account.id },\n canDrag: account != null\n });\n\n let { dropRef, dropPos } = useDroppable({\n types: account ? [type] : [],\n id: account && account.id,\n onDrop: onDrop\n });\n\n return (\n <View innerRef={dropRef} style={[{ flexShrink: 0 }, outerStyle]}>\n <View>\n <DropHighlight pos={dropPos} />\n <View innerRef={dragRef}>\n <AnchorLink\n ref={dragRef}\n to={to}\n style={[\n accountNameStyle,\n style,\n { position: 'relative', borderLeft: '4px solid transparent' },\n updated && { fontWeight: 700 }\n ]}\n activeStyle={{\n borderColor: colors.p8,\n color: colors.p8,\n // This is kind of a hack, but we don't ever want the account\n // that the user is looking at to be \"bolded\" which means it\n // has unread transactions. The system does mark is read and\n // unbolds it, but it still \"flashes\" bold so this just\n // ignores it if it's active\n fontWeight: 'normal',\n '& .dot': {\n backgroundColor: colors.p8,\n transform: 'translateX(-4.5px)'\n }\n }}\n >\n <View\n style={{\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n flexDirection: 'row',\n alignItems: 'center'\n }}\n >\n <div\n className=\"dot\"\n {...css({\n marginRight: 3,\n width: 5,\n height: 5,\n borderRadius: 5,\n backgroundColor: failed ? colors.r7 : colors.g5,\n marginLeft: 2,\n transition: 'transform .3s',\n opacity: connected ? 1 : 0\n })}\n />\n </View>\n\n <AlignedText\n left={name}\n right={\n <CellValue debug={true} binding={query} type=\"financial\" />\n }\n />\n </AnchorLink>\n </View>{' '}\n </View>\n </View>\n );\n}\n\nexport function Accounts({\n accounts,\n failedAccounts,\n updatedAccounts,\n to,\n icon,\n history,\n getAccountPath,\n budgetedAccountPath,\n offBudgetAccountPath,\n getBalanceQuery,\n getOnBudgetBalance,\n getOffBudgetBalance,\n showClosedAccounts,\n onAddAccount,\n onToggleClosedAccounts,\n onReorder\n}) {\n let [isDragging, setIsDragging] = useState(false);\n let offbudgetAccounts = useMemo(\n () =>\n accounts.filter(\n account => account.closed === 0 && account.offbudget === 1\n ),\n [accounts]\n );\n let budgetedAccounts = useMemo(\n () =>\n accounts.filter(\n account => account.closed === 0 && account.offbudget === 0\n ),\n [accounts]\n );\n let closedAccounts = useMemo(\n () => accounts.filter(account => account.closed === 1),\n [accounts]\n );\n\n function onDragChange(drag) {\n setIsDragging(drag.state === 'start');\n }\n\n let makeDropPadding = (i, length) => {\n if (i === 0) {\n return {\n paddingTop: isDragging ? 15 : 0,\n marginTop: isDragging ? -15 : 0\n };\n } else if (i === length - 1) {\n return {\n paddingBottom: 15\n };\n }\n return null;\n };\n\n return (\n <Item\n title=\"Accounts\"\n to={to}\n icon={icon}\n exact={true}\n style={{ marginBottom: 5, flex: 1 }}\n onButtonPress={onAddAccount}\n >\n <View style={{ overflow: 'auto', marginTop: -5 }}>\n {budgetedAccounts.length > 0 && (\n <Account\n name=\"For budget\"\n to={budgetedAccountPath}\n query={getOnBudgetBalance()}\n style={{ marginTop: 15, color: colors.n6 }}\n />\n )}\n\n {budgetedAccounts.map((account, i) => (\n <Account\n key={account.id}\n name={account.name}\n account={account}\n connected={!!account.bankId}\n failed={failedAccounts && failedAccounts.has(account.id)}\n updated={updatedAccounts && updatedAccounts.includes(account.id)}\n to={getAccountPath(account)}\n query={getBalanceQuery(account)}\n onDragChange={onDragChange}\n onDrop={onReorder}\n outerStyle={makeDropPadding(i, budgetedAccounts.length)}\n />\n ))}\n\n {offbudgetAccounts.length > 0 && (\n <Account\n name=\"Off budget\"\n to={offBudgetAccountPath}\n query={getOffBudgetBalance()}\n style={{ color: colors.n6 }}\n />\n )}\n\n {offbudgetAccounts.map((account, i) => (\n <Account\n key={account.id}\n name={account.name}\n account={account}\n connected={!!account.bankId}\n failed={failedAccounts && failedAccounts.has(account.id)}\n updated={updatedAccounts && updatedAccounts.includes(account.id)}\n to={getAccountPath(account)}\n query={getBalanceQuery(account)}\n onDragChange={onDragChange}\n onDrop={onReorder}\n outerStyle={makeDropPadding(i, offbudgetAccounts.length)}\n />\n ))}\n\n {closedAccounts.length > 0 && (\n <View\n style={[\n accountNameStyle,\n {\n marginTop: 15,\n color: colors.n6,\n flexDirection: 'row',\n userSelect: 'none',\n alignItems: 'center',\n flexShrink: 0\n }\n ]}\n onClick={onToggleClosedAccounts}\n >\n {'Closed Accounts' + (showClosedAccounts ? '' : '...')}\n </View>\n )}\n\n {showClosedAccounts &&\n closedAccounts.map((account, i) => (\n <Account\n key={account.id}\n name={account.name}\n account={account}\n to={getAccountPath(account)}\n query={getBalanceQuery(account)}\n onDragChange={onDragChange}\n onDrop={onReorder}\n />\n ))}\n </View>\n </Item>\n );\n}\n\nfunction ToggleButton({ style, onFloat }) {\n return (\n <View className=\"float\" style={[style, { flexShrink: 0 }]}>\n <Button bare onClick={onFloat}>\n <ArrowButtonLeft1 style={{ width: 13, height: 13, color: colors.n5 }} />\n </Button>\n </View>\n );\n}\n\nconst MenuButton = withRouter(function MenuButton({ history }) {\n let dispatch = useDispatch();\n let [menuOpen, setMenuOpen] = useState(false);\n\n function onMenuSelect(type) {\n setMenuOpen(false);\n\n switch (type) {\n case 'open-payees':\n dispatch(pushModal('manage-payees'));\n break;\n case 'open-rules':\n dispatch(pushModal('manage-rules'));\n break;\n case 'find-schedules':\n history.push('/schedule/discover', { locationPtr: history.location });\n break;\n case 'repair-splits':\n history.push('/tools/fix-splits', { locationPtr: history.location });\n break;\n case 'settings':\n history.push('/settings');\n break;\n case 'close':\n dispatch(closeBudget());\n break;\n default:\n }\n }\n\n let items = [\n { name: 'open-payees', text: 'Manage Payees' },\n { name: 'open-rules', text: 'Manage Rules' },\n { name: 'find-schedules', text: 'Find schedules' },\n { name: 'repair-splits', text: 'Repair split transactions' },\n Menu.line,\n { name: 'settings', text: 'Settings' },\n { name: 'close', text: 'Close File' }\n ];\n\n return (\n <Button\n bare\n style={{\n color: colors.n5,\n flexShrink: 0\n }}\n activeStyle={{ color: colors.p7 }}\n onClick={() => setMenuOpen(true)}\n >\n <DotsHorizontalTriple\n width={15}\n height={15}\n style={{ color: 'inherit', transform: 'rotateZ(0deg)' }}\n />\n {menuOpen && (\n <Tooltip\n position=\"bottom-right\"\n style={{ padding: 0 }}\n onClose={() => setMenuOpen(false)}\n >\n <Menu onMenuSelect={onMenuSelect} items={items} />\n </Tooltip>\n )}\n </Button>\n );\n});\n\nexport function Sidebar({\n style,\n budgetName,\n accounts,\n failedAccounts,\n updatedAccounts,\n getBalanceQuery,\n getOnBudgetBalance,\n getOffBudgetBalance,\n showClosedAccounts,\n isFloating,\n onFloat,\n onAddAccount,\n onToggleClosedAccounts,\n onReorder\n}) {\n let hasWindowButtons = !Platform.isBrowser && Platform.OS === 'mac';\n\n return (\n <View\n style={[\n {\n width: SIDEBAR_WIDTH,\n color: colors.n9,\n overflow: 'auto',\n backgroundColor: colors.n1,\n '& .float': {\n opacity: 0,\n transition: 'opacity .25s, width .25s',\n width: hasWindowButtons ? null : 0\n },\n '&:hover .float': {\n opacity: 1,\n width: hasWindowButtons ? null : 'auto'\n }\n },\n style\n ]}\n >\n {hasWindowButtons && (\n <ToggleButton\n style={[\n {\n height: isFloating ? 0 : 36,\n alignItems: 'flex-end',\n justifyContent: 'center',\n overflow: 'hidden',\n WebkitAppRegion: 'drag',\n paddingRight: 8\n }\n ]}\n onFloat={onFloat}\n />\n )}\n <View\n style={[\n {\n paddingTop: 35,\n height: 30,\n flexDirection: 'row',\n alignItems: 'center',\n margin: '0 8px 23px 20px',\n transition: 'padding .4s'\n },\n hasWindowButtons && {\n paddingTop: 20,\n justifyContent: 'flex-start'\n }\n ]}\n >\n {budgetName}\n\n {!Platform.isBrowser && (\n <ButtonLink\n bare\n to=\"/settings\"\n style={{\n // Needed for Windows? No idea why this is displayed as block\n display: 'inherit',\n color: colors.n5,\n marginLeft: hasWindowButtons ? 0 : 5,\n flexShrink: 0\n }}\n activeStyle={{ color: colors.p7 }}\n >\n <Cog width={15} height={15} style={{ color: 'inherit' }} />\n </ButtonLink>\n )}\n\n <View style={{ flex: 1, flexDirection: 'row' }} />\n\n {!hasWindowButtons && <ToggleButton onFloat={onFloat} />}\n {Platform.isBrowser && <MenuButton />}\n </View>\n <Item\n title=\"Budget\"\n icon={<Wallet width={15} height={15} style={{ color: 'inherit' }} />}\n to=\"/budget\"\n />\n <Item\n title=\"Reports\"\n icon={<Reports width={15} height={15} style={{ color: 'inherit' }} />}\n to=\"/reports\"\n />\n <Item\n title=\"Schedules\"\n icon={\n <CalendarIcon width={15} height={15} style={{ color: 'inherit' }} />\n }\n to=\"/schedules\"\n />\n <Accounts\n to=\"/accounts\"\n icon={<PiggyBank width={15} height={15} style={{ color: 'inherit' }} />}\n accounts={accounts}\n failedAccounts={failedAccounts}\n updatedAccounts={updatedAccounts}\n getAccountPath={account => `/accounts/${account.id}`}\n budgetedAccountPath=\"/accounts/budgeted\"\n offBudgetAccountPath=\"/accounts/offbudget\"\n getBalanceQuery={getBalanceQuery}\n getOnBudgetBalance={getOnBudgetBalance}\n getOffBudgetBalance={getOffBudgetBalance}\n showClosedAccounts={showClosedAccounts}\n onAddAccount={onAddAccount}\n onToggleClosedAccounts={onToggleClosedAccounts}\n onReorder={onReorder}\n />\n </View>\n );\n}\n","import React, { useState, useEffect } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { select } from 'glamor';\nimport lively from '@jlongster/lively';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { styles, colors } from 'loot-design/src/style';\nimport {\n Button,\n Input,\n InitialFocus,\n View,\n Text\n} from 'loot-design/src/components/common';\nimport { Sidebar } from 'loot-design/src/components/sidebar';\nimport * as actions from 'loot-core/src/client/actions';\nimport * as queries from 'loot-core/src/client/queries';\n\nfunction EditableBudgetName({ prefs, savePrefs }) {\n const [editing, setEditing] = useState(false);\n\n if (editing) {\n return (\n <InitialFocus>\n <Input\n style={{\n width: 160,\n fontSize: 16,\n fontWeight: 500\n }}\n defaultValue={prefs.budgetName}\n onEnter={async e => {\n const newBudgetName = e.target.value;\n if (newBudgetName.trim() !== '') {\n await savePrefs({\n budgetName: e.target.value\n });\n setEditing(false);\n }\n }}\n onBlur={() => setEditing(false)}\n />\n </InitialFocus>\n );\n } else {\n return (\n <Button\n bare\n style={{\n color: colors.n9,\n fontSize: 16,\n fontWeight: 500,\n marginLeft: -5,\n flex: '0 auto'\n }}\n onClick={() => setEditing(true)}\n >\n <Text style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>\n {prefs.budgetName || 'A budget has no name'}\n </Text>\n </Button>\n );\n }\n}\n\nfunction SidebarWithData({\n accounts,\n failedAccounts,\n updatedAccounts,\n replaceModal,\n prefs,\n floatingSidebar,\n savePrefs,\n saveGlobalPrefs,\n getAccounts\n}) {\n useEffect(() => void getAccounts(), [getAccounts]);\n\n async function onReorder(id, dropPos, targetId) {\n if (dropPos === 'bottom') {\n let idx = accounts.findIndex(a => a.id === targetId) + 1;\n targetId = idx < accounts.length ? accounts[idx].id : null;\n }\n\n await send('account-move', { id, targetId });\n await getAccounts();\n }\n\n return (\n <Sidebar\n isFloating={floatingSidebar}\n budgetName={<EditableBudgetName prefs={prefs} savePrefs={savePrefs} />}\n accounts={accounts}\n failedAccounts={failedAccounts}\n updatedAccounts={updatedAccounts}\n getBalanceQuery={queries.accountBalance}\n getOnBudgetBalance={queries.budgetedAccountBalance}\n getOffBudgetBalance={queries.offbudgetAccountBalance}\n onFloat={() => saveGlobalPrefs({ floatingSidebar: !floatingSidebar })}\n onReorder={onReorder}\n onAddAccount={() =>\n replaceModal(\n prefs['flags.syncAccount'] ? 'add-account' : 'add-local-account'\n )\n }\n showClosedAccounts={prefs['ui.showClosedAccounts']}\n onToggleClosedAccounts={() =>\n savePrefs({\n 'ui.showClosedAccounts': !prefs['ui.showClosedAccounts']\n })\n }\n style={[{ flex: 1 }, styles.darkScrollbar]}\n />\n );\n}\n\nexport default withRouter(\n connect(\n state => ({\n accounts: state.queries.accounts,\n failedAccounts: state.account.failedAccounts,\n updatedAccounts: state.queries.updatedAccounts,\n prefs: state.prefs.local,\n floatingSidebar: state.prefs.global.floatingSidebar\n }),\n dispatch => bindActionCreators(actions, dispatch)\n )(SidebarWithData)\n);\n","import React, { useState, useEffect, useContext } from 'react';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport mitt from 'mitt';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View } from 'loot-design/src/components/common';\nimport { SIDEBAR_WIDTH } from 'loot-design/src/components/sidebar';\nimport { colors } from 'loot-design/src/style';\n\nimport SidebarWithData from './SidebarWithData';\n\nconst SidebarContext = React.createContext(null);\n\nexport function SidebarProvider({ children }) {\n let emitter = mitt();\n return (\n <SidebarContext.Provider\n value={{\n show: () => emitter.emit('show'),\n hide: () => emitter.emit('hide'),\n on: (name, listener) => {\n emitter.on(name, listener);\n return () => emitter.off(name, listener);\n }\n }}\n >\n {children}\n </SidebarContext.Provider>\n );\n}\n\nexport function useSidebar() {\n return useContext(SidebarContext);\n}\n\nfunction Sidebar({ floatingSidebar }) {\n let [hidden, setHidden] = useState(true);\n let sidebar = useSidebar();\n\n if (!floatingSidebar && hidden) {\n setHidden(false);\n }\n\n useEffect(() => {\n let cleanups = [\n sidebar.on('show', () => setHidden(false)),\n sidebar.on('hide', () => setHidden(true))\n ];\n return () => {\n cleanups.forEach(fn => fn());\n };\n }, [sidebar]);\n\n return (\n <>\n {floatingSidebar && (\n <View\n onMouseOver={() => setHidden(false)}\n onMouseLeave={() => setHidden(true)}\n style={{\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n width: hidden ? 0 : 160,\n zIndex: 999\n }}\n ></View>\n )}\n\n <View\n onMouseOver={\n floatingSidebar\n ? e => {\n e.stopPropagation();\n setHidden(false);\n }\n : null\n }\n onMouseLeave={floatingSidebar ? () => setHidden(true) : null}\n style={{\n position: 'absolute',\n top: 50,\n // If not floating, the -50 takes into account the transform below\n bottom: floatingSidebar ? 50 : -50,\n zIndex: 1001,\n borderRadius: '0 6px 6px 0',\n overflow: 'hidden',\n boxShadow:\n !floatingSidebar || hidden\n ? 'none'\n : '0 15px 30px 0 rgba(0,0,0,0.25), 0 3px 15px 0 rgba(0,0,0,.5)',\n transform: `translateY(${!floatingSidebar ? -50 : 0}px)\n translateX(${hidden ? -SIDEBAR_WIDTH : 0}px)`,\n transition: 'transform .5s, box-shadow .5s'\n }}\n >\n <SidebarWithData />\n </View>\n\n <View\n style={[\n {\n backgroundColor: colors.n1,\n opacity: floatingSidebar ? 0 : 1,\n transform: `translateX(${floatingSidebar ? -50 : 0}px)`,\n transition: 'transform .4s, opacity .2s',\n width: SIDEBAR_WIDTH\n },\n floatingSidebar && {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0\n }\n ]}\n ></View>\n </>\n );\n}\n\nexport default withRouter(\n connect(\n state => ({ floatingSidebar: state.prefs.global.floatingSidebar }),\n actions\n )(Sidebar)\n);\n","import React, {\n useState,\n useEffect,\n useRef,\n useCallback,\n useContext\n} from 'react';\nimport { Switch, Route, withRouter } from 'react-router-dom';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport * as queries from 'loot-core/src/client/queries';\nimport { listen } from 'loot-core/src/platform/client/fetch';\nimport Platform from 'loot-core/src/client/platform';\nimport { colors } from 'loot-design/src/style';\nimport {\n View,\n Text,\n ButtonLink,\n Button,\n ButtonWithLoading,\n Tooltip,\n P\n} from 'loot-design/src/components/common';\nimport SheetValue from 'loot-design/src/components/spreadsheet/SheetValue';\nimport { MonthCountSelector } from './budget/MonthCountSelector';\nimport ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1';\nimport NavigationMenu from 'loot-design/src/svg/v2/NavigationMenu';\nimport ArrowLeft from 'loot-design/src/svg/v1/ArrowLeft';\nimport AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle';\nimport AccountSyncCheck from './accounts/AccountSyncCheck';\nimport LoggedInUser from './LoggedInUser';\nimport AnimatedRefresh from './AnimatedRefresh';\nimport { useSidebar } from './FloatableSidebar';\n\nexport let TitlebarContext = React.createContext();\n\nexport function TitlebarProvider({ children }) {\n let listeners = useRef([]);\n\n function sendEvent(msg) {\n listeners.current.forEach(func => func(msg));\n }\n\n function subscribe(listener) {\n listeners.current.push(listener);\n return () =>\n (listeners.current = listeners.current.filter(func => func !== listener));\n }\n\n return (\n <TitlebarContext.Provider\n value={{ sendEvent, subscribe }}\n children={children}\n />\n );\n}\n\nexport function UncategorizedButton() {\n return (\n <SheetValue binding={queries.uncategorizedCount()}>\n {node => {\n const num = node.value;\n return (\n num !== 0 && (\n <ButtonLink\n bare\n to=\"/accounts/uncategorized\"\n style={{ color: colors.r5 }}\n >\n {num} uncategorized {num === 1 ? 'transaction' : 'transactions'}\n </ButtonLink>\n )\n );\n }}\n </SheetValue>\n );\n}\n\nfunction SyncButton({ localPrefs, style, onSync }) {\n let [syncing, setSyncing] = useState(false);\n let [syncState, setSyncState] = useState(null);\n\n useEffect(() => {\n let unlisten = listen('sync-event', ({ type, subtype, syncDisabled }) => {\n if (type === 'start') {\n setSyncing(true);\n setSyncState(null);\n } else {\n // Give the layout some time to apply the starting animation\n // so we always finish it correctly even if it's almost\n // instant\n setTimeout(() => {\n setSyncing(false);\n }, 20);\n }\n\n if (type === 'error') {\n // Use the offline state if either there is a network error or\n // if this file isn't a \"cloud file\". You can't sync a local\n // file.\n if (subtype === 'network') {\n setSyncState('offline');\n } else if (!localPrefs.cloudFileId) {\n setSyncState('local');\n } else {\n setSyncState('error');\n }\n } else if (type === 'success') {\n setSyncState(syncDisabled ? 'disabled' : null);\n }\n });\n\n return unlisten;\n }, []);\n\n return (\n <Button\n bare\n style={[\n style,\n {\n WebkitAppRegion: 'none',\n color:\n syncState === 'error'\n ? colors.r4\n : syncState === 'disabled' ||\n syncState === 'offline' ||\n syncState === 'local'\n ? colors.n6\n : null\n }\n ]}\n onClick={onSync}\n >\n {syncState === 'error' ? (\n <AlertTriangle width={13} style={{ color: 'currentColor' }} />\n ) : (\n <AnimatedRefresh animating={syncing} />\n )}\n <Text style={{ marginLeft: 3 }}>\n {syncState === 'disabled'\n ? 'Disabled'\n : syncState === 'offline'\n ? 'Offline'\n : 'Sync'}\n </Text>\n </Button>\n );\n}\n\nfunction BudgetTitlebar({ globalPrefs, saveGlobalPrefs, localPrefs }) {\n let { sendEvent } = useContext(TitlebarContext);\n let [loading, setLoading] = useState(false);\n let [showTooltip, setShowTooltip] = useState(false);\n\n let reportBudgetEnabled = localPrefs['flags.reportBudget'];\n\n function onSwitchType() {\n setLoading(true);\n if (!loading) {\n sendEvent('budget/switch-type');\n }\n }\n\n useEffect(() => {\n setLoading(false);\n }, [localPrefs.budgetType]);\n\n let { budgetType } = localPrefs;\n\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n <MonthCountSelector\n maxMonths={globalPrefs.maxMonths || 1}\n onChange={value => saveGlobalPrefs({ maxMonths: value })}\n />\n {reportBudgetEnabled && (\n <View style={{ marginLeft: -5 }}>\n <Button\n bare\n loading={loading}\n style={{\n alignSelf: 'flex-start',\n padding: '4px 7px'\n }}\n title=\"Learn more about budgeting\"\n onClick={() => setShowTooltip(true)}\n >\n {budgetType === 'report' ? 'Report budget' : 'Rollover budget'}\n </Button>\n {showTooltip && (\n <Tooltip\n position=\"bottom-left\"\n onClose={() => setShowTooltip(false)}\n style={{\n padding: 10,\n maxWidth: 400\n }}\n >\n <P>\n You are currently using a{' '}\n <Text style={{ fontWeight: 600 }}>\n {budgetType === 'report'\n ? 'Report budget'\n : 'Rollover budget'}\n .\n </Text>{' '}\n Switching will not lose any data and you can always switch back.\n </P>\n <P>\n <ButtonWithLoading\n primary\n loading={loading}\n onClick={onSwitchType}\n >\n Switch to a{' '}\n {budgetType === 'report'\n ? 'Rollover budget'\n : 'Report budget'}\n </ButtonWithLoading>\n </P>\n <P isLast={true}>\n <a // eslint-disable-line\n href=\"#\"\n style={{\n color: colors.n4,\n fontStyle: 'italic'\n }}\n >\n How do these types of budgeting work?\n </a>\n </P>\n </Tooltip>\n )}\n </View>\n )}\n </View>\n );\n}\n\nfunction Titlebar({\n location,\n globalPrefs,\n saveGlobalPrefs,\n localPrefs,\n userData,\n floatingSidebar,\n syncError,\n setAppState,\n style,\n sync\n}) {\n let sidebar = useSidebar();\n\n return (\n <View\n style={[\n {\n flexDirection: 'row',\n alignItems: 'center',\n padding: '0 15px',\n height: 36,\n pointerEvents: 'none',\n '& *': {\n pointerEvents: 'auto'\n }\n },\n !Platform.isBrowser &&\n Platform.OS === 'mac' &&\n floatingSidebar && { paddingLeft: 80 },\n style\n ]}\n >\n {floatingSidebar && (\n <Button\n bare\n style={{\n marginRight: 8,\n '& .arrow-right': { opacity: 0, transition: 'opacity .3s' },\n '& .menu': { opacity: 1, transition: 'opacity .3s' },\n '&:hover .arrow-right': { opacity: 1 },\n '&:hover .menu': { opacity: 0 }\n }}\n onMouseEnter={() => sidebar.show()}\n onMouseLeave={() => sidebar.hide()}\n onClick={() => {\n saveGlobalPrefs({ floatingSidebar: !floatingSidebar });\n }}\n >\n <View style={{ width: 15, height: 15 }}>\n <ArrowButtonRight1\n className=\"arrow-right\"\n style={{\n width: 13,\n height: 13,\n color: colors.n5,\n position: 'absolute',\n top: 1,\n left: 1\n }}\n />\n <NavigationMenu\n className=\"menu\"\n style={{\n width: 15,\n height: 15,\n color: colors.n5,\n position: 'absolute',\n top: 0,\n left: 0\n }}\n />\n </View>\n </Button>\n )}\n\n <Switch>\n <Route\n path=\"/accounts\"\n exact\n children={props => {\n let state = props.location.state || {};\n return state.goBack ? (\n <Button onClick={() => props.history.goBack()} bare>\n <ArrowLeft\n width={10}\n height={10}\n style={{ marginRight: 5, color: 'currentColor' }}\n />{' '}\n Back\n </Button>\n ) : null;\n }}\n />\n\n <Route\n path=\"/accounts/:id\"\n exact\n children={props => {\n return (\n props.match && <AccountSyncCheck id={props.match.params.id} />\n );\n }}\n />\n\n <Route\n path=\"/budget\"\n exact\n children={() => (\n <BudgetTitlebar\n globalPrefs={globalPrefs}\n saveGlobalPrefs={saveGlobalPrefs}\n localPrefs={localPrefs}\n />\n )}\n />\n </Switch>\n <View style={{ flex: 1 }} />\n <UncategorizedButton />\n <SyncButton\n style={{ marginLeft: 10 }}\n localPrefs={localPrefs}\n onSync={sync}\n />\n <LoggedInUser style={{ marginLeft: 10 }} />\n </View>\n );\n}\n\nexport default withRouter(\n connect(\n state => ({\n globalPrefs: state.prefs.global,\n localPrefs: state.prefs.local,\n userData: state.user.data,\n floatingSidebar: state.prefs.global.floatingSidebar\n }),\n actions\n )(Titlebar)\n);\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass TutorialPoint extends React.Component {\n static contextTypes = {\n setTutorialNode: PropTypes.func\n };\n\n ref = el => {\n if (this.context.setTutorialNode) {\n this.context.setTutorialNode(this.props.name, el, this.props.expand);\n }\n };\n\n render() {\n return <div ref={this.ref} />;\n }\n}\n\nexport default TutorialPoint;\n","import React from 'react';\n\nconst SvgPencil1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgPencil1;\n","import React from 'react';\n\nconst SvgSearchAlternate = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgSearchAlternate;\n","import React from 'react';\n\nconst SvgDownloadThickBottom = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgDownloadThickBottom;\n","import React from 'react';\n\nconst SvgCheveronDown = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n d=\"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCheveronDown;\n","import React from 'react';\n\nconst SvgCheckCircle1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCheckCircle1;\n","import React from 'react';\n\nconst SvgArrowsExpand3 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowsExpand3;\n","import React from 'react';\n\nconst SvgArrowsShrink3 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowsShrink3;\n","import React, { useState, useContext, useMemo, useEffect } from 'react';\nimport { runQuery, liveQuery, LiveQuery, PagedQuery } from './query-helpers';\n\nfunction makeContext(queryState, opts, QueryClass) {\n let query = new QueryClass(queryState, null, opts);\n let Context = React.createContext(null);\n\n function Provider({ children }) {\n let [data, setData] = useState(query.getData());\n let value = useMemo(() => ({ data, query }), [data, query]);\n\n useEffect(() => {\n if (query.getNumListeners() !== 0) {\n throw new Error(\n 'Query already has listeners. You cannot use the same query context `Provider` twice'\n );\n }\n\n let unlisten = query.addListener(data => setData(data));\n\n // Start the query if it hasn't run yet. Most likely it's not\n // running, however the user can freely start the query early if\n // they want\n if (!query.isRunning()) {\n query.run();\n }\n\n // There's a small chance data has changed between rendering and\n // running this effect, so just in case set this again. Note\n // this won't rerender if the data is the same\n setData(query.getData());\n\n return () => {\n unlisten();\n query.unsubscribe();\n };\n }, []);\n\n return <Context.Provider value={value} children={children} />;\n }\n\n function useQuery() {\n let queryData = useContext(Context);\n if (queryData == null) {\n throw new Error(\n \"`useQuery` tried to access a query that hasn't been run. You need to put its `Provider` in a parent component\"\n );\n }\n return queryData;\n }\n\n return {\n Provider,\n useQuery\n };\n}\n\nexport function queryContext(queryState, opts) {\n let Context = React.createContext(null);\n\n function Provider({ children }) {\n let [data, setData] = useState(null);\n let value = useMemo(() => ({ data }), [data]);\n\n useEffect(() => {\n async function run() {\n let { data } = await runQuery(queryState, opts);\n setData(data);\n }\n run();\n }, []);\n\n return <Context.Provider value={value} children={children} />;\n }\n\n function useQuery() {\n return useContext(Context);\n }\n\n return {\n Provider,\n useQuery\n };\n}\n\nexport function liveQueryContext(query, opts) {\n return makeContext(query, opts, LiveQuery);\n}\n\nexport function pagedQueryContext(query, opts) {\n return makeContext(query, opts, PagedQuery);\n}\n\nexport function useLiveQuery(query, opts) {\n let [data, setData] = useState(null);\n\n useEffect(() => {\n let live = liveQuery(\n query,\n async data => {\n if (live) {\n setData(data);\n }\n },\n opts\n );\n\n return () => {\n live.unsubscribe();\n live = null;\n };\n }, [query]);\n\n return { data };\n}\n\nfunction usePagedQuery(query) {\n // TODO\n}\n","import { last, diffItems, getChangedValues, applyChanges } from './util';\nconst uuid = require('../platform/uuid');\n\n// The amount might be null when adding a new transaction\nfunction num(n) {\n return typeof n === 'number' ? n : 0;\n}\n\nfunction SplitTransactionError(total, parent) {\n let difference = num(parent.amount) - total;\n\n return {\n type: 'SplitTransactionError',\n version: 1,\n difference\n };\n}\n\nexport function makeChild(parent, data) {\n let prefix = parent.id === 'temp' ? 'temp' : '';\n\n return {\n amount: 0,\n ...data,\n payee: data.payee || parent.payee,\n id: data.id ? data.id : prefix + uuid.v4Sync(),\n account: parent.account,\n date: parent.date,\n cleared: parent.cleared != null ? parent.cleared : null,\n starting_balance_flag:\n parent.starting_balance_flag != null\n ? parent.starting_balance_flag\n : null,\n is_child: true,\n parent_id: parent.id,\n error: null\n };\n}\n\nexport function recalculateSplit(trans) {\n // Calculate the new total of split transactions and make sure\n // that it equals the parent amount\n const total = trans.subtransactions.reduce(\n (acc, t) => acc + num(t.amount),\n 0\n );\n return {\n ...trans,\n error:\n total === num(trans.amount) ? null : SplitTransactionError(total, trans)\n };\n}\n\nexport function findParentIndex(transactions, idx) {\n // This relies on transactions being sorted in a way where parents\n // are always before children, which is enforced in the db layer.\n // Walk backwards and find the last parent;\n while (idx >= 0) {\n let trans = transactions[idx];\n if (trans.is_parent) {\n return idx;\n }\n idx--;\n }\n return null;\n}\n\nexport function getSplit(transactions, parentIndex) {\n let split = [transactions[parentIndex]];\n let curr = parentIndex + 1;\n while (curr < transactions.length && transactions[curr].is_child) {\n split.push(transactions[curr]);\n curr++;\n }\n return split;\n}\n\nexport function ungroupTransactions(transactions) {\n let x = transactions.reduce((list, parent) => {\n let { subtransactions, ...trans } = parent;\n subtransactions = subtransactions || [];\n\n list.push(trans);\n\n for (let i = 0; i < subtransactions.length; i++) {\n list.push(subtransactions[i]);\n }\n return list;\n }, []);\n return x;\n}\n\nexport function groupTransaction(split) {\n return { ...split[0], subtransactions: split.slice(1) };\n}\n\nexport function ungroupTransaction(split) {\n if (split == null) {\n return null;\n }\n return ungroupTransactions([split]);\n}\n\nexport function applyTransactionDiff(groupedTrans, diff) {\n return groupTransaction(applyChanges(diff, ungroupTransaction(groupedTrans)));\n}\n\nexport function replaceTransactions(transactions, id, func) {\n let idx = transactions.findIndex(t => t.id === id);\n let trans = transactions[idx];\n let transactionsCopy = [...transactions];\n\n if (idx === -1) {\n throw new Error('Tried to edit unknown transaction id: ' + id);\n }\n\n if (trans.is_parent || trans.is_child) {\n let parentIndex = findParentIndex(transactions, idx);\n if (parentIndex == null) {\n console.log('Cannot find parent index');\n return { diff: { deleted: [], updated: [] } };\n }\n\n let split = getSplit(transactions, parentIndex);\n let grouped = func(groupTransaction(split));\n let newSplit = ungroupTransaction(grouped);\n\n let diff;\n if (newSplit == null) {\n // If everything was deleted, just delete the parent which will\n // delete everything\n diff = { deleted: [{ id: split[0].id }], updated: [] };\n grouped = { id: split[0].id, _deleted: true };\n transactionsCopy.splice(parentIndex, split.length);\n } else {\n diff = diffItems(split, newSplit);\n transactionsCopy.splice(parentIndex, split.length, ...newSplit);\n }\n\n return { data: transactionsCopy, newTransaction: grouped, diff };\n } else {\n let grouped = func(trans);\n let newTrans = ungroupTransaction(grouped) || [];\n if (grouped) {\n grouped.subtransactions = grouped.subtransactions || [];\n }\n transactionsCopy.splice(idx, 1, ...newTrans);\n\n return {\n data: transactionsCopy,\n newTransaction: grouped || { id: trans.id, _deleted: true },\n diff: diffItems([trans], newTrans)\n };\n }\n}\n\nexport function addSplitTransaction(transactions, id) {\n return replaceTransactions(transactions, id, trans => {\n if (!trans.is_parent) {\n return trans;\n }\n let prevSub = last(trans.subtransactions);\n trans.subtransactions.push(\n makeChild(trans, {\n amount: 0,\n sort_order: num(prevSub && prevSub.sort_order) - 1\n })\n );\n return trans;\n });\n}\n\nexport function updateTransaction(transactions, transaction) {\n return replaceTransactions(transactions, transaction.id, trans => {\n if (trans.is_parent) {\n let parent = trans.id === transaction.id ? transaction : trans;\n let sub = trans.subtransactions.map(t => {\n // Make sure to update the children to reflect the updated\n // properties (if the parent updated)\n\n let child = t;\n if (trans.id === transaction.id) {\n child = {\n ...t,\n payee: t.payee === trans.payee ? transaction.payee : t.payee\n };\n } else if (t.id === transaction.id) {\n child = transaction;\n }\n\n return makeChild(parent, child);\n });\n\n return recalculateSplit({ ...parent, subtransactions: sub });\n } else {\n return transaction;\n }\n });\n}\n\nexport function deleteTransaction(transactions, id) {\n return replaceTransactions(transactions, id, trans => {\n if (trans.is_parent) {\n if (trans.id === id) {\n return null;\n } else if (trans.subtransactions.length === 1) {\n return {\n ...trans,\n subtransactions: null,\n is_parent: false,\n error: null\n };\n } else {\n let sub = trans.subtransactions.filter(t => t.id !== id);\n return recalculateSplit({ ...trans, subtransactions: sub });\n }\n } else {\n return null;\n }\n });\n}\n\nexport function splitTransaction(transactions, id) {\n return replaceTransactions(transactions, id, trans => {\n if (trans.is_parent || trans.is_child) {\n return trans;\n }\n\n return {\n ...trans,\n is_parent: true,\n error: num(trans.amount) === 0 ? null : SplitTransactionError(0, trans),\n subtransactions: [makeChild(trans, { amount: 0, sort_order: -1 })]\n };\n });\n}\n\nexport function realizeTempTransactions(transactions) {\n let parent = transactions.find(t => !t.is_child);\n parent = { ...parent, id: uuid.v4Sync() };\n\n let children = transactions.filter(t => t.is_child);\n return [\n parent,\n ...children.map(child => ({\n ...child,\n id: uuid.v4Sync(),\n parent_id: parent.id\n }))\n ];\n}\n","import React from 'react';\n\nconst SvgRemove = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgRemove;\n","import React, { useState, useRef, useEffect } from 'react';\nimport lively from '@jlongster/lively';\nimport Downshift from 'downshift';\nimport { css } from 'glamor';\nimport { colors } from '../style';\nimport Remove from '../svg/v2/Remove';\nimport { View, Input, Tooltip, Button } from './common';\n\nfunction findItem(strict, suggestions, value) {\n if (strict) {\n let idx = suggestions.findIndex(item => item.id === value);\n return idx === -1 ? null : suggestions[idx];\n }\n\n return value;\n}\n\nfunction getItemName(item) {\n if (item == null) {\n return '';\n } else if (typeof item === 'string') {\n return item;\n }\n return item.name || '';\n}\n\nfunction getItemId(item) {\n if (typeof item === 'string') {\n return item;\n }\n return item ? item.id : null;\n}\n\nfunction getInitialState({\n props: {\n value,\n suggestions,\n embedded,\n isOpen = false,\n strict,\n initialFilterSuggestions\n }\n}) {\n let selectedItem = findItem(strict, suggestions, value);\n let filteredSuggestions = initialFilterSuggestions\n ? initialFilterSuggestions(suggestions, value)\n : null;\n\n return {\n selectedItem,\n value: selectedItem ? getItemName(selectedItem) : '',\n originalItem: selectedItem,\n filteredSuggestions,\n highlightedIndex: null,\n isOpen: embedded || isOpen\n };\n}\n\nfunction componentWillReceiveProps(bag, nextProps) {\n let {\n strict,\n suggestions,\n filterSuggestions = defaultFilterSuggestions,\n initialFilterSuggestions,\n value,\n itemToString = defaultItemToString\n } = nextProps;\n let { value: currValue } = bag.state;\n let updates = null;\n\n function updateValue() {\n let selectedItem = findItem(strict, suggestions, value);\n if (selectedItem) {\n updates = updates || {};\n updates.value = itemToString(selectedItem);\n updates.selectedItem = selectedItem;\n }\n }\n\n if (bag.props.value !== value) {\n updateValue();\n }\n\n // TODO: Something is causing a rerender immediately after first\n // render, and this condition is true, causing items to be filtered\n // twice. This shouldn't effect functionality (I think), but look\n // into this later\n if (bag.props.suggestions !== suggestions) {\n let filteredSuggestions = null;\n\n if (bag.state.highlightedIndex != null) {\n filteredSuggestions = filterSuggestions(suggestions, currValue);\n } else {\n filteredSuggestions = initialFilterSuggestions\n ? initialFilterSuggestions(suggestions, currValue)\n : null;\n }\n\n updates = updates || {};\n updateValue();\n updates.filteredSuggestions = filteredSuggestions;\n }\n\n return updates;\n}\n\nexport function defaultFilterSuggestion(suggestion, value) {\n return getItemName(suggestion)\n .toLowerCase()\n .includes(value.toLowerCase());\n}\n\nexport function defaultFilterSuggestions(suggestions, value) {\n return suggestions.filter(suggestion =>\n defaultFilterSuggestion(suggestion, value)\n );\n}\n\nfunction fireUpdate(onUpdate, strict, suggestions, index, value) {\n // If the index is null, look up the id in the suggestions. If the\n // value is empty it will select nothing (as expected). If it's not\n // empty but nothing is selected, it still resolves to an id. It\n // would very confusing otherwise: the menu could be in a state\n // where nothing is highlighted but there is a valid value.\n\n let selected = null;\n if (!strict) {\n selected = value;\n } else {\n if (index == null) {\n // If passing in a value directly, validate the id\n let sug = suggestions.find(sug => sug.id === value);\n if (sug) {\n selected = sug.id;\n }\n } else if (index < suggestions.length) {\n selected = suggestions[index].id;\n }\n }\n\n onUpdate && onUpdate(selected);\n}\n\nfunction onInputValueChange(\n {\n props: {\n suggestions,\n onUpdate,\n multi,\n highlightFirst,\n strict,\n filterSuggestions = defaultFilterSuggestions,\n getHighlightedIndex\n },\n state: { isOpen }\n },\n value,\n changes\n) {\n // OMG this is the dumbest thing ever. I need to remove Downshift\n // and build my own component. For some reason this is fired on blur\n // with an empty value which clears out the input when the app blurs\n if (!document.hasFocus()) {\n return;\n }\n\n // Do nothing if it's simply updating the selected item\n if (\n changes.type ===\n Downshift.stateChangeTypes.controlledPropUpdatedSelectedItem\n ) {\n return;\n }\n\n // Otherwise, filter the items and always the first item if\n // desired\n const filteredSuggestions = filterSuggestions(suggestions, value);\n\n if (value === '') {\n // A blank value shouldn't highlight any item so that the field\n // can be left blank if desired\n\n if (changes.type !== Downshift.stateChangeTypes.clickItem) {\n fireUpdate(onUpdate, strict, filteredSuggestions, null, null);\n }\n\n return {\n value,\n filteredSuggestions,\n highlightedIndex: null\n };\n } else {\n let defaultGetHighlightedIndex = filteredSuggestions => {\n return highlightFirst && filteredSuggestions.length ? 0 : null;\n };\n let highlightedIndex = (getHighlightedIndex || defaultGetHighlightedIndex)(\n filteredSuggestions\n );\n\n if (changes.type !== Downshift.stateChangeTypes.clickItem) {\n fireUpdate(\n onUpdate,\n strict,\n filteredSuggestions,\n highlightedIndex,\n value\n );\n }\n\n return {\n value,\n filteredSuggestions,\n highlightedIndex\n };\n }\n}\n\nfunction onStateChange({ props, state, inst }, changes, stateAndHelpers) {\n if (\n props.tableBehavior &&\n changes.type === Downshift.stateChangeTypes.mouseUp\n ) {\n return;\n }\n\n const newState = {};\n if ('highlightedIndex' in changes) {\n newState.highlightedIndex = changes.highlightedIndex;\n }\n if ('isOpen' in changes) {\n newState.isOpen = props.embedded ? true : changes.isOpen;\n }\n if ('selectedItem' in changes) {\n newState.selectedItem = changes.selectedItem;\n }\n\n // We only ever want to update the value if the user explicitly\n // highlighted an item via the keyboard. It shouldn't change with\n // mouseover; otherwise the user could accidentally hover over an\n // item without realizing it and change the value.\n if (\n state.isOpen &&\n (changes.type === Downshift.stateChangeTypes.keyDownArrowUp ||\n changes.type === Downshift.stateChangeTypes.keyDownArrowDown)\n ) {\n fireUpdate(\n props.onUpdate,\n props.strict,\n state.filteredSuggestions || props.suggestions,\n newState.highlightedIndex != null\n ? newState.highlightedIndex\n : state.highlightedIndex,\n state.value\n );\n }\n\n inst.lastChangeType = changes.type;\n return newState;\n}\n\nfunction onSelect(\n { props: { onSelect, clearAfterSelect, suggestions }, inst },\n item\n) {\n if (onSelect) {\n // I AM NOT PROUD OF THIS OK??\n // This WHOLE FILE is a mess anyway\n // OK SIT DOWN AND I WILL EXPLAIN\n // This component uses `componentWillReceiveProps` and in there\n // it will re-filter suggestions if the suggestions change and\n // a `highlightedIndex` exists. When we select something,\n // we clear `highlightedIndex` so it should show all suggestions\n // again. HOWEVER, in the case of a multi-autocomplete, it's\n // changing the suggestions every time something is selected.\n // In that case, cWRP is running *before* our state setting that\n // cleared `highlightedIndex`. Forcing this to run later assures\n // us that we will clear out local state before cWRP runs.\n // YEAH THAT'S ALL OK I JUST WANT TO SHIP THIS\n setTimeout(() => {\n onSelect(getItemId(item));\n }, 0);\n }\n return onSelectAfter(suggestions, clearAfterSelect, inst);\n}\n\nfunction onSelectAfter(suggestions, clearAfterSelect, inst) {\n if (clearAfterSelect) {\n return {\n value: '',\n selectedItem: null,\n highlightedIndex: null,\n filteredSuggestions: suggestions\n };\n } else if (inst.input) {\n inst.input.setSelectionRange(0, 10000);\n }\n}\n\nfunction onChange({ props: { inputProps } }, e) {\n const { onChange } = inputProps || {};\n onChange && onChange(e.target.value);\n}\n\nfunction onKeyDown(\n {\n props: {\n suggestions,\n clearAfterSelect,\n initialFilterSuggestions,\n embedded,\n onUpdate,\n onSelect,\n inputProps,\n shouldSaveFromKey = defaultShouldSaveFromKey,\n strict\n },\n state: {\n selectedItem,\n filteredSuggestions,\n highlightedIndex,\n originalItem,\n isNulled,\n isOpen,\n value\n },\n inst\n },\n e\n) {\n let ENTER = 13;\n let ESC = 27;\n let { onKeyDown } = inputProps || {};\n\n // If the dropdown is open, an item is highlighted, and the user\n // pressed enter, always capture that and handle it ourselves\n if (isOpen) {\n if (e.keyCode === ENTER) {\n if (highlightedIndex != null) {\n if (inst.lastChangeType === Downshift.stateChangeTypes.itemMouseEnter) {\n // If the last thing the user did was hover an item, intentionally\n // ignore the default behavior of selecting the item. It's too\n // common to accidentally hover an item and then save it\n e.preventDefault();\n } else {\n // Otherwise, stop propagation so that the table navigator\n // doesn't handle it\n e.stopPropagation();\n }\n } else if (!strict) {\n // Handle it ourselves\n e.stopPropagation();\n onSelect(value);\n return onSelectAfter(suggestions, clearAfterSelect, inst);\n } else {\n // No highlighted item, still allow the table to save the item\n // as `null`, even though we're allowing the table to move\n e.preventDefault();\n onKeyDown && onKeyDown(e);\n }\n } else if (shouldSaveFromKey(e)) {\n e.preventDefault();\n onKeyDown && onKeyDown(e);\n }\n }\n\n // Handle escape ourselves\n if (e.keyCode === ESC) {\n e.preventDefault();\n\n if (!embedded) {\n e.stopPropagation();\n }\n\n let filteredSuggestions = initialFilterSuggestions\n ? initialFilterSuggestions(suggestions, getItemName(originalItem))\n : null;\n fireUpdate(onUpdate, strict, suggestions, null, getItemId(originalItem));\n return {\n value: getItemName(originalItem),\n selectedItem: findItem(strict, suggestions, originalItem),\n filteredSuggestions,\n highlightedIndex: null,\n isOpen: embedded ? true : false\n };\n }\n}\n\nfunction defaultRenderInput(props) {\n return <Input {...props} />;\n}\n\nfunction defaultRenderItems(items, getItemProps, highlightedIndex) {\n return (\n <div>\n {items.map((item, index) => {\n let name = getItemName(item);\n return (\n <div\n {...getItemProps({ item })}\n key={name}\n {...css({\n padding: 5,\n cursor: 'default',\n backgroundColor: highlightedIndex === index ? colors.n4 : null\n })}\n >\n {name}\n </div>\n );\n })}\n </div>\n );\n}\n\nfunction defaultShouldSaveFromKey(e) {\n // Enter\n return e.keyCode === 13;\n}\n\nfunction onFocus({ inst, props: { inputProps = {}, openOnFocus = true } }, e) {\n inputProps.onFocus && inputProps.onFocus(e);\n\n if (openOnFocus) {\n return { isOpen: true };\n }\n}\n\nfunction onBlur({ inst, props, state: { selectedItem } }, e) {\n let { inputProps = {}, onSelect } = props;\n\n e.preventDownshiftDefault = true;\n inputProps.onBlur && inputProps.onBlur(e);\n\n if (!props.tableBehavior) {\n if (e.target.value === '') {\n onSelect && onSelect(null);\n return { selectedItem: null, originalValue: null, isOpen: false };\n }\n\n // If not using table behavior, reset the input on blur. Tables\n // handle saving the value on blur.\n let value = selectedItem ? getItemId(selectedItem) : null;\n\n return getInitialState({\n props: {\n ...props,\n value,\n originalValue: value\n }\n });\n } else {\n return { isOpen: false };\n }\n}\n\nfunction defaultItemToString(item) {\n return item ? getItemName(item) : '';\n}\n\nfunction _SingleAutocomplete({\n props: {\n focused,\n embedded,\n containerProps,\n inputProps,\n children,\n suggestions,\n tooltipStyle,\n onItemClick,\n strict,\n tooltipProps,\n renderInput = defaultRenderInput,\n renderItems = defaultRenderItems,\n itemToString = defaultItemToString\n },\n state: { value, selectedItem, filteredSuggestions, highlightedIndex, isOpen },\n updater,\n inst\n}) {\n const filtered = filteredSuggestions || suggestions;\n\n return (\n <Downshift\n onSelect={updater(onSelect)}\n highlightedIndex={highlightedIndex}\n selectedItem={selectedItem || null}\n itemToString={itemToString}\n inputValue={value}\n isOpen={isOpen}\n onInputValueChange={updater(onInputValueChange)}\n onStateChange={updater(onStateChange)}\n >\n {({\n getInputProps,\n getItemProps,\n getRootProps,\n isOpen,\n inputValue,\n selectedItem,\n highlightedIndex\n }) => (\n // Super annoying but it works best to return a div so we\n // can't use a View here, but we can fake it be using the\n // className\n <div\n className={'view ' + css({ display: 'flex' }).toString()}\n {...containerProps}\n >\n {renderInput(\n getInputProps({\n focused,\n ...inputProps,\n onFocus: updater(onFocus),\n onBlur: updater(onBlur),\n onKeyDown: updater(onKeyDown),\n onChange: updater(onChange)\n })\n )}\n {isOpen &&\n filtered.length > 0 &&\n (embedded ? (\n <View style={{ marginTop: 5 }} data-testid=\"autocomplete\">\n {renderItems(\n filtered,\n getItemProps,\n highlightedIndex,\n inputValue\n )}\n </View>\n ) : (\n <Tooltip\n position=\"bottom-stretch\"\n offset={2}\n style={{\n padding: 0,\n backgroundColor: colors.n1,\n color: 'white',\n ...tooltipStyle\n }}\n {...tooltipProps}\n data-testid=\"autocomplete\"\n >\n {renderItems(\n filtered,\n getItemProps,\n highlightedIndex,\n inputValue\n )}\n </Tooltip>\n ))}\n </div>\n )}\n </Downshift>\n );\n}\n\nconst SingleAutocomplete = lively(_SingleAutocomplete, {\n getInitialState,\n componentWillReceiveProps\n});\n\nfunction MultiItem({ name, onRemove }) {\n return (\n <View\n style={{\n alignItems: 'center',\n flexDirection: 'row',\n backgroundColor: colors.b9,\n padding: '2px 4px',\n margin: '2px',\n borderRadius: 4\n }}\n >\n {name}\n <Button type=\"button\" bare style={{ marginLeft: 1 }} onClick={onRemove}>\n <Remove style={{ width: 8, height: 8 }} />\n </Button>\n </View>\n );\n}\n\nexport function MultiAutocomplete({\n value: selectedItems,\n onSelect,\n suggestions,\n strict,\n ...props\n}) {\n let [focused, setFocused] = useState(false);\n let lastSelectedItems = useRef();\n\n useEffect(() => {\n lastSelectedItems.current = selectedItems;\n });\n\n function onRemoveItem(id) {\n let items = selectedItems.filter(i => i !== id);\n onSelect(items);\n }\n\n function onAddItem(id) {\n if (id) {\n id = id.trim();\n onSelect([...selectedItems, id], id);\n }\n }\n\n function onKeyDown(e, prevOnKeyDown) {\n if (e.key === 'Backspace' && e.target.value === '') {\n onRemoveItem(selectedItems[selectedItems.length - 1]);\n }\n\n prevOnKeyDown && prevOnKeyDown(e);\n }\n\n return (\n <Autocomplete\n {...props}\n value={null}\n suggestions={suggestions.filter(\n item => !selectedItems.includes(getItemId(item))\n )}\n onSelect={onAddItem}\n clearAfterSelect\n highlightFirst\n strict={strict}\n tooltipProps={{\n forceLayout: lastSelectedItems.current !== selectedItems\n }}\n renderInput={props => (\n <View\n style={[\n {\n display: 'flex',\n flexWrap: 'wrap',\n flexDirection: 'row',\n alignItems: 'center',\n backgroundColor: 'white',\n borderRadius: 4,\n border: '1px solid #d0d0d0'\n },\n focused && {\n border: '1px solid ' + colors.b5,\n boxShadow: '0 1px 1px ' + colors.b7\n }\n ]}\n >\n {selectedItems.map((item, idx) => {\n item = findItem(strict, suggestions, item);\n return (\n item && (\n <MultiItem\n key={getItemId(item) || idx}\n name={getItemName(item)}\n onRemove={() => onRemoveItem(getItemId(item))}\n />\n )\n );\n })}\n <Input\n {...props}\n onKeyDown={e => onKeyDown(e, props.onKeyDown)}\n onFocus={e => {\n setFocused(true);\n props.onFocus(e);\n }}\n onBlur={e => {\n setFocused(false);\n props.onBlur(e);\n }}\n style={[\n {\n flex: 1,\n minWidth: 30,\n border: 0,\n ':focus': { border: 0, boxShadow: 'none' }\n },\n props.style\n ]}\n />\n </View>\n )}\n />\n );\n}\n\nexport function AutocompleteFooterButton({\n title,\n style,\n hoveredStyle,\n onClick\n}) {\n return (\n <Button\n style={[\n {\n fontSize: 12,\n color: colors.n10,\n backgroundColor: 'transparent',\n borderColor: colors.n5\n },\n style\n ]}\n hoveredStyle={[\n { backgroundColor: 'rgba(200, 200, 200, .25)' },\n hoveredStyle\n ]}\n onClick={onClick}\n >\n {title}\n </Button>\n );\n}\n\nexport function AutocompleteFooter({ show = true, embedded, children }) {\n return (\n show && (\n <View\n style={[\n { flexShrink: 0 },\n embedded ? { paddingTop: 5 } : { padding: 5 }\n ]}\n onMouseDown={e => e.preventDefault()}\n >\n {children}\n </View>\n )\n );\n}\n\nexport default function Autocomplete({ multi, ...props }) {\n if (multi) {\n return <MultiAutocomplete {...props} />;\n } else {\n return <SingleAutocomplete {...props} />;\n }\n}\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction Split({ width, height, style, color = \"currentColor\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M30 9L26 5\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M30 9L26 13\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M6 5L2 9\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M2 9L6 13\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M10 9H3\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M22 9H29\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 15L22 9\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 15L10 9\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 28L16 15\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n\nexport default Split;\n","import React, { useMemo } from 'react';\nimport { View, Text, Select } from './common';\nimport Autocomplete, { defaultFilterSuggestion } from './Autocomplete';\nimport { styles, colors } from '../style';\nimport Split from '../svg/split';\n\nexport const NativeCategorySelect = React.forwardRef(\n ({ categoryGroups, emptyLabel, ...nativeProps }, ref) => {\n return (\n <Select {...nativeProps} ref={ref}>\n <option value=\"\">{emptyLabel || 'Select category...'}</option>\n {categoryGroups.map(group => (\n <optgroup key={group.id} label={group.name}>\n {group.categories.map(category => (\n <option key={category.id} value={category.id}>\n {category.name}\n </option>\n ))}\n </optgroup>\n ))}\n </Select>\n );\n }\n);\n\nexport function CategoryList({\n items,\n getItemProps,\n highlightedIndex,\n embedded,\n footer\n}) {\n let lastGroup = null;\n\n return (\n <View>\n <View\n style={[\n {\n overflow: 'auto',\n padding: '5px 0'\n },\n !embedded && { maxHeight: 175 }\n ]}\n >\n {items.map((item, idx) => {\n if (item.id === 'split') {\n return (\n <View\n key=\"split\"\n {...(getItemProps ? getItemProps({ item }) : null)}\n style={{\n backgroundColor:\n highlightedIndex === idx ? colors.n4 : 'transparent',\n borderRadius: embedded ? 4 : 0,\n flexShrink: 0,\n flexDirection: 'row',\n alignItems: 'center',\n fontSize: 11,\n fontWeight: 500,\n color: colors.g8,\n padding: '6px 8px'\n }}\n data-testid=\"split-transaction-button\"\n >\n <Text style={{ lineHeight: 0 }}>\n <Split width={10} height={10} style={{ marginRight: 5 }} />\n </Text>\n Split Transaction\n </View>\n );\n }\n\n const showGroup = item.cat_group !== lastGroup;\n lastGroup = item.cat_group;\n return (\n <React.Fragment key={item.id}>\n {showGroup && (\n <div\n style={{\n color: colors.y9,\n padding: '4px 9px'\n }}\n data-testid=\"category-item-group\"\n >\n {item.groupName}\n </div>\n )}\n <div\n {...(getItemProps ? getItemProps({ item }) : null)}\n style={{\n backgroundColor:\n highlightedIndex === idx ? colors.n4 : 'transparent',\n padding: 4,\n paddingLeft: 20,\n borderRadius: embedded ? 4 : 0\n }}\n data-testid={\n 'category-item' +\n (highlightedIndex === idx ? '-highlighted' : '')\n }\n >\n {item.name}\n </div>\n </React.Fragment>\n );\n })}\n </View>\n {footer}\n </View>\n );\n}\n\nexport default function CategoryAutocomplete({\n categoryGroups,\n showSplitOption,\n embedded,\n onSplit,\n ...props\n}) {\n let categorySuggestions = useMemo(\n () =>\n categoryGroups.reduce(\n (list, group) =>\n list.concat(\n group.categories.map(category => ({\n ...category,\n groupName: group.name\n }))\n ),\n showSplitOption ? [{ id: 'split', name: '' }] : []\n ),\n [categoryGroups]\n );\n\n return (\n <Autocomplete\n strict={true}\n highlightFirst={true}\n embedded={embedded}\n getHighlightedIndex={suggestions => {\n if (suggestions.length === 0) {\n return null;\n } else if (suggestions[0].id === 'split') {\n return suggestions.length > 1 ? 1 : null;\n }\n return 0;\n }}\n filterSuggestions={(suggestions, value) => {\n return suggestions.filter(suggestion => {\n return (\n suggestion.id === 'split' ||\n defaultFilterSuggestion(suggestion, value) ||\n suggestion.groupName.toLowerCase().includes(value.toLowerCase())\n );\n });\n }}\n suggestions={categorySuggestions}\n renderItems={(items, getItemProps, highlightedIndex) => (\n <CategoryList\n items={items}\n embedded={embedded}\n getItemProps={getItemProps}\n highlightedIndex={highlightedIndex}\n />\n )}\n {...props}\n />\n );\n}\n","import React, { useState, useMemo, useRef } from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { getActivePayees } from 'loot-core/src/client/reducers/queries';\nimport { createPayee } from 'loot-core/src/client/actions/queries';\nimport { useCachedPayees } from 'loot-core/src/client/data-hooks/payees';\nimport { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts';\nimport { View } from './common';\nimport Add from '../svg/v1/Add';\nimport Autocomplete, {\n defaultFilterSuggestion,\n AutocompleteFooter,\n AutocompleteFooterButton\n} from './Autocomplete';\nimport { colors } from '../style';\n\nfunction getPayeeSuggestions(payees, focusTransferPayees, accounts) {\n let activePayees = accounts ? getActivePayees(payees, accounts) : payees;\n\n if (focusTransferPayees && activePayees) {\n activePayees = activePayees.filter(p => !!p.transfer_acct);\n }\n\n return activePayees || [];\n}\n\nfunction makeNew(value, rawPayee) {\n if (value === 'new' && !rawPayee.current.startsWith('new:')) {\n return 'new:' + rawPayee.current;\n }\n return value;\n}\n\n// Convert the fully resolved new value into the 'new' id that can be\n// looked up in the suggestions\nfunction stripNew(value) {\n if (typeof value === 'string' && value.startsWith('new:')) {\n return 'new';\n }\n return value;\n}\n\nexport function PayeeList({\n items,\n getItemProps,\n highlightedIndex,\n embedded,\n inputValue,\n footer\n}) {\n let isFiltered = items.filtered;\n let createNew = null;\n items = [...items];\n\n // If the \"new payee\" item exists, create it as a special-cased item\n // with the value of the input so it always shows whatever the user\n // entered\n if (items[0].id === 'new') {\n let [first, ...rest] = items;\n createNew = first;\n items = rest;\n }\n\n let offset = createNew ? 1 : 0;\n let lastType = null;\n\n return (\n <View>\n <View\n style={[\n { overflow: 'auto', padding: '5px 0' },\n !embedded && { maxHeight: 175 }\n ]}\n >\n {createNew && (\n <View\n {...(getItemProps ? getItemProps({ item: createNew }) : null)}\n style={{\n flexShrink: 0,\n padding: '6px 9px',\n backgroundColor:\n highlightedIndex === 0 ? colors.n4 : 'transparent',\n borderRadius: embedded ? 4 : 0\n }}\n >\n <View\n style={{\n display: 'block',\n color: colors.g8,\n borderRadius: 4,\n fontSize: 11,\n fontWeight: 500\n }}\n >\n <Add\n width={8}\n height={8}\n style={{\n color: colors.g8,\n marginRight: 5,\n display: 'inline-block'\n }}\n />\n Create Payee \"{inputValue}\"\n </View>\n </View>\n )}\n\n {items.map((item, idx) => {\n let type = item.transfer_acct ? 'account' : 'payee';\n let title;\n if (type === 'payee' && lastType !== type) {\n title = 'Payees';\n } else if (type === 'account' && lastType !== type) {\n title = 'Transfer To/From';\n }\n let showMoreMessage = idx === items.length - 1 && isFiltered;\n lastType = type;\n\n return (\n <React.Fragment key={item.id}>\n {title && (\n <div\n key={'title-' + idx}\n style={{\n color: colors.y9,\n padding: '4px 9px'\n }}\n >\n {title}\n </div>\n )}\n\n <div\n {...(getItemProps ? getItemProps({ item }) : null)}\n key={item.id}\n style={{\n backgroundColor:\n highlightedIndex === idx + offset\n ? colors.n4\n : 'transparent',\n borderRadius: embedded ? 4 : 0,\n padding: 4,\n paddingLeft: 20\n }}\n >\n {item.name}\n </div>\n\n {showMoreMessage && (\n <div\n style={{\n fontSize: 11,\n padding: 5,\n color: colors.n5,\n textAlign: 'center'\n }}\n >\n More payees are available, search to find them\n </div>\n )}\n </React.Fragment>\n );\n })}\n </View>\n {footer}\n </View>\n );\n}\n\nexport default function PayeeAutocomplete({\n value,\n inputProps,\n showMakeTransfer = true,\n showManagePayees = false,\n defaultFocusTransferPayees = false,\n tableBehavior,\n embedded,\n onUpdate,\n onSelect,\n onManagePayees,\n ...props\n}) {\n let payees = useCachedPayees();\n let accounts = useCachedAccounts();\n\n let [focusTransferPayees, setFocusTransferPayees] = useState(defaultFocusTransferPayees);\n let payeeSuggestions = useMemo(\n () => [\n { id: 'new', name: '' },\n ...getPayeeSuggestions(payees, focusTransferPayees, accounts)\n ],\n [payees, focusTransferPayees, accounts]\n );\n\n let rawPayee = useRef('');\n let dispatch = useDispatch();\n\n async function handleSelect(value) {\n if (tableBehavior) {\n onSelect && onSelect(makeNew(value, rawPayee));\n } else {\n let create = () => dispatch(createPayee(rawPayee.current));\n\n if (Array.isArray(value)) {\n value = await Promise.all(value.map(v => (v === 'new' ? create() : v)));\n } else {\n if (value === 'new') {\n value = await create();\n }\n }\n onSelect && onSelect(value);\n }\n }\n\n return (\n <Autocomplete\n key={focusTransferPayees ? 'transfers' : 'all'}\n strict={true}\n embedded={embedded}\n value={stripNew(value)}\n suggestions={payeeSuggestions}\n tableBehavior={tableBehavior}\n itemToString={item => {\n if (!item) {\n return '';\n } else if (item.id === 'new') {\n return rawPayee.current;\n }\n return item.name;\n }}\n inputProps={{\n ...inputProps,\n onChange: text => (rawPayee.current = text)\n }}\n onUpdate={value => onUpdate && onUpdate(makeNew(value, rawPayee))}\n onSelect={handleSelect}\n getHighlightedIndex={suggestions => {\n if (suggestions.length > 1 && suggestions[0].id === 'new') {\n return 1;\n }\n return 0;\n }}\n filterSuggestions={(suggestions, value) => {\n let filtered = suggestions.filter((suggestion, idx) => {\n if (suggestion.id === 'new') {\n return !value || value === '' || focusTransferPayees ? false : true;\n }\n\n return defaultFilterSuggestion(suggestion, value);\n });\n\n filtered.sort((p1, p2) => {\n let r1 = p1.name.toLowerCase().startsWith(value.toLowerCase());\n let r2 = p2.name.toLowerCase().startsWith(value.toLowerCase());\n let r1exact = p1.name.toLowerCase() === value.toLowerCase();\n let r2exact = p2.name.toLowerCase() === value.toLowerCase();\n\n // (maniacal laughter) mwahaHAHAHAHAH\n if (p1.id === 'new') {\n return -1;\n } else if (p2.id === 'new') {\n return 1;\n } else {\n if (r1exact && !r2exact) {\n return -1;\n } else if (!r1exact && r2exact) {\n return 1;\n } else {\n if (r1 === r2) {\n return 0;\n } else if (r1 && !r2) {\n return -1;\n } else {\n return 1;\n }\n }\n }\n });\n\n let isf = filtered.length > 100;\n filtered = filtered.slice(0, 100);\n filtered.filtered = isf;\n\n if (filtered.length >= 2 && filtered[0].id === 'new') {\n if (filtered[1].name.toLowerCase() === value.toLowerCase()) {\n return filtered.slice(1);\n }\n }\n return filtered;\n }}\n initialFilterSuggestions={suggestions => {\n let filtered = false;\n let res = suggestions.filter((suggestion, idx) => {\n if (suggestion.id === 'new') {\n // Never show the \"create new\" initially\n return false;\n }\n\n if (idx >= 100 && !suggestion.transfer_acct) {\n filtered = true;\n return false;\n }\n return true;\n });\n\n if (filtered) {\n res.filtered = true;\n }\n return res;\n }}\n renderItems={(items, getItemProps, highlightedIndex, inputValue) => (\n <PayeeList\n items={items}\n getItemProps={getItemProps}\n highlightedIndex={highlightedIndex}\n inputValue={inputValue}\n embedded={embedded}\n footer={\n <AutocompleteFooter embedded={embedded}>\n {showMakeTransfer && (\n <AutocompleteFooterButton\n title=\"Make Transfer\"\n style={[\n showManagePayees && { marginBottom: 5 },\n focusTransferPayees && {\n backgroundColor: colors.y8,\n color: colors.g2,\n borderColor: colors.y8\n }\n ]}\n hoveredStyle={\n focusTransferPayees && {\n backgroundColor: colors.y8,\n colors: colors.y2\n }\n }\n onClick={() => {\n onUpdate && onUpdate(null);\n setFocusTransferPayees(!focusTransferPayees);\n }}\n />\n )}\n {showManagePayees && (\n <AutocompleteFooterButton\n title=\"Manage Payees\"\n onClick={() => onManagePayees()}\n />\n )}\n </AutocompleteFooter>\n }\n />\n )}\n {...props}\n />\n );\n}\n","import React from 'react';\nimport { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts';\nimport Autocomplete from './Autocomplete';\nimport { View } from './common';\nimport { colors } from '../style';\n\nexport function AccountList({\n items,\n getItemProps,\n highlightedIndex,\n embedded\n}) {\n let lastItem = null;\n\n return (\n <View>\n <View\n style={[\n { overflow: 'auto', padding: '5px 0' },\n !embedded && { maxHeight: 175 }\n ]}\n >\n {items.map((item, idx) => {\n const showGroup = lastItem\n ? item.offbudget !== lastItem.offbudget\n : true;\n const group = item.offbudget ? 'Off Budget' : 'For Budget';\n lastItem = item;\n\n return [\n showGroup ? (\n <div\n key={group}\n style={{\n color: colors.y9,\n padding: '4px 9px'\n }}\n data-testid=\"account-item-group\"\n >\n {group}\n </div>\n ) : null,\n <div\n {...(getItemProps ? getItemProps({ item }) : null)}\n key={item.id}\n style={{\n backgroundColor:\n highlightedIndex === idx ? colors.n4 : 'transparent',\n padding: 4,\n paddingLeft: 20,\n borderRadius: embedded ? 4 : 0\n }}\n data-testid={\n 'account-item' +\n (highlightedIndex === idx ? '-highlighted' : '')\n }\n >\n {item.name}\n </div>\n ];\n })}\n </View>\n </View>\n );\n}\n\nexport default function AccountAutocomplete({ embedded, ...props }) {\n let accounts = useCachedAccounts() || [];\n\n return (\n <Autocomplete\n strict={true}\n highlightFirst={true}\n embedded={embedded}\n suggestions={accounts}\n renderItems={(items, getItemProps, highlightedIndex) => (\n <AccountList\n items={items}\n getItemProps={getItemProps}\n highlightedIndex={highlightedIndex}\n embedded={embedded}\n />\n )}\n {...props}\n />\n );\n}\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction RightArrow2({ width, height, style, color = \"black\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 91 51\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill={color}\n className=\"path\"\n 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\"\n />\n </svg>\n );\n}\n\nexport default RightArrow2;\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction LeftArrow2({ width, height, style, color = \"black\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 91 51\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill={color}\n className=\"path\"\n 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\"\n />\n </svg>\n );\n}\n\nexport default LeftArrow2;\n","import React from 'react';\n\nconst SvgHyperlink2 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgHyperlink2;\n","import React from 'react';\n\nconst SvgArrowsSynchronize = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <g fill=\"#000\">\n <path\n 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\"\n fill=\"currentColor\"\n />\n </g>\n </svg>\n);\n\nexport default SvgArrowsSynchronize;\n","import { getNumberFormat } from './util';\n\nfunction fail(state, msg) {\n throw new Error(\n msg + ': ' + JSON.stringify(state.str.slice(state.index, 10))\n );\n}\n\nfunction char(state) {\n return state.str[state.index];\n}\n\nfunction next(state) {\n if (state.index >= state.str.length) {\n return null;\n }\n\n let ch = char(state);\n state.index++;\n return ch;\n}\n\nfunction isEnd(state) {\n return state.index >= state.str.length;\n}\n\nfunction nextOperator(state, op) {\n if (char(state) === op) {\n next(state);\n return true;\n }\n\n return false;\n}\n\nfunction parsePrimary(state) {\n // We only support numbers\n let isNegative = char(state) === '-';\n if (isNegative) {\n next(state);\n }\n\n // TODO: Support currency symbols better\n if (char(state) === '$') {\n next(state);\n }\n\n // TODO: The regex should probably respect the number format better,\n // and we should do more strict parsing\n let numberStr = '';\n while (char(state) && char(state).match(/[0-9,.]/)) {\n let thousandsSep = getNumberFormat().separator === ',' ? '.' : ',';\n\n // Don't include the thousands separator\n if (char(state) === thousandsSep) {\n next(state);\n } else {\n numberStr += next(state);\n }\n }\n\n if (numberStr === '') {\n fail(state, 'Unexpected character');\n }\n\n let number = parseFloat(numberStr.replace(getNumberFormat().separator, '.'));\n return isNegative ? -number : number;\n}\n\nfunction parseParens(state) {\n if (char(state) === '(') {\n next(state);\n let expr = parseOperator(state);\n\n if (char(state) !== ')') {\n fail(state, 'Unbalanced parentheses');\n }\n\n next(state);\n return expr;\n }\n\n return parsePrimary(state);\n}\n\nfunction makeOperatorParser(...ops) {\n return ops.reduce((prevParser, op) => {\n return state => {\n let node = prevParser(state);\n while (nextOperator(state, op)) {\n node = { op, left: node, right: prevParser(state) };\n }\n return node;\n };\n }, parseParens);\n}\n\n// These operators go from high to low order of precedence\nlet parseOperator = makeOperatorParser('^', '/', '*', '-', '+');\n\nfunction parse(expression) {\n let state = { str: expression.replace(/\\s/g, ''), index: 0 };\n return parseOperator(state);\n}\n\nfunction evaluate(ast) {\n if (typeof ast === 'number') {\n return ast;\n }\n\n let { left, right, op } = ast;\n\n switch (op) {\n case '+':\n return evaluate(left) + evaluate(right);\n case '-':\n return evaluate(left) - evaluate(right);\n case '*':\n return evaluate(left) * evaluate(right);\n case '/':\n return evaluate(left) / evaluate(right);\n case '^':\n return Math.pow(evaluate(left), evaluate(right));\n default:\n throw new Error('Unknown operator: ' + op);\n }\n}\n\nexport default function evalArithmetic(expression, defaultValue = null) {\n // An empty expression always evals to the default\n if (expression === '') {\n return defaultValue;\n }\n\n let result;\n try {\n result = evaluate(parse(expression));\n } catch (e) {\n // If it errors, return the default value\n return defaultValue;\n }\n\n // Never return NaN\n return isNaN(result) ? defaultValue : result;\n}\n","import React from 'react';\n\nconst SvgEditSkull1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgEditSkull1;\n","import React from 'react';\n\nconst SvgValidationCheck = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgValidationCheck;\n","import React from 'react';\n\nconst SvgFavoriteStar = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgFavoriteStar;\n","import React from 'react';\nimport { colors } from 'loot-design/src/style';\nimport { View, Text } from 'loot-design/src/components/common';\nimport { titleFirst } from 'loot-core/src/shared/util';\n\nimport EditSkull1 from 'loot-design/src/svg/v2/EditSkull1';\nimport AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle';\nimport CalendarIcon from 'loot-design/src/svg/v2/Calendar';\nimport ValidationCheck from 'loot-design/src/svg/v2/ValidationCheck';\nimport FavoriteStar from 'loot-design/src/svg/v2/FavoriteStar';\nimport CheckCircle1 from 'loot-design/src/svg/v2/CheckCircle1';\n\nexport function getStatusProps(status) {\n let color, backgroundColor, Icon;\n\n switch (status) {\n case 'missed':\n color = colors.r1;\n backgroundColor = colors.r10;\n Icon = EditSkull1;\n break;\n case 'due':\n color = colors.y1;\n backgroundColor = colors.y9;\n Icon = AlertTriangle;\n break;\n case 'upcoming':\n color = colors.p1;\n backgroundColor = colors.p10;\n Icon = CalendarIcon;\n break;\n case 'paid':\n color = colors.g2;\n backgroundColor = colors.g10;\n Icon = ValidationCheck;\n break;\n case 'completed':\n color = colors.n4;\n backgroundColor = colors.n11;\n Icon = FavoriteStar;\n break;\n case 'pending':\n color = colors.g4;\n backgroundColor = colors.g11;\n Icon = CalendarIcon;\n break;\n case 'scheduled':\n color = colors.n1;\n backgroundColor = colors.n11;\n Icon = CalendarIcon;\n break;\n default:\n color = colors.n1;\n backgroundColor = colors.n11;\n Icon = CheckCircle1;\n break;\n }\n\n return { color, backgroundColor, Icon };\n}\n\nexport function StatusIcon({ status }) {\n let { color } = getStatusProps(status);\n\n return <Icon style={{ width: 13, height: 13, color }} />;\n}\n\nexport function StatusBadge({ status, style }) {\n let { color, backgroundColor, Icon } = getStatusProps(status);\n return (\n <View\n style={[\n {\n color,\n backgroundColor,\n padding: '6px 8px',\n borderRadius: 4,\n flexDirection: 'row',\n alignItems: 'center',\n flexShrink: 0\n },\n style\n ]}\n >\n <Icon\n style={{\n width: 13,\n height: 13,\n color: 'inherit',\n marginRight: 7\n }}\n />\n <Text style={{ lineHeight: '1em' }}>{titleFirst(status)}</Text>\n </View>\n );\n}\n","import * as monthUtils from './months';\nimport q from './query';\n\nexport function getStatus(nextDate, completed, hasTrans) {\n let today = monthUtils.currentDay();\n\n if (completed) {\n return 'completed';\n } else if (hasTrans) {\n return 'paid';\n } else if (nextDate === today) {\n return 'due';\n } else if (nextDate > today && nextDate <= monthUtils.addDays(today, 7)) {\n return 'upcoming';\n } else if (nextDate < today) {\n return 'missed';\n } else {\n return 'scheduled';\n }\n}\n\nexport function getHasTransactionsQuery(schedules) {\n let filters = schedules.map(schedule => {\n let dateCond = schedule._conditions.find(c => c.field === 'date');\n return {\n $and: {\n schedule: schedule.id,\n date: {\n $gte:\n dateCond && dateCond.op === 'is'\n ? schedule.next_date\n : monthUtils.subDays(schedule.next_date, 2)\n }\n }\n };\n });\n\n return q('transactions')\n .filter({ $or: filters })\n .orderBy({ date: 'desc' })\n .groupBy('schedule')\n .select(['schedule', 'date']);\n}\n\nfunction makeNumberSuffix(num) {\n // Slight abuse of date-fns to turn a number like \"1\" into the full\n // form \"1st\" but formatting a date with that number\n return monthUtils.format(new Date(2020, 0, num, 12), 'do');\n}\n\nfunction prettyDayName(day) {\n let days = {\n SU: 'Sunday',\n MO: 'Monday',\n TU: 'Tuesday',\n WE: 'Wednesday',\n TH: 'Thursday',\n FR: 'Friday',\n SA: 'Saturday'\n };\n return days[day];\n}\n\nexport function getRecurringDescription(config) {\n let interval = config.interval || 1;\n\n switch (config.frequency) {\n case 'weekly': {\n let desc = 'Every ';\n desc += interval !== 1 ? `${interval} weeks` : 'week';\n desc += ' on ' + monthUtils.format(config.start, 'EEEE');\n return desc;\n }\n case 'monthly': {\n let desc = 'Every ';\n desc += interval !== 1 ? `${interval} months` : 'month';\n\n if (config.patterns && config.patterns.length > 0) {\n // Sort the days ascending. We filter out -1 because that\n // represents \"last days\" and should always be last, but this\n // sort would put them first\n let patterns = [...config.patterns]\n .sort((p1, p2) => {\n let typeOrder =\n (p1.type === 'day' ? 1 : 0) - (p2.type === 'day' ? 1 : 0);\n let valOrder = p1.value - p2.value;\n\n if (typeOrder === 0) {\n return valOrder;\n }\n return typeOrder;\n })\n .filter(p => p.value !== -1);\n\n // Add on all -1 values to the end\n patterns = patterns.concat(config.patterns.filter(p => p.value === -1));\n\n desc += ' on the ';\n\n let strs = [];\n\n let uniqueDays = new Set(patterns.map(p => p.type));\n let isSameDay = uniqueDays.length === 1 && !uniqueDays.has('day');\n\n for (let pattern of patterns) {\n if (pattern.type === 'day') {\n if (pattern.value === -1) {\n strs.push('last day');\n } else {\n // Example: 15th day\n strs.push(makeNumberSuffix(pattern.value));\n }\n } else {\n let dayName = isSameDay ? '' : ' ' + prettyDayName(pattern.type);\n\n if (pattern.value === -1) {\n // Example: last Monday\n strs.push('last' + dayName);\n } else {\n // Example: 3rd Monday\n strs.push(makeNumberSuffix(pattern.value) + dayName);\n }\n }\n }\n\n if (strs.length > 2) {\n desc += strs.slice(0, strs.length - 1).join(', ');\n desc += ', and ';\n desc += strs[strs.length - 1];\n } else {\n desc += strs.join(' and ');\n }\n\n if (isSameDay) {\n desc += ' ' + prettyDayName(patterns[0].type);\n }\n } else {\n desc += ' on the ' + monthUtils.format(config.start, 'do');\n }\n\n return desc;\n }\n case 'yearly': {\n let desc = 'Every ';\n desc += interval !== 1 ? `${interval} years` : 'year';\n desc += ' on ' + monthUtils.format(config.start, 'LLL do');\n return desc;\n }\n default:\n return 'Recurring error';\n }\n}\n\nexport function recurConfigToRSchedule(config) {\n let base = {\n start: monthUtils.parseDate(config.start),\n frequency: config.frequency.toUpperCase(),\n byHourOfDay: [12]\n };\n\n if (config.interval) {\n base.interval = config.interval;\n }\n\n let abbrevDay = name => name.slice(0, 2).toUpperCase();\n\n switch (config.frequency) {\n case 'weekly':\n // Nothing to do\n return [base];\n case 'monthly':\n if (config.patterns && config.patterns.length > 0) {\n let days = config.patterns.filter(p => p.type === 'day');\n let dayNames = config.patterns.filter(p => p.type !== 'day');\n\n return [\n days.length > 0 && { ...base, byDayOfMonth: days.map(p => p.value) },\n dayNames.length > 0 && {\n ...base,\n byDayOfWeek: dayNames.map(p => [abbrevDay(p.type), p.value])\n }\n ].filter(Boolean);\n } else {\n // Nothing to do\n return [base];\n }\n case 'yearly':\n return [base];\n default:\n throw new Error('Invalid recurring date config');\n }\n}\n\nexport function extractScheduleConds(conditions) {\n return {\n payee:\n conditions.find(cond => cond.op === 'is' && cond.field === 'payee') ||\n conditions.find(\n cond => cond.op === 'is' && cond.field === 'description'\n ) ||\n null,\n account:\n conditions.find(cond => cond.op === 'is' && cond.field === 'account') ||\n conditions.find(cond => cond.op === 'is' && cond.field === 'acct') ||\n null,\n amount:\n conditions.find(\n cond =>\n (cond.op === 'is' ||\n cond.op === 'isapprox' ||\n cond.op === 'isbetween') &&\n cond.field === 'amount'\n ) || null,\n date:\n conditions.find(\n cond =>\n (cond.op === 'is' || cond.op === 'isapprox') && cond.field === 'date'\n ) || null\n };\n}\n\nexport function getScheduledAmount(amount) {\n if (amount && typeof amount !== 'number') {\n return ((amount.num1 + amount.num2) / 2) | 0;\n }\n return amount;\n}\n","import React, { useMemo, useEffect, useState, useContext } from 'react';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport {\n getStatus,\n getHasTransactionsQuery\n} from 'loot-core/src/shared/schedules';\nimport q, { liveQuery, runQuery } from 'loot-core/src/client/query-helpers';\nimport { send } from 'loot-core/src/platform/client/fetch';\n\nfunction loadStatuses(schedules, onData) {\n return liveQuery(getHasTransactionsQuery(schedules), onData, {\n mapper: data => {\n let hasTrans = new Set(data.filter(Boolean).map(row => row.schedule));\n\n return new Map(\n schedules.map(s => [\n s.id,\n getStatus(s.next_date, s.completed, hasTrans.has(s.id))\n ])\n );\n }\n });\n}\n\nexport function useSchedules({ transform } = {}) {\n let [data, setData] = useState(null);\n\n useEffect(() => {\n let query = q('schedules').select('*');\n let scheduleQuery, statusQuery;\n\n scheduleQuery = liveQuery(\n transform ? transform(query) : query,\n async schedules => {\n if (scheduleQuery) {\n if (statusQuery) {\n statusQuery.unsubscribe();\n }\n\n statusQuery = loadStatuses(schedules, statuses =>\n setData({ schedules, statuses })\n );\n }\n }\n );\n\n return () => {\n if (scheduleQuery) {\n scheduleQuery.unsubscribe();\n }\n if (statusQuery) {\n statusQuery.unsubscribe();\n }\n };\n }, [transform]);\n\n return data;\n}\n\nlet SchedulesContext = React.createContext(null);\n\nexport function SchedulesProvider({ transform, children }) {\n let data = useSchedules({ transform });\n return <SchedulesContext.Provider value={data} children={children} />;\n}\n\nexport function useCachedSchedules() {\n return useContext(SchedulesContext);\n}\n","import React, {\n useState,\n useRef,\n useMemo,\n useCallback,\n useLayoutEffect,\n useEffect,\n useImperativeHandle,\n useContext,\n useReducer\n} from 'react';\nimport { useSelector, useDispatch } from 'react-redux';\nimport {\n format as formatDate,\n parse as parseDate,\n parseISO,\n isValid as isDateValid\n} from 'date-fns';\nimport q, { runQuery } from 'loot-core/src/client/query-helpers';\nimport {\n View,\n Text,\n Stack,\n Tooltip,\n Button\n} from 'loot-design/src/components/common';\nimport CategoryAutocomplete from 'loot-design/src/components/CategorySelect';\nimport PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete';\nimport AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete';\nimport DateSelect from 'loot-design/src/components/DateSelect';\nimport RightArrow2 from 'loot-design/src/svg/RightArrow2';\nimport LeftArrow2 from 'loot-design/src/svg/LeftArrow2';\nimport Hyperlink2 from 'loot-design/src/svg/v2/Hyperlink2';\nimport DeleteIcon from 'loot-design/src/svg/Delete';\nimport CheveronDown from 'loot-design/src/svg/v1/CheveronDown';\nimport CalendarIcon from 'loot-design/src/svg/v2/Calendar';\nimport ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize';\nimport {\n integerToCurrency,\n amountToInteger,\n applyChanges,\n debugMemoFailure,\n titleFirst\n} from 'loot-core/src/shared/util';\nimport evalArithmetic from 'loot-core/src/shared/arithmetic';\nimport {\n getAccountsById,\n getPayeesById,\n getCategoriesById\n} from 'loot-core/src/client/reducers/queries';\nimport { currentDay, dayFromDate, addDays } from 'loot-core/src/shared/months';\nimport {\n splitTransaction,\n updateTransaction,\n deleteTransaction,\n addSplitTransaction,\n ungroupTransaction\n} from 'loot-core/src/shared/transactions';\nimport { styles, colors } from 'loot-design/src/style';\nimport {\n Cell,\n Field,\n Row,\n InputCell,\n SelectCell,\n DeleteCell,\n CustomCell,\n CellButton,\n useTableNavigator,\n Table,\n ROW_HEIGHT\n} from 'loot-design/src/components/table';\nimport {\n useSelectedDispatch,\n useSelectedItems\n} from 'loot-design/src/components/useSelected';\nimport { keys } from 'loot-design/src/util/keys';\nimport { useMergedRefs } from 'loot-design/src/components/useMergedRefs';\nimport { getStatusProps } from '../schedules/StatusBadge';\nimport { useCachedSchedules } from 'loot-core/src/client/data-hooks/schedules';\nimport { getScheduledAmount } from 'loot-core/src/shared/schedules';\n\nlet TABLE_BACKGROUND_COLOR = colors.n11;\n\nfunction getDisplayValue(obj, name) {\n return obj ? obj[name] : '';\n}\n\nfunction serializeTransaction(transaction, showZeroInDeposit, dateFormat) {\n let { amount, date } = transaction;\n\n if (isPreviewId(transaction.id)) {\n amount = getScheduledAmount(amount);\n }\n\n let debit = amount < 0 ? -amount : null;\n let credit = amount > 0 ? amount : null;\n\n if (amount === 0) {\n if (showZeroInDeposit) {\n credit = 0;\n } else {\n debit = 0;\n }\n }\n\n // Validate the date format\n if (!isDateValid(parseISO(date))) {\n // Be a little forgiving if the date isn't valid. This at least\n // stops the UI from crashing, but this is a serious problem with\n // the data. This allows the user to go through and see empty\n // dates and manually fix them.\n date = null;\n }\n\n return {\n ...transaction,\n date,\n debit: debit != null ? integerToCurrency(debit) : '',\n credit: credit != null ? integerToCurrency(credit) : ''\n };\n}\n\nfunction deserializeTransaction(transaction, originalTransaction, dateFormat) {\n let { debit, credit, date, ...realTransaction } = transaction;\n\n let amount;\n if (debit !== '') {\n let parsed = evalArithmetic(debit, null);\n amount = parsed != null ? -parsed : null;\n } else {\n amount = evalArithmetic(credit, null);\n }\n\n amount =\n amount != null ? amountToInteger(amount) : originalTransaction.amount;\n\n if (date == null) {\n date = originalTransaction.date || currentDay();\n }\n\n return { ...realTransaction, date, amount };\n}\n\nfunction getParentTransaction(transactions, fromIndex) {\n let trans = transactions[fromIndex];\n let parent;\n let parentIdx = fromIndex;\n while (parentIdx >= 0) {\n if (transactions[parentIdx].id === trans.parent_id) {\n // Found the parent\n return transactions[parentIdx];\n }\n parentIdx--;\n }\n\n return null;\n}\n\nfunction isLastChild(transactions, index) {\n let trans = transactions[index];\n return (\n trans &&\n trans.is_child &&\n (transactions[index + 1] == null ||\n transactions[index + 1].parent_id !== trans.parent_id)\n );\n}\n\nlet SplitsExpandedContext = React.createContext(null);\n\nexport function useSplitsExpanded() {\n let data = useContext(SplitsExpandedContext);\n\n return useMemo(\n () => ({\n ...data,\n expanded: id =>\n data.state.mode === 'collapse'\n ? !data.state.ids.has(id)\n : data.state.ids.has(id)\n }),\n [data]\n );\n}\n\nexport function SplitsExpandedProvider({ children, initialMode = 'expand' }) {\n let cachedState = useSelector(state => state.app.lastSplitState);\n let reduxDispatch = useDispatch();\n\n let [state, dispatch] = useReducer((state, action) => {\n switch (action.type) {\n case 'toggle-split': {\n let ids = new Set([...state.ids]);\n let { id } = action;\n if (ids.has(id)) {\n ids.delete(id);\n } else {\n ids.add(id);\n }\n return { ...state, ids };\n }\n case 'open-split': {\n let ids = new Set([...state.ids]);\n let { id } = action;\n if (state.mode === 'collapse') {\n ids.delete(id);\n } else {\n ids.add(id);\n }\n return { ...state, ids };\n }\n case 'set-mode': {\n return {\n ...state,\n mode: action.mode,\n ids: new Set(),\n transitionId: null\n };\n }\n case 'switch-mode':\n if (state.transitionId != null) {\n // You can only transition once at a time\n return state;\n }\n\n return {\n ...state,\n mode: state.mode === 'expand' ? 'collapse' : 'expand',\n transitionId: action.id,\n ids: new Set()\n };\n case 'finish-switch-mode':\n return { ...state, transitionId: null };\n default:\n throw new Error('Unknown action type: ' + action.type);\n }\n }, cachedState.current || { ids: new Set(), mode: initialMode });\n\n useEffect(() => {\n if (state.transitionId != null) {\n // This timeout allows animations to finish\n setTimeout(() => {\n dispatch({ type: 'finish-switch-mode' });\n }, 250);\n }\n }, [state.transitionId]);\n\n useEffect(() => {\n // In a finished state, cache the state\n if (state.transitionId == null) {\n reduxDispatch({ type: 'SET_LAST_SPLIT_STATE', splitState: state });\n }\n }, [state]);\n\n let value = useMemo(() => ({ state, dispatch }), [state, dispatch]);\n\n return (\n <SplitsExpandedContext.Provider value={value}>\n {children}\n </SplitsExpandedContext.Provider>\n );\n}\n\nexport const TransactionHeader = React.memo(\n ({ hasSelected, showAccount, showCategory, showBalance }) => {\n let dispatchSelected = useSelectedDispatch();\n\n return (\n <Row\n borderColor={colors.n9}\n backgroundColor=\"white\"\n style={{\n color: colors.n4,\n fontWeight: 300,\n zIndex: 200\n }}\n >\n <SelectCell\n exposed={true}\n focused={false}\n selected={hasSelected}\n width={20}\n onSelect={() => dispatchSelected({ type: 'select-all' })}\n />\n <Cell value=\"Date\" width={110} />\n {showAccount && <Cell value=\"Account\" width=\"flex\" />}\n <Cell value=\"Payee\" width=\"flex\" />\n <Cell value=\"Notes\" width=\"flex\" />\n {showCategory && <Cell value=\"Category\" width=\"flex\" />}\n <Cell value=\"Payment\" width={80} textAlign=\"right\" />\n <Cell value=\"Deposit\" width={80} textAlign=\"right\" />\n {showBalance && <Cell value=\"Balance\" width={85} textAlign=\"right\" />}\n <Field width={21} truncate={false} />\n <Cell value=\"\" width={15 + styles.scrollbarWidth} />\n </Row>\n );\n }\n);\n\nfunction getPayeePretty(transaction, payee, transferAcct) {\n let { payee: payeeId } = transaction;\n\n if (transferAcct) {\n const Icon = transaction.amount > 0 ? LeftArrow2 : RightArrow2;\n return (\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center'\n }}\n >\n <Icon width={10} height={8} style={{ marginRight: 5, flexShrink: 0 }} />\n <div>{transferAcct.name}</div>\n </View>\n );\n } else if (payee && !payee.transfer_acct) {\n // Check to make sure this isn't a transfer because in the rare\n // occasion that the account has been deleted but the payee is\n // still there, we don't want to show the name.\n return payee.name;\n } else if (payeeId && payeeId.startsWith('new:')) {\n return payeeId.slice('new:'.length);\n }\n\n return '';\n}\n\nfunction StatusCell({\n id,\n focused,\n selected,\n status,\n isChild,\n onEdit,\n onUpdate\n}) {\n let isClearedField = status === 'cleared' || status == null;\n let statusProps = getStatusProps(status);\n\n let props = {\n color:\n status === 'cleared'\n ? colors.g5\n : status === 'missed'\n ? colors.r6\n : status === 'due'\n ? colors.y5\n : selected\n ? colors.b7\n : colors.n6\n };\n\n function onSelect() {\n if (isClearedField) {\n onUpdate('cleared', !(status === 'cleared'));\n }\n }\n\n return (\n <Cell\n name=\"cleared\"\n width=\"auto\"\n focused={focused}\n style={{ padding: 1 }}\n plain\n >\n <CellButton\n style={[\n {\n padding: 3,\n border: '1px solid transparent',\n borderRadius: 50,\n ':focus': {\n border: '1px solid ' + props.color,\n boxShadow: `0 1px 2px ${props.color}`\n }\n },\n\n isChild && { visibility: 'hidden' }\n ]}\n onEdit={() => onEdit(id, 'cleared')}\n onSelect={onSelect}\n >\n {React.createElement(statusProps.Icon, {\n style: {\n width: 13,\n height: 13,\n color: props.color,\n marginTop: status === 'due' ? -1 : 0\n }\n })}\n </CellButton>\n </Cell>\n );\n}\n\nfunction PayeeCell({\n id,\n payeeId,\n focused,\n inherited,\n payees,\n accounts,\n valueStyle,\n transaction,\n payee,\n transferAcct,\n importedPayee,\n isPreview,\n onEdit,\n onUpdate,\n onCreatePayee,\n onManagePayees\n}) {\n let isCreatingPayee = useRef(false);\n\n return (\n <CustomCell\n width=\"flex\"\n name=\"payee\"\n value={payeeId}\n valueStyle={[valueStyle, inherited && { color: colors.n8 }]}\n formatter={value => getPayeePretty(transaction, payee, transferAcct)}\n exposed={focused}\n title={importedPayee || payeeId}\n onExpose={!isPreview && (name => onEdit(id, name))}\n onUpdate={async value => {\n onUpdate('payee', value);\n\n if (value && value.startsWith('new:') && !isCreatingPayee.current) {\n isCreatingPayee.current = true;\n let id = await onCreatePayee(value.slice('new:'.length));\n onUpdate('payee', id);\n isCreatingPayee.current = false;\n }\n }}\n >\n {({\n onBlur,\n onKeyDown,\n onUpdate,\n onSave,\n shouldSaveFromKey,\n inputStyle\n }) => {\n return (\n <>\n <PayeeAutocomplete\n payees={payees}\n accounts={accounts}\n value={payeeId}\n shouldSaveFromKey={shouldSaveFromKey}\n inputProps={{\n onBlur,\n onKeyDown,\n style: inputStyle\n }}\n showManagePayees={true}\n tableBehavior={true}\n defaultFocusTransferPayees={transaction.is_child}\n focused={true}\n onUpdate={onUpdate}\n onSelect={onSave}\n onManagePayees={() => onManagePayees(payeeId)}\n />\n </>\n );\n }}\n </CustomCell>\n );\n}\n\nfunction CellWithScheduleIcon({ scheduleId, children }) {\n let scheduleData = useCachedSchedules();\n\n let schedule = scheduleData.schedules.find(s => s.id === scheduleId);\n\n if (schedule == null) {\n // This must be a deleted schedule\n return children;\n }\n\n let recurring = schedule._date && !!schedule._date.frequency;\n\n let style = {\n width: 13,\n height: 13,\n marginLeft: 5,\n marginRight: 3,\n color: 'inherit'\n };\n let Icon = recurring ? ArrowsSynchronize : CalendarIcon;\n\n return (\n <View style={{ flex: 1, flexDirection: 'row', alignItems: 'stretch' }}>\n <Cell exposed={true}>\n {() =>\n recurring ? (\n <ArrowsSynchronize style={style} />\n ) : (\n <CalendarIcon style={{ ...style, transform: 'translateY(-1px)' }} />\n )\n }\n </Cell>\n\n {children}\n </View>\n );\n}\n\nexport const Transaction = React.memo(function Transaction(props) {\n let {\n transaction: originalTransaction,\n editing,\n backgroundColor = 'white',\n showAccount,\n showBalance,\n showZeroInDeposit,\n style,\n hovered,\n selected,\n highlighted,\n added,\n matched,\n expanded,\n inheritedFields,\n focusedField,\n categoryGroups,\n payees,\n accounts,\n balance,\n dateFormat = 'MM/dd/yyyy',\n onSave,\n onEdit,\n onHover,\n onDelete,\n onSplit,\n onManagePayees,\n onCreatePayee,\n onToggleSplit\n } = props;\n\n let dispatchSelected = useSelectedDispatch();\n\n let [prevShowZero, setPrevShowZero] = useState(showZeroInDeposit);\n let [prevTransaction, setPrevTransaction] = useState(originalTransaction);\n let [transaction, setTransaction] = useState(\n serializeTransaction(originalTransaction, showZeroInDeposit, dateFormat)\n );\n let isPreview = isPreviewId(transaction.id);\n\n if (\n originalTransaction !== prevTransaction ||\n showZeroInDeposit !== prevShowZero\n ) {\n setTransaction(\n serializeTransaction(originalTransaction, showZeroInDeposit, dateFormat)\n );\n setPrevTransaction(originalTransaction);\n setPrevShowZero(showZeroInDeposit);\n }\n\n function onUpdate(name, value) {\n if (transaction[name] !== value) {\n let newTransaction = { ...transaction, [name]: value };\n\n if (\n name === 'account' &&\n value &&\n getAccountsById(accounts)[value].offbudget\n ) {\n newTransaction.category = null;\n }\n\n // If entering an amount in either of the credit/debit fields, we\n // need to clear out the other one so it's always properly\n // translated into the desired amount (see\n // `deserializeTransaction`)\n if (name === 'credit') {\n newTransaction['debit'] = '';\n } else if (name === 'debit') {\n newTransaction['credit'] = '';\n }\n\n // Don't save a temporary value (a new payee) which will be\n // filled in with a real id later\n if (name === 'payee' && value && value.startsWith('new:')) {\n setTransaction(newTransaction);\n } else {\n let deserialized = deserializeTransaction(\n newTransaction,\n originalTransaction,\n dateFormat\n );\n // Run the transaction through the formatting so that we know\n // it's always showing the formatted result\n setTransaction(\n serializeTransaction(deserialized, showZeroInDeposit, dateFormat)\n );\n onSave(deserialized);\n }\n }\n }\n\n let {\n id,\n debit,\n credit,\n payee: payeeId,\n imported_payee: importedPayee,\n notes,\n date,\n account: accountId,\n category,\n cleared,\n is_parent: isParent,\n _unmatched = false\n } = transaction;\n\n // Join in some data\n let payee = payees && payeeId && getPayeesById(payees)[payeeId];\n let account = accounts && accountId && getAccountsById(accounts)[accountId];\n let transferAcct =\n payee &&\n payee.transfer_acct &&\n getAccountsById(accounts)[payee.transfer_acct];\n\n let isChild = transaction.is_child;\n let borderColor = selected ? colors.b8 : colors.border;\n let isBudgetTransfer = transferAcct && transferAcct.offbudget === 0;\n let isOffBudget = account && account.offbudget === 1;\n\n let valueStyle = added ? { fontWeight: 600 } : null;\n let backgroundFocus = hovered || focusedField === 'select';\n\n return (\n <Row\n borderColor={borderColor}\n backgroundColor={\n selected\n ? colors.selected\n : backgroundFocus\n ? colors.hover\n : isPreview\n ? '#fcfcfc'\n : backgroundColor\n }\n highlighted={highlighted}\n style={[\n style,\n isPreview && { color: colors.n5, fontStyle: 'italic' },\n _unmatched && { opacity: 0.5 }\n ]}\n onMouseEnter={() => onHover && onHover(transaction.id)}\n >\n {isChild && (\n <Field\n borderColor=\"transparent\"\n width={110}\n style={{\n width: 110,\n backgroundColor: colors.n11,\n borderBottomWidth: 0\n }}\n />\n )}\n {isChild && showAccount && (\n <Field\n borderColor=\"transparent\"\n style={{\n flex: 1,\n backgroundColor: colors.n11,\n opacity: 0\n }}\n />\n )}\n\n {isTemporaryId(transaction.id) ? (\n isChild ? (\n <DeleteCell\n onDelete={() => onDelete && onDelete(transaction.id)}\n exposed={hovered || editing}\n style={[isChild && { borderLeftWidth: 1 }, { lineHeight: 0 }]}\n />\n ) : (\n <Cell width={20} />\n )\n ) : (\n <SelectCell\n exposed={hovered || selected || editing}\n focused={focusedField === 'select'}\n onSelect={() => {\n dispatchSelected({ type: 'select', id: transaction.id });\n }}\n onEdit={() => onEdit(id, 'select')}\n selected={selected}\n style={[isChild && { borderLeftWidth: 1 }]}\n value={\n matched && (\n <Hyperlink2 style={{ width: 13, height: 13, color: colors.n7 }} />\n )\n }\n />\n )}\n\n {!isChild && (\n <CustomCell\n name=\"date\"\n width={110}\n exposed={focusedField === 'date'}\n value={date}\n valueStyle={valueStyle}\n formatter={date =>\n date ? formatDate(parseISO(date), dateFormat) : ''\n }\n onExpose={!isPreview && (name => onEdit(id, name))}\n onUpdate={value => {\n onUpdate('date', value);\n }}\n >\n {({\n onBlur,\n onKeyDown,\n onUpdate,\n onSave,\n shouldSaveFromKey,\n inputStyle\n }) => (\n <DateSelect\n value={date || ''}\n dateFormat={dateFormat}\n inputProps={{ onBlur, onKeyDown, style: inputStyle }}\n shouldSaveFromKey={shouldSaveFromKey}\n tableBehavior={true}\n onUpdate={onUpdate}\n onSelect={onSave}\n />\n )}\n </CustomCell>\n )}\n\n {!isChild && showAccount && (\n <CustomCell\n name=\"account\"\n width=\"flex\"\n value={accountId}\n formatter={acctId => {\n let acct = acctId && getAccountsById(accounts)[acctId];\n if (acct) {\n return acct.name;\n }\n return '';\n }}\n valueStyle={valueStyle}\n exposed={focusedField === 'account'}\n onExpose={!isPreview && (name => onEdit(id, name))}\n onUpdate={async value => {\n // Only ever allow non-null values\n if (value) {\n onUpdate('account', value);\n }\n }}\n >\n {({\n onBlur,\n onKeyDown,\n onUpdate,\n onSave,\n shouldSaveFromKey,\n inputStyle\n }) => (\n <AccountAutocomplete\n value={accountId}\n accounts={accounts}\n shouldSaveFromKey={shouldSaveFromKey}\n tableBehavior={true}\n focused={true}\n inputProps={{ onBlur, onKeyDown, style: inputStyle }}\n onUpdate={onUpdate}\n onSelect={onSave}\n />\n )}\n </CustomCell>\n )}\n {(() => {\n let cell = (\n <PayeeCell\n id={id}\n payeeId={payeeId}\n focused={focusedField === 'payee'}\n inherited={inheritedFields && inheritedFields.has('payee')}\n payees={payees}\n accounts={accounts}\n valueStyle={valueStyle}\n transaction={transaction}\n payee={payee}\n transferAcct={transferAcct}\n importedPayee={importedPayee}\n isPreview={isPreview}\n onEdit={onEdit}\n onUpdate={onUpdate}\n onCreatePayee={onCreatePayee}\n onManagePayees={onManagePayees}\n />\n );\n\n if (transaction.schedule) {\n return (\n <CellWithScheduleIcon scheduleId={transaction.schedule}>\n {cell}\n </CellWithScheduleIcon>\n );\n }\n return cell;\n })()}\n\n {isPreview ? (\n <Cell name=\"notes\" width=\"flex\" />\n ) : (\n <InputCell\n width=\"flex\"\n name=\"notes\"\n exposed={focusedField === 'notes'}\n focused={focusedField === 'notes'}\n value={notes || ''}\n valueStyle={valueStyle}\n onExpose={!isPreview && (name => onEdit(id, name))}\n inputProps={{\n value: notes || '',\n onUpdate: onUpdate.bind(null, 'notes')\n }}\n />\n )}\n\n {isPreview ? (\n <Cell width=\"flex\" style={{ alignItems: 'flex-start' }} exposed={true}>\n {() => (\n <View\n style={{\n color:\n notes === 'missed'\n ? colors.r6\n : notes === 'due'\n ? colors.y4\n : selected\n ? colors.b5\n : colors.n6,\n backgroundColor:\n notes === 'missed'\n ? colors.r10\n : notes === 'due'\n ? colors.y9\n : selected\n ? colors.b8\n : colors.n10,\n margin: '0 5px',\n padding: '3px 7px',\n borderRadius: 4\n }}\n >\n {titleFirst(notes)}\n </View>\n )}\n </Cell>\n ) : isParent ? (\n <Cell\n name=\"category\"\n width=\"flex\"\n focused={focusedField === 'category'}\n style={{ padding: 0 }}\n plain\n >\n <CellButton\n style={{\n alignSelf: 'flex-start',\n color: colors.n6,\n borderRadius: 4,\n transition: 'none',\n '&:hover': {\n backgroundColor: 'rgba(100, 100, 100, .15)',\n color: colors.n5\n }\n }}\n disabled={isTemporaryId(transaction.id)}\n onEdit={() => onEdit(id, 'category')}\n onSelect={() => onToggleSplit(id)}\n >\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'stretch',\n borderRadius: 4,\n flex: 1,\n padding: 4\n }}\n >\n {isParent && (\n <CheveronDown\n style={{\n width: 14,\n height: 14,\n color: 'currentColor',\n transition: 'transform .08s',\n transform: expanded ? 'rotateZ(0)' : 'rotateZ(-90deg)'\n }}\n />\n )}\n <Text style={{ fontStyle: 'italic', userSelect: 'none' }}>\n Split\n </Text>\n </View>\n </CellButton>\n </Cell>\n ) : isBudgetTransfer || isOffBudget || isPreview ? (\n <InputCell\n name=\"category\"\n width=\"flex\"\n exposed={focusedField === 'category'}\n focused={focusedField === 'category'}\n onExpose={!isPreview && (name => onEdit(id, name))}\n value={\n isParent\n ? 'Split'\n : isOffBudget\n ? 'Off Budget'\n : isBudgetTransfer\n ? 'Transfer'\n : ''\n }\n valueStyle={valueStyle}\n style={{ fontStyle: 'italic', color: '#c0c0c0', fontWeight: 300 }}\n inputProps={{\n readOnly: true,\n style: { fontStyle: 'italic' }\n }}\n />\n ) : (\n <CustomCell\n name=\"category\"\n width=\"flex\"\n value={category}\n formatter={value =>\n value\n ? getDisplayValue(\n getCategoriesById(categoryGroups)[value],\n 'name'\n )\n : transaction.id\n ? 'Categorize'\n : ''\n }\n exposed={focusedField === 'category'}\n onExpose={name => onEdit(id, name)}\n valueStyle={\n !category\n ? {\n fontStyle: 'italic',\n fontWeight: 300,\n color: colors.p8\n }\n : valueStyle\n }\n onUpdate={async value => {\n if (value === 'split') {\n onSplit(transaction.id);\n } else {\n onUpdate('category', value);\n }\n }}\n >\n {({\n onBlur,\n onKeyDown,\n onUpdate,\n onSave,\n shouldSaveFromKey,\n inputStyle\n }) => (\n <CategoryAutocomplete\n categoryGroups={categoryGroups}\n value={category}\n focused={true}\n tableBehavior={true}\n showSplitOption={!isChild && !isParent}\n shouldSaveFromKey={shouldSaveFromKey}\n inputProps={{ onBlur, onKeyDown, style: inputStyle }}\n onUpdate={onUpdate}\n onSelect={onSave}\n />\n )}\n </CustomCell>\n )}\n\n <InputCell\n type=\"input\"\n width={80}\n name=\"debit\"\n exposed={focusedField === 'debit'}\n focused={focusedField === 'debit'}\n value={debit == null ? '' : debit}\n valueStyle={valueStyle}\n textAlign=\"right\"\n title={debit}\n onExpose={!isPreview && (name => onEdit(id, name))}\n style={[isParent && { fontStyle: 'italic' }, styles.tnum]}\n inputProps={{\n value: debit,\n onUpdate: onUpdate.bind(null, 'debit')\n }}\n />\n\n <InputCell\n type=\"input\"\n width={80}\n name=\"credit\"\n exposed={focusedField === 'credit'}\n focused={focusedField === 'credit'}\n value={credit == null ? '' : credit}\n valueStyle={valueStyle}\n textAlign=\"right\"\n title={credit}\n onExpose={!isPreview && (name => onEdit(id, name))}\n style={[isParent && { fontStyle: 'italic' }, styles.tnum]}\n inputProps={{\n value: credit,\n onUpdate: onUpdate.bind(null, 'credit')\n }}\n />\n\n {showBalance && (\n <Cell\n name=\"balance\"\n value={\n balance == null || isChild || isPreview\n ? ''\n : integerToCurrency(balance)\n }\n valueStyle={{ color: balance < 0 ? colors.r4 : colors.g4 }}\n style={styles.tnum}\n width={85}\n textAlign=\"right\"\n />\n )}\n\n <StatusCell\n id={id}\n focused={focusedField === 'cleared'}\n selected={selected}\n isPreview={isPreview}\n status={isPreview ? notes : cleared ? 'cleared' : null}\n isChild={isChild}\n onEdit={onEdit}\n onUpdate={onUpdate}\n />\n\n <Cell width={15} />\n </Row>\n );\n});\n\nexport function TransactionError({ error, isDeposit, onAddSplit, style }) {\n switch (error.type) {\n case 'SplitTransactionError':\n if (error.version === 1) {\n return (\n <View\n style={[\n {\n flexDirection: 'row',\n alignItems: 'center',\n padding: '0 5px'\n },\n style\n ]}\n data-testid=\"transaction-error\"\n >\n <Text>\n Amount left:{' '}\n <Text style={{ fontWeight: 500 }}>\n {integerToCurrency(\n isDeposit ? error.difference : -error.difference\n )}\n </Text>\n </Text>\n <View style={{ flex: 1 }} />\n <Button\n style={{ marginLeft: 15, padding: '4px 10px' }}\n primary\n onClick={onAddSplit}\n >\n Add Split\n </Button>\n </View>\n );\n }\n break;\n default:\n return null;\n }\n}\n\nfunction makeTemporaryTransactions(currentAccountId, lastDate) {\n return [\n {\n id: 'temp',\n date: lastDate || currentDay(),\n account: currentAccountId || null,\n cleared: false,\n amount: 0\n }\n ];\n}\n\nfunction isTemporaryId(id) {\n return id.indexOf('temp') !== -1;\n}\n\nexport function isPreviewId(id) {\n return id.indexOf('preview/') !== -1;\n}\n\nfunction NewTransaction({\n transactions,\n accounts,\n currentAccountId,\n categoryGroups,\n payees,\n editingTransaction,\n hoveredTransaction,\n focusedField,\n showAccount,\n showCategory,\n showBalance,\n dateFormat,\n onHover,\n onClose,\n onSplit,\n onEdit,\n onDelete,\n onSave,\n onAdd,\n onAddSplit,\n onManagePayees,\n onCreatePayee\n}) {\n const error = transactions[0].error;\n const isDeposit = transactions[0].amount > 0;\n\n return (\n <View\n style={{\n borderBottom: '1px solid #ebebeb',\n paddingBottom: 6,\n backgroundColor: 'white'\n }}\n data-testid=\"new-transaction\"\n onKeyDown={e => {\n if (e.keyCode === 27) {\n onClose();\n }\n }}\n onMouseLeave={() => onHover(null)}\n >\n {transactions.map((transaction, idx) => (\n <Transaction\n key={transaction.id}\n editing={editingTransaction === transaction.id}\n hovered={hoveredTransaction === transaction.id}\n transaction={transaction}\n showAccount={showAccount}\n showCategory={showCategory}\n showBalance={showBalance}\n focusedField={editingTransaction === transaction.id && focusedField}\n showZeroInDeposit={isDeposit}\n accounts={accounts}\n categoryGroups={categoryGroups}\n payees={payees}\n dateFormat={dateFormat}\n expanded={true}\n onHover={onHover}\n onEdit={onEdit}\n onSave={onSave}\n onSplit={onSplit}\n onDelete={onDelete}\n onAdd={onAdd}\n onManagePayees={onManagePayees}\n onCreatePayee={onCreatePayee}\n style={{ marginTop: -1 }}\n />\n ))}\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-end',\n marginTop: 6,\n marginRight: 20\n }}\n >\n <Button\n style={{ marginRight: 10, padding: '4px 10px' }}\n onClick={() => onClose()}\n data-testid=\"cancel-button\"\n >\n Cancel\n </Button>\n {error ? (\n <TransactionError\n error={error}\n isDeposit={isDeposit}\n onAddSplit={() => onAddSplit(transactions[0].id)}\n />\n ) : (\n <Button\n style={{ padding: '4px 10px' }}\n primary\n onClick={onAdd}\n data-testid=\"add-button\"\n >\n Add\n </Button>\n )}\n </View>\n </View>\n );\n}\n\nclass TransactionTable_ extends React.Component {\n container = React.createRef();\n state = { highlightedRows: null };\n\n componentDidMount() {\n this.highlight = ids => {\n this.setState({ highlightedRows: new Set(ids) }, () => {\n this.setState({ highlightedRows: null });\n });\n };\n }\n\n componentWillReceiveProps(nextProps) {\n const { isAdding } = this.props;\n if (!isAdding && nextProps.isAdding) {\n this.props.newNavigator.onEdit('temp', 'date');\n }\n }\n\n componentDidUpdate() {\n this._cachedParent = null;\n }\n\n getParent(trans, index) {\n let { transactions } = this.props;\n\n if (this._cachedParent && this._cachedParent.id === trans.parent_id) {\n return this._cachedParent;\n }\n\n if (trans.parent_id) {\n this._cachedParent = getParentTransaction(transactions, index);\n return this._cachedParent;\n }\n\n return null;\n }\n\n renderRow = ({ item, index, position, editing, focusedFied, onEdit }) => {\n const { highlightedRows } = this.state;\n const {\n transactions,\n selectedItems,\n hoveredTransaction,\n accounts,\n categoryGroups,\n payees,\n showAccount,\n showCategory,\n balances,\n dateFormat = 'MM/dd/yyyy',\n tableNavigator,\n isNew,\n isMatched,\n isExpanded\n } = this.props;\n\n let trans = item;\n let hovered = hoveredTransaction === trans.id;\n let selected = selectedItems.has(trans.id);\n let highlighted =\n !selected && (highlightedRows ? highlightedRows.has(trans.id) : false);\n\n let parent = this.getParent(trans, index);\n let isChildDeposit = parent && parent.amount > 0;\n let expanded = isExpanded && isExpanded((parent || trans).id);\n\n // For backwards compatibility, read the error of the transaction\n // since in previous versions we stored it there. In the future we\n // can simplify this to just the parent\n let error = expanded\n ? (parent && parent.error) || trans.error\n : trans.error;\n\n return (\n <>\n {(!expanded || isLastChild(transactions, index)) &&\n error &&\n error.type === 'SplitTransactionError' && (\n <Tooltip\n position=\"bottom-right\"\n width={250}\n forceTop={position}\n forceLayout={true}\n style={{ transform: 'translate(-5px, 2px)' }}\n >\n <TransactionError\n error={error}\n isDeposit={isChildDeposit}\n onAddSplit={() => this.props.onAddSplit(trans.id)}\n />\n </Tooltip>\n )}\n <Transaction\n editing={editing}\n transaction={trans}\n showAccount={showAccount}\n showCategory={showCategory}\n showBalance={!!balances}\n hovered={hovered}\n selected={selected}\n highlighted={highlighted}\n added={isNew && isNew(trans.id)}\n expanded={isExpanded && isExpanded(trans.id)}\n matched={isMatched && isMatched(trans.id)}\n showZeroInDeposit={isChildDeposit}\n balance={balances && balances[trans.id] && balances[trans.id].balance}\n focusedField={editing && tableNavigator.focusedField}\n accounts={accounts}\n categoryGroups={categoryGroups}\n payees={payees}\n inheritedFields={\n parent && parent.payee === trans.payee\n ? new Set(['payee'])\n : new Set()\n }\n dateFormat={dateFormat}\n onHover={this.props.onHover}\n onEdit={tableNavigator.onEdit}\n onSave={this.props.onSave}\n onDelete={this.props.onDelete}\n onSplit={this.props.onSplit}\n onManagePayees={this.props.onManagePayees}\n onCreatePayee={this.props.onCreatePayee}\n onToggleSplit={this.props.onToggleSplit}\n />\n </>\n );\n };\n\n render() {\n let { props } = this;\n let {\n tableNavigator,\n tableRef,\n dateFormat = 'MM/dd/yyyy',\n newNavigator,\n renderEmpty,\n onHover,\n onScroll\n } = props;\n\n return (\n <View\n innerRef={this.container}\n style={[{ flex: 1, cursor: 'default' }, props.style]}\n >\n <View>\n <TransactionHeader\n hasSelected={props.selectedItems.size > 0}\n showAccount={props.showAccount}\n showCategory={props.showCategory}\n showBalance={!!props.balances}\n />\n\n {props.isAdding && (\n <View\n {...newNavigator.getNavigatorProps({\n onKeyDown: e => props.onCheckNewEnter(e)\n })}\n >\n <NewTransaction\n transactions={props.newTransactions}\n editingTransaction={newNavigator.editingId}\n hoveredTransaction={props.hoveredTransaction}\n focusedField={newNavigator.focusedField}\n accounts={props.accounts}\n currentAccountId={props.currentAccountId}\n categoryGroups={props.categoryGroups}\n payees={this.props.payees || []}\n showAccount={props.showAccount}\n showCategory={props.showCategory}\n showBalance={!!props.balances}\n dateFormat={dateFormat}\n onClose={props.onCloseAddTransaction}\n onAdd={this.props.onAddTemporary}\n onAddSplit={this.props.onAddSplit}\n onSplit={this.props.onSplit}\n onEdit={newNavigator.onEdit}\n onSave={this.props.onSave}\n onDelete={this.props.onDelete}\n onHover={this.props.onHover}\n onManagePayees={this.props.onManagePayees}\n onCreatePayee={this.props.onCreatePayee}\n />\n </View>\n )}\n </View>\n {/*// * On Windows, makes the scrollbar always appear\n // the full height of the container ??? */}\n\n <View\n style={[{ flex: 1, overflow: 'hidden' }]}\n data-testid=\"transaction-table\"\n onMouseLeave={() => onHover(null)}\n >\n <Table\n navigator={tableNavigator}\n ref={tableRef}\n items={props.transactions}\n renderItem={this.renderRow}\n renderEmpty={renderEmpty}\n loadMore={props.loadMoreTransactions}\n isSelected={id => props.selectedItems.has(id)}\n onKeyDown={e => props.onCheckEnter(e)}\n onScroll={onScroll}\n />\n\n {props.isAdding && (\n <div\n key=\"shadow\"\n style={{\n position: 'absolute',\n top: -20,\n left: 0,\n right: 0,\n height: 20,\n backgroundColor: 'red',\n boxShadow: '0 0 6px rgba(0, 0, 0, .20)'\n }}\n />\n )}\n </View>\n </View>\n );\n }\n}\n\nexport let TransactionTable = React.forwardRef((props, ref) => {\n let [newTransactions, setNewTransactions] = useState(null);\n let [hoveredTransaction, setHoveredTransaction] = useState(\n props.hoveredTransaction\n );\n let [prevIsAdding, setPrevIsAdding] = useState(false);\n let splitsExpanded = useSplitsExpanded();\n let prevSplitsExpanded = useRef(null);\n\n let tableRef = useRef(null);\n let mergedRef = useMergedRefs(tableRef, ref);\n\n let transactions = useMemo(() => {\n let result;\n if (splitsExpanded.state.transitionId != null) {\n let index = props.transactions.findIndex(\n t => t.id === splitsExpanded.state.transitionId\n );\n result = props.transactions.filter((t, idx) => {\n if (t.parent_id) {\n if (idx >= index) {\n return splitsExpanded.expanded(t.parent_id);\n } else if (prevSplitsExpanded.current) {\n return prevSplitsExpanded.current.expanded(t.parent_id);\n }\n }\n return true;\n });\n } else {\n if (\n prevSplitsExpanded.current &&\n prevSplitsExpanded.current.state.transitionId != null\n ) {\n tableRef.current.anchor();\n tableRef.current.setRowAnimation(false);\n }\n prevSplitsExpanded.current = splitsExpanded;\n\n result = props.transactions.filter(t => {\n if (t.parent_id) {\n return splitsExpanded.expanded(t.parent_id);\n }\n return true;\n });\n }\n\n prevSplitsExpanded.current = splitsExpanded;\n return result;\n }, [props.transactions, splitsExpanded]);\n\n useEffect(() => {\n // If it's anchored that means we've also disabled animations. To\n // reduce the chance for side effect collision, only do this if\n // we've actually anchored it\n if (tableRef.current.isAnchored()) {\n tableRef.current.unanchor();\n tableRef.current.setRowAnimation(true);\n }\n }, [prevSplitsExpanded.current]);\n\n let newNavigator = useTableNavigator(newTransactions, getFields);\n let tableNavigator = useTableNavigator(transactions, getFields);\n let shouldAdd = useRef(false);\n let latestState = useRef({ newTransactions, newNavigator, tableNavigator });\n let savePending = useRef(false);\n let afterSaveFunc = useRef(false);\n // eslint-disable-next-line\n let [_, forceRerender] = useState({});\n\n let selectedItems = useSelectedItems();\n let dispatchSelected = useSelectedDispatch();\n\n useLayoutEffect(() => {\n latestState.current = {\n newTransactions,\n newNavigator,\n tableNavigator,\n transactions: props.transactions\n };\n });\n\n // Derive new transactions from the `isAdding` prop\n if (prevIsAdding !== props.isAdding) {\n if (!prevIsAdding && props.isAdding) {\n setNewTransactions(makeTemporaryTransactions(props.currentAccountId));\n }\n setPrevIsAdding(props.isAdding);\n }\n\n useEffect(() => {\n if (shouldAdd.current) {\n if (newTransactions[0].account == null) {\n props.addNotification({\n type: 'error',\n message: 'Account is a required field'\n });\n newNavigator.onEdit('temp', 'account');\n } else {\n let transactions = latestState.current.newTransactions;\n let lastDate = transactions.length > 0 ? transactions[0].date : null;\n setNewTransactions(\n makeTemporaryTransactions(props.currentAccountId, lastDate)\n );\n newNavigator.onEdit('temp', 'date');\n props.onAdd(transactions);\n }\n shouldAdd.current = false;\n }\n });\n\n useEffect(() => {\n if (savePending.current && afterSaveFunc.current) {\n afterSaveFunc.current(props);\n afterSaveFunc.current = null;\n }\n\n savePending.current = false;\n }, [newTransactions, props.transactions]);\n\n function getFields(item) {\n let fields = [\n 'select',\n 'date',\n 'account',\n 'payee',\n 'notes',\n 'category',\n 'debit',\n 'credit',\n 'cleared'\n ];\n\n fields = item.is_child\n ? ['select', 'payee', 'notes', 'category', 'debit', 'credit']\n : fields.filter(\n f =>\n (props.showAccount || f !== 'account') &&\n (props.showCategory || f !== 'category')\n );\n\n if (isPreviewId(item.id)) {\n fields = ['select', 'cleared'];\n }\n if (isTemporaryId(item.id)) {\n // You can't focus the select/delete button of temporary\n // transactions\n fields = fields.slice(1);\n }\n\n return fields;\n }\n\n function afterSave(func) {\n if (savePending.current) {\n afterSaveFunc.current = func;\n } else {\n func(props);\n }\n }\n\n function onCheckNewEnter(e) {\n const ENTER = 13;\n\n if (e.keyCode === ENTER) {\n if (e.metaKey) {\n e.stopPropagation();\n onAddTemporary();\n } else if (!e.shiftKey) {\n function getLastTransaction(state) {\n let { newTransactions } = state.current;\n return newTransactions[newTransactions.length - 1];\n }\n\n // Right now, the table navigator does some funky stuff with\n // focus, so we want to stop it from handling this event. We\n // still want enter to move up/down normally, so we only stop\n // it if we are on the last transaction (where we are about to\n // do some logic). I don't like this.\n if (newNavigator.editingId === getLastTransaction(latestState).id) {\n e.stopPropagation();\n }\n\n afterSave(() => {\n let lastTransaction = getLastTransaction(latestState);\n let isSplit = lastTransaction.parent_id || lastTransaction.is_parent;\n\n if (\n latestState.current.newTransactions[0].error &&\n newNavigator.editingId === lastTransaction.id\n ) {\n // add split\n onAddSplit(lastTransaction.id);\n } else if (\n (newNavigator.focusedField === 'debit' ||\n newNavigator.focusedField === 'credit') &&\n newNavigator.editingId === lastTransaction.id &&\n (!isSplit || !lastTransaction.error)\n ) {\n onAddTemporary();\n }\n });\n }\n }\n }\n\n function onCheckEnter(e) {\n const ENTER = 13;\n\n if (e.keyCode === ENTER && !e.shiftKey) {\n let { editingId: id, focusedField } = tableNavigator;\n\n afterSave(props => {\n let transactions = latestState.current.transactions;\n let idx = transactions.findIndex(t => t.id === id);\n let parent = getParentTransaction(transactions, idx);\n\n if (\n isLastChild(transactions, idx) &&\n parent &&\n parent.error &&\n focusedField !== 'select'\n ) {\n e.stopPropagation();\n onAddSplit(id);\n }\n });\n }\n }\n\n let onAddTemporary = useCallback(() => {\n shouldAdd.current = true;\n // A little hacky - this forces a rerender which will cause the\n // effect we want to run. We have to wait for all updates to be\n // committed (the input could still be saving a value).\n forceRerender({});\n }, [props.onAdd, newNavigator.onEdit]);\n\n let onSave = useCallback(\n async transaction => {\n savePending.current = true;\n\n if (isTemporaryId(transaction.id)) {\n if (props.onApplyRules) {\n transaction = await props.onApplyRules(transaction);\n }\n\n let newTrans = latestState.current.newTransactions;\n setNewTransactions(updateTransaction(newTrans, transaction).data);\n } else {\n props.onSave(transaction);\n }\n },\n [props.onSave]\n );\n\n let onHover = useCallback(id => {\n setHoveredTransaction(id);\n }, []);\n\n let onDelete = useCallback(id => {\n let temporary = isTemporaryId(id);\n\n if (temporary) {\n let newTrans = latestState.current.newTransactions;\n\n if (id === newTrans[0].id) {\n // You can never delete the parent new transaction\n return;\n }\n\n setNewTransactions(deleteTransaction(newTrans, id).data);\n }\n }, []);\n\n let onSplit = useMemo(() => {\n return id => {\n if (isTemporaryId(id)) {\n let { newNavigator } = latestState.current;\n let newTrans = latestState.current.newTransactions;\n let { data, diff } = splitTransaction(newTrans, id);\n setNewTransactions(data);\n\n // TODO: what is this for???\n // if (newTrans[0].amount == null) {\n // newNavigator.onEdit(newTrans[0].id, 'debit');\n // } else {\n newNavigator.onEdit(\n diff.added[0].id,\n latestState.current.newNavigator.focusedField\n );\n // }\n } else {\n let trans = latestState.current.transactions.find(t => t.id === id);\n let newId = props.onSplit(id);\n\n splitsExpanded.dispatch({ type: 'open-split', id: trans.id });\n\n let { tableNavigator } = latestState.current;\n if (trans.amount == null) {\n tableNavigator.onEdit(trans.id, 'debit');\n } else {\n tableNavigator.onEdit(newId, tableNavigator.focusedField);\n }\n }\n };\n }, [props.onSplit, splitsExpanded.dispatch]);\n\n let onAddSplit = useCallback(\n id => {\n if (isTemporaryId(id)) {\n let newTrans = latestState.current.newTransactions;\n let { data, diff } = addSplitTransaction(newTrans, id);\n setNewTransactions(data);\n newNavigator.onEdit(\n diff.added[0].id,\n latestState.current.newNavigator.focusedField\n );\n } else {\n let newId = props.onAddSplit(id);\n tableNavigator.onEdit(\n newId,\n latestState.current.tableNavigator.focusedField\n );\n }\n },\n [props.onAddSplit]\n );\n\n function onCloseAddTransaction() {\n setNewTransactions(makeTemporaryTransactions(props.currentAccountId));\n props.onCloseAddTransaction();\n }\n\n let onToggleSplit = useCallback(\n id => splitsExpanded.dispatch({ type: 'toggle-split', id }),\n [splitsExpanded.dispatch]\n );\n\n return (\n // eslint-disable-next-line\n <TransactionTable_\n tableRef={mergedRef}\n {...props}\n transactions={transactions}\n selectedItems={selectedItems}\n hoveredTransaction={hoveredTransaction}\n isExpanded={splitsExpanded.expanded}\n onHover={onHover}\n onSave={onSave}\n onDelete={onDelete}\n onSplit={onSplit}\n onCheckNewEnter={onCheckNewEnter}\n onCheckEnter={onCheckEnter}\n onAddTemporary={onAddTemporary}\n onAddSplit={onAddSplit}\n onCloseAddTransaction={onCloseAddTransaction}\n onToggleSplit={onToggleSplit}\n newTransactions={newTransactions}\n tableNavigator={tableNavigator}\n newNavigator={newNavigator}\n />\n );\n});\n","import { useMemo } from 'react';\n\nexport function useMergedRefs(ref1, ref2) {\n return useMemo(() => {\n function ref(value) {\n [ref1, ref2].forEach(ref => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n ref.current = value;\n }\n });\n }\n\n return ref;\n }, [ref1, ref2]);\n}\n","import React, {\n useRef,\n useEffect,\n useCallback,\n useLayoutEffect,\n useMemo\n} from 'react';\nimport { useDispatch } from 'react-redux';\nimport { TransactionTable } from './TransactionsTable';\nimport lively from '@jlongster/lively';\nimport {\n splitTransaction,\n updateTransaction,\n addSplitTransaction,\n realizeTempTransactions,\n applyTransactionDiff\n} from 'loot-core/src/shared/transactions';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { pushModal } from 'loot-core/src/client/actions/modals';\nimport { getChangedValues, applyChanges } from 'loot-core/src/shared/util';\nconst uuid = require('loot-core/src/platform/uuid');\n\n// When data changes, there are two ways to update the UI:\n//\n// * Optimistic updates: we apply the needed updates to local data\n// and rerender immediately, and send off the changes to the\n// server. Currently, it assumes the server request is successful.\n// If it fails the user will see a generic error which isn't\n// great, but since the server is local a failure is very\n// unlikely. Still, we should notify errors better.\n//\n// * A full refetch and rerender: this is needed when applying\n// updates locally is too complex. Usually this happens when\n// changing a field that data is sorted on: we're not going\n// to resort the data in memory, we want to rely on the database\n// for that. So we need to do a full refresh.\n//\n// When writing updates, it's up to you to decide which one to do.\n// Optimistic updates feel snappy, but they might show data\n// differently than a full refresh. It's up to you to decide which\n// one to use when doing updates.\n\nasync function saveDiff(diff) {\n let remoteUpdates = await send('transactions-batch-update', {\n ...diff,\n learnCategories: true\n });\n if (remoteUpdates.length > 0) {\n return { updates: remoteUpdates };\n }\n return {};\n}\n\nasync function saveDiffAndApply(diff, changes, onChange) {\n let remoteDiff = await saveDiff(diff);\n onChange(\n applyTransactionDiff(changes.newTransaction, remoteDiff),\n applyChanges(remoteDiff, changes.data)\n );\n}\n\nexport default function TransactionList({\n tableRef,\n transactions,\n allTransactions,\n loadMoreTransactions,\n account,\n accounts,\n categoryGroups,\n payees,\n balances,\n showAccount,\n headerContent,\n animated,\n isAdding,\n isNew,\n isMatched,\n isFiltered,\n dateFormat,\n addNotification,\n renderEmpty,\n onChange,\n onRefetch,\n onRefetchUpToRow,\n onCloseAddTransaction,\n onManagePayees,\n onCreatePayee\n}) {\n let dispatch = useDispatch();\n let table = useRef();\n let transactionsLatest = useRef();\n let scrollTo = useRef();\n\n // useEffect(() => {\n // if (scrollTo.current) {\n // // table.current.scrollTo(scrollTo.current);\n // }\n // }, [transactions]);\n\n useEffect(clearScrollTo);\n\n useLayoutEffect(() => {\n transactionsLatest.current = transactions;\n }, [transactions]);\n\n function clearScrollTo() {\n scrollTo.current = null;\n }\n\n let onAdd = useCallback(async newTransactions => {\n newTransactions = realizeTempTransactions(newTransactions);\n\n await saveDiff({ added: newTransactions });\n onRefetch();\n }, []);\n\n let onSave = useCallback(async transaction => {\n let changes = updateTransaction(transactionsLatest.current, transaction);\n\n if (changes.diff.updated.length > 0) {\n let dateChanged = !!changes.diff.updated[0].date;\n if (dateChanged) {\n // Make sure it stays at the top of the list of transactions\n // for that date\n changes.diff.updated[0].sort_order = Date.now();\n await saveDiff(changes.diff);\n onRefetch();\n } else {\n onChange(changes.newTransaction, changes.data);\n saveDiffAndApply(changes.diff, changes, onChange);\n }\n }\n }, []);\n\n let onAddSplit = useCallback(id => {\n const changes = addSplitTransaction(transactionsLatest.current, id);\n onChange(changes.newTransaction, changes.data);\n saveDiffAndApply(changes.diff, changes, onChange);\n return changes.diff.added[0].id;\n }, []);\n\n let onSplit = useCallback(id => {\n const changes = splitTransaction(transactionsLatest.current, id);\n onChange(changes.newTransaction, changes.data);\n saveDiffAndApply(changes.diff, changes, onChange);\n return changes.diff.added[0].id;\n }, []);\n\n let onApplyRules = useCallback(async transaction => {\n let afterRules = await send('rules-run', { transaction });\n let diff = getChangedValues(transaction, afterRules);\n\n let newTransaction = { ...transaction };\n if (diff) {\n Object.keys(diff).forEach(field => {\n if (\n newTransaction[field] == null ||\n newTransaction[field] === '' ||\n newTransaction[field] === 0\n ) {\n newTransaction[field] = diff[field];\n }\n });\n }\n return newTransaction;\n }, []);\n\n return (\n <TransactionTable\n ref={tableRef}\n transactions={allTransactions}\n loadMoreTransactions={loadMoreTransactions}\n accounts={accounts}\n categoryGroups={categoryGroups}\n payees={payees}\n balances={balances}\n showAccount={showAccount}\n showCategory={true}\n animated={animated}\n currentAccountId={account && account.id}\n isAdding={isAdding}\n isNew={isNew}\n isMatched={isMatched}\n isFiltered={isFiltered}\n dateFormat={dateFormat}\n addNotification={addNotification}\n headerContent={headerContent}\n renderEmpty={renderEmpty}\n onSave={onSave}\n onApplyRules={onApplyRules}\n onSplit={onSplit}\n onCloseAddTransaction={onCloseAddTransaction}\n onAdd={onAdd}\n onAddSplit={onAddSplit}\n onManagePayees={onManagePayees}\n onCreatePayee={onCreatePayee}\n onScroll={clearScrollTo}\n style={{ backgroundColor: 'white' }}\n />\n );\n}\n","import { integerToAmount, amountToInteger, currencyToAmount } from './util';\n\n// For now, this info is duplicated from the backend. Figure out how\n// to share it later.\nexport const TYPE_INFO = {\n date: {\n ops: ['is', 'isapprox', 'gt', 'gte', 'lt', 'lte'],\n nullable: false\n },\n id: {\n ops: ['is', 'contains', 'oneOf'],\n nullable: true\n },\n string: {\n ops: ['is', 'contains', 'oneOf'],\n nullable: false\n },\n number: {\n ops: ['is', 'isapprox', 'isbetween', 'gt', 'gte', 'lt', 'lte'],\n nullable: false\n },\n boolean: {\n ops: ['is'],\n nullable: false\n }\n};\n\nexport const FIELD_TYPES = new Map(\n Object.entries({\n imported_payee: 'string',\n payee: 'id',\n date: 'date',\n notes: 'string',\n amount: 'number',\n amountInflow: 'number',\n amountOutfow: 'number',\n category: 'id',\n account: 'id',\n cleared: 'boolean'\n })\n);\n\nexport function mapField(field, opts) {\n opts = opts || {};\n\n switch (field) {\n case 'imported_payee':\n return 'imported payee';\n case 'amount':\n if (opts.inflow) {\n return 'amount (inflow)';\n } else if (opts.outflow) {\n return 'amount (outflow)';\n }\n return 'amount';\n case 'amount-inflow':\n return 'amount (inflow)';\n case 'amount-outflow':\n return 'amount (outflow)';\n default:\n return field;\n }\n}\n\nexport function friendlyOp(op, type) {\n switch (op) {\n case 'oneOf':\n return 'one of';\n case 'is':\n return 'is';\n case 'isapprox':\n return 'is approx';\n case 'isbetween':\n return 'is between';\n case 'contains':\n return 'contains';\n case 'gt':\n if (type === 'date') {\n return 'is after';\n }\n return 'is greater than';\n case 'gte':\n if (type === 'date') {\n return 'is after or equals';\n }\n return 'is greater than or equals';\n case 'lt':\n if (type === 'date') {\n return 'is before';\n }\n return 'is less than';\n case 'lte':\n if (type === 'date') {\n return 'is before or equals';\n }\n return 'is less than or equals';\n case 'true':\n return 'is true';\n case 'false':\n return 'is false';\n case 'set':\n return 'set';\n case 'link-schedule':\n return 'link schedule';\n default:\n return '';\n }\n}\n\nexport function deserializeField(field) {\n if (field === 'amount-inflow') {\n return { field: 'amount', options: { inflow: true } };\n } else if (field === 'amount-outflow') {\n return { field: 'amount', options: { outflow: true } };\n } else {\n return { field };\n }\n}\n\nexport function getFieldError(type) {\n switch (type) {\n case 'date-format':\n return 'Invalid date format';\n case 'no-null':\n case 'no-empty-array':\n case 'no-empty-string':\n return 'Value cannot be empty';\n case 'not-number':\n return 'Value must be a number';\n case 'invalid-field':\n return 'Please choose a valid field for this type of rule';\n default:\n return 'Internal error, sorry! Contact help@actualbudget.com';\n }\n}\n\nexport function sortNumbers(num1, num2) {\n if (num1 < num2) {\n return [num1, num2];\n }\n return [num2, num1];\n}\n\nexport function parse(item) {\n switch (item.type) {\n case 'number': {\n let parsed = item.value;\n if (item.field === 'amount' && item.op !== 'isbetween') {\n parsed = integerToAmount(parsed);\n }\n return { ...item, value: parsed };\n }\n case 'string': {\n let parsed = item.value == null ? '' : item.value;\n return { ...item, value: parsed };\n }\n default:\n }\n\n return { ...item, error: null };\n}\n\nexport function unparse({ error, inputKey, ...item }) {\n switch (item.type) {\n case 'number': {\n let unparsed = item.value;\n if (item.field === 'amount' && item.op !== 'isbetween') {\n unparsed = amountToInteger(unparsed);\n }\n\n return { ...item, value: unparsed };\n }\n case 'string': {\n let unparsed = item.value == null ? '' : item.value;\n return { ...item, value: unparsed };\n }\n default:\n }\n\n return item;\n}\n\nexport function makeValue(value, cond) {\n switch (cond.type) {\n case 'number': {\n if (cond.op !== 'isbetween') {\n return {\n ...cond,\n error: null,\n value: value ? currencyToAmount(value) || 0 : 0\n };\n }\n break;\n }\n default:\n }\n\n return { ...cond, error: null, value };\n}\n\nexport function getApproxNumberThreshold(number) {\n return (Math.abs(number) * 0.075) | 0;\n}\n","import React from 'react';\n\nconst SvgSettingsSliderAlternate = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgSettingsSliderAlternate;\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from 'react';\nimport { css } from 'glamor';\n\nfunction Subtract({ width, height, style, color = 'black', ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 24 24\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill={color}\n className=\"path\"\n className=\"path\"\n 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\"\n />\n </svg>\n );\n}\n\nexport default Subtract;\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction Add({ width, height, style, color = \"black\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 24 24\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill={color}\n className=\"path\"\n className=\"path\"\n 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\"\n />\n <path\n fill={color}\n className=\"path\"\n className=\"path\"\n 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\"\n />\n </svg>\n );\n}\n\nexport default Add;\n","import PropTypes from 'prop-types';\nimport React, { useEffect, useReducer, useState } from 'react';\nimport * as d from 'date-fns';\nimport { useSelector } from 'react-redux';\nimport { parse as parseDate } from 'date-fns';\nimport { sendCatch } from 'loot-core/src/platform/client/fetch';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { getRecurringDescription } from 'loot-core/src/shared/schedules';\nimport DateSelect from './DateSelect';\nimport {\n Button,\n Select,\n Input,\n Tooltip,\n View,\n Text,\n Stack\n} from '../components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { useTooltip } from 'loot-design/src/components/tooltips';\nimport SubtractIcon from 'loot-design/src/svg/Subtract';\nimport AddIcon from 'loot-design/src/svg/Add';\n\nconst DATE_FORMAT = 'yyyy-MM-dd';\n\n// ex: There is no 6th Friday of the Month\nconst MAX_DAY_OF_WEEK_INTERVAL = 5;\n\nconst FREQUENCY_OPTIONS = [\n { id: 'weekly', name: 'Weeks' },\n { id: 'monthly', name: 'Months' },\n { id: 'yearly', name: 'Years' }\n];\n\nconst DAY_OF_MONTH_OPTIONS = [...Array(31).keys()].map(day => day + 1);\n\nconst DAY_OF_WEEK_OPTIONS = [\n { id: 'SU', name: 'Sunday' },\n { id: 'MO', name: 'Monday' },\n { id: 'TU', name: 'Tuesday' },\n { id: 'WE', name: 'Wednesday' },\n { id: 'TH', name: 'Thursday' },\n { id: 'FR', name: 'Friday' },\n { id: 'SA', name: 'Saturday' }\n];\n\nfunction parsePatternValue(value) {\n if (value === 'last') {\n return -1;\n }\n return Number(value);\n}\n\nfunction parseConfig(config) {\n return (\n config || {\n start: monthUtils.currentDay(),\n interval: 1,\n frequency: 'monthly',\n patterns: [createMonthlyRecurrence(monthUtils.currentDay())]\n }\n );\n}\n\nfunction unparseConfig(parsed) {\n return {\n ...parsed,\n interval: validInterval(parsed.interval)\n };\n}\n\nfunction createMonthlyRecurrence(startDate) {\n return {\n value: parseInt(monthUtils.format(startDate, 'd')),\n type: 'day'\n };\n}\n\nfunction boundedRecurrence({ field, value, recurrence }) {\n if (\n (field === 'value' &&\n recurrence.type !== 'day' &&\n value > MAX_DAY_OF_WEEK_INTERVAL) ||\n (field === 'type' &&\n value !== 'day' &&\n recurrence.value > MAX_DAY_OF_WEEK_INTERVAL)\n ) {\n return { [field]: value, value: MAX_DAY_OF_WEEK_INTERVAL };\n }\n return { [field]: value };\n}\n\nfunction reducer(state, action) {\n switch (action.type) {\n case 'replace-config':\n return { ...state, config: action.config };\n case 'change-field':\n return {\n ...state,\n config: {\n ...state.config,\n [action.field]: action.value,\n patterns:\n state.config.frequency !== 'monthly' ? [] : state.config.patterns\n }\n };\n case 'update-recurrence':\n const index = state.config.patterns.indexOf(action.recurrence);\n return {\n ...state,\n config: {\n ...state.config,\n patterns: state.config.patterns.map(p =>\n p === action.recurrence\n ? { ...action.recurrence, ...boundedRecurrence(action) }\n : p\n )\n }\n };\n case 'add-recurrence':\n return {\n ...state,\n config: {\n ...state.config,\n patterns: [\n ...(state.config.patterns || []),\n createMonthlyRecurrence(state.config.start)\n ]\n }\n };\n case 'remove-recurrence':\n return {\n ...state,\n config: {\n ...state.config,\n patterns: state.config.patterns.filter(p => p !== action.recurrence)\n }\n };\n default:\n return state;\n }\n}\n\nfunction SchedulePreview({ previewDates }) {\n if (!previewDates) {\n return null;\n }\n\n let dateFormat = useSelector(\n state => state.prefs.local.dateFormat || 'MM/dd/yyyy'\n );\n dateFormat = dateFormat.replace('MM', 'M').replace('dd', 'd');\n\n let content = null;\n if (typeof previewDates === 'string') {\n content = <Text>{previewDates}</Text>;\n } else {\n content = (\n <View>\n <Text style={{ fontWeight: 600 }}>Upcoming dates</Text>\n <Stack direction=\"row\" spacing={4} style={{ marginTop: 10 }}>\n {previewDates.map(d => (\n <View>\n <Text>{monthUtils.format(d, dateFormat)}</Text>\n <Text>{monthUtils.format(d, 'EEEE')}</Text>\n </View>\n ))}\n </Stack>\n </View>\n );\n }\n\n return (\n <>\n <Stack\n direction=\"column\"\n spacing={1}\n style={{ marginTop: 15, color: colors.n4 }}\n >\n {content}\n </Stack>\n </>\n );\n}\n\nfunction validInterval(interval) {\n const intInterval = parseInt(interval);\n return Number.isInteger(intInterval) && intInterval > 0 ? intInterval : 1;\n}\n\nfunction MonthlyPatterns({ config, dispatch }) {\n let updateRecurrence = (recurrence, field, value) =>\n dispatch({ type: 'update-recurrence', recurrence, field, value });\n\n return (\n <Stack spacing={2} style={{ marginTop: 10 }}>\n {config.patterns.map((recurrence, idx) => (\n <View\n key={idx}\n style={{\n display: 'flex',\n flexDirection: 'row'\n }}\n >\n <Select\n style={{ marginRight: 10 }}\n value={recurrence.value}\n onChange={e =>\n updateRecurrence(\n recurrence,\n 'value',\n parsePatternValue(e.target.value)\n )\n }\n >\n <option value={-1}>Last</option>\n <option disabled>---</option>\n {DAY_OF_MONTH_OPTIONS.map(opt => (\n <option key={opt} value={opt}>\n {opt}\n </option>\n ))}\n </Select>\n <Select\n style={{ marginRight: 10 }}\n value={recurrence.type}\n onChange={e => updateRecurrence(recurrence, 'type', e.target.value)}\n >\n <option value=\"day\">Day</option>\n <option disabled>---</option>\n {DAY_OF_WEEK_OPTIONS.map(opt => (\n <option key={opt.id} value={opt.id}>\n {opt.name}\n </option>\n ))}\n </Select>\n <Button\n bare\n style={{ padding: 7 }}\n onClick={() =>\n dispatch({\n type: 'remove-recurrence',\n recurrence: recurrence\n })\n }\n >\n <SubtractIcon style={{ width: 8, height: 8 }} />\n </Button>\n <Button\n bare\n style={{ padding: 7, marginLeft: 5 }}\n onClick={() => dispatch({ type: 'add-recurrence' })}\n >\n <AddIcon style={{ width: 10, height: 10 }} />\n </Button>\n </View>\n ))}\n </Stack>\n );\n}\n\nfunction RecurringScheduleTooltip({ config: currentConfig, onClose, onSave }) {\n let [previewDates, setPreviewDates] = useState(null);\n\n let [state, dispatch] = useReducer(reducer, {\n config: parseConfig(currentConfig)\n });\n\n let dateFormat = useSelector(\n state => state.prefs.local.dateFormat || 'MM/dd/yyyy'\n );\n\n useEffect(() => {\n dispatch({\n type: 'replace-config',\n config: parseConfig(currentConfig)\n });\n }, [currentConfig]);\n\n let { config } = state;\n\n let updateField = (field, value) =>\n dispatch({ type: 'change-field', field, value });\n\n useEffect(() => {\n async function run() {\n let { data, error } = await sendCatch('schedule/get-upcoming-dates', {\n config: unparseConfig(config),\n count: 4\n });\n setPreviewDates(error ? 'Invalid rule' : data);\n }\n run();\n }, [config]);\n\n if (previewDates == null) {\n return null;\n }\n\n return (\n <Tooltip\n style={{ padding: 10, width: 380 }}\n offset={1}\n position=\"bottom-left\"\n onClose={onClose}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <label htmlFor=\"start\" style={{ marginRight: 5 }}>\n Starts:\n </label>\n <DateSelect\n id=\"start\"\n inputProps={{ placeholder: 'Start Date' }}\n value={config.start}\n onSelect={value => updateField('start', value)}\n containerProps={{ style: { width: 100 } }}\n dateFormat={dateFormat}\n />\n </div>\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-start\"\n style={{ marginTop: 10 }}\n spacing={2}\n >\n <Text style={{ whiteSpace: 'nowrap' }}>Repeat every</Text>\n <Input\n id=\"interval\"\n style={{ width: 40 }}\n type=\"text\"\n onBlur={e => updateField('interval', e.target.value)}\n onEnter={e => updateField('interval', e.target.value)}\n defaultValue={config.interval || 1}\n ></Input>\n <Select\n onChange={e => updateField('frequency', e.target.value)}\n value={config.frequency}\n style={{ flex: 0 }}\n >\n {FREQUENCY_OPTIONS.map(opt => (\n <option key={opt.id} value={opt.id}>\n {opt.name}\n </option>\n ))}\n </Select>\n {config.frequency === 'monthly' &&\n (config.patterns == null || config.patterns.length === 0) ? (\n <Button onClick={() => dispatch({ type: 'add-recurrence' })}>\n Add specific days\n </Button>\n ) : null}\n </Stack>\n {config.frequency === 'monthly' &&\n config.patterns &&\n config.patterns.length > 0 && (\n <MonthlyPatterns config={config} dispatch={dispatch} />\n )}\n <SchedulePreview previewDates={previewDates} />\n <div\n style={{ display: 'flex', marginTop: 15, justifyContent: 'flex-end' }}\n >\n <Button onClick={onClose}>Cancel</Button>\n <Button\n onClick={() => onSave(unparseConfig(config))}\n primary\n style={{ marginLeft: 10 }}\n >\n Apply\n </Button>\n </div>\n </Tooltip>\n );\n}\n\nexport default function RecurringSchedulePicker({\n value,\n buttonStyle,\n onChange\n}) {\n let { isOpen, close, getOpenEvents } = useTooltip();\n\n function onSave(config) {\n onChange(config);\n close();\n }\n\n return (\n <View>\n <Button {...getOpenEvents()} style={[{ textAlign: 'left' }, buttonStyle]}>\n {value ? getRecurringDescription(value) : 'No recurring date'}\n </Button>\n {isOpen && (\n <RecurringScheduleTooltip\n config={value}\n onClose={close}\n onSave={onSave}\n />\n )}\n </View>\n );\n}\n","import React from 'react';\nimport { useSelector } from 'react-redux';\nimport { format as formatDate, parse as parseDate, parseISO } from 'date-fns';\nimport { dayFromDate, getMonthYearFormat } from 'loot-core/src/shared/months';\nimport { View, Input } from 'loot-design/src/components/common';\nimport PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete';\nimport AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete';\nimport Autocomplete from 'loot-design/src/components/Autocomplete';\nimport CategoryAutocomplete from 'loot-design/src/components/CategorySelect';\nimport DateSelect from 'loot-design/src/components/DateSelect';\nimport RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker';\n\nexport default function GenericInput({\n field,\n subfield,\n type,\n multi,\n value,\n inputRef,\n style,\n onChange\n}) {\n let { payees, accounts, categoryGroups, dateFormat } = useSelector(state => {\n return {\n payees: state.queries.payees,\n accounts: state.queries.accounts,\n categoryGroups: state.queries.categories.grouped,\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy'\n };\n });\n\n // This makes the UI more resilient in case of faulty data\n if (multi && !Array.isArray(value)) {\n value = [];\n } else if (!multi && Array.isArray(value)) {\n return null;\n }\n\n let showPlaceholder = multi ? value.length === 0 : true;\n\n let content;\n switch (type) {\n case 'id':\n switch (field) {\n case 'payee':\n if (payees.length > 0) {\n content = (\n <PayeeAutocomplete\n payees={payees}\n accounts={accounts}\n multi={multi}\n showMakeTransfer={false}\n openOnFocus={false}\n value={value}\n onSelect={onChange}\n inputProps={{\n inputRef,\n ...(showPlaceholder ? { placeholder: 'nothing' } : null)\n }}\n />\n );\n }\n break;\n\n case 'account':\n content = (\n <AccountAutocomplete\n accounts={accounts}\n value={value}\n multi={multi}\n openOnFocus={false}\n onSelect={onChange}\n inputProps={{\n inputRef,\n ...(showPlaceholder ? { placeholder: 'nothing' } : null)\n }}\n />\n );\n break;\n\n case 'category':\n content = (\n <CategoryAutocomplete\n categoryGroups={categoryGroups}\n value={value}\n multi={multi}\n openOnFocus={false}\n onSelect={onChange}\n inputProps={{\n inputRef,\n ...(showPlaceholder ? { placeholder: 'nothing' } : null)\n }}\n />\n );\n break;\n\n default:\n }\n break;\n\n case 'date':\n switch (subfield) {\n case 'month':\n content = (\n <Input\n inputRef={inputRef}\n defaultValue={value || ''}\n placeholder={getMonthYearFormat(dateFormat).toLowerCase()}\n onEnter={e => onChange(e.target.value)}\n onBlur={e => onChange(e.target.value)}\n />\n );\n break;\n\n case 'year':\n content = (\n <Input\n inputRef={inputRef}\n defaultValue={value || ''}\n placeholder={'yyyy'}\n onEnter={e => onChange(e.target.value)}\n onBlur={e => onChange(e.target.value)}\n />\n );\n break;\n\n default:\n if (value && value.frequency) {\n content = (\n <RecurringSchedulePicker\n value={value}\n buttonStyle={{ justifyContent: 'flex-start' }}\n onChange={onChange}\n />\n );\n } else {\n content = (\n <DateSelect\n value={value}\n dateFormat={dateFormat}\n openOnFocus={false}\n inputRef={inputRef}\n inputProps={{ placeholder: dateFormat.toLowerCase() }}\n onSelect={onChange}\n />\n );\n }\n break;\n }\n break;\n\n default:\n if (multi) {\n content = (\n <Autocomplete\n multi={true}\n suggestions={[]}\n value={value}\n inputProps={{ inputRef }}\n onSelect={onChange}\n />\n );\n } else {\n content = (\n <Input\n inputRef={inputRef}\n defaultValue={value || ''}\n placeholder=\"nothing\"\n onEnter={e => onChange(e.target.value)}\n onBlur={e => onChange(e.target.value)}\n />\n );\n }\n break;\n }\n\n return <View style={[{ flex: 1 }, style]}>{content}</View>;\n}\n","import React from 'react';\n\nconst SvgInformationOutline = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgInformationOutline;\n","import React, {\n useState,\n useEffect,\n useRef,\n useCallback,\n useMemo,\n useImperativeHandle\n} from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { css } from 'glamor';\nimport { format as formatDate, parseISO } from 'date-fns';\nimport * as undo from 'loot-core/src/platform/client/undo';\nimport * as actions from 'loot-core/src/client/actions';\nimport { initiallyLoadPayees } from 'loot-core/src/client/actions/queries';\nimport q from 'loot-core/src/client/query-helpers';\nimport { liveQueryContext } from 'loot-core/src/client/query-hooks';\nimport {\n View,\n Text,\n Modal,\n Button,\n Stack,\n ExternalLink\n} from 'loot-design/src/components/common';\nimport {\n SelectCell,\n Row,\n Field,\n Cell,\n CellButton,\n TableHeader,\n useTableNavigator\n} from 'loot-design/src/components/table';\nimport useSelected, {\n useSelectedDispatch,\n useSelectedItems,\n SelectedProvider\n} from 'loot-design/src/components/useSelected';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { send, listen, unlisten } from 'loot-core/src/platform/client/fetch';\nimport { pushModal } from 'loot-core/src/client/actions/modals';\nimport { mapField, friendlyOp } from 'loot-core/src/shared/rules';\nimport ArrowRight from 'loot-design/src/svg/RightArrow2';\nimport InformationOutline from 'loot-design/src/svg/v1/InformationOutline';\nimport ExpandArrow from 'loot-design/src/svg/ExpandArrow';\nimport { colors, styles } from 'loot-design/src/style';\nimport { dayFromDate, getMonthYearFormat } from 'loot-core/src/shared/months';\nimport {\n extractScheduleConds,\n getRecurringDescription\n} from 'loot-core/src/shared/schedules';\nimport { getPayeesById } from 'loot-core/src/client/reducers/queries';\n\nlet SchedulesQuery = liveQueryContext(q('schedules').select('*'));\n\nexport function Value({\n value,\n field,\n inline = false,\n data: dataProp,\n describe = x => x.name\n}) {\n let { data, dateFormat } = useSelector(state => {\n let data;\n if (dataProp) {\n data = dataProp;\n } else {\n switch (field) {\n case 'payee':\n data = state.queries.payees;\n break;\n case 'category':\n data = state.queries.categories.list;\n break;\n case 'account':\n data = state.queries.accounts;\n break;\n default:\n data = [];\n }\n }\n\n return {\n data,\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy'\n };\n });\n let [expanded, setExpanded] = useState(false);\n\n function onExpand(e) {\n e.preventDefault();\n setExpanded(true);\n }\n\n function formatValue(value) {\n if (value == null || value === '') {\n return '(nothing)';\n } else if (typeof value === 'boolean') {\n return value ? 'true' : 'false';\n } else {\n if (field === 'amount') {\n return integerToCurrency(value);\n } else if (field === 'date') {\n if (value) {\n if (value.frequency) {\n return getRecurringDescription(value);\n }\n return formatDate(parseISO(value), dateFormat);\n }\n return null;\n } else if (field === 'month') {\n return value\n ? formatDate(parseISO(value), getMonthYearFormat(dateFormat))\n : null;\n } else if (field === 'year') {\n return value ? formatDate(parseISO(value), 'yyyy') : null;\n } else {\n let name = value;\n if (data) {\n let item = data.find(item => item.id === value);\n if (item) {\n name = describe(item);\n }\n }\n return name;\n }\n }\n }\n\n if (Array.isArray(value)) {\n if (value.length === 0) {\n return <Text style={{ color: colors.p4 }}>(empty)</Text>;\n } else if (value.length === 1) {\n return (\n <Text>\n [<Text style={{ color: colors.p4 }}>{formatValue(value[0])}</Text>]\n </Text>\n );\n }\n\n let displayed = value;\n if (!expanded && value.length > 4) {\n displayed = value.slice(0, 3);\n }\n let numHidden = value.length - displayed.length;\n return (\n <Text style={{ color: colors.n3 }}>\n [\n {displayed.map((v, i) => {\n let text = <Text style={{ color: colors.p4 }}>{formatValue(v)}</Text>;\n let spacing;\n if (inline) {\n spacing = i !== 0 ? ' ' : '';\n } else {\n spacing = (\n <>\n {i === 0 && <br />}\n &nbsp;&nbsp;\n </>\n );\n }\n\n return (\n <Text key={i}>\n {spacing}\n {text}\n {i === value.length - 1 ? '' : ','}\n {!inline && <br />}\n </Text>\n );\n })}\n {// prettier-ignore\n numHidden > 0 && (\n <Text style={{ color: colors.p4 }}>\n &nbsp;&nbsp;\n { // eslint-disable-next-line\n }<a\n href=\"#\"\n onClick={onExpand}\n {...css({\n color: colors.p4,\n textDecoration: 'none',\n ':hover': { textDecoration: 'underline' }\n })}\n >\n {numHidden} more items...\n </a>\n {!inline && <br />}\n </Text>\n )}\n ]\n </Text>\n );\n } else if (value && value.num1 != null && value.num2 != null) {\n // An \"in between\" type\n return (\n <Text>\n <Text style={{ color: colors.p4 }}>{formatValue(value.num1)}</Text> and{' '}\n <Text style={{ color: colors.p4 }}>{formatValue(value.num2)}</Text>\n </Text>\n );\n } else {\n return <Text style={{ color: colors.p4 }}>{formatValue(value)}</Text>;\n }\n}\n\nexport function ConditionExpression({\n field,\n op,\n value,\n options,\n stage,\n style\n}) {\n return (\n <View\n style={[\n {\n display: 'block',\n maxWidth: '100%',\n backgroundColor: colors.n10,\n borderRadius: 4,\n padding: '3px 5px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n },\n style\n ]}\n >\n <Text style={{ color: colors.p4 }}>{mapField(field, options)}</Text>{' '}\n <Text style={{ color: colors.n3 }}>{friendlyOp(op)}</Text>{' '}\n <Value value={value} field={field} />\n </View>\n );\n}\n\nfunction ScheduleValue({ value }) {\n let payees = useSelector(state => state.queries.payees);\n let byId = getPayeesById(payees);\n let { data: schedules } = SchedulesQuery.useQuery();\n\n return (\n <Value\n value={value}\n field=\"rule\"\n data={schedules}\n describe={s => {\n let { payee } = extractScheduleConds(s._conditions);\n return payee\n ? `${byId[payee.value].name} (${s.next_date})`\n : `Next: ${s.next_date}`;\n }}\n />\n );\n}\n\nexport function ActionExpression({ field, op, value, options, style }) {\n return (\n <View\n style={[\n {\n display: 'block',\n maxWidth: '100%',\n backgroundColor: colors.n10,\n borderRadius: 4,\n padding: '3px 5px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n },\n style\n ]}\n >\n {op === 'set' ? (\n <>\n <Text style={{ color: colors.n3 }}>{friendlyOp(op)}</Text>{' '}\n <Text style={{ color: colors.p4 }}>{mapField(field, options)}</Text>{' '}\n <Text style={{ color: colors.n3 }}>to </Text>\n <Value value={value} field={field} />\n </>\n ) : op === 'link-schedule' ? (\n <>\n <Text style={{ color: colors.n3 }}>{friendlyOp(op)}</Text>{' '}\n <ScheduleValue value={value} />\n </>\n ) : null}\n </View>\n );\n}\n\nlet Rule = React.memo(\n ({\n rule,\n hovered,\n selected,\n editing,\n focusedField,\n onHover,\n onEdit,\n onEditRule\n }) => {\n let dispatch = useDispatch();\n let dispatchSelected = useSelectedDispatch();\n let borderColor = selected ? colors.b8 : colors.border;\n let backgroundFocus = hovered || focusedField === 'select';\n\n return (\n <Row\n height=\"auto\"\n borderColor={borderColor}\n backgroundColor={\n selected ? colors.selected : backgroundFocus ? colors.hover : 'white'\n }\n style={{ fontSize: 13, zIndex: editing || selected ? 101 : 'auto' }}\n collapsed=\"true\"\n onMouseEnter={() => onHover && onHover(rule.id)}\n onMouseLeave={() => onHover && onHover(null)}\n >\n <SelectCell\n exposed={hovered || selected || editing}\n focused={focusedField === 'select'}\n onSelect={() => {\n dispatchSelected({ type: 'select', id: rule.id });\n }}\n onEdit={() => onEdit(rule.id, 'select')}\n selected={selected}\n />\n\n <Cell name=\"stage\" width={50} plain style={{ color: colors.n5 }}>\n {rule.stage && (\n <View\n style={{\n alignSelf: 'flex-start',\n margin: 5,\n backgroundColor: colors.b10,\n color: colors.b1,\n borderRadius: 4,\n padding: '3px 5px'\n }}\n >\n {rule.stage}\n </View>\n )}\n </Cell>\n\n <Field width=\"flex\" style={{ padding: '15px 0' }} truncate={false}>\n <Stack direction=\"row\" align=\"center\">\n <View style={{ flex: 1, alignItems: 'flex-start' }}>\n {rule.conditions.map((cond, i) => (\n <ConditionExpression\n key={i}\n field={cond.field}\n op={cond.op}\n value={cond.value}\n options={cond.options}\n stage={rule.stage}\n style={i !== 0 && { marginTop: 3 }}\n />\n ))}\n </View>\n\n <Text>\n <ArrowRight color={colors.n4} style={{ width: 12, height: 12 }} />\n </Text>\n\n <View style={{ flex: 1, alignItems: 'flex-start' }}>\n {rule.actions.map((action, i) => (\n <ActionExpression\n key={i}\n field={action.field}\n op={action.op}\n value={action.value}\n options={action.options}\n style={i !== 0 && { marginTop: 3 }}\n />\n ))}\n </View>\n </Stack>\n </Field>\n\n <Cell\n name=\"edit\"\n focused={focusedField === 'edit'}\n plain\n style={{ padding: '0 15px', paddingLeft: 5 }}\n >\n <Button\n as={CellButton}\n onSelect={() => onEditRule(rule)}\n onEdit={() => onEdit(rule.id, 'edit')}\n >\n Edit\n </Button>\n </Cell>\n </Row>\n );\n }\n);\n\nlet SimpleTable = React.forwardRef(\n (\n { data, navigator, loadMore, style, onHoverLeave, children, ...props },\n ref\n ) => {\n let contentRef = useRef();\n let contentHeight = useRef();\n let scrollRef = useRef();\n let { getNavigatorProps } = navigator;\n\n function onScroll(e) {\n if (contentHeight.current != null) {\n if (loadMore && e.target.scrollTop > contentHeight.current - 750) {\n loadMore();\n }\n }\n }\n\n useEffect(() => {\n if (contentRef.current) {\n contentHeight.current = contentRef.current.getBoundingClientRect().height;\n } else {\n contentHeight.current = null;\n }\n }, [contentRef.current, data]);\n\n return (\n <View\n style={[\n {\n flex: 1,\n outline: 'none',\n '& .animated .animated-row': { transition: '.25s transform' }\n },\n style\n ]}\n tabIndex=\"1\"\n {...getNavigatorProps(props)}\n >\n <View\n innerRef={scrollRef}\n style={{ maxWidth: '100%', overflow: 'auto' }}\n onScroll={onScroll}\n >\n <div ref={contentRef} onMouseLeave={onHoverLeave}>\n {children}\n </div>\n </View>\n </View>\n );\n }\n);\n\nfunction RulesHeader() {\n let selectedItems = useSelectedItems();\n let dispatchSelected = useSelectedDispatch();\n\n return (\n <TableHeader>\n <SelectCell\n exposed={true}\n focused={false}\n selected={selectedItems.size > 0}\n onSelect={() => dispatchSelected({ type: 'select-all' })}\n />\n <Cell value=\"Stage\" width={50} />\n <Cell value=\"Rule\" width=\"flex\" />\n </TableHeader>\n );\n}\n\nfunction RulesList({\n rules,\n selectedItems,\n navigator,\n hoveredRule,\n collapsed: borderCollapsed,\n onHover,\n onCollapse,\n onEditRule\n}) {\n if (rules.length === 0) {\n return null;\n }\n\n return (\n <View>\n {rules.map(rule => {\n let hovered = hoveredRule === rule.id;\n let selected = selectedItems.has(rule.id);\n let editing = navigator.editingId === rule.id;\n\n return (\n <Rule\n key={rule.id}\n rule={rule}\n hovered={hovered}\n selected={selected}\n editing={editing}\n focusedField={editing && navigator.focusedField}\n onHover={onHover}\n onEdit={navigator.onEdit}\n onEditRule={onEditRule}\n />\n );\n })}\n </View>\n );\n}\n\nexport default function ManageRules({ history, modalProps, payeeId }) {\n let [allRules, setAllRules] = useState(null);\n let [rules, setRules] = useState(null);\n let dispatch = useDispatch();\n let navigator = useTableNavigator(rules, ['select', 'edit']);\n let selectedInst = useSelected('manage-rules', allRules, []);\n let [hoveredRule, setHoveredRule] = useState(null);\n let [loading, setLoading] = useState(true);\n let tableRef = useRef(null);\n\n async function loadRules() {\n setLoading(true);\n\n let loadedRules = null;\n if (payeeId) {\n loadedRules = await send('payees-get-rules', { id: payeeId });\n } else {\n loadedRules = await send('rules-get');\n }\n\n setAllRules(loadedRules);\n return loadedRules;\n }\n\n useEffect(() => {\n async function loadData() {\n let loadedRules = await loadRules();\n setRules(loadedRules.slice(0, 100));\n setLoading(false);\n\n await dispatch(initiallyLoadPayees());\n }\n\n undo.setUndoState('openModal', 'manage-rules');\n\n loadData();\n\n return () => {\n undo.setUndoState('openModal', null);\n };\n }, []);\n\n function loadMore() {\n setRules(rules.concat(allRules.slice(rules.length, rules.length + 50)));\n }\n\n async function onDeleteSelected() {\n setLoading(true);\n let { someDeletionsFailed } = await send('rule-delete-all', [\n ...selectedInst.items\n ]);\n\n if (someDeletionsFailed) {\n alert('Some rules were not deleted because they are linked to schedules');\n }\n\n let newRules = await loadRules();\n setRules(rules => {\n return newRules.slice(0, rules.length);\n });\n selectedInst.dispatch({ type: 'select-none' });\n setLoading(false);\n }\n\n let onEditRule = useCallback(rule => {\n dispatch(\n pushModal('edit-rule', {\n rule,\n onSave: async newRule => {\n let newRules = await loadRules();\n\n setRules(rules => {\n let newIdx = newRules.findIndex(rule => rule.id === newRule.id);\n let oldIdx = rules.findIndex(rule => rule.id === newRule.id);\n\n if (newIdx > rules.length) {\n return newRules.slice(0, newIdx + 75);\n } else {\n return newRules.slice(0, rules.length);\n }\n });\n\n setLoading(false);\n }\n })\n );\n }, []);\n\n function onCreateRule() {\n dispatch(\n pushModal('edit-rule', {\n rule: {\n stage: null,\n conditions: [{ op: 'is', field: 'payee', value: null, type: 'id' }],\n actions: [{ op: 'set', field: 'category', value: null, type: 'id' }]\n },\n onSave: async newRule => {\n let newRules = await loadRules();\n\n navigator.onEdit(newRule.id, 'edit');\n\n setRules(rules => {\n let newIdx = newRules.findIndex(rule => rule.id === newRule.id);\n return newRules.slice(0, newIdx + 75);\n });\n\n setLoading(false);\n }\n })\n );\n }\n\n let onHover = useCallback(id => {\n setHoveredRule(id);\n }, []);\n\n if (rules === null) {\n return null;\n }\n\n return (\n <Modal\n title=\"Rules\"\n padding={0}\n loading={loading}\n {...modalProps}\n style={[modalProps.style, { flex: 1, maxWidth: '90%' }]}\n >\n {() => (\n <SchedulesQuery.Provider>\n <SelectedProvider instance={selectedInst}>\n <View style={{ height: '70vh' }}>\n <View style={{ flex: 1 }}>\n <RulesHeader />\n <SimpleTable\n ref={tableRef}\n data={rules}\n navigator={navigator}\n loadMore={loadMore}\n // Hide the last border of the item in the table\n style={{ marginBottom: -1 }}\n >\n <RulesList\n rules={rules}\n selectedItems={selectedInst.items}\n navigator={navigator}\n hoveredRule={hoveredRule}\n onHover={onHover}\n onEditRule={onEditRule}\n />\n </SimpleTable>\n </View>\n\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n padding: '13px 15px',\n borderTop: '1px solid ' + colors.border\n }}\n >\n <View\n style={{\n color: colors.n4,\n flexDirection: 'row',\n alignItems: 'center',\n width: '50%'\n }}\n >\n <Text>\n Rules are always run in the order that you see them.{' '}\n <ExternalLink\n asAnchor={true}\n href=\"https://actualbudget.com/docs/other/rules/\"\n style={{ color: colors.n4 }}\n >\n Learn more\n </ExternalLink>\n </Text>\n </View>\n\n <View style={{ flex: 1 }} />\n\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-end\"\n spacing={2}\n >\n {selectedInst.items.size > 0 && (\n <Button onClick={onDeleteSelected}>\n Delete {selectedInst.items.size} rules\n </Button>\n )}\n <Button primary onClick={onCreateRule}>\n Create new rule\n </Button>\n </Stack>\n </View>\n </View>\n </SelectedProvider>\n </SchedulesQuery.Provider>\n )}\n </Modal>\n );\n}\n","import React, { useState, useRef, useEffect, useReducer } from 'react';\nimport { useSelector } from 'react-redux';\nimport scopeTab from 'react-modal/lib/helpers/scopeTab';\nimport {\n parse as parseDate,\n format as formatDate,\n isValid as isDateValid\n} from 'date-fns';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { getMonthYearFormat } from 'loot-core/src/shared/months';\nimport { titleFirst } from 'loot-core/src/shared/util';\nimport {\n View,\n Text,\n Tooltip,\n Stack,\n Button,\n InitialFocus,\n Menu,\n CustomSelect\n} from 'loot-design/src/components/common';\nimport {\n mapField,\n friendlyOp,\n deserializeField,\n getFieldError,\n unparse,\n makeValue,\n FIELD_TYPES,\n TYPE_INFO\n} from 'loot-core/src/shared/rules';\nimport DeleteIcon from 'loot-design/src/svg/Delete';\nimport SettingsSliderAlternate from 'loot-design/src/svg/v2/SettingsSliderAlternate';\nimport GenericInput from '../util/GenericInput';\nimport { Value } from '../modals/ManageRules';\nimport { styles, colors } from 'loot-design/src/style';\n\nlet filterFields = [\n 'date',\n 'account',\n 'payee',\n 'notes',\n 'category',\n 'amount',\n 'cleared'\n].map(field => [field, mapField(field)]);\n\nfunction subfieldToOptions(field, subfield) {\n switch (field) {\n case 'amount':\n switch (subfield) {\n case 'amount-inflow':\n return { inflow: true };\n case 'amount-outflow':\n return { outflow: true };\n default:\n return null;\n }\n case 'date':\n switch (subfield) {\n case 'month':\n return { month: true };\n case 'year':\n return { year: true };\n default:\n return null;\n }\n default:\n return null;\n }\n}\n\nfunction ScopeTab({ children }) {\n let contentRef = useRef();\n\n function onKeyDown(e) {\n if (e.keyCode === 9) {\n scopeTab(contentRef.current, e);\n }\n }\n\n useEffect(() => {\n contentRef.current.focus();\n }, []);\n\n return (\n <div ref={contentRef} tabIndex={-1} onKeyDown={onKeyDown}>\n {children}\n </div>\n );\n}\n\nfunction OpButton({ op, selected, style, onClick }) {\n return (\n <Button\n bare\n style={[\n { backgroundColor: colors.n10, marginBottom: 5 },\n style,\n selected && {\n color: 'white',\n '&,:hover,:active': { backgroundColor: colors.b4 }\n }\n ]}\n onClick={onClick}\n >\n {friendlyOp(op)}\n </Button>\n );\n}\n\nfunction ConfigureField({ field, op, value, dispatch, onApply }) {\n let [subfield, setSubfield] = useState(field);\n let inputRef = useRef();\n let prevOp = useRef(null);\n\n useEffect(() => {\n if (prevOp.current !== op && inputRef.current) {\n inputRef.current.focus();\n }\n prevOp.current = op;\n }, [op]);\n\n let type = FIELD_TYPES.get(field);\n let ops = TYPE_INFO[type].ops;\n\n // Month and year fields are quite hacky right now! Figure out how\n // to clean this up later\n if (subfield === 'month' || subfield === 'year') {\n ops = ['is'];\n }\n\n return (\n <Tooltip\n position=\"bottom-left\"\n style={{ padding: 15 }}\n width={300}\n onClose={() => dispatch({ type: 'close' })}\n >\n <ScopeTab>\n <View style={{ marginBottom: 10 }}>\n {field === 'amount' || field === 'date' ? (\n <CustomSelect\n options={\n field === 'amount'\n ? [\n ['amount', 'Amount'],\n ['amount-inflow', 'Amount (inflow)'],\n ['amount-outflow', 'Amount (outflow)']\n ]\n : field === 'date'\n ? [['date', 'Date'], ['month', 'Month'], ['year', 'Year']]\n : null\n }\n value={subfield}\n onChange={sub => {\n setSubfield(sub);\n\n if (sub === 'month' || sub === 'year') {\n dispatch({ type: 'set-op', op: 'is' });\n }\n }}\n style={{ borderWidth: 1 }}\n />\n ) : (\n titleFirst(mapField(field))\n )}\n </View>\n\n <Stack\n direction=\"row\"\n align=\"flex-start\"\n spacing={1}\n style={{ flexWrap: 'wrap' }}\n >\n {type === 'boolean'\n ? [\n <OpButton\n op=\"true\"\n selected={value === true}\n onClick={() => {\n dispatch({ type: 'set-op', op: 'is' });\n dispatch({ type: 'set-value', value: true });\n }}\n />,\n <OpButton\n op=\"false\"\n selected={value === false}\n onClick={() => {\n dispatch({ type: 'set-op', op: 'is' });\n dispatch({ type: 'set-value', value: false });\n }}\n />\n ]\n : ops.map(currOp => (\n <OpButton\n op={currOp}\n selected={currOp === op}\n onClick={() => dispatch({ type: 'set-op', op: currOp })}\n />\n ))}\n </Stack>\n\n <form action=\"#\">\n {type !== 'boolean' && (\n <GenericInput\n inputRef={inputRef}\n field={field}\n subfield={subfield}\n type={type === 'id' && op === 'contains' ? 'string' : type}\n value={value}\n multi={op === 'oneOf'}\n style={{ marginTop: 10 }}\n onChange={v => dispatch({ type: 'set-value', value: v })}\n />\n )}\n\n <View>\n <Button\n primary\n style={{ marginTop: 15 }}\n onClick={e => {\n e.preventDefault();\n onApply({\n field,\n op,\n value,\n options: subfieldToOptions(field, subfield)\n });\n }}\n >\n Apply\n </Button>\n </View>\n </form>\n </ScopeTab>\n </Tooltip>\n );\n}\n\nexport function FilterButton({ onApply }) {\n let { dateFormat } = useSelector(state => {\n return {\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy'\n };\n });\n\n let [state, dispatch] = useReducer(\n (state, action) => {\n switch (action.type) {\n case 'select-field':\n return { ...state, fieldsOpen: true, condOpen: false };\n case 'configure': {\n let { field } = deserializeField(action.field);\n let type = FIELD_TYPES.get(field);\n let ops = TYPE_INFO[type].ops;\n return {\n ...state,\n fieldsOpen: false,\n condOpen: true,\n field: action.field,\n op: ops[0],\n value: type === 'boolean' ? true : null\n };\n }\n case 'set-op': {\n let type = FIELD_TYPES.get(state.field);\n let value = state.value;\n if (type === 'id' && action.op === 'contains') {\n // Clear out the value if switching between contains for\n // the id type\n value = null;\n }\n return { ...state, op: action.op, value };\n }\n case 'set-value':\n let { value } = makeValue(action.value, {\n type: FIELD_TYPES.get(state.field)\n });\n return { ...state, value: value };\n case 'close':\n return { fieldsOpen: false, condOpen: false, value: null };\n default:\n throw new Error('Unknown action: ' + action.type);\n }\n },\n { fieldsOpen: false, condOpen: false, field: null, value: null }\n );\n\n async function onValidateAndApply(cond) {\n cond = unparse({ ...cond, type: FIELD_TYPES.get(cond.field) });\n\n if (cond.type === 'date' && cond.options) {\n if (cond.options.month) {\n let date = parseDate(\n cond.value,\n getMonthYearFormat(dateFormat),\n new Date()\n );\n if (isDateValid(date)) {\n cond.value = formatDate(date, 'yyyy-MM');\n } else {\n alert('Invalid date format');\n return;\n }\n } else if (cond.options.year) {\n let date = parseDate(cond.value, 'yyyy', new Date());\n if (isDateValid(date)) {\n cond.value = formatDate(date, 'yyyy');\n } else {\n alert('Invalid date format');\n return;\n }\n }\n }\n\n let { error } = await send('rule-validate', {\n conditions: [cond],\n actions: []\n });\n\n if (error && error.conditionErrors.length > 0) {\n let field = titleFirst(mapField(cond.field));\n alert(field + ': ' + getFieldError(error.conditionErrors[0]));\n } else {\n onApply(cond);\n dispatch({ type: 'close' });\n }\n }\n\n return (\n <View>\n <Button bare onClick={() => dispatch({ type: 'select-field' })}>\n <SettingsSliderAlternate\n style={{\n width: 16,\n height: 16,\n color: 'inherit',\n marginRight: 5\n }}\n />{' '}\n Filter\n </Button>\n {state.fieldsOpen && (\n <Tooltip\n position=\"bottom-left\"\n style={{ padding: 0 }}\n onClose={() => dispatch({ type: 'close' })}\n >\n <Menu\n onMenuSelect={name => {\n dispatch({ type: 'configure', field: name });\n }}\n items={filterFields.map(([name, text]) => ({\n name: name,\n text: titleFirst(text)\n }))}\n />\n </Tooltip>\n )}\n {state.condOpen && (\n <ConfigureField\n field={state.field}\n op={state.op}\n value={state.value}\n dispatch={dispatch}\n onApply={onValidateAndApply}\n />\n )}\n </View>\n );\n}\n\nfunction FilterExpression({\n field: originalField,\n customName,\n op,\n value,\n options,\n stage,\n style,\n onDelete\n}) {\n let type = FIELD_TYPES.get(originalField);\n\n let field = originalField;\n if (type === 'date') {\n if (value.length === 7) {\n field = 'month';\n } else if (value.length === 4) {\n field = 'year';\n }\n }\n\n return (\n <View\n style={[\n {\n backgroundColor: colors.n10,\n borderRadius: 4,\n flexDirection: 'row',\n alignItems: 'center',\n padding: 5,\n paddingLeft: 10,\n marginBottom: 10,\n marginRight: 10\n },\n style\n ]}\n >\n <div>\n {customName ? (\n <Text style={{ color: colors.p4 }}>{customName}</Text>\n ) : (\n <>\n <Text style={{ color: colors.p4 }}>{mapField(field, options)}</Text>{' '}\n <Text style={{ color: colors.n3 }}>{friendlyOp(op)}</Text>{' '}\n <Value value={value} field={field} inline={true} />\n </>\n )}\n </div>\n <Button bare style={{ marginLeft: 3 }} onClick={onDelete}>\n <DeleteIcon style={{ width: 8, height: 8, color: colors.n4 }} />\n </Button>\n </View>\n );\n}\n\nexport function AppliedFilters({ filters, editingFilter, onDelete }) {\n return (\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n flexWrap: 'wrap',\n marginTop: 10,\n marginBottom: -5\n }}\n >\n {filters.map((filter, i) => (\n <FilterExpression\n customName={filter.customName}\n field={filter.field}\n op={filter.op}\n value={filter.value}\n options={filter.options}\n editing={editingFilter === filter}\n onDelete={() => onDelete(filter)}\n />\n ))}\n </View>\n );\n}\n","import React, {\n useState,\n useLayoutEffect,\n useEffect,\n useRef,\n useMemo,\n useReducer,\n useCallback\n} from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport { useSelector, useDispatch } from 'react-redux';\nimport {\n Redirect,\n withRouter,\n useParams,\n useHistory,\n useLocation\n} from 'react-router-dom';\nimport { css } from 'glamor';\nimport Modal from 'react-modal';\nimport Component from '@reactions/component';\nimport { debounce } from 'debounce';\nimport SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext';\nimport { send, listen } from 'loot-core/src/platform/client/fetch';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Button,\n Input,\n InputWithContent,\n InitialFocus,\n Tooltip,\n Menu,\n Block,\n Stack\n} from 'loot-design/src/components/common';\nimport {\n currencyToInteger,\n applyChanges,\n groupById\n} from 'loot-core/src/shared/util';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport TutorialPoint from 'loot-design/src/components/TutorialPoint';\nimport DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple';\nimport Pencil1 from 'loot-design/src/svg/v2/Pencil1';\nimport SearchAlternate from 'loot-design/src/svg/v2/SearchAlternate';\nimport DownloadThickBottom from 'loot-design/src/svg/v2/DownloadThickBottom';\nimport AnimatedRefresh from '../AnimatedRefresh';\nimport Add from 'loot-design/src/svg/v1/Add';\nimport format from 'loot-design/src/components/spreadsheet/format';\nimport useSheetValue from 'loot-design/src/components/spreadsheet/useSheetValue';\nimport CellValue from 'loot-design/src/components/spreadsheet/CellValue';\nimport ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1';\nimport CheveronDown from 'loot-design/src/svg/v1/CheveronDown';\nimport CheckCircle1 from 'loot-design/src/svg/v2/CheckCircle1';\nimport Loading from 'loot-design/src/svg/v1/AnimatedLoading';\nimport ArrowsExpand3 from 'loot-design/src/svg/v2/ArrowsExpand3';\nimport ArrowsShrink3 from 'loot-design/src/svg/v2/ArrowsShrink3';\nimport * as queries from 'loot-core/src/client/queries';\nimport q, { runQuery, pagedQuery } from 'loot-core/src/client/query-helpers';\nimport { queryContext } from 'loot-core/src/client/query-hooks';\nimport { SelectedItemsButton } from 'loot-design/src/components/table';\nimport { Query } from 'loot-core/src/shared/query';\nimport * as aql from 'loot-core/src/client/query-helpers';\nimport {\n deleteTransaction,\n updateTransaction,\n ungroupTransactions\n} from 'loot-core/src/shared/transactions';\nimport {\n SplitsExpandedProvider,\n useSplitsExpanded,\n isPreviewId\n} from './TransactionsTable';\nimport { styles, colors } from 'loot-design/src/style';\nimport TransactionList from './TransactionList';\nimport { authorizeBank } from '../../plaid';\nimport {\n SelectedProviderWithItems,\n useSelectedItems\n} from 'loot-design/src/components/useSelected';\nimport { keys } from 'loot-design/src/util/keys';\nimport { KeyHandlers } from 'loot-design/src/components/KeyHandlers';\nimport { FilterButton, AppliedFilters } from './Filters';\nimport {\n SchedulesProvider,\n useCachedSchedules\n} from 'loot-core/src/client/data-hooks/schedules';\nimport { getPayeesById } from 'loot-core/src/client/reducers/queries';\nimport { useActiveLocation } from '../ActiveLocation';\n\nfunction EmptyMessage({ onAdd }) {\n return (\n <View\n style={{\n backgroundColor: 'white',\n flex: 1,\n alignItems: 'center',\n borderTopWidth: 1,\n borderColor: colors.n9\n }}\n >\n <View\n style={{\n width: 550,\n marginTop: 75,\n fontSize: 15,\n alignItems: 'center'\n }}\n >\n <Text style={{ textAlign: 'center', lineHeight: '1.4em' }}>\n For Actual to be useful, you need to <strong>add an account</strong>.\n You can link an account to automatically download transactions, or\n manage it locally yourself.\n </Text>\n\n <Button primary style={{ marginTop: 20 }} onClick={onAdd}>\n Add account\n </Button>\n\n <View style={{ marginTop: 20, fontSize: 13, color: colors.n5 }}>\n In the future, you can add accounts from the sidebar.\n </View>\n </View>\n </View>\n );\n}\n\nfunction ReconcilingMessage({ balanceQuery, targetBalance, onDone }) {\n let cleared = useSheetValue({\n name: balanceQuery.name + '-cleared',\n query: balanceQuery.query.filter({ cleared: true })\n });\n let targetDiff = targetBalance - cleared;\n\n return (\n <View\n style={{\n flexDirection: 'row',\n alignSelf: 'center',\n backgroundColor: 'white',\n boxShadow: styles.shadow,\n borderRadius: 4,\n marginTop: 5,\n marginBottom: 15,\n padding: 10\n }}\n >\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n {targetDiff === 0 ? (\n <View\n style={{\n color: colors.g4,\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n <CheckCircle1\n style={{\n width: 13,\n height: 13,\n color: colors.g5,\n marginRight: 3\n }}\n />\n All reconciled!\n </View>\n ) : (\n <View style={{ color: colors.n3 }}>\n <Text style={{ fontStyle: 'italic', textAlign: 'center' }}>\n Your cleared balance{' '}\n <strong>{format(cleared, 'financial')}</strong> needs{' '}\n <strong>\n {(targetDiff > 0 ? '+' : '') + format(targetDiff, 'financial')}\n </strong>{' '}\n to match\n <br /> your bank{\"'\"}s balance of{' '}\n <Text style={{ fontWeight: 700 }}>\n {format(targetBalance, 'financial')}\n </Text>\n </Text>\n </View>\n )}\n <View style={{ marginLeft: 15 }}>\n <Button primary onClick={onDone}>\n Done Reconciling\n </Button>\n </View>\n </View>\n </View>\n );\n}\n\nfunction ReconcileTooltip({ account, onReconcile, onClose }) {\n let balance = useSheetValue(queries.accountBalance(account));\n\n function onSubmit(e) {\n let input = e.target.elements[0];\n let amount = currencyToInteger(input.value);\n onReconcile(amount == null ? balance : amount);\n onClose();\n }\n\n return (\n <Tooltip position=\"bottom-right\" width={275} onClose={onClose}>\n <View style={{ padding: '5px 8px' }}>\n <Text>\n Enter the current balance of your bank account that you want to\n reconcile with:\n </Text>\n <form onSubmit={onSubmit}>\n {balance != null && (\n <InitialFocus>\n <Input\n defaultValue={format(balance, 'financial')}\n style={{ margin: '7px 0' }}\n />\n </InitialFocus>\n )}\n <Button primary>Reconcile</Button>\n </form>\n </View>\n </Tooltip>\n );\n}\n\nfunction MenuButton({ onClick }) {\n return (\n <Button bare onClick={onClick}>\n <DotsHorizontalTriple\n width={15}\n height={15}\n style={{ color: 'inherit', transform: 'rotateZ(90deg)' }}\n />\n </Button>\n );\n}\n\nfunction MenuTooltip({ onClose, children }) {\n return (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 0 }}\n onClose={onClose}\n >\n {children}\n </Tooltip>\n );\n}\n\nfunction AccountMenu({\n account,\n canSync,\n syncEnabled,\n showBalances,\n canShowBalances,\n onClose,\n onReconcile,\n onMenuSelect\n}) {\n let [tooltip, setTooltip] = useState('default');\n\n return tooltip === 'reconcile' ? (\n <ReconcileTooltip\n account={account}\n onClose={onClose}\n onReconcile={onReconcile}\n />\n ) : (\n <MenuTooltip onClose={onClose}>\n <Menu\n onMenuSelect={item => {\n if (item === 'reconcile') {\n setTooltip('reconcile');\n } else {\n onMenuSelect(item);\n }\n }}\n items={[\n canShowBalances && {\n name: 'toggle-balance',\n text: (showBalances ? 'Hide' : 'Show') + ' Running Balance'\n },\n { name: 'export', text: 'Export' },\n { name: 'reconcile', text: 'Reconcile' },\n syncEnabled &&\n account &&\n !account.closed &&\n (canSync\n ? { name: 'unlink', text: 'Unlink Account' }\n : { name: 'link', text: 'Link Account' }),\n account.closed\n ? { name: 'reopen', text: 'Reopen Account' }\n : { name: 'close', text: 'Close Account' }\n ].filter(x => x)}\n />\n </MenuTooltip>\n );\n}\n\nfunction CategoryMenu({ onClose, onMenuSelect }) {\n return (\n <MenuTooltip onClose={onClose}>\n <Menu\n onMenuSelect={item => {\n onMenuSelect(item);\n }}\n items={[{ name: 'export', text: 'Export' }]}\n />\n </MenuTooltip>\n );\n}\n\nfunction DetailedBalance({ name, balance }) {\n return (\n <Text\n style={{\n marginLeft: 15,\n backgroundColor: colors.n10,\n borderRadius: 4,\n padding: '4px 6px',\n color: colors.n5\n }}\n >\n {name}{' '}\n <Text style={{ fontWeight: 600 }}>{format(balance, 'financial')}</Text>\n </Text>\n );\n}\n\nfunction SelectedBalance({ selectedItems }) {\n let [balance, setBalance] = useState(null);\n\n useEffect(() => {\n async function run() {\n let { data: rows } = await runQuery(\n q('transactions')\n .filter({\n id: { $oneof: [...selectedItems] },\n parent_id: { $oneof: [...selectedItems] }\n })\n .select('id')\n );\n let ids = new Set(rows.map(r => r.id));\n\n let finalIds = [...selectedItems].filter(id => !ids.has(id));\n let { data: balance } = await runQuery(\n q('transactions')\n .filter({ id: { $oneof: finalIds } })\n .options({ splits: 'all' })\n .calculate({ $sum: '$amount' })\n );\n setBalance(balance);\n }\n run();\n }, [selectedItems]);\n\n if (balance == null) {\n return null;\n }\n return <DetailedBalance name=\"Selected balance:\" balance={balance} />;\n}\n\nfunction MoreBalances({ balanceQuery }) {\n let cleared = useSheetValue({\n name: balanceQuery.name + '-cleared',\n query: balanceQuery.query.filter({ cleared: true })\n });\n let uncleared = useSheetValue({\n name: balanceQuery.name + '-uncleared',\n query: balanceQuery.query.filter({ cleared: false })\n });\n\n return (\n <View style={{ flexDirection: 'row' }}>\n <DetailedBalance name=\"Cleared total:\" balance={cleared} />\n <DetailedBalance name=\"Uncleared total:\" balance={uncleared} />\n </View>\n );\n}\n\nfunction Balances({ balanceQuery, showExtraBalances, onToggleExtraBalances }) {\n let selectedItems = useSelectedItems();\n\n return (\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n marginTop: -5,\n marginLeft: -5\n }}\n >\n <Button\n bare\n onClick={onToggleExtraBalances}\n style={{\n '& svg': {\n opacity: selectedItems.size > 0 || showExtraBalances ? 1 : 0\n },\n '&:hover svg': { opacity: 1 }\n }}\n >\n <CellValue\n binding={{ ...balanceQuery, value: 0 }}\n type=\"financial\"\n style={{ fontSize: 22, fontWeight: 400 }}\n getStyle={value => ({\n color: value < 0 ? colors.r5 : value > 0 ? colors.g5 : colors.n8\n })}\n />\n\n <ArrowButtonRight1\n style={{\n width: 10,\n height: 10,\n marginLeft: 10,\n color: colors.n5,\n transform: showExtraBalances ? 'rotateZ(180deg)' : 'rotateZ(0)'\n }}\n />\n </Button>\n {showExtraBalances && <MoreBalances balanceQuery={balanceQuery} />}\n\n {selectedItems.size > 0 && (\n <SelectedBalance selectedItems={selectedItems} />\n )}\n </View>\n );\n}\n\n// function ScheduleMenu({ onSelect, onClose }) {\n// let params = useParams();\n// let scheduleData = useCachedSchedules();\n// let payees = useSelector(state => state.queries.payees);\n// let byId = getPayeesById(payees);\n\n// if (scheduleData == null) {\n// return null;\n// }\n\n// return (\n// <Tooltip\n// position=\"bottom-right\"\n// width={200}\n// style={{ padding: 0 }}\n// onClose={onClose}\n// >\n// <Menu\n// onMenuSelect={name => {\n// onSelect(name);\n// onClose();\n// }}\n// items={scheduleData.schedules.map(s => {\n// let desc = s._payee\n// ? `${byId[s._payee].name} (${s.next_date})`\n// : `No payee (${s.next_date})`;\n\n// return { name: s.id, text: desc };\n// })}\n// />\n// </Tooltip>\n// );\n// }\n\nfunction SelectedTransactionsButton({\n style,\n getTransaction,\n onShow,\n onDelete,\n onEdit,\n onUnlink,\n onScheduleAction\n}) {\n let selectedItems = useSelectedItems();\n let history = useHistory();\n\n let types = useMemo(() => {\n let items = [...selectedItems];\n return {\n preview: !!items.find(id => isPreviewId(id)),\n trans: !!items.find(id => !isPreviewId(id))\n };\n }, [selectedItems]);\n\n let linked = useMemo(() => {\n return (\n !types.preview &&\n [...selectedItems].every(id => {\n let t = getTransaction(id);\n return t && t.schedule;\n })\n );\n }, [types.preview, selectedItems, getTransaction]);\n\n function getRealTransactions() {\n return [...selectedItems].filter(id => !isPreviewId(id));\n }\n\n return (\n <SelectedItemsButton\n name=\"transactions\"\n keyHandlers={\n types.trans && {\n f: () => onShow([...selectedItems]),\n d: () => onDelete([...selectedItems]),\n a: () => onEdit('account', [...selectedItems]),\n p: () => onEdit('payee', [...selectedItems]),\n n: () => onEdit('notes', [...selectedItems]),\n c: () => onEdit('category', [...selectedItems]),\n l: () => onEdit('cleared', [...selectedItems])\n }\n }\n items={[\n ...(!types.trans\n ? [\n { name: 'view-schedule', text: 'View schedule' },\n { name: 'post-transaction', text: 'Post transaction' },\n { name: 'skip', text: 'Skip scheduled date' }\n ]\n : [\n { name: 'show', text: 'Show', key: 'F' },\n { name: 'delete', text: 'Delete', key: 'D' },\n ...(linked\n ? [\n {\n name: 'view-schedule',\n text: 'View schedule',\n disabled: selectedItems.size > 1\n },\n { name: 'unlink-schedule', text: 'Unlink schedule' }\n ]\n : [\n {\n name: 'link-schedule',\n text: 'Link schedule'\n }\n ]),\n Menu.line,\n { type: Menu.label, name: 'Edit field' },\n { name: 'date', text: 'Date' },\n { name: 'account', text: 'Account', key: 'A' },\n { name: 'payee', text: 'Payee', key: 'P' },\n { name: 'notes', text: 'Notes', key: 'N' },\n { name: 'category', text: 'Category', key: 'C' },\n { name: 'amount', text: 'Amount' },\n { name: 'cleared', text: 'Cleared', key: 'L' }\n ])\n ]}\n onSelect={name => {\n switch (name) {\n case 'show':\n onShow([...selectedItems]);\n break;\n case 'delete':\n onDelete([...selectedItems]);\n break;\n case 'post-transaction':\n case 'skip':\n onScheduleAction(name, selectedItems);\n break;\n case 'view-schedule':\n let firstId = [...selectedItems][0];\n let scheduleId;\n if (isPreviewId(firstId)) {\n let parts = firstId.split('/');\n scheduleId = parts[1];\n } else {\n let trans = getTransaction(firstId);\n scheduleId = trans && trans.schedule;\n }\n\n if (scheduleId) {\n history.push(`/schedule/edit/${scheduleId}`, {\n locationPtr: history.location\n });\n }\n break;\n case 'link-schedule':\n history.push(`/schedule/link`, {\n locationPtr: history.location,\n transactionIds: [...selectedItems]\n });\n break;\n case 'unlink-schedule':\n onUnlink([...selectedItems]);\n break;\n default:\n let field = name;\n onEdit(name, [...selectedItems]);\n }\n }}\n ></SelectedItemsButton>\n );\n}\n\nconst AccountHeader = React.memo(\n ({\n tableRef,\n editingName,\n isNameEditable,\n workingHard,\n accountName,\n account,\n accountsSyncing,\n accounts,\n transactions,\n syncEnabled,\n showBalances,\n showExtraBalances,\n showEmptyMessage,\n balanceQuery,\n reconcileAmount,\n canCalculateBalance,\n search,\n filters,\n savePrefs,\n onSearch,\n onAddTransaction,\n onShowTransactions,\n onDoneReconciling,\n onToggleExtraBalances,\n onSaveName,\n onExposeName,\n onSync,\n onImport,\n onMenuSelect,\n onReconcile,\n onBatchDelete,\n onBatchEdit,\n onBatchUnlink,\n onApplyFilter,\n onDeleteFilter,\n onScheduleAction\n }) => {\n let [menuOpen, setMenuOpen] = useState(false);\n let searchInput = useRef(null);\n let splitsExpanded = useSplitsExpanded();\n\n let canSync = syncEnabled && (account && account.account_id);\n if (!account) {\n // All accounts - check for any syncable account\n canSync = !!accounts.find(account => !!account.account_id);\n }\n\n function onToggleSplits() {\n if (tableRef.current) {\n splitsExpanded.dispatch({\n type: 'switch-mode',\n id: tableRef.current.getScrolledItem()\n });\n\n savePrefs({\n 'expand-splits': !(splitsExpanded.state.mode === 'expand')\n });\n }\n }\n\n return (\n <>\n <KeyHandlers\n keys={{\n 'mod+f': () => {\n if (searchInput.current) {\n searchInput.current.focus();\n }\n }\n }}\n />\n\n <View\n style={[styles.pageContent, { paddingBottom: 10, flexShrink: 0 }]}\n >\n <View style={{ marginTop: 2, alignItems: 'flex-start' }}>\n <View>\n {editingName ? (\n <InitialFocus>\n <Input\n defaultValue={accountName}\n onEnter={e => onSaveName(e.target.value)}\n onBlur={() => onExposeName(false)}\n style={{\n fontSize: 25,\n fontWeight: 500,\n marginTop: -5,\n marginBottom: -2,\n marginLeft: -5\n }}\n />\n </InitialFocus>\n ) : isNameEditable ? (\n <Button\n bare\n style={{\n fontSize: 25,\n fontWeight: 500,\n marginLeft: -5,\n marginTop: -5,\n backgroundColor: 'transparent',\n '& svg': { display: 'none' },\n '&:hover svg': { display: 'unset' }\n }}\n onClick={() => onExposeName(true)}\n >\n {accountName}\n\n <Pencil1\n style={{\n width: 11,\n height: 11,\n marginLeft: 5,\n color: colors.n4\n }}\n />\n </Button>\n ) : (\n <View\n style={{ fontSize: 25, fontWeight: 500, marginBottom: 5 }}\n >\n {accountName}\n </View>\n )}\n </View>\n </View>\n\n <Balances\n balanceQuery={balanceQuery}\n showExtraBalances={showExtraBalances}\n onToggleExtraBalances={onToggleExtraBalances}\n />\n\n <Stack\n spacing={2}\n direction=\"row\"\n align=\"center\"\n style={{ marginTop: 12 }}\n >\n {((account && !account.closed) || canSync) && (\n <Button bare onClick={canSync ? onSync : onImport}>\n {canSync ? (\n <>\n <AnimatedRefresh\n width={13}\n height={13}\n animating={\n (account && accountsSyncing === account.name) ||\n accountsSyncing === '__all'\n }\n style={{ color: 'currentColor', marginRight: 4 }}\n />{' '}\n Sync\n </>\n ) : (\n <>\n <DownloadThickBottom\n width={13}\n height={13}\n style={{ color: 'currentColor', marginRight: 4 }}\n />{' '}\n Import\n </>\n )}\n </Button>\n )}\n {!showEmptyMessage && (\n <Button bare onClick={onAddTransaction}>\n <Add\n width={10}\n height={10}\n style={{ color: 'inherit', marginRight: 3 }}\n />{' '}\n Add New\n </Button>\n )}\n <View>\n <FilterButton onApply={onApplyFilter} />\n </View>\n <InputWithContent\n leftContent={\n <SearchAlternate\n style={{\n width: 13,\n height: 13,\n flexShrink: 0,\n color: 'inherit',\n margin: 5,\n marginRight: 0\n }}\n />\n }\n inputRef={searchInput}\n value={search}\n placeholder=\"Search\"\n getStyle={focused => [\n {\n backgroundColor: 'transparent',\n borderWidth: 0,\n boxShadow: 'none',\n transition: 'color .15s',\n '& input::placeholder': {\n color: colors.n1,\n transition: 'color .25s'\n }\n },\n focused && { boxShadow: '0 0 0 2px ' + colors.b5 },\n !focused && search !== '' && { color: colors.p4 }\n ]}\n onChange={e => onSearch(e.target.value)}\n />\n {workingHard ? (\n <View>\n <Loading color={colors.n1} style={{ width: 16, height: 16 }} />\n </View>\n ) : (\n <SelectedTransactionsButton\n getTransaction={id => transactions.find(t => t.id === id)}\n onShow={onShowTransactions}\n onDelete={onBatchDelete}\n onEdit={onBatchEdit}\n onUnlink={onBatchUnlink}\n onScheduleAction={onScheduleAction}\n />\n )}\n <Button\n bare\n disabled={search !== '' || filters.length > 0}\n style={{ padding: 6 }}\n onClick={onToggleSplits}\n title={\n splitsExpanded.state.mode === 'collapse'\n ? 'Collapse split transactions'\n : 'Expand split transactions'\n }\n >\n {splitsExpanded.state.mode === 'collapse' ? (\n <ArrowsShrink3\n style={{\n width: 14,\n height: 14,\n color: 'inherit'\n }}\n />\n ) : (\n <ArrowsExpand3\n style={{\n width: 14,\n height: 14,\n color: 'inherit'\n }}\n />\n )}\n </Button>\n {account ? (\n <View>\n <MenuButton onClick={() => setMenuOpen(true)} />\n\n {menuOpen && (\n <AccountMenu\n account={account}\n canSync={canSync}\n syncEnabled={syncEnabled}\n canShowBalances={canCalculateBalance()}\n showBalances={showBalances}\n onMenuSelect={item => {\n setMenuOpen(false);\n onMenuSelect(item);\n }}\n onReconcile={onReconcile}\n onClose={() => setMenuOpen(false)}\n />\n )}\n </View>\n ) : (\n <View>\n <MenuButton onClick={() => setMenuOpen(true)} />\n\n {menuOpen && (\n <CategoryMenu\n onMenuSelect={item => {\n setMenuOpen(false);\n onMenuSelect(item);\n }}\n onClose={() => setMenuOpen(false)}\n />\n )}\n </View>\n )}\n </Stack>\n\n {filters && filters.length > 0 && (\n <AppliedFilters filters={filters} onDelete={onDeleteFilter} />\n )}\n </View>\n {reconcileAmount != null && (\n <ReconcilingMessage\n targetBalance={reconcileAmount}\n balanceQuery={balanceQuery}\n onDone={onDoneReconciling}\n />\n )}\n </>\n );\n }\n);\n\nfunction AllTransactions({ transactions, filtered, children }) {\n let scheduleData = useCachedSchedules();\n\n let schedules = useMemo(\n () =>\n scheduleData\n ? scheduleData.schedules.filter(\n s =>\n !s.completed &&\n ['due', 'upcoming', 'missed'].includes(\n scheduleData.statuses.get(s.id)\n )\n )\n : [],\n [scheduleData]\n );\n\n let prependTransactions = useMemo(() => {\n return schedules.map(schedule => ({\n id: 'preview/' + schedule.id,\n payee: schedule._payee,\n account: schedule._account,\n amount: schedule._amount,\n date: schedule.next_date,\n notes: scheduleData.statuses.get(schedule.id),\n schedule: schedule.id\n }));\n }, [schedules]);\n\n let allTransactions = useMemo(() => {\n // Don't prepend scheduled transactions if we are filtering\n if (!filtered && prependTransactions.length > 0) {\n return prependTransactions.concat(transactions);\n }\n return transactions;\n }, [filtered, prependTransactions, transactions]);\n\n if (scheduleData == null) {\n return children(null);\n }\n return children(allTransactions);\n}\n\nclass AccountInternal extends React.PureComponent {\n constructor(props) {\n super(props);\n this.paged = null;\n this.table = React.createRef();\n this.animated = true;\n\n this.state = {\n search: '',\n filters: [],\n loading: true,\n workingHard: false,\n reconcileAmount: null,\n transactions: [],\n transactionsCount: 0,\n showBalances: props.showBalances,\n balances: [],\n editingName: false,\n isAdding: false,\n latestDate: null\n };\n }\n\n async componentDidMount() {\n let maybeRefetch = tables => {\n if (\n tables.includes('transactions') ||\n tables.includes('category_mapping') ||\n tables.includes('payee_mapping')\n ) {\n return this.refetchTransactions();\n }\n };\n\n let onUndo = async ({ tables, messages, undoTag }) => {\n await maybeRefetch(tables);\n\n // If all the messages are dealing with transactions, find the\n // first message referencing a non-deleted row so that we can\n // highlight the row\n //\n let focusId;\n if (\n messages.every(msg => msg.dataset === 'transactions') &&\n !messages.find(msg => msg.column === 'tombstone')\n ) {\n let focusableMsgs = messages.filter(\n msg => msg.dataset === 'transactions' && !(msg.column === 'tombstone')\n );\n\n focusId = focusableMsgs.length === 1 ? focusableMsgs[0].row : null;\n\n // Highlight the transactions\n // this.table && this.table.highlight(focusableMsgs.map(msg => msg.row));\n }\n\n if (this.table.current) {\n this.table.current.edit(null);\n\n // Focus a transaction if applicable. There is a chance if the\n // user navigated away that focusId is a transaction that has\n // been \"paged off\" and we won't focus it. That's ok, we just\n // do our best.\n if (focusId) {\n this.table.current.scrollTo(focusId);\n }\n }\n\n this.props.setLastUndoState(null);\n };\n\n let unlistens = [listen('undo-event', onUndo)];\n\n this.unlisten = () => {\n unlistens.forEach(unlisten => unlisten());\n };\n\n // Important that any async work happens last so that the\n // listeners are set up synchronously\n if (this.props.categoryGroups.length === 0) {\n await this.props.getCategories();\n }\n await this.props.initiallyLoadPayees();\n await this.fetchTransactions();\n\n // If there is a pending undo, apply it immediately (this happens\n // when an undo changes the location to this page)\n if (this.props.lastUndoState && this.props.lastUndoState.current) {\n onUndo(this.props.lastUndoState.current);\n }\n }\n\n componentDidUpdate(prevProps) {\n // If the user was on a different screen and is now coming back to\n // the transactions, automatically refresh the transaction to make\n // sure we have updated state\n if (prevProps.modalShowing && !this.props.modalShowing) {\n // This is clearly a hack. Need a better way to track which\n // things are listening to transactions and refetch\n // automatically (use ActualQL?)\n setTimeout(() => {\n this.refetchTransactions();\n }, 100);\n }\n }\n\n componentWillUnmount() {\n if (this.unlisten) {\n this.unlisten();\n }\n if (this.paged) {\n this.paged.unsubscribe();\n }\n }\n\n fetchAllIds = async () => {\n let { data } = await runQuery(this.paged.getQuery().select('id'));\n // Remember, this is the `grouped` split type so we need to deal\n // with the `subtransactions` property\n return data.reduce((arr, t) => {\n arr.push(t.id);\n t.subtransactions.forEach(sub => arr.push(sub.id));\n return arr;\n }, []);\n };\n\n refetchTransactions = async () => {\n this.paged && this.paged.run();\n };\n\n fetchTransactions = () => {\n let query = this.makeRootQuery();\n this.rootQuery = this.currentQuery = query;\n this.updateQuery(query);\n\n if (this.props.accountId) {\n this.props.markAccountRead(this.props.accountId);\n }\n };\n\n makeRootQuery = () => {\n let { transactions } = this.state;\n let locationState = this.props.location.state;\n let accountId = this.props.accountId;\n\n if (locationState && locationState.filter) {\n return q('transactions')\n .options({ splits: 'grouped' })\n .filter({\n 'account.offbudget': false,\n ...locationState.filter\n });\n }\n\n return queries.makeTransactionsQuery(accountId);\n };\n\n updateQuery(query, isFiltered) {\n if (this.paged) {\n this.paged.unsubscribe();\n }\n\n this.paged = pagedQuery(\n query.select('*'),\n async (data, prevData) => {\n const firstLoad = prevData == null;\n\n if (firstLoad) {\n this.table.current && this.table.current.setRowAnimation(false);\n\n if (isFiltered) {\n this.props.splitsExpandedDispatch({\n type: 'set-mode',\n mode: 'collapse'\n });\n } else {\n this.props.splitsExpandedDispatch({\n type: 'set-mode',\n mode: this.props.expandSplits ? 'expand' : 'collapse'\n });\n }\n }\n\n this.setState(\n {\n transactions: data,\n transactionCount: this.paged.getTotalCount(),\n transactionsFiltered: isFiltered,\n loading: false,\n workingHard: false\n },\n () => {\n if (this.state.showBalances) {\n this.calculateBalances();\n }\n\n if (firstLoad) {\n this.table.current && this.table.current.scrollToTop();\n }\n\n setTimeout(() => {\n this.table.current && this.table.current.setRowAnimation(true);\n }, 0);\n }\n );\n },\n {\n pageCount: 150,\n onlySync: true,\n mapper: ungroupTransactions\n }\n );\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.match !== nextProps.match) {\n this.setState(\n {\n editingName: false,\n loading: true,\n search: '',\n showBalances: nextProps.showBalances,\n balances: []\n },\n () => {\n this.fetchTransactions();\n }\n );\n }\n }\n\n onSearch = value => {\n this.paged.unsubscribe();\n this.setState({ search: value }, this.onSearchDone);\n };\n\n onSearchDone = debounce(() => {\n if (this.state.search === '') {\n this.updateQuery(this.currentQuery, this.state.filters.length > 0);\n } else {\n this.updateQuery(\n queries.makeTransactionSearchQuery(\n this.currentQuery,\n this.state.search,\n this.props.dateFormat\n ),\n true\n );\n }\n }, 150);\n\n onSync = async () => {\n const accountId = this.props.accountId;\n const account = this.props.accounts.find(acct => acct.id === accountId);\n\n await this.props.syncAndDownload(account ? account.id : null);\n };\n\n onImport = async () => {\n const accountId = this.props.accountId;\n const account = this.props.accounts.find(acct => acct.id === accountId);\n\n if (account) {\n const res = await window.Actual.openFileDialog({\n filters: [\n { name: 'Financial Files', extensions: ['qif', 'ofx', 'qfx', 'csv'] }\n ]\n });\n\n if (res) {\n this.props.pushModal('import-transactions', {\n accountId,\n filename: res[0],\n onImported: didChange => {\n if (didChange) {\n this.fetchTransactions();\n }\n }\n });\n }\n }\n };\n\n onExport = async accountName => {\n let exportedTransactions = await send('transactions-export-query', {\n query: this.currentQuery.serialize()\n });\n let normalizedName =\n accountName && accountName.replace(/[()]/g, '').replace(/\\s+/g, '-');\n let filename = `${normalizedName || 'transactions'}.csv`;\n\n window.Actual.saveFile(\n exportedTransactions,\n filename,\n 'Export Transactions'\n );\n };\n\n onTransactionsChange = (newTransaction, data) => {\n // Apply changes to pagedQuery data\n this.paged.optimisticUpdate(\n data => {\n if (newTransaction._deleted) {\n return data.filter(t => t.id !== newTransaction.id);\n } else {\n return data.map(t => {\n return t.id === newTransaction.id ? newTransaction : t;\n });\n }\n },\n mappedData => {\n return data;\n }\n );\n\n this.props.updateNewTransactions(newTransaction.id);\n };\n\n canCalculateBalance = () => {\n let accountId = this.props.accountId;\n let account = this.props.accounts.find(account => account.id === accountId);\n return (\n account && this.state.search === '' && this.state.filters.length === 0\n );\n };\n\n async calculateBalances() {\n if (!this.canCalculateBalance()) {\n return;\n }\n\n let { data } = await runQuery(\n this.paged\n .getQuery()\n .options({ splits: 'none' })\n .select([{ balance: { $sumOver: '$amount' } }])\n );\n\n this.setState({ balances: groupById(data) });\n }\n\n onAddTransaction = () => {\n this.setState({ isAdding: true });\n };\n\n onExposeName = flag => {\n this.setState({ editingName: flag });\n };\n\n onSaveName = name => {\n const accountId = this.props.accountId;\n const account = this.props.accounts.find(\n account => account.id === accountId\n );\n this.props.updateAccount({ ...account, name });\n this.setState({ editingName: false });\n };\n\n onToggleExtraBalances = () => {\n let { accountId, showExtraBalances } = this.props;\n let key = 'show-extra-balances-' + accountId;\n\n this.props.savePrefs({ [key]: !showExtraBalances });\n };\n\n onMenuSelect = async item => {\n const accountId = this.props.accountId;\n const account = this.props.accounts.find(\n account => account.id === accountId\n );\n\n switch (item) {\n case 'link':\n authorizeBank(this.props.pushModal, { upgradingId: accountId });\n break;\n case 'unlink':\n this.props.unlinkAccount(accountId);\n break;\n case 'close':\n this.props.openAccountCloseModal(accountId);\n break;\n case 'reopen':\n this.props.reopenAccount(accountId);\n break;\n case 'export':\n const accountName = this.getAccountTitle(account, accountId);\n this.onExport(accountName);\n break;\n case 'toggle-balance':\n if (this.state.showBalances) {\n this.props.savePrefs({ ['show-balances-' + accountId]: false });\n this.setState({ showBalances: false, balances: [] });\n } else {\n this.props.savePrefs({ ['show-balances-' + accountId]: true });\n this.setState({ showBalances: true });\n this.calculateBalances();\n }\n break;\n default:\n }\n };\n\n getAccountTitle(account, id) {\n let { filterName } = this.props.location.state || {};\n\n if (filterName) {\n return filterName;\n }\n\n if (!account) {\n if (id === 'budgeted') {\n return 'Budgeted Accounts';\n } else if (id === 'offbudget') {\n return 'Off Budget Accounts';\n } else if (id === 'uncategorized') {\n return 'Uncategorized';\n } else if (!id) {\n return 'All Accounts';\n }\n return null;\n }\n\n return (account.closed ? 'Closed: ' : '') + account.name;\n }\n\n getBalanceQuery(account, id) {\n return {\n name: `balance-query-${id}`,\n query: this.makeRootQuery().calculate({ $sum: '$amount' })\n };\n }\n\n isNew = id => {\n return this.props.newTransactions.includes(id);\n };\n\n isMatched = id => {\n return this.props.matchedTransactions.includes(id);\n };\n\n onManagePayees = id => {\n this.props.pushModal('manage-payees', { selectedPayee: id });\n };\n\n onCreatePayee = name => {\n let trimmed = name.trim();\n if (trimmed !== '') {\n return this.props.createPayee(name);\n }\n return null;\n };\n\n onReconcile = balance => {\n this.setState({ reconcileAmount: balance });\n };\n\n onDoneReconciling = () => {\n this.setState({ reconcileAmount: null });\n };\n\n onShowTransactions = async ids => {\n this.onApplyFilter({\n customName: 'Selected transactions',\n filter: { id: { $oneof: ids } }\n });\n };\n\n onBatchEdit = async (name, ids) => {\n let onChange = async (name, value) => {\n this.setState({ workingHard: true });\n\n let { data } = await runQuery(\n q('transactions')\n .filter({ id: { $oneof: ids } })\n .select('*')\n .options({ splits: 'grouped' })\n );\n let transactions = ungroupTransactions(data);\n\n let changes = { deleted: [], updated: [] };\n\n // Cleared is a special case right now\n if (name === 'cleared') {\n // Clear them if any are uncleared, otherwise unclear them\n value = !!transactions.find(t => !t.cleared);\n }\n\n transactions.forEach(trans => {\n let { diff } = updateTransaction(transactions, {\n ...trans,\n [name]: value\n });\n\n // TODO: We need to keep an updated list of transactions so\n // the logic in `updateTransaction`, particularly about\n // updating split transactions, works. This isn't ideal and we\n // should figure something else out\n transactions = applyChanges(diff, transactions);\n\n changes.deleted = changes.deleted\n ? changes.deleted.concat(diff.deleted)\n : diff.deleted;\n changes.updated = changes.updated\n ? changes.updated.concat(diff.updated)\n : diff.updated;\n changes.added = changes.added\n ? changes.added.concat(diff.added)\n : diff.added;\n });\n\n await send('transactions-batch-update', changes);\n await this.refetchTransactions();\n\n if (this.table.current) {\n this.table.current.edit(transactions[0].id, 'select', false);\n }\n };\n\n if (name === 'cleared') {\n // Cleared just toggles it on/off and it depends on the data\n // loaded. Need to clean this up in the future.\n onChange('cleared', null);\n } else {\n this.props.pushModal('edit-field', { name, onSubmit: onChange });\n }\n };\n\n onBatchDelete = async ids => {\n this.setState({ workingHard: true });\n\n let { data } = await runQuery(\n q('transactions')\n .filter({ id: { $oneof: ids } })\n .select('*')\n .options({ splits: 'grouped' })\n );\n let transactions = ungroupTransactions(data);\n\n let idSet = new Set(ids);\n let changes = { deleted: [], updated: [] };\n\n transactions.forEach(trans => {\n let parentId = trans.parent_id;\n\n // First, check if we're actually deleting this transaction by\n // checking `idSet`. Then, we don't need to do anything if it's\n // a child transaction and the parent is already being deleted\n if (!idSet.has(trans.id) || (parentId && idSet.has(parentId))) {\n return;\n }\n\n let { diff } = deleteTransaction(transactions, trans.id);\n\n // TODO: We need to keep an updated list of transactions so\n // the logic in `updateTransaction`, particularly about\n // updating split transactions, works. This isn't ideal and we\n // should figure something else out\n transactions = applyChanges(diff, transactions);\n\n changes.deleted = diff.deleted\n ? changes.deleted.concat(diff.deleted)\n : diff.deleted;\n changes.updated = diff.updated\n ? changes.updated.concat(diff.updated)\n : diff.updated;\n });\n\n await send('transactions-batch-update', changes);\n await this.refetchTransactions();\n };\n\n onBatchUnlink = async ids => {\n await send('transactions-batch-update', {\n updated: ids.map(id => ({ id, schedule: null }))\n });\n\n await this.refetchTransactions();\n };\n\n onDeleteFilter = filter => {\n this.applyFilters(this.state.filters.filter(f => f !== filter));\n };\n\n onApplyFilter = async cond => {\n let filters = this.state.filters;\n if (cond.customName) {\n filters = filters.filter(f => f.customName !== cond.customName);\n }\n this.applyFilters([...filters, cond]);\n };\n\n onScheduleAction = async (name, ids) => {\n switch (name) {\n case 'post-transaction':\n for (let id of ids) {\n let parts = id.split('/');\n await send('schedule/post-transaction', { id: parts[1] });\n }\n this.refetchTransactions();\n break;\n case 'skip':\n for (let id of ids) {\n let parts = id.split('/');\n await send('schedule/skip-next-date', { id: parts[1] });\n }\n break;\n default:\n }\n };\n\n applyFilters = async conditions => {\n if (conditions.length > 0) {\n let customFilters = conditions\n .filter(cond => !!cond.customName)\n .map(f => f.filter);\n let { filters } = await send('make-filters-from-conditions', {\n conditions: conditions.filter(cond => !cond.customName)\n });\n\n this.currentQuery = this.rootQuery.filter({\n $and: [...filters, ...customFilters]\n });\n this.updateQuery(this.currentQuery, true);\n this.setState({ filters: conditions, search: '' });\n } else {\n this.setState({ transactions: [], transactionCount: 0 });\n this.fetchTransactions();\n this.setState({ filters: conditions, search: '' });\n }\n };\n\n render() {\n let {\n accounts,\n categoryGroups,\n payees,\n match,\n syncEnabled,\n dateFormat,\n addNotification,\n accountsSyncing,\n replaceModal,\n showExtraBalances,\n expandSplits,\n accountId\n } = this.props;\n let {\n transactions,\n loading,\n workingHard,\n reconcileAmount,\n transactionCount,\n transactionsFiltered,\n editingName,\n showBalances,\n balances\n } = this.state;\n\n let account = accounts.find(account => account.id === accountId);\n const accountName = this.getAccountTitle(account, accountId);\n\n if (!accountName && !loading) {\n // This is probably an account that was deleted, so redirect to\n // all accounts\n return <Redirect to=\"/accounts\" />;\n }\n\n let showEmptyMessage = !loading && !accountId && accounts.length === 0;\n\n let isNameEditable =\n accountId &&\n accountId !== 'budgeted' &&\n accountId !== 'offbudget' &&\n accountId !== 'uncategorized';\n\n let balanceQuery = this.getBalanceQuery(account, accountId);\n\n return (\n <AllTransactions\n transactions={transactions}\n filtered={transactionsFiltered}\n >\n {allTransactions =>\n allTransactions == null ? null : (\n <SelectedProviderWithItems\n name=\"transactions\"\n items={allTransactions}\n fetchAllIds={this.fetchAllIds}\n registerDispatch={dispatch => (this.dispatchSelected = dispatch)}\n >\n <View style={[styles.page, { backgroundColor: colors.n11 }]}>\n <AccountHeader\n tableRef={this.table}\n editingName={editingName}\n isNameEditable={isNameEditable}\n workingHard={workingHard}\n account={account}\n accountName={accountName}\n accountsSyncing={accountsSyncing}\n accounts={accounts}\n transactions={transactions}\n showBalances={showBalances}\n showExtraBalances={showExtraBalances}\n showEmptyMessage={showEmptyMessage}\n balanceQuery={balanceQuery}\n syncEnabled={syncEnabled}\n canCalculateBalance={this.canCalculateBalance}\n reconcileAmount={reconcileAmount}\n search={this.state.search}\n filters={this.state.filters}\n savePrefs={this.props.savePrefs}\n onSearch={this.onSearch}\n onShowTransactions={this.onShowTransactions}\n onMenuSelect={this.onMenuSelect}\n onAddTransaction={this.onAddTransaction}\n onToggleExtraBalances={this.onToggleExtraBalances}\n onSaveName={this.onSaveName}\n onExposeName={this.onExposeName}\n onReconcile={this.onReconcile}\n onDoneReconciling={this.onDoneReconciling}\n onSync={this.onSync}\n onImport={this.onImport}\n onBatchDelete={this.onBatchDelete}\n onBatchEdit={this.onBatchEdit}\n onBatchUnlink={this.onBatchUnlink}\n onDeleteFilter={this.onDeleteFilter}\n onApplyFilter={this.onApplyFilter}\n onScheduleAction={this.onScheduleAction}\n />\n\n <View style={{ flex: 1 }}>\n <TransactionList\n tableRef={this.table}\n account={account}\n transactions={transactions}\n allTransactions={allTransactions}\n animated={this.animated}\n loadMoreTransactions={() =>\n this.paged && this.paged.fetchNext()\n }\n accounts={accounts}\n categoryGroups={categoryGroups}\n payees={payees}\n balances={\n showBalances && this.canCalculateBalance()\n ? balances\n : null\n }\n showAccount={\n !accountId ||\n (accountId === 'offbudget' ||\n accountId === 'budgeted' ||\n accountId === 'uncategorized')\n }\n isAdding={this.state.isAdding}\n isNew={this.isNew}\n isMatched={this.isMatched}\n isFiltered={\n this.state.search !== '' || this.state.filters.length > 0\n }\n dateFormat={dateFormat}\n addNotification={addNotification}\n renderEmpty={() =>\n showEmptyMessage ? (\n <EmptyMessage\n onAdd={() =>\n replaceModal(\n syncEnabled ? 'add-account' : 'add-local-account'\n )\n }\n />\n ) : !loading ? (\n <View\n style={{\n marginTop: 20,\n textAlign: 'center',\n fontStyle: 'italic'\n }}\n >\n No transactions\n </View>\n ) : null\n }\n onChange={this.onTransactionsChange}\n onRefetch={this.refetchTransactions}\n onRefetchUpToRow={row =>\n this.paged.refetchUpToRow(row, {\n field: 'date',\n order: 'desc'\n })\n }\n onCloseAddTransaction={() =>\n this.setState({ isAdding: false })\n }\n onManagePayees={this.onManagePayees}\n onCreatePayee={this.onCreatePayee}\n />\n </View>\n </View>\n </SelectedProviderWithItems>\n )\n }\n </AllTransactions>\n );\n }\n}\n\nfunction AccountHack(props) {\n let { dispatch: splitsExpandedDispatch } = useSplitsExpanded();\n return (\n <AccountInternal\n {...props}\n splitsExpandedDispatch={splitsExpandedDispatch}\n />\n );\n}\n\nexport default function Account(props) {\n let state = useSelector(state => ({\n newTransactions: state.queries.newTransactions,\n matchedTransactions: state.queries.matchedTransactions,\n accounts: state.queries.accounts,\n failedAccounts: state.account.failedAccounts,\n categoryGroups: state.queries.categories.grouped,\n syncEnabled: state.prefs.local['flags.syncAccount'],\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy',\n expandSplits: props.match && state.prefs.local['expand-splits'],\n showBalances:\n props.match &&\n state.prefs.local['show-balances-' + props.match.params.id],\n showExtraBalances:\n props.match &&\n state.prefs.local['show-extra-balances-' + props.match.params.id],\n payees: state.queries.payees,\n modalShowing: state.modals.modalStack.length > 0,\n accountsSyncing: state.account.accountsSyncing,\n lastUndoState: state.app.lastUndoState,\n tutorialStage: state.tutorial.stage\n }));\n\n let dispatch = useDispatch();\n let actionCreators = useMemo(() => bindActionCreators(actions, dispatch), [\n dispatch\n ]);\n\n let params = useParams();\n let location = useLocation();\n let activeLocation = useActiveLocation();\n\n let transform = useMemo(() => {\n let filter = queries.getAccountFilter(params.id, '_account');\n\n // Never show schedules on these pages\n if (\n (location.state && location.state.filter) ||\n params.id === 'uncategorized'\n ) {\n filter = { id: null };\n }\n\n return q => {\n q = q.filter({ $and: [filter, { '_account.closed': false }] });\n return q.orderBy({ next_date: 'desc' });\n };\n }, [params.id]);\n\n return (\n <SchedulesProvider transform={transform}>\n <SplitsExpandedProvider\n initialMode={state.expandSplits ? 'collapse' : 'expand'}\n >\n <AccountHack\n {...state}\n {...actionCreators}\n modalShowing={\n state.modalShowing ||\n !!(activeLocation.state && activeLocation.state.locationPtr)\n }\n accountId={params.id}\n location={props.location}\n />\n </SplitsExpandedProvider>\n </SchedulesProvider>\n );\n}\n","import React from 'react';\nimport * as monthUtils from 'loot-core/src/shared/months';\n\nexport function getValidMonthBounds(bounds, startMonth, endMonth) {\n return {\n start: startMonth < bounds.start ? bounds.start : startMonth,\n end: endMonth > bounds.end ? bounds.end : endMonth\n };\n}\n\nexport let MonthsContext = React.createContext();\n\nexport function MonthsProvider({\n startMonth,\n numMonths,\n monthBounds,\n type,\n children\n}) {\n let endMonth = monthUtils.addMonths(startMonth, numMonths - 1);\n let bounds = getValidMonthBounds(monthBounds, startMonth, endMonth);\n let months = monthUtils.rangeInclusive(bounds.start, bounds.end);\n\n return (\n <MonthsContext.Provider value={{ months, type }}>\n {children}\n </MonthsContext.Provider>\n );\n}\n","import React from 'react';\nimport { colors } from '../../style';\n\nexport let CategoryGroupsContext = React.createContext([]);\n\nexport function addToBeBudgetedGroup(groups) {\n return [\n {\n id: 'to-be-budgeted',\n name: 'To Be Budgeted',\n categories: [{ id: 'to-be-budgeted', name: 'To Be Budgeted' }]\n },\n ...groups\n ];\n}\n\nexport function separateGroups(categoryGroups) {\n return [\n categoryGroups.filter(g => !g.is_income),\n categoryGroups.find(g => g.is_income)\n ];\n}\n\nexport function makeAmountGrey(value) {\n return value === 0 || value === '0' || value === ''\n ? { color: colors.n10 }\n : null;\n}\n\nexport function makeAmountStyle(value) {\n const greyed = makeAmountGrey(value);\n if (greyed) {\n return greyed;\n }\n\n if (value < 0) {\n return { color: colors.r4 };\n }\n}\n\nexport function makeAmountFullStyle(value) {\n return {\n color: value < 0 ? colors.r4 : value === 0 ? colors.n10 : colors.g4\n };\n}\n\nexport function findSortDown(arr, pos, targetId) {\n if (pos === 'top') {\n return { targetId };\n } else {\n let idx = arr.findIndex(item => item.id === targetId);\n\n if (idx === -1) {\n throw new Error('findSort: item not found: ' + targetId);\n }\n\n let newIdx = idx + 1;\n if (newIdx < arr.length - 1) {\n return { targetId: arr[newIdx].id };\n } else {\n // Move to the end\n return { targetId: null };\n }\n }\n}\n\nexport function findSortUp(arr, pos, targetId) {\n if (pos === 'bottom') {\n return { targetId };\n } else {\n let idx = arr.findIndex(item => item.id === targetId);\n\n if (idx === -1) {\n throw new Error('findSort: item not found: ' + targetId);\n }\n\n let newIdx = idx - 1;\n if (newIdx >= 0) {\n return { targetId: arr[newIdx].id };\n } else {\n // Move to the beginning\n return { targetId: null };\n }\n }\n}\n","export const INCOME_HEADER_HEIGHT = 70;\nexport const MONTH_BOX_SHADOW =\n '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)';\nexport const MONTH_RIGHT_PADDING = 5;\n","import React, { useState, useContext, useEffect } from 'react';\nimport { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';\nimport evalArithmetic from 'loot-core/src/shared/arithmetic';\nimport { View, Button, Tooltip, InitialFocus, Input } from '../../common';\nimport SpreadsheetContext from '../../spreadsheet/SpreadsheetContext';\nimport NamespaceContext from '../../spreadsheet/NamespaceContext';\nimport { addToBeBudgetedGroup } from '../util';\nimport CategoryAutocomplete from '../../CategorySelect';\nimport { CategoryGroupsContext } from '../util';\n\nexport default function TransferTooltip({\n initialAmount,\n initialAmountName,\n showToBeBudgeted,\n tooltipProps,\n onSubmit,\n onClose\n}) {\n let spreadsheet = useContext(SpreadsheetContext);\n let sheetName = useContext(NamespaceContext);\n let categoryGroups = useContext(CategoryGroupsContext);\n\n categoryGroups = categoryGroups.filter(g => !g.is_income);\n if (showToBeBudgeted) {\n categoryGroups = addToBeBudgetedGroup(categoryGroups);\n }\n\n let [amount, setAmount] = useState(null);\n let [category, setCategory] = useState(null);\n\n useEffect(() => {\n (async () => {\n if (initialAmountName) {\n const node = await spreadsheet.get(sheetName, initialAmountName);\n setAmount(integerToCurrency(Math.max(node.value, 0)));\n } else {\n setAmount(integerToCurrency(Math.max(initialAmount, 0)));\n }\n })();\n }, []);\n\n function submit() {\n let parsedAmount = evalArithmetic(amount, null);\n if (parsedAmount && category) {\n onSubmit(amountToInteger(parsedAmount), category);\n onClose();\n }\n }\n\n if (amount === null) {\n // Don't render anything until we have the amount to show. This\n // ensures that the amount field is focused and fully selected\n // when it's initially rendered (instead of being updated\n // afterwards and losing selection)\n return null;\n }\n\n return (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 10 }}\n {...tooltipProps}\n onClose={onClose}\n >\n <View style={{ marginBottom: 5 }}>Transfer this amount:</View>\n <View>\n <InitialFocus>\n <Input\n value={amount}\n onChange={e => setAmount(e.target.value)}\n onEnter={submit}\n />\n </InitialFocus>\n </View>\n <View style={{ margin: '10px 0 5px 0' }}>To:</View>\n\n <CategoryAutocomplete\n categoryGroups={categoryGroups}\n value={null}\n openOnFocus={false}\n onUpdate={id => {}}\n onSelect={id => setCategory(id)}\n inputProps={{\n onKeyDown: e => {\n if (e.keyCode === 13) {\n submit();\n }\n }\n }}\n />\n\n <View\n style={{\n alignItems: 'flex-end',\n marginTop: 10\n }}\n >\n <Button\n primary\n style={{\n fontSize: 12,\n paddingTop: 3,\n paddingBottom: 3\n }}\n onClick={submit}\n >\n Transfer\n </Button>\n </View>\n </Tooltip>\n );\n}\n","import React from 'react';\n\nconst SvgArrowThinRight = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowThinRight;\n","import React from 'react';\nimport useSheetValue from '../spreadsheet/useSheetValue';\nimport { makeAmountStyle } from './util';\nimport { View } from '../common';\nimport ArrowThinRight from '../../svg/v1/ArrowThinRight';\nimport CellValue from '../spreadsheet/CellValue';\n\nexport default function BalanceWithCarryover({\n carryover,\n balance,\n category,\n disabled\n}) {\n let carryoverValue = useSheetValue(carryover);\n let balanceValue = useSheetValue(balance);\n\n return (\n <>\n <CellValue\n binding={balance}\n type=\"financial\"\n getStyle={makeAmountStyle}\n style={[\n { textAlign: 'right' },\n !disabled && {\n cursor: 'pointer',\n ':hover': { textDecoration: 'underline' }\n }\n ]}\n />\n {carryoverValue === true && (\n <View\n style={{\n alignSelf: 'center',\n marginLeft: 2,\n position: 'absolute',\n right: -4,\n top: 0,\n bottom: 0,\n justifyContent: 'center'\n }}\n >\n <ArrowThinRight\n width={7}\n height={7}\n style={{\n ...makeAmountStyle(balanceValue)\n }}\n />\n </View>\n )}\n </>\n );\n}\n","import React from 'react';\n\nconst SvgArrowButtonDown1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowButtonDown1;\n","import React from 'react';\n\nconst SvgArrowButtonUp1 = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowButtonUp1;\n","import React, { useContext } from 'react';\nimport * as monthUtils from 'loot-core/src/shared/months';\n\nlet Context = React.createContext(null);\n\nexport function RolloverContext({\n categoryGroups,\n summaryCollapsed,\n onBudgetAction,\n onToggleSummaryCollapse,\n children\n}) {\n let currentMonth = monthUtils.currentMonth();\n\n return (\n <Context.Provider\n value={{\n currentMonth,\n categoryGroups,\n summaryCollapsed,\n onBudgetAction,\n onToggleSummaryCollapse\n }}\n children={children}\n />\n );\n}\n\nexport function useRollover() {\n return useContext(Context);\n}\n","import React, { useState, useContext, useEffect } from 'react';\nimport { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';\nimport evalArithmetic from 'loot-core/src/shared/arithmetic';\nimport { View, Button, Tooltip, InitialFocus, Input } from '../../common';\nimport SpreadsheetContext from '../../spreadsheet/SpreadsheetContext';\nimport NamespaceContext from '../../spreadsheet/NamespaceContext';\n\nexport default function HoldTooltip({ onSubmit, onClose }) {\n const spreadsheet = useContext(SpreadsheetContext);\n const sheetName = useContext(NamespaceContext);\n\n const [amount, setAmount] = useState(null);\n\n useEffect(() => {\n (async () => {\n const node = await spreadsheet.get(sheetName, 'to-budget');\n setAmount(integerToCurrency(Math.max(node.value, 0)));\n })();\n }, []);\n\n function submit() {\n const parsedAmount = evalArithmetic(amount, null);\n if (parsedAmount) {\n onSubmit(amountToInteger(parsedAmount));\n }\n onClose();\n }\n\n if (amount === null) {\n // See `TransferTooltip` for more info about this\n return null;\n }\n\n return (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 10 }}\n onClose={onClose}\n >\n <View style={{ marginBottom: 5 }}>Hold this amount:</View>\n <View>\n <InitialFocus>\n <Input\n value={amount}\n onChange={e => setAmount(e.target.value)}\n onEnter={submit}\n />\n </InitialFocus>\n </View>\n <View\n style={{\n alignItems: 'flex-end',\n marginTop: 10\n }}\n >\n <Button\n primary\n style={{\n fontSize: 12,\n paddingTop: 3,\n paddingBottom: 3\n }}\n onClick={submit}\n >\n Hold\n </Button>\n </View>\n </Tooltip>\n );\n}\n","import React from 'react';\n\nconst SvgCustomNotesPaper = props => (\n <svg\n {...props}\n viewBox=\"0 0 19 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCustomNotesPaper;\n","import React, { useState, useEffect, useMemo } from 'react';\nimport { css } from 'glamor';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { useLiveQuery } from 'loot-core/src/client/query-hooks';\nimport q from 'loot-core/src/client/query-helpers';\nimport { View, Button, Tooltip, useTooltip } from './common';\nimport CustomNotesPaper from '../svg/v2/CustomNotesPaper';\nimport { colors } from '../style';\n\nexport function NotesTooltip({\n defaultNotes,\n position = 'bottom-left',\n onClose\n}) {\n let [notes, setNotes] = useState(defaultNotes);\n let inputRef = React.createRef();\n\n useEffect(() => {\n inputRef.current.focus();\n }, []);\n\n return (\n <Tooltip position={position} onClose={() => onClose(notes)}>\n <textarea\n ref={inputRef}\n {...css({\n border: '1px solid ' + colors.border,\n minWidth: 300,\n minHeight: 120,\n outline: 'none'\n })}\n value={notes || ''}\n onChange={e => setNotes(e.target.value)}\n ></textarea>\n </Tooltip>\n );\n}\n\nexport default function NotesButton({\n id,\n width = 12,\n height = 12,\n defaultColor = colors.n8,\n tooltipPosition,\n style\n}) {\n let tooltip = useTooltip();\n let { data } = useLiveQuery(\n useMemo(\n () =>\n q('notes')\n .filter({ id })\n .select('*'),\n [id]\n )\n );\n let note = data && data.length > 0 ? data[0].note : null;\n let hasNotes = note && note !== '';\n\n function onClose(notes) {\n send('notes-save', { id, note: notes });\n tooltip.close();\n }\n\n return (\n <View\n style={[\n { flexShrink: 0 },\n tooltip.isOpen && {\n '& button, & .hover-visible': {\n display: 'flex',\n opacity: 1,\n color: colors.n1\n }\n },\n hasNotes && {\n '& button, & .hover-visible': { display: 'flex', opacity: 1 }\n }\n ]}\n >\n <Button\n bare\n className=\"hover-visible\"\n style={[{ color: defaultColor }, style]}\n {...tooltip.getOpenEvents()}\n >\n <CustomNotesPaper style={{ width, height, color: 'currentColor' }} />\n </Button>\n {tooltip.isOpen && (\n <NotesTooltip\n defaultNotes={note}\n position={tooltipPosition}\n onClose={onClose}\n />\n )}\n </View>\n );\n}\n","import React, { useState } from 'react';\nimport { css } from 'glamor';\nimport Component from '@reactions/component';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { rolloverBudget } from 'loot-core/src/client/queries';\nimport NamespaceContext from '../../spreadsheet/NamespaceContext';\nimport format from '../../spreadsheet/format';\nimport SheetValue from '../../spreadsheet/SheetValue';\nimport CellValue from '../../spreadsheet/CellValue';\nimport {\n View,\n Block,\n Button,\n Tooltip,\n Menu,\n HoverTarget,\n AlignedText\n} from '../../common';\nimport { MONTH_BOX_SHADOW } from '../constants';\nimport ArrowButtonDown1 from '../../../svg/v2/ArrowButtonDown1';\nimport ArrowButtonUp1 from '../../../svg/v2/ArrowButtonUp1';\nimport DotsHorizontalTriple from '../../../svg/v1/DotsHorizontalTriple';\nimport { colors, styles } from '../../../style';\nimport { useRollover } from './RolloverContext';\nimport TransferTooltip from './TransferTooltip';\nimport HoldTooltip from './HoldTooltip';\nimport NotesButton from '../../NotesButton';\n\nfunction TotalsList({ prevMonthName, collapsed }) {\n return (\n <View\n style={[\n {\n flexDirection: 'row',\n lineHeight: 1.5,\n justifyContent: 'center'\n },\n !collapsed && {\n padding: '5px 0',\n marginTop: 17,\n backgroundColor: colors.n11,\n borderTopWidth: 1,\n borderBottomWidth: 1,\n borderColor: colors.n9\n },\n collapsed && {\n padding: 7\n },\n styles.smallText\n ]}\n >\n <View\n style={{\n textAlign: 'right',\n marginRight: 10,\n minWidth: 50\n }}\n >\n <HoverTarget\n style={{ flexShrink: 0 }}\n renderContent={() => (\n <Tooltip\n width={200}\n style={{ lineHeight: 1.5, padding: '6px 10px' }}\n >\n <AlignedText\n left=\"Income:\"\n right={\n <CellValue\n binding={rolloverBudget.totalIncome}\n type=\"financial\"\n />\n }\n />\n <AlignedText\n left=\"From Last Month:\"\n right={\n <CellValue\n binding={rolloverBudget.fromLastMonth}\n type=\"financial\"\n />\n }\n />\n </Tooltip>\n )}\n >\n <CellValue\n binding={rolloverBudget.incomeAvailable}\n type=\"financial\"\n style={{ fontWeight: 600 }}\n />\n </HoverTarget>\n\n <CellValue\n binding={rolloverBudget.lastMonthOverspent}\n formatter={value => {\n let v = format(value, 'financial');\n return value > 0 ? '+' + v : value === 0 ? '-' + v : v;\n }}\n style={[{ fontWeight: 600 }, styles.tnum]}\n />\n\n <CellValue\n binding={rolloverBudget.totalBudgeted}\n formatter={value => {\n let v = format(value, 'financial');\n return value > 0 ? '+' + v : value === 0 ? '-' + v : v;\n }}\n style={[{ fontWeight: 600 }, styles.tnum]}\n />\n\n <CellValue\n binding={rolloverBudget.forNextMonth}\n formatter={value => {\n let n = parseInt(value);\n n = isNaN(n) ? 0 : -n;\n let v = format(n, 'financial');\n\n return n > 0 ? '+' + v : n === 0 ? '-' + v : v;\n }}\n style={[{ fontWeight: 600 }, styles.tnum]}\n />\n </View>\n\n <View>\n <Block>Available Funds</Block>\n <Block>Overspent in {prevMonthName}</Block>\n <Block>Budgeted</Block>\n <Block>For Next Month</Block>\n </View>\n </View>\n );\n}\n\nfunction ToBudget({ month, prevMonthName, collapsed, onBudgetAction }) {\n return (\n <SheetValue binding={rolloverBudget.toBudget} initialValue={0}>\n {node => {\n const availableValue = parseInt(node.value);\n const num = isNaN(availableValue) ? 0 : availableValue;\n const isNegative = num < 0;\n\n return (\n <View style={{ alignItems: 'center' }}>\n <Block>{isNegative ? 'Overbudgeted:' : 'To Budget:'}</Block>\n <Component initialState={{ menuOpen: null }}>\n {({ state, setState }) => (\n <View>\n <HoverTarget\n disabled={!collapsed || state.menuOpen}\n renderContent={() => (\n <Tooltip position=\"bottom-center\">\n <TotalsList\n collapsed={true}\n prevMonthName={prevMonthName}\n />\n </Tooltip>\n )}\n >\n <Block\n onClick={() => setState({ menuOpen: 'actions' })}\n data-cellname={node.name}\n {...css([\n styles.veryLargeText,\n {\n fontWeight: 400,\n userSelect: 'none',\n cursor: 'pointer',\n color: isNegative ? colors.r4 : colors.p5,\n marginBottom: -1,\n borderBottom: '1px solid transparent',\n ':hover': {\n borderColor: isNegative ? colors.r4 : colors.p5\n }\n }\n ])}\n >\n {format(num, 'financial')}\n </Block>\n </HoverTarget>\n {state.menuOpen === 'actions' && (\n <Tooltip\n position=\"bottom-center\"\n width={200}\n style={{ padding: 0 }}\n onClose={() => setState({ menuOpen: null })}\n >\n <Menu\n onMenuSelect={type => {\n if (type === 'reset-buffer') {\n onBudgetAction(month, 'reset-hold');\n setState({ menuOpen: null });\n } else {\n setState({ menuOpen: type });\n }\n }}\n items={[\n {\n name: 'transfer',\n text: 'Move to a category'\n },\n {\n name: 'buffer',\n text: 'Hold for next month'\n },\n {\n name: 'buffer-future',\n text: 'Hold for all future months'\n },\n {\n name: 'reset-buffer',\n text: \"Reset next month's buffer\"\n }\n ]}\n />\n </Tooltip>\n )}\n {state.menuOpen === 'buffer' && (\n <HoldTooltip\n onClose={() => setState({ menuOpen: null })}\n onSubmit={amount => {\n onBudgetAction(month, 'hold', { amount });\n }}\n />\n )}\n {state.menuOpen === 'buffer-future' && (\n <HoldTooltip\n onClose={() => setState({ menuOpen: null })}\n onSubmit={amount => {\n onBudgetAction(month, 'hold-all-future', { amount });\n }}\n />\n )}\n {state.menuOpen === 'transfer' && (\n <TransferTooltip\n initialAmountName=\"leftover\"\n onClose={() => setState({ menuOpen: null })}\n onSubmit={(amount, category) => {\n onBudgetAction(month, 'transfer-available', {\n amount,\n category\n });\n }}\n />\n )}\n </View>\n )}\n </Component>\n </View>\n );\n }}\n </SheetValue>\n );\n}\n\nexport default React.memo(function BudgetSummary({ month }) {\n let {\n currentMonth,\n summaryCollapsed: collapsed,\n onBudgetAction,\n onToggleSummaryCollapse\n } = useRollover();\n\n let [menuOpen, setMenuOpen] = useState(false);\n function onMenuOpen(e) {\n setMenuOpen(true);\n }\n\n function onMenuClose(bag) {\n setMenuOpen(false);\n }\n\n let prevMonthName = monthUtils.format(monthUtils.prevMonth(month), 'MMM');\n\n let ExpandOrCollapseIcon = collapsed ? ArrowButtonDown1 : ArrowButtonUp1;\n\n return (\n <View\n style={{\n backgroundColor: 'white',\n boxShadow: MONTH_BOX_SHADOW,\n borderRadius: 6,\n marginLeft: 0,\n marginRight: 0,\n marginTop: 5,\n flex: 1,\n cursor: 'default',\n marginBottom: 5,\n overflow: 'hidden',\n '& .hover-visible': {\n opacity: 0,\n transition: 'opacity .25s'\n },\n '&:hover .hover-visible': {\n opacity: 1\n }\n }}\n >\n <NamespaceContext.Provider value={monthUtils.sheetForMonth(month)}>\n <View\n style={[\n { padding: '0 13px' },\n collapsed ? { margin: '10px 0' } : { marginTop: 16 }\n ]}\n >\n <View\n style={{\n position: 'absolute',\n left: 10,\n top: 0\n }}\n >\n <Button\n className=\"hover-visible\"\n bare\n onClick={onToggleSummaryCollapse}\n >\n <ExpandOrCollapseIcon\n width={13}\n height={13}\n // The margin is to make it the exact same size as the dots button\n style={{ color: colors.n6, margin: 1 }}\n />\n </Button>\n </View>\n\n <div\n {...css([\n {\n textAlign: 'center',\n marginTop: 3,\n fontSize: 18,\n fontWeight: 500,\n textDecorationSkip: 'ink'\n },\n currentMonth === month && { textDecoration: 'underline' }\n ])}\n >\n {monthUtils.format(month, 'MMMM')}\n </div>\n\n <View\n style={{\n position: 'absolute',\n right: 10,\n top: 0,\n flexDirection: 'row',\n alignItems: 'center'\n }}\n >\n <View>\n <NotesButton\n id={`budget-${month}`}\n width={15}\n height={15}\n tooltipPosition=\"bottom-right\"\n defaultColor={colors.n6}\n />\n </View>\n <View style={{ userSelect: 'none', marginLeft: 2 }}>\n <Button bare onClick={onMenuOpen}>\n <DotsHorizontalTriple\n width={15}\n height={15}\n style={{ color: colors.n5 }}\n />\n </Button>\n {menuOpen && (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 0 }}\n onClose={onMenuClose}\n >\n <Menu\n onMenuSelect={type => {\n onMenuClose();\n onBudgetAction(month, type);\n }}\n items={[\n { name: 'copy-last', text: \"Copy last month's budget\" },\n { name: 'set-zero', text: 'Set budgets to zero' },\n {\n name: 'set-3-avg',\n text: 'Set budgets to 3 month avg'\n }\n ]}\n />\n </Tooltip>\n )}\n </View>\n </View>\n </View>\n\n {collapsed ? (\n <View\n style={{\n alignItems: 'center',\n padding: '10px 20px',\n justifyContent: 'space-between',\n backgroundColor: colors.n11,\n borderTop: '1px solid ' + colors.n10\n }}\n >\n <ToBudget\n collapsed={collapsed}\n prevMonthName={prevMonthName}\n month={month}\n onBudgetAction={onBudgetAction}\n />\n </View>\n ) : (\n <>\n <TotalsList prevMonthName={prevMonthName} />\n <View style={{ margin: '23px 0' }}>\n <ToBudget month={month} onBudgetAction={onBudgetAction} />\n </View>\n </>\n )}\n </NamespaceContext.Provider>\n </View>\n );\n});\n","import React, { useContext, useState } from 'react';\nimport { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';\nimport evalArithmetic from 'loot-core/src/shared/arithmetic';\nimport { rolloverBudget } from 'loot-core/src/client/queries';\nimport { styles, colors } from '../../../style';\nimport {\n View,\n Text,\n useTooltip,\n InitialFocus,\n Tooltip,\n Button,\n Menu\n} from '../../common';\nimport { Row, Field, SheetCell } from '../../table';\nimport {\n makeAmountGrey,\n addToBeBudgetedGroup,\n CategoryGroupsContext\n} from '../util';\nimport { MONTH_RIGHT_PADDING } from '../constants';\nimport useSheetValue from '../../spreadsheet/useSheetValue';\nimport format from '../../spreadsheet/format';\nimport CellValue from '../../spreadsheet/CellValue';\nimport CategoryAutocomplete from '../../CategorySelect';\nimport TransferTooltip from './TransferTooltip';\nimport BalanceWithCarryover from '../BalanceWithCarryover';\n\nexport BudgetSummary from './BudgetSummary';\n\nfunction CoverTooltip({\n showToBeBudgeted,\n inline,\n tooltipProps,\n onSubmit,\n onClose\n}) {\n let categoryGroups = useContext(CategoryGroupsContext);\n categoryGroups = addToBeBudgetedGroup(\n categoryGroups.filter(g => !g.is_income)\n );\n let [category, setCategory] = useState(null);\n\n function submit() {\n if (category) {\n onSubmit(category);\n onClose();\n }\n }\n\n return (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 10 }}\n {...tooltipProps}\n onClose={onClose}\n >\n <View style={{ marginBottom: 5 }}>Cover from category:</View>\n\n <InitialFocus>\n {node => (\n <CategoryAutocomplete\n categoryGroups={categoryGroups}\n value={null}\n openOnFocus={false}\n onUpdate={id => {}}\n onSelect={id => setCategory(id)}\n inputProps={{\n inputRef: node,\n onKeyDown: e => {\n if (e.keyCode === 13) {\n submit();\n }\n }\n }}\n />\n )}\n </InitialFocus>\n\n <View\n style={{\n alignItems: 'flex-end',\n marginTop: 10\n }}\n >\n <Button\n primary\n style={{\n fontSize: 12,\n paddingTop: 3\n }}\n onClick={submit}\n >\n Transfer\n </Button>\n </View>\n </Tooltip>\n );\n}\n\nfunction BalanceTooltip({ categoryId, tooltip, monthIndex, onBudgetAction }) {\n let carryover = useSheetValue(rolloverBudget.catCarryover(categoryId));\n let balance = useSheetValue(rolloverBudget.catBalance(categoryId));\n let [menu, setMenu] = useState('menu');\n\n return (\n <>\n {menu === 'menu' && (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 0 }}\n onClose={tooltip.close}\n >\n <Menu\n onMenuSelect={type => {\n if (type === 'carryover') {\n onBudgetAction(monthIndex, 'carryover', {\n category: categoryId,\n flag: !carryover\n });\n tooltip.close();\n } else {\n setMenu(type);\n }\n }}\n items={[\n {\n name: 'transfer',\n text: 'Transfer to another category'\n },\n {\n name: 'carryover',\n text: carryover\n ? 'Remove overspending rollover'\n : 'Rollover overspending'\n },\n balance < 0 && {\n name: 'cover',\n text: 'Cover overspending'\n }\n ].filter(x => x)}\n />\n </Tooltip>\n )}\n\n {menu === 'transfer' && (\n <TransferTooltip\n initialAmountName={rolloverBudget.catBalance(categoryId)}\n showToBeBudgeted={true}\n onClose={tooltip.close}\n onSubmit={(amount, toCategory) => {\n onBudgetAction(monthIndex, 'transfer-category', {\n amount,\n from: categoryId,\n to: toCategory\n });\n }}\n />\n )}\n\n {menu === 'cover' && (\n <CoverTooltip\n showToBeBudgeted={true}\n onClose={tooltip.close}\n onSubmit={fromCategory => {\n onBudgetAction(monthIndex, 'cover', {\n to: categoryId,\n from: fromCategory\n });\n }}\n />\n )}\n </>\n );\n}\n\nlet headerLabelStyle = { flex: 1, padding: '0 5px', textAlign: 'right' };\n\nexport const BudgetTotalsMonth = React.memo(function BudgetTotalsMonth() {\n return (\n <View\n style={{\n flex: 1,\n flexDirection: 'row',\n marginRight: MONTH_RIGHT_PADDING,\n paddingTop: 10,\n paddingBottom: 10\n }}\n >\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Budgeted</Text>\n <CellValue\n binding={rolloverBudget.totalBudgeted}\n type=\"financial\"\n style={{ color: colors.n4, fontWeight: 600 }}\n formatter={value => {\n return format(-parseFloat(value || '0'), 'financial');\n }}\n />\n </View>\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Spent</Text>\n <CellValue\n binding={rolloverBudget.totalSpent}\n type=\"financial\"\n style={{ color: colors.n4, fontWeight: 600 }}\n />\n </View>\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Balance</Text>\n <CellValue\n binding={rolloverBudget.totalBalance}\n type=\"financial\"\n style={{ color: colors.n4, fontWeight: 600 }}\n />\n </View>\n </View>\n );\n});\n\nexport function IncomeHeaderMonth() {\n return (\n <Row\n style={{\n color: colors.n4,\n alignItems: 'center',\n paddingRight: 10\n }}\n >\n <View style={{ flex: 1, textAlign: 'right' }}>Received</View>\n </Row>\n );\n}\n\nexport const ExpenseGroupMonth = React.memo(function ExpenseGroupMonth({\n group\n}) {\n let borderColor = colors.border;\n let { id } = group;\n\n return (\n <View style={{ flex: 1, flexDirection: 'row' }}>\n <SheetCell\n name=\"budgeted\"\n width=\"flex\"\n borderColor={borderColor}\n textAlign=\"right\"\n style={[{ fontWeight: 600 }, styles.tnum]}\n valueProps={{\n binding: rolloverBudget.groupBudgeted(id),\n type: 'financial'\n }}\n />\n <SheetCell\n name=\"spent\"\n width=\"flex\"\n textAlign=\"right\"\n borderColor={borderColor}\n style={[{ fontWeight: 600 }, styles.tnum]}\n valueProps={{\n binding: rolloverBudget.groupSumAmount(id),\n type: 'financial'\n }}\n />\n <SheetCell\n name=\"balance\"\n width=\"flex\"\n borderColor={borderColor}\n textAlign=\"right\"\n style={[\n { fontWeight: 600, paddingRight: MONTH_RIGHT_PADDING },\n styles.tnum\n ]}\n valueProps={{\n binding: rolloverBudget.groupBalance(id),\n type: 'financial'\n }}\n />\n </View>\n );\n});\n\nexport const ExpenseCategoryMonth = React.memo(function ExpenseCategoryMonth({\n monthIndex,\n category,\n editing,\n onEdit,\n onBudgetAction,\n onShowActivity\n}) {\n let borderColor = colors.border;\n let balanceTooltip = useTooltip();\n\n return (\n <View style={{ flex: 1, flexDirection: 'row' }}>\n <SheetCell\n name=\"budget\"\n sync={true}\n exposed={editing}\n width=\"flex\"\n borderColor={borderColor}\n onExpose={() => onEdit(category.id, monthIndex)}\n style={[editing && { zIndex: 100 }, styles.tnum]}\n textAlign=\"right\"\n valueStyle={[\n {\n cursor: 'default',\n margin: 1,\n padding: '0 4px',\n borderRadius: 4\n },\n {\n ':hover': {\n boxShadow: 'inset 0 0 0 1px ' + colors.n7,\n backgroundColor: 'white'\n }\n }\n ]}\n valueProps={{\n binding: rolloverBudget.catBudgeted(category.id),\n type: 'financial',\n getValueStyle: makeAmountGrey,\n formatExpr: expr => {\n return integerToCurrency(expr);\n },\n unformatExpr: expr => {\n return amountToInteger(evalArithmetic(expr, 0));\n }\n }}\n inputProps={{\n onBlur: () => {\n onEdit(null);\n }\n }}\n onSave={amount => {\n onBudgetAction(monthIndex, 'budget-amount', {\n category: category.id,\n amount\n });\n }}\n />\n\n <Field\n name=\"spent\"\n width=\"flex\"\n borderColor={borderColor}\n style={{ textAlign: 'right' }}\n >\n <span\n onClick={() => onShowActivity(category.name, category.id, monthIndex)}\n >\n <CellValue\n binding={rolloverBudget.catSumAmount(category.id)}\n type=\"financial\"\n getStyle={makeAmountGrey}\n style={{\n cursor: 'pointer',\n ':hover': { textDecoration: 'underline' }\n }}\n />\n </span>\n </Field>\n\n <Field\n name=\"balance\"\n width=\"flex\"\n borderColor={borderColor}\n style={{ paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' }}\n >\n <span {...balanceTooltip.getOpenEvents()}>\n <BalanceWithCarryover\n category={category}\n carryover={rolloverBudget.catCarryover(category.id)}\n balance={rolloverBudget.catBalance(category.id)}\n />\n </span>\n {balanceTooltip.isOpen && (\n <BalanceTooltip\n categoryId={category.id}\n tooltip={balanceTooltip}\n monthIndex={monthIndex}\n onBudgetAction={onBudgetAction}\n />\n )}\n </Field>\n </View>\n );\n});\n\nexport function IncomeGroupMonth({ group }) {\n // let { id } = group;\n\n return (\n <View style={{ flex: 1 }}>\n <SheetCell\n name=\"received\"\n width=\"flex\"\n borderColor={colors.border}\n textAlign=\"right\"\n style={[\n { fontWeight: 600, paddingRight: MONTH_RIGHT_PADDING },\n styles.tnum\n ]}\n valueProps={{\n binding: rolloverBudget.groupIncomeReceived,\n type: 'financial'\n }}\n />\n </View>\n );\n}\n\nexport function IncomeCategoryMonth({\n category,\n isLast,\n monthIndex,\n onShowActivity\n}) {\n return (\n <View style={{ flex: 1 }}>\n <Field\n name=\"received\"\n width=\"flex\"\n borderColor={colors.border}\n textAlign=\"right\"\n style={[\n { paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' },\n isLast && { borderBottomWidth: 0 }\n ]}\n >\n <span\n onClick={() => onShowActivity(category.name, category.id, monthIndex)}\n >\n <CellValue\n binding={rolloverBudget.catSumAmount(category.id)}\n type=\"financial\"\n style={{\n cursor: 'pointer',\n ':hover': { textDecoration: 'underline' }\n }}\n />\n </span>\n </Field>\n </View>\n );\n}\n","import React, { useContext } from 'react';\nimport * as monthUtils from 'loot-core/src/shared/months';\n\nlet Context = React.createContext(null);\n\nexport function ReportProvider({\n summaryCollapsed,\n onBudgetAction,\n onToggleSummaryCollapse,\n children\n}) {\n let currentMonth = monthUtils.currentMonth();\n\n return (\n <Context.Provider\n value={{\n currentMonth,\n summaryCollapsed,\n onBudgetAction,\n onToggleSummaryCollapse\n }}\n children={children}\n />\n );\n}\n\nexport function useReport() {\n return useContext(Context);\n}\n","import React, { useState } from 'react';\nimport { css } from 'glamor';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { reportBudget } from 'loot-core/src/client/queries';\nimport NamespaceContext from '../../spreadsheet/NamespaceContext';\nimport CellValue from '../../spreadsheet/CellValue';\nimport useSheetValue from '../../spreadsheet/useSheetValue';\nimport format from '../../spreadsheet/format';\nimport {\n View,\n Text,\n Button,\n Tooltip,\n Menu,\n Stack,\n HoverTarget,\n AlignedText\n} from '../../common';\nimport { MONTH_BOX_SHADOW } from '../constants';\nimport { makeAmountFullStyle } from '../util';\nimport ArrowButtonDown1 from '../../../svg/v2/ArrowButtonDown1';\nimport ArrowButtonUp1 from '../../../svg/v2/ArrowButtonUp1';\nimport DotsHorizontalTriple from '../../../svg/v1/DotsHorizontalTriple';\nimport { useReport } from './ReportContext';\nimport NotesButton from '../../NotesButton';\nimport { colors, styles } from '../../../style';\n\nfunction PieProgress({ style, progress, color, backgroundColor }) {\n let radius = 4;\n let circum = 2 * Math.PI * radius;\n let dash = progress * circum;\n let gap = circum;\n\n return (\n <svg viewBox=\"0 0 20 20\" style={style}>\n <circle r=\"10\" cx=\"10\" cy=\"10\" fill={backgroundColor} />\n <circle\n r={radius}\n cx=\"10\"\n cy=\"10\"\n fill=\"none\"\n stroke={color}\n strokeWidth={radius * 2}\n strokeDasharray={`${dash} ${gap}`}\n transform=\"rotate(-90) translate(-20)\"\n />{' '}\n </svg>\n );\n}\n\nfunction fraction(num, denom) {\n if (denom === 0) {\n if (num > 0) {\n return 1;\n }\n return 0;\n }\n\n return num / denom;\n}\n\nfunction IncomeProgress({ current, target }) {\n let totalIncome = useSheetValue(current) || 0;\n let totalBudgeted = useSheetValue(target) || 0;\n\n let over = false;\n\n if (totalIncome < 0) {\n over = true;\n totalIncome = -totalIncome;\n }\n\n let frac = fraction(totalIncome, totalBudgeted);\n\n return (\n <PieProgress\n progress={frac}\n color={over ? colors.r7 : colors.g5}\n backgroundColor={over ? colors.r10 : colors.n10}\n style={{ width: 20, height: 20 }}\n />\n );\n}\n\nfunction ExpenseProgress({ current, target }) {\n let totalSpent = useSheetValue(current) || 0;\n let totalBudgeted = useSheetValue(target) || 0;\n\n // Reverse total spent, and also set a bottom boundary of 0 (in case\n // income goes into an expense category and it's \"positive\", don't\n // show that in the graph)\n totalSpent = Math.max(-totalSpent, 0);\n\n let frac;\n let over = false;\n\n if (totalSpent > totalBudgeted) {\n frac = (totalSpent - totalBudgeted) / totalBudgeted;\n over = true;\n } else {\n frac = fraction(totalSpent, totalBudgeted);\n }\n\n return (\n <PieProgress\n progress={frac}\n color={over ? colors.r7 : colors.g5}\n backgroundColor={over ? colors.r10 : colors.n10}\n style={{ width: 20, height: 20 }}\n />\n );\n}\n\nfunction BudgetTotal({ title, current, target, ProgressComponent, style }) {\n return (\n <View\n style={[\n {\n lineHeight: 1.5,\n flexDirection: 'row',\n alignItems: 'center',\n fontSize: 14\n },\n style\n ]}\n >\n <ProgressComponent current={current} target={target} />\n\n <View style={{ marginLeft: 10 }}>\n <View>\n <Text style={{ color: colors.n4 }}>{title}</Text>\n </View>\n\n <Text>\n <CellValue binding={current} type=\"financial\" />\n <Text style={{ color: colors.n6, fontStyle: 'italic' }}>\n {' of '}\n <CellValue\n binding={target}\n type=\"financial\"\n style={styles.notFixed}\n />\n </Text>\n </Text>\n </View>\n </View>\n );\n}\n\nfunction IncomeTotal({ projected, style }) {\n return (\n <BudgetTotal\n title=\"Income\"\n current={reportBudget.totalIncome}\n target={reportBudget.totalBudgetedIncome}\n ProgressComponent={IncomeProgress}\n style={style}\n />\n );\n}\n\nfunction ExpenseTotal({ style }) {\n return (\n <BudgetTotal\n title=\"Expenses\"\n current={reportBudget.totalSpent}\n target={reportBudget.totalBudgetedExpense}\n ProgressComponent={ExpenseProgress}\n style={style}\n />\n );\n}\n\nfunction Saved({ projected, style }) {\n let budgetedSaved = useSheetValue(reportBudget.totalBudgetedSaved) || 0;\n let totalSaved = useSheetValue(reportBudget.totalSaved) || 0;\n let saved = projected ? budgetedSaved : totalSaved;\n let isNegative = saved < 0;\n\n return (\n <View style={[{ alignItems: 'center', fontSize: 14 }, style]}>\n {projected ? (\n <Text style={{ color: colors.n4 }}>Projected Savings:</Text>\n ) : (\n <View style={{ color: colors.n4 }}>\n {isNegative ? 'Overspent:' : 'Saved:'}\n </View>\n )}\n\n <HoverTarget\n renderContent={() => {\n if (!projected) {\n let diff = totalSaved - budgetedSaved;\n return (\n <Tooltip\n position=\"bottom-center\"\n style={{ padding: 10, fontSize: 14 }}\n >\n <AlignedText\n left=\"Projected Savings:\"\n right={\n <Text\n style={[makeAmountFullStyle(budgetedSaved), styles.tnum]}\n >\n {format(budgetedSaved, 'financial-with-sign')}\n </Text>\n }\n />\n <AlignedText\n left=\"Difference:\"\n right={\n <Text style={[makeAmountFullStyle(diff), styles.tnum]}>\n {format(diff, 'financial-with-sign')}\n </Text>\n }\n />\n </Tooltip>\n );\n }\n return null;\n }}\n >\n <View\n {...css([\n {\n fontSize: 25,\n color: projected ? colors.y3 : isNegative ? colors.r4 : colors.p5\n }\n ])}\n >\n {format(saved, 'financial')}\n </View>\n </HoverTarget>\n </View>\n );\n}\n\nexport default React.memo(function BudgetSummary({ month }) {\n let {\n currentMonth,\n summaryCollapsed: collapsed,\n onBudgetAction,\n onToggleSummaryCollapse\n } = useReport();\n\n let [menuOpen, setMenuOpen] = useState(false);\n function onMenuOpen(e) {\n setMenuOpen(true);\n }\n\n function onMenuClose(bag) {\n setMenuOpen(false);\n }\n\n let ExpandOrCollapseIcon = collapsed ? ArrowButtonDown1 : ArrowButtonUp1;\n\n return (\n <View\n style={{\n backgroundColor: 'white',\n boxShadow: MONTH_BOX_SHADOW,\n borderRadius: 6,\n marginLeft: 0,\n marginRight: 0,\n marginTop: 5,\n flex: 1,\n cursor: 'default',\n marginBottom: 5,\n overflow: 'hidden',\n '& .hover-visible': {\n opacity: 0,\n transition: 'opacity .25s'\n },\n '&:hover .hover-visible': {\n opacity: 1\n }\n }}\n >\n <NamespaceContext.Provider\n value={monthUtils.sheetForMonth(month, 'report')}\n >\n <View\n style={[\n { padding: '0 13px' },\n collapsed ? { margin: '10px 0' } : { marginTop: 16 }\n ]}\n >\n <View\n style={{\n position: 'absolute',\n left: 10,\n top: 0\n }}\n >\n <Button\n className=\"hover-visible\"\n bare\n onClick={onToggleSummaryCollapse}\n >\n <ExpandOrCollapseIcon\n width={13}\n height={13}\n // The margin is to make it the exact same size as the dots button\n style={{ color: colors.n6, margin: 1 }}\n />\n </Button>\n </View>\n\n <div\n {...css([\n {\n textAlign: 'center',\n marginTop: 3,\n fontSize: 18,\n fontWeight: 500,\n textDecorationSkip: 'ink'\n },\n currentMonth === month && { textDecoration: 'underline' }\n ])}\n >\n {monthUtils.format(month, 'MMMM')}\n </div>\n\n <View\n style={{\n position: 'absolute',\n right: 10,\n top: 0,\n flexDirection: 'row',\n alignItems: 'center'\n }}\n >\n <View>\n <NotesButton\n id={`budget-${month}`}\n width={15}\n height={15}\n tooltipPosition=\"bottom-right\"\n defaultColor={colors.n6}\n />\n </View>\n <View style={{ userSelect: 'none' }}>\n <Button bare onClick={onMenuOpen}>\n <DotsHorizontalTriple\n width={15}\n height={15}\n style={{ color: colors.n5 }}\n />\n </Button>\n {menuOpen && (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 0 }}\n onClose={onMenuClose}\n >\n <Menu\n onMenuSelect={type => {\n onMenuClose();\n onBudgetAction(month, type);\n }}\n items={[\n { name: 'copy-last', text: \"Copy last month's budget\" },\n { name: 'set-zero', text: 'Set budgets to zero' },\n {\n name: 'set-3-avg',\n text: 'Set budgets to 3 month avg'\n },\n {\n name: 'set-all-future',\n text: 'Apply to all future budgets'\n }\n ]}\n />\n </Tooltip>\n )}\n </View>\n </View>\n </View>\n\n {!collapsed && (\n <Stack\n spacing={2}\n style={{\n alignSelf: 'center',\n backgroundColor: colors.n11,\n borderRadius: 4,\n padding: '10px 15px',\n marginTop: 13\n }}\n >\n <IncomeTotal />\n <ExpenseTotal />\n </Stack>\n )}\n\n {collapsed ? (\n <View\n style={{\n alignItems: 'center',\n padding: '10px 20px',\n justifyContent: 'space-between',\n backgroundColor: colors.n11,\n borderTop: '1px solid ' + colors.n10\n }}\n >\n <Saved projected={month >= currentMonth} />\n </View>\n ) : (\n <Saved\n projected={month >= currentMonth}\n style={{ marginTop: 13, marginBottom: 20 }}\n />\n )}\n </NamespaceContext.Provider>\n </View>\n );\n});\n","import React from 'react';\nimport { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';\nimport evalArithmetic from 'loot-core/src/shared/arithmetic';\nimport { reportBudget } from 'loot-core/src/client/queries';\nimport { styles, colors } from '../../../style';\nimport { View, Text, Tooltip, Menu, useTooltip } from '../../common';\nimport { Field, SheetCell } from '../../table';\nimport useSheetValue from '../../spreadsheet/useSheetValue';\nimport { makeAmountGrey } from '../util';\nimport { MONTH_RIGHT_PADDING } from '../constants';\nimport format from '../../spreadsheet/format';\nimport CellValue from '../../spreadsheet/CellValue';\nimport BalanceWithCarryover from '../BalanceWithCarryover';\n\nexport BudgetSummary from './BudgetSummary';\n\nlet headerLabelStyle = { flex: 1, padding: '0 5px', textAlign: 'right' };\n\nexport const BudgetTotalsMonth = React.memo(function BudgetTotalsMonth() {\n return (\n <View\n style={{\n flex: 1,\n flexDirection: 'row',\n marginRight: MONTH_RIGHT_PADDING,\n paddingTop: 10,\n paddingBottom: 10\n }}\n >\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Budgeted</Text>\n <CellValue\n binding={reportBudget.totalBudgetedExpense}\n type=\"financial\"\n style={{ color: colors.n4, fontWeight: 600 }}\n formatter={(value) => {\n return format(parseFloat(value || '0'), 'financial');\n }}\n />\n </View>\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Spent</Text>\n <CellValue\n binding={reportBudget.totalSpent}\n type=\"financial\"\n style={{ color: colors.n4, fontWeight: 600 }}\n />\n </View>\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Balance</Text>\n <CellValue\n binding={reportBudget.totalLeftover}\n type=\"financial\"\n style={{ color: colors.n4, fontWeight: 600 }}\n />\n </View>\n </View>\n );\n});\n\nexport function IncomeHeaderMonth() {\n return (\n <View\n style={{\n flexDirection: 'row',\n marginRight: MONTH_RIGHT_PADDING,\n paddingBottom: 5\n }}\n >\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Budgeted</Text>\n </View>\n <View style={headerLabelStyle}>\n <Text style={{ color: colors.n4 }}>Received</Text>\n </View>\n </View>\n );\n}\n\nexport const GroupMonth = React.memo(function ExpenseGroupMonth({ group }) {\n let borderColor = colors.border;\n let { id } = group;\n\n return (\n <View style={{ flex: 1, flexDirection: 'row' }}>\n <SheetCell\n name=\"budgeted\"\n width=\"flex\"\n borderColor={borderColor}\n textAlign=\"right\"\n style={[{ fontWeight: 600 }, styles.tnum]}\n valueProps={{\n binding: reportBudget.groupBudgeted(id),\n type: 'financial'\n }}\n />\n <SheetCell\n name=\"spent\"\n width=\"flex\"\n textAlign=\"right\"\n borderColor={borderColor}\n style={[{ fontWeight: 600 }, styles.tnum]}\n valueProps={{\n binding: reportBudget.groupSumAmount(id),\n type: 'financial'\n }}\n />\n {!group.is_income && (\n <SheetCell\n name=\"balance\"\n width=\"flex\"\n borderColor={borderColor}\n textAlign=\"right\"\n style={[\n { fontWeight: 600, paddingRight: MONTH_RIGHT_PADDING },\n styles.tnum\n ]}\n valueProps={{\n binding: reportBudget.groupBalance(id),\n type: 'financial'\n }}\n />\n )}\n </View>\n );\n});\n\nfunction BalanceTooltip({ categoryId, tooltip, monthIndex, onBudgetAction }) {\n let carryover = useSheetValue(reportBudget.catCarryover(categoryId));\n\n return (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 0 }}\n onClose={tooltip.close}\n >\n <Menu\n onMenuSelect={(type) => {\n onBudgetAction(monthIndex, 'carryover', {\n category: categoryId,\n flag: !carryover\n });\n tooltip.close();\n }}\n items={[\n {\n name: 'carryover',\n text: carryover\n ? 'Remove overspending rollover'\n : 'Rollover overspending'\n }\n ]}\n />\n </Tooltip>\n );\n}\n\nexport const CategoryMonth = React.memo(function CategoryMonth({\n monthIndex,\n category,\n budgeted,\n currentSum,\n balance,\n editing,\n onEdit,\n onBudgetAction,\n onShowActivity\n}) {\n let borderColor = colors.border;\n let balanceTooltip = useTooltip();\n\n return (\n <View style={{ flex: 1, flexDirection: 'row' }}>\n <SheetCell\n name=\"budget\"\n sync={true}\n exposed={editing}\n width=\"flex\"\n borderColor={borderColor}\n onExpose={() => onEdit(category.id, monthIndex)}\n style={[editing && { zIndex: 100 }, styles.tnum]}\n textAlign=\"right\"\n valueStyle={[\n {\n cursor: 'default',\n margin: 1,\n padding: '0 4px',\n borderRadius: 4\n },\n {\n ':hover': {\n boxShadow: 'inset 0 0 0 1px ' + colors.n7,\n backgroundColor: 'white'\n }\n }\n ]}\n valueProps={{\n binding: reportBudget.catBudgeted(category.id),\n type: 'financial',\n getValueStyle: makeAmountGrey,\n formatExpr: (expr) => {\n return integerToCurrency(expr);\n },\n unformatExpr: (expr) => {\n return amountToInteger(evalArithmetic(expr, 0));\n }\n }}\n inputProps={{\n onBlur: () => {\n onEdit(null);\n }\n }}\n onSave={(amount) => {\n onBudgetAction(monthIndex, 'budget-amount', {\n category: category.id,\n amount\n });\n }}\n />\n\n <Field\n name=\"spent\"\n width=\"flex\"\n borderColor={borderColor}\n style={{ textAlign: 'right' }}\n >\n <span\n onClick={() => onShowActivity(category.name, category.id, monthIndex)}\n >\n <CellValue\n binding={reportBudget.catSumAmount(category.id)}\n type=\"financial\"\n getStyle={makeAmountGrey}\n style={{\n cursor: 'pointer',\n ':hover': {\n textDecoration: 'underline'\n }\n }}\n />\n </span>\n </Field>\n\n {!category.is_income && (\n <Field\n name=\"balance\"\n width=\"flex\"\n borderColor={borderColor}\n style={{ paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' }}\n >\n <span {...(category.is_income ? {} : balanceTooltip.getOpenEvents())}>\n <BalanceWithCarryover\n category={category}\n disabled={category.is_income}\n carryover={reportBudget.catCarryover(category.id)}\n balance={reportBudget.catBalance(category.id)}\n />\n </span>\n {balanceTooltip.isOpen && (\n <BalanceTooltip\n categoryId={category.id}\n tooltip={balanceTooltip}\n monthIndex={monthIndex}\n onBudgetAction={onBudgetAction}\n />\n )}\n </Field>\n )}\n </View>\n );\n});\n\nexport const ExpenseGroupMonth = GroupMonth;\nexport const ExpenseCategoryMonth = CategoryMonth;\n\nexport const IncomeGroupMonth = GroupMonth;\nexport const IncomeCategoryMonth = CategoryMonth;\n","import lively from '@jlongster/lively';\n\nfunction findMatch(element, sizes) {\n const rect = element.getBoundingClientRect();\n const matched = sizes.find(size => {\n return (\n (size.width != null && rect.width < size.width) ||\n (size.height != null && rect.height < size.height)\n );\n });\n\n return matched || sizes[sizes.length - 1];\n}\n\n// Component\n\nfunction ElementQuery({ props: { children }, state: { matched }, inst }) {\n return children(matched, el => (inst.element = el));\n}\n\nexport default lively(ElementQuery, {\n getInitialState() {\n return { matched: null };\n },\n componentDidMount({ inst, props, setState }) {\n inst.observer = new ResizeObserver(entries => {\n entries.forEach(entry => {\n setState({ matched: findMatch(inst.element, props.sizes) });\n });\n });\n\n inst.observer.observe(inst.element);\n },\n componentWillUnmount({ inst }) {\n inst.observer.disconnect();\n }\n});\n","import React from 'react';\n\nconst SvgArrowThinLeft = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgArrowThinLeft;\n","import React, {\n useContext,\n useState,\n useRef,\n useCallback,\n useLayoutEffect\n} from 'react';\nimport { Spring } from 'wobble';\nimport { css } from 'glamor';\nimport { MonthsContext } from './MonthsContext';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { View } from '../common';\nimport useResizeObserver from '../useResizeObserver';\n\nexport default function BudgetSummaries({ SummaryComponent }) {\n let { months } = useContext(MonthsContext);\n\n let [widthState, setWidthState] = useState(0);\n let spring = useRef(null);\n\n let containerRef = useResizeObserver(\n useCallback(rect => {\n setWidthState(rect.width);\n }, [])\n );\n let scrollerRef = useRef();\n\n let prevMonth0 = useRef(months[0]);\n\n let allMonths = [...months];\n allMonths.unshift(monthUtils.subMonths(months[0], 1));\n allMonths.push(monthUtils.addMonths(months[months.length - 1], 1));\n let monthWidth = widthState / months.length;\n\n useLayoutEffect(() => {\n if (!scrollerRef.current) {\n return;\n }\n\n if (!spring.current) {\n spring.current = new Spring({\n stiffness: 600,\n damping: 80,\n mass: 3,\n fromValue: -monthWidth\n });\n\n spring.current.onUpdate(s => {\n if (scrollerRef.current) {\n scrollerRef.current.style.transform =\n 'translateX(' + s.currentValue + 'px)';\n }\n });\n }\n\n let prevMonth = prevMonth0.current;\n let reversed = prevMonth > months[0];\n let offsetX = monthWidth;\n\n let from = reversed ? -offsetX * 2 : 0;\n if (prevMonth !== allMonths[0] && prevMonth !== allMonths[2]) {\n from = -offsetX;\n }\n\n let to = -offsetX;\n spring.current.updateConfig({ fromValue: from, toValue: to }).start();\n }, [months[0]]);\n\n useLayoutEffect(() => {\n prevMonth0.current = months[0];\n }, [months[0]]);\n\n useLayoutEffect(() => {\n scrollerRef.current.style.transform = `translateX(${-monthWidth}px)`;\n }, [monthWidth]);\n\n return (\n <div\n {...css([\n { flex: 1, overflow: 'hidden' },\n months.length === 1 && {\n marginLeft: -4,\n marginRight: -4\n }\n ])}\n ref={containerRef}\n >\n <View\n style={{\n flexDirection: 'row',\n width: widthState,\n willChange: 'transform'\n }}\n innerRef={scrollerRef}\n >\n {allMonths.map((month, idx) => {\n return (\n <View\n key={month}\n style={[\n { flex: `0 0 ${monthWidth}px` },\n { paddingLeft: 4, paddingRight: 4 }\n ]}\n >\n <SummaryComponent month={month} />\n </View>\n );\n })}\n </View>\n </div>\n );\n}\n","import React, { useContext, useState, useMemo, useEffect } from 'react';\nimport ElementQuery from '../ElementQuery';\nimport {\n View,\n Text,\n Button,\n Tooltip,\n Menu,\n IntersectionBoundary\n} from '../common';\nimport { Row, InputCell, ROW_HEIGHT } from '../table';\nimport {\n useDraggable,\n useDroppable,\n DropHighlight,\n DropHighlightPosContext\n} from '../sort.js';\nimport NamespaceContext from '../spreadsheet/NamespaceContext';\nimport { scope } from '@jlongster/lively';\nimport { styles, colors } from '../../style';\nimport ArrowThinLeft from '../../svg/v1/ArrowThinLeft';\nimport ArrowThinRight from '../../svg/v1/ArrowThinRight';\nimport ExpandArrow from '../../svg/ExpandArrow';\nimport CheveronDown from '../../svg/v1/CheveronDown';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { separateGroups, findSortDown, findSortUp } from './util';\nimport { MonthsProvider, MonthsContext } from './MonthsContext';\nimport NotesButton from '../NotesButton';\n\nimport BudgetSummaries from './BudgetSummaries';\n\nimport { INCOME_HEADER_HEIGHT, MONTH_BOX_SHADOW } from './constants';\n\nfunction getScrollbarWidth() {\n return Math.max(styles.scrollbarWidth - 2, 0);\n}\n\nexport class BudgetTable extends React.Component {\n constructor(props) {\n super(props);\n this.budgetCategoriesRef = React.createRef();\n\n this.state = {\n editing: null,\n draggingState: null\n };\n }\n\n onEditMonth = (id, monthIndex) => {\n this.setState({ editing: id ? { id, cell: monthIndex } : null });\n };\n\n onEditName = id => {\n this.setState({ editing: id ? { id, cell: 'name' } : null });\n };\n\n onReorderCategory = (id, dropPos, targetId) => {\n let { categoryGroups } = this.props;\n\n let isGroup = !!categoryGroups.find(g => g.id === targetId);\n\n if (isGroup) {\n let { targetId: groupId } = findSortUp(categoryGroups, dropPos, targetId);\n let group = categoryGroups.find(g => g.id === groupId);\n\n if (group) {\n let { categories } = group;\n this.props.onReorderCategory({\n id,\n groupId: group.id,\n targetId:\n categories.length === 0 || dropPos === 'top'\n ? null\n : categories[0].id\n });\n }\n } else {\n let targetGroup;\n\n for (let group of categoryGroups) {\n if (group.categories.find(cat => cat.id === targetId)) {\n targetGroup = group;\n break;\n }\n }\n\n this.props.onReorderCategory({\n id,\n groupId: targetGroup.id,\n ...findSortDown(targetGroup.categories, dropPos, targetId)\n });\n }\n };\n\n onReorderGroup = (id, dropPos, targetId) => {\n let { categoryGroups } = this.props;\n\n this.props.onReorderGroup({\n id,\n ...findSortDown(categoryGroups, dropPos, targetId)\n });\n };\n\n moveVertically = dir => {\n let { editing } = this.state;\n let { type, categoryGroups, collapsed } = this.props;\n\n const flattened = categoryGroups.reduce((all, group) => {\n if (collapsed.includes(group.id)) {\n return all.concat({ id: group.id, isGroup: true });\n }\n return all.concat([{ id: group.id, isGroup: true }, ...group.categories]);\n }, []);\n\n if (editing) {\n const idx = flattened.findIndex(item => item.id === editing.id);\n let nextIdx = idx + dir;\n\n while (nextIdx >= 0 && nextIdx < flattened.length) {\n const next = flattened[nextIdx];\n\n if (next.isGroup) {\n nextIdx += dir;\n continue;\n } else if (type === 'report' || !next.is_income) {\n this.onEditMonth(next.id, editing.cell);\n return;\n } else {\n break;\n }\n }\n }\n };\n\n onKeyDown = e => {\n const TAB = 9;\n const ENTER = 13;\n\n if (!this.state.editing) {\n return null;\n }\n\n if (e.keyCode === ENTER || e.keyCode === TAB) {\n e.preventDefault();\n this.moveVertically(e.shiftKey ? -1 : 1);\n }\n };\n\n onShowActivity = (catName, catId, monthIndex) => {\n this.props.onShowActivity(catName, catId, this.resolveMonth(monthIndex));\n };\n\n onBudgetAction = (monthIndex, type, args) => {\n this.props.onBudgetAction(this.resolveMonth(monthIndex), type, args);\n };\n\n resolveMonth = monthIndex => {\n return monthUtils.addMonths(this.props.startMonth, monthIndex);\n };\n\n clearEditing() {\n this.setState({ editing: null });\n }\n\n render() {\n let {\n type,\n categoryGroups,\n prewarmStartMonth,\n startMonth,\n numMonths,\n monthBounds,\n collapsed,\n setCollapsed,\n newCategoryForGroup,\n dataComponents,\n isAddingGroup,\n onSaveCategory,\n onSaveGroup,\n onDeleteCategory,\n onDeleteGroup,\n onShowNewCategory,\n onHideNewCategory,\n onShowNewGroup,\n onHideNewGroup\n } = this.props;\n let { editing, draggingState } = this.state;\n\n return (\n <View\n style={[\n { flex: 1 },\n styles.lightScrollbar && {\n '& ::-webkit-scrollbar': {\n backgroundColor: 'transparent'\n },\n '& ::-webkit-scrollbar-thumb:vertical': {\n backgroundColor: 'white'\n }\n }\n ]}\n >\n <View\n style={{\n flexDirection: 'row',\n overflow: 'hidden',\n flexShrink: 0,\n // This is necessary to align with the table because the\n // table has this padding to allow the shadow to show\n paddingLeft: 5,\n paddingRight: 5 + getScrollbarWidth()\n }}\n >\n <View style={{ width: 200 }} />\n <MonthsProvider\n startMonth={prewarmStartMonth}\n numMonths={numMonths}\n monthBounds={monthBounds}\n type={type}\n >\n <BudgetSummaries\n SummaryComponent={dataComponents.SummaryComponent}\n />\n </MonthsProvider>\n </View>\n\n <MonthsProvider\n startMonth={startMonth}\n numMonths={numMonths}\n monthBounds={monthBounds}\n type={type}\n >\n <BudgetTotals MonthComponent={dataComponents.BudgetTotalsComponent} />\n <IntersectionBoundary.Provider value={this.budgetCategoriesRef}>\n <View\n style={{\n overflowY: 'scroll',\n overflowAnchor: 'none',\n flex: 1,\n paddingLeft: 5,\n paddingRight: 5\n }}\n innerRef={this.budgetCategoriesRef}\n >\n <View\n style={{\n opacity: draggingState ? 0.5 : 1,\n flexShrink: 0\n }}\n onKeyDown={this.onKeyDown}\n innerRef={el => (this.budgetDataNode = el)}\n >\n <BudgetCategories\n categoryGroups={categoryGroups}\n newCategoryForGroup={newCategoryForGroup}\n isAddingGroup={isAddingGroup}\n editingCell={editing}\n collapsed={collapsed}\n setCollapsed={setCollapsed}\n dataComponents={dataComponents}\n onEditMonth={this.onEditMonth}\n onEditName={this.onEditName}\n onSaveCategory={onSaveCategory}\n onSaveGroup={onSaveGroup}\n onDeleteCategory={onDeleteCategory}\n onDeleteGroup={onDeleteGroup}\n onReorderCategory={this.onReorderCategory}\n onReorderGroup={this.onReorderGroup}\n onShowNewCategory={onShowNewCategory}\n onHideNewCategory={onHideNewCategory}\n onShowNewGroup={onShowNewGroup}\n onHideNewGroup={onHideNewGroup}\n onBudgetAction={this.onBudgetAction}\n onShowActivity={this.onShowActivity}\n />\n </View>\n </View>\n </IntersectionBoundary.Provider>\n </MonthsProvider>\n </View>\n );\n }\n}\n\nexport function SidebarCategory({\n innerRef,\n category,\n dragPreview,\n dragging,\n editing,\n style,\n borderColor = colors.border,\n isLast,\n onDragChange,\n onEditMonth,\n onEditName,\n onSave,\n onDelete,\n onHideNewCategory\n}) {\n const temporary = category.id === 'new';\n const [menuOpen, setMenuOpen] = useState(false);\n\n const displayed = (\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n userSelect: 'none',\n WebkitUserSelect: 'none'\n }}\n >\n <div\n style={{\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n minWidth: 0\n }}\n >\n {category.name}\n </div>\n <View style={{ flexShrink: 0, marginLeft: 5 }}>\n <Button\n bare\n onClick={e => {\n e.stopPropagation();\n setMenuOpen(true);\n }}\n style={{ color: 'currentColor', padding: 3 }}\n >\n <CheveronDown\n width={14}\n height={14}\n style={{ color: 'currentColor' }}\n />\n </Button>\n {menuOpen && (\n <Tooltip\n position=\"bottom-left\"\n width={200}\n style={{ padding: 0 }}\n onClose={() => setMenuOpen(false)}\n >\n <Menu\n onMenuSelect={type => {\n if (type === 'rename') {\n onEditName(category.id);\n } else {\n onDelete(category.id);\n }\n setMenuOpen(false);\n }}\n items={[\n { name: 'rename', text: 'Rename' },\n { name: 'delete', text: 'Delete' }\n ]}\n />\n </Tooltip>\n )}\n </View>\n <View style={{ flex: 1 }} />\n <NotesButton\n id={category.id}\n style={dragging && { color: 'currentColor' }}\n />\n </View>\n );\n\n return (\n <View\n innerRef={innerRef}\n style={[\n {\n width: 200,\n '& button': { display: 'none' }\n },\n !dragging &&\n !dragPreview && {\n '&:hover button': { display: 'flex', color: colors.n1 }\n },\n dragging && { color: colors.n8 },\n\n // The zIndex here forces the the view on top of a row below\n // it that may be \"collapsed\" and show a border on top\n dragPreview && {\n backgroundColor: 'white',\n zIndex: 10000,\n borderRadius: 6,\n overflow: 'hidden'\n },\n style\n ]}\n onKeyDown={e => {\n const ENTER = 13;\n if (e.keyCode === ENTER) {\n onEditName(null);\n e.stopPropagation();\n }\n }}\n >\n <InputCell\n value={category.name}\n formatter={value => displayed}\n width=\"flex\"\n exposed={editing || temporary}\n borderColor={dragPreview ? 'transparent' : borderColor}\n onUpdate={value => {\n if (temporary) {\n if (value === '') {\n onHideNewCategory();\n } else if (value !== '') {\n onSave({ ...category, name: value });\n }\n } else {\n if (value !== category.name) {\n onSave({ ...category, name: value });\n }\n }\n }}\n onBlur={() => onEditName(null)}\n style={[{ paddingLeft: 13 }, isLast && { borderBottomWidth: 0 }]}\n inputProps={{\n placeholder: temporary ? 'New Category Name' : ''\n }}\n />\n </View>\n );\n}\n\nexport function SidebarGroup({\n group,\n editing,\n collapsed,\n dragPreview,\n innerRef,\n style,\n borderColor = colors.border,\n onEdit,\n onSave,\n onDelete,\n onShowNewCategory,\n onHideNewGroup,\n onToggleCollapse\n}) {\n const temporary = group.id === 'new';\n const [menuOpen, setMenuOpen] = useState(false);\n\n const displayed = (\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n userSelect: 'none',\n WebkitUserSelect: 'none'\n }}\n onClick={e => {\n onToggleCollapse(group.id);\n }}\n >\n {!dragPreview && (\n <ExpandArrow\n width={8}\n height={8}\n style={{\n marginRight: 5,\n marginLeft: 5,\n flexShrink: 0,\n transition: 'transform .1s',\n transform: collapsed ? 'rotate(-90deg)' : ''\n }}\n />\n )}\n <div\n style={{\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n minWidth: 0\n }}\n >\n {dragPreview && <Text style={{ fontWeight: 500 }}>Group: </Text>}\n {group.name}\n </div>\n {!dragPreview && (\n <>\n <View style={{ marginLeft: 5, flexShrink: 0 }}>\n <Button\n bare\n onClick={e => {\n e.stopPropagation();\n setMenuOpen(true);\n }}\n style={{ padding: 3 }}\n >\n <CheveronDown width={14} height={14} />\n </Button>\n {menuOpen && (\n <Tooltip\n position=\"bottom-left\"\n width={200}\n style={{ padding: 0 }}\n onClose={() => setMenuOpen(false)}\n >\n <Menu\n onMenuSelect={type => {\n if (type === 'rename') {\n onEdit(group.id);\n } else if (type === 'add-category') {\n onShowNewCategory(group.id);\n } else {\n onDelete(group.id);\n }\n setMenuOpen(false);\n }}\n items={[\n { name: 'add-category', text: 'Add category' },\n { name: 'rename', text: 'Rename' },\n onDelete && { name: 'delete', text: 'Delete' }\n ]}\n />\n </Tooltip>\n )}\n </View>\n <View style={{ flex: 1 }} />\n <NotesButton id={group.id} />\n </>\n )}\n </View>\n );\n\n return (\n <View\n innerRef={innerRef}\n style={[\n style,\n {\n width: 200,\n backgroundColor: colors.n11,\n '& button': { display: 'none' },\n '&:hover button': { display: 'flex', color: colors.n1 }\n },\n dragPreview && {\n paddingLeft: 10,\n zIndex: 10000,\n borderRadius: 6,\n overflow: 'hidden'\n }\n ]}\n onKeyDown={e => {\n const ENTER = 13;\n if (e.keyCode === ENTER) {\n onEdit(null);\n e.stopPropagation();\n }\n }}\n >\n <InputCell\n value={group.name}\n formatter={value => displayed}\n width=\"flex\"\n exposed={editing}\n borderColor={colors.border}\n onUpdate={value => {\n if (temporary) {\n if (value === '') {\n onHideNewGroup();\n } else if (value !== '') {\n onSave({ id: group.id, name: value });\n }\n } else {\n onSave({ id: group.id, name: value });\n }\n }}\n onBlur={() => onEdit(null)}\n style={{ fontWeight: 600 }}\n inputProps={{\n style: { marginLeft: 20 },\n placeholder: temporary ? 'New Group Name' : ''\n }}\n />\n </View>\n );\n}\n\nfunction RenderMonths({ component: Component, editingIndex, args, style }) {\n let { months, type } = useContext(MonthsContext);\n\n return months.map((month, index) => {\n let editing = editingIndex === index;\n\n return (\n <NamespaceContext.Provider\n key={index}\n value={monthUtils.sheetForMonth(month, type)}\n >\n <View\n style={[\n { flex: 1 },\n { borderLeft: '1px solid ' + colors.border },\n style\n ]}\n >\n <Component monthIndex={index} editing={editing} {...args} />\n </View>\n </NamespaceContext.Provider>\n );\n });\n}\n\nconst BudgetTotals = React.memo(function BudgetTotals({ MonthComponent }) {\n return (\n <View\n style={{\n backgroundColor: 'white',\n flexDirection: 'row',\n flexShrink: 0,\n boxShadow: MONTH_BOX_SHADOW,\n marginLeft: 5,\n marginRight: 5 + getScrollbarWidth(),\n borderRadius: '4px 4px 0 0',\n borderBottom: '1px solid ' + colors.border\n }}\n >\n <View\n style={{\n width: 200,\n color: colors.n4,\n justifyContent: 'center',\n paddingLeft: 18\n }}\n >\n Category\n </View>\n <RenderMonths component={MonthComponent} />\n </View>\n );\n});\n\nfunction ExpenseGroup({\n group,\n collapsed,\n editingCell,\n dragState,\n itemPos,\n MonthComponent,\n onEditName,\n onSave,\n onDelete,\n onDragChange,\n onReorderGroup,\n onReorderCategory,\n onToggleCollapse,\n onShowNewCategory\n}) {\n let dragging = dragState && dragState.item === group;\n\n let { dragRef } = useDraggable({\n type: 'group',\n onDragChange,\n item: group,\n canDrag: editingCell === null\n });\n\n let { dropRef, dropPos } = useDroppable({\n types: 'group',\n id: group.id,\n onDrop: onReorderGroup\n });\n\n let { dropRef: catDropRef, dropPos: catDropPos } = useDroppable({\n types: 'category',\n id: group.id,\n onDrop: onReorderCategory,\n onLongHover: () => {\n if (collapsed) {\n onToggleCollapse(group.id);\n }\n }\n });\n\n return (\n <Row\n collapsed={true}\n backgroundColor={colors.n11}\n style={{ fontWeight: 600 }}\n >\n {dragState && !dragState.preview && dragState.type === 'group' && (\n <View\n innerRef={dropRef}\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n height: collapsed\n ? ROW_HEIGHT - 1\n : (1 + group.categories.length) * (ROW_HEIGHT - 1) + 1,\n zIndex: 10000\n }}\n >\n <DropHighlight pos={dropPos} offset={{ top: 1 }} />\n </View>\n )}\n\n <DropHighlight pos={catDropPos} offset={{ top: 1 }} />\n\n <View\n innerRef={catDropRef}\n style={{\n flex: 1,\n flexDirection: 'row',\n opacity: dragging && !dragState.preview ? 0.3 : 1\n }}\n >\n <SidebarGroup\n innerRef={dragRef}\n group={group}\n editing={\n editingCell &&\n editingCell.cell === 'name' &&\n editingCell.id === group.id\n }\n dragPreview={dragging && dragState.preview}\n collapsed={collapsed}\n onToggleCollapse={onToggleCollapse}\n onEdit={onEditName}\n onSave={onSave}\n onDelete={onDelete}\n onShowNewCategory={onShowNewCategory}\n />\n <RenderMonths component={MonthComponent} args={{ group }} />\n </View>\n </Row>\n );\n}\n\nfunction ExpenseCategory({\n cat,\n budgetArray,\n editingCell,\n dragState,\n MonthComponent,\n onEditName,\n onEditMonth,\n onSave,\n onDelete,\n onBudgetAction,\n onShowActivity,\n onDragChange,\n onReorder\n}) {\n let dragging = dragState && dragState.item === cat;\n\n if (dragState && dragState.item.id === cat.cat_group) {\n dragging = true;\n }\n\n let { dragRef } = useDraggable({\n type: 'category',\n onDragChange,\n item: cat,\n canDrag: editingCell === null\n });\n\n let { dropRef, dropPos } = useDroppable({\n types: 'category',\n id: cat.id,\n onDrop: onReorder\n });\n\n return (\n <Row innerRef={dropRef} collapsed={true} backgroundColor=\"transparent\">\n <DropHighlight pos={dropPos} offset={{ top: 1 }} />\n\n <View\n style={[\n {\n flex: 1,\n flexDirection: 'row'\n }\n ]}\n >\n <SidebarCategory\n innerRef={dragRef}\n category={cat}\n dragPreview={dragging && dragState.preview}\n dragging={dragging && !dragState.preview}\n editing={\n editingCell &&\n editingCell.cell === 'name' &&\n editingCell.id === cat.id\n }\n onEditName={onEditName}\n onSave={onSave}\n onDelete={onDelete}\n onDragChange={onDragChange}\n />\n\n <RenderMonths\n component={MonthComponent}\n editingIndex={\n editingCell && editingCell.id === cat.id && editingCell.cell\n }\n args={{\n category: cat,\n onEdit: onEditMonth,\n onBudgetAction,\n onShowActivity\n }}\n />\n </View>\n </Row>\n );\n}\n\nfunction IncomeGroup({\n group,\n editingCell,\n collapsed,\n MonthComponent,\n onEditName,\n onSave,\n onToggleCollapse,\n onShowNewCategory\n}) {\n return (\n <Row\n collapsed={true}\n backgroundColor={colors.n11}\n style={{ fontWeight: 600 }}\n >\n <SidebarGroup\n group={group}\n collapsed={collapsed}\n editing={\n editingCell &&\n editingCell.cell === 'name' &&\n editingCell.id === group.id\n }\n onEdit={onEditName}\n onSave={onSave}\n onToggleCollapse={onToggleCollapse}\n onShowNewCategory={onShowNewCategory}\n />\n <RenderMonths component={MonthComponent} args={{ group }} />\n </Row>\n );\n}\n\nfunction IncomeCategory({\n cat,\n isLast,\n editingCell,\n MonthComponent,\n onEditName,\n onEditMonth,\n onSave,\n onDelete,\n onDragChange,\n onBudgetAction,\n onReorder,\n onShowActivity\n}) {\n let { dragRef } = useDraggable({\n type: 'income-category',\n onDragChange,\n item: cat,\n canDrag: editingCell === null\n });\n\n let { dropRef, dropPos } = useDroppable({\n types: 'income-category',\n id: cat.id,\n onDrop: onReorder\n });\n\n return (\n <Row innerRef={dropRef} collapsed={true} backgroundColor=\"transparent\">\n <DropHighlight pos={dropPos} offset={{ top: 1 }} />\n\n <SidebarCategory\n innerRef={dragRef}\n category={cat}\n isLast={isLast}\n editing={\n editingCell &&\n editingCell.cell === 'name' &&\n editingCell.id === cat.id\n }\n onEditName={onEditName}\n onSave={onSave}\n onDelete={onDelete}\n />\n <RenderMonths\n component={MonthComponent}\n editingIndex={\n editingCell && editingCell.id === cat.id && editingCell.cell\n }\n args={{\n category: cat,\n onEdit: onEditMonth,\n isLast,\n onShowActivity,\n onBudgetAction\n }}\n />\n </Row>\n );\n}\n\nconst BudgetCategories = React.memo(\n ({\n categoryGroups,\n newCategoryForGroup,\n isAddingGroup,\n editingCell,\n collapsed,\n setCollapsed,\n dataComponents,\n onBudgetAction,\n onShowActivity,\n onEditName,\n onEditMonth,\n onSaveCategory,\n onSaveGroup,\n onDeleteCategory,\n onDeleteGroup,\n onReorderCategory,\n onReorderGroup,\n onShowNewCategory,\n onHideNewCategory,\n onShowNewGroup,\n onHideNewGroup\n }) => {\n let items = useMemo(() => {\n let [expenseGroups, incomeGroup] = separateGroups(categoryGroups);\n\n let items = Array.prototype.concat.apply(\n [],\n expenseGroups.map(group => {\n let items = [{ type: 'expense-group', value: group }];\n\n if (newCategoryForGroup === group.id) {\n items.push({ type: 'new-category' });\n }\n\n return [\n ...items,\n ...(collapsed.includes(group.id) ? [] : group.categories).map(\n cat => ({\n type: 'expense-category',\n value: cat\n })\n )\n ];\n })\n );\n\n if (isAddingGroup) {\n items.push({ type: 'new-group' });\n }\n\n if (incomeGroup) {\n items = items.concat(\n [\n { type: 'income-separator' },\n { type: 'income-group', value: incomeGroup },\n newCategoryForGroup === incomeGroup.id && { type: 'new-category' },\n ...(collapsed.includes(incomeGroup.id)\n ? []\n : incomeGroup.categories\n ).map(cat => ({\n type: 'income-category',\n value: cat\n }))\n ].filter(x => x)\n );\n }\n\n return items;\n }, [categoryGroups, collapsed, newCategoryForGroup, isAddingGroup]);\n\n let [dragState, setDragState] = useState(null);\n let [savedCollapsed, setSavedCollapsed] = useState(null);\n\n // TODO: If we turn this into a reducer, we could probably memoize\n // each item in the list for better perf\n function onDragChange(newDragState) {\n let { state } = newDragState;\n\n if (state === 'start-preview') {\n setDragState({\n type: newDragState.type,\n item: newDragState.item,\n preview: true\n });\n } else if (state === 'start') {\n if (dragState) {\n setDragState({\n ...dragState,\n preview: false\n });\n setSavedCollapsed(collapsed);\n }\n } else if (state === 'hover') {\n setDragState({\n ...dragState,\n hoveredId: newDragState.id,\n hoveredPos: newDragState.pos\n });\n } else if (state === 'end') {\n setDragState(null);\n setCollapsed(savedCollapsed);\n }\n }\n\n function onToggleCollapse(id) {\n if (collapsed.includes(id)) {\n setCollapsed(collapsed.filter(id_ => id_ !== id));\n } else {\n setCollapsed([...collapsed, id]);\n }\n }\n\n return (\n <View\n style={{\n marginBottom: 10,\n backgroundColor: 'white',\n overflow: 'hidden',\n boxShadow: MONTH_BOX_SHADOW,\n borderRadius: '0 0 4px 4px',\n flex: 1\n }}\n >\n {items.map((item, idx) => {\n let content;\n switch (item.type) {\n case 'new-group':\n content = (\n <Row style={{ backgroundColor: colors.n11 }}>\n <SidebarGroup\n group={{ id: 'new', name: '' }}\n editing={true}\n onSave={onSaveGroup}\n onHideNewGroup={onHideNewGroup}\n onEdit={onEditName}\n />\n </Row>\n );\n break;\n case 'new-category':\n content = (\n <Row>\n <SidebarCategory\n category={{\n name: '',\n cat_group: newCategoryForGroup,\n is_income:\n newCategoryForGroup ===\n categoryGroups.find(g => g.is_income).id,\n id: 'new'\n }}\n editing={true}\n onSave={onSaveCategory}\n onHideNewCategory={onHideNewCategory}\n onEditName={onEditName}\n />\n </Row>\n );\n break;\n\n case 'expense-group':\n content = (\n <ExpenseGroup\n group={item.value}\n editingCell={editingCell}\n collapsed={collapsed.includes(item.value.id)}\n MonthComponent={dataComponents.ExpenseGroupComponent}\n dragState={dragState}\n onEditName={onEditName}\n onSave={onSaveGroup}\n onDelete={onDeleteGroup}\n onDragChange={onDragChange}\n onReorderGroup={onReorderGroup}\n onReorderCategory={onReorderCategory}\n onToggleCollapse={onToggleCollapse}\n onShowNewCategory={onShowNewCategory}\n />\n );\n break;\n case 'expense-category':\n content = (\n <ExpenseCategory\n cat={item.value}\n editingCell={editingCell}\n MonthComponent={dataComponents.ExpenseCategoryComponent}\n dragState={dragState}\n onEditName={onEditName}\n onEditMonth={onEditMonth}\n onSave={onSaveCategory}\n onDelete={onDeleteCategory}\n onDragChange={onDragChange}\n onReorder={onReorderCategory}\n onBudgetAction={onBudgetAction}\n onShowActivity={onShowActivity}\n />\n );\n break;\n case 'income-separator':\n content = (\n <View\n style={{\n height: INCOME_HEADER_HEIGHT,\n backgroundColor: 'white'\n }}\n >\n <IncomeHeader\n MonthComponent={dataComponents.IncomeHeaderComponent}\n onShowNewGroup={onShowNewGroup}\n />\n </View>\n );\n break;\n case 'income-group':\n content = (\n <IncomeGroup\n group={item.value}\n editingCell={editingCell}\n MonthComponent={dataComponents.IncomeGroupComponent}\n collapsed={collapsed.includes(item.value.id)}\n onEditName={onEditName}\n onSave={onSaveGroup}\n onToggleCollapse={onToggleCollapse}\n onShowNewCategory={onShowNewCategory}\n />\n );\n break;\n case 'income-category':\n content = (\n <IncomeCategory\n cat={item.value}\n editingCell={editingCell}\n isLast={idx === items.length - 1}\n MonthComponent={dataComponents.IncomeCategoryComponent}\n onEditName={onEditName}\n onEditMonth={onEditMonth}\n onSave={onSaveCategory}\n onDelete={onDeleteCategory}\n onDragChange={onDragChange}\n onReorder={onReorderCategory}\n onBudgetAction={onBudgetAction}\n onShowActivity={onShowActivity}\n />\n );\n break;\n default:\n throw new Error('Unknown item type: ' + item.type);\n }\n\n let pos =\n idx === 0 ? 'first' : idx === items.length - 1 ? 'last' : null;\n\n return (\n <DropHighlightPosContext.Provider\n key={\n item.value\n ? item.value.id\n : item.type === 'income-separator'\n ? 'separator'\n : idx\n }\n value={pos}\n >\n <View\n style={\n !dragState && {\n ':hover': { backgroundColor: '#fcfcfc' }\n }\n }\n >\n {content}\n </View>\n </DropHighlightPosContext.Provider>\n );\n })}\n </View>\n );\n }\n);\n\nfunction IncomeHeader({ MonthComponent, onShowNewGroup }) {\n return (\n <View style={{ flexDirection: 'row', flex: 1 }}>\n <View\n style={{\n width: 200,\n alignItems: 'flex-start',\n justifyContent: 'flex-start'\n }}\n >\n <Button onClick={onShowNewGroup} style={{ fontSize: 12, margin: 10 }}>\n Add Group\n </Button>\n </View>\n <RenderMonths\n component={MonthComponent}\n style={{ border: 0, justifyContent: 'flex-end' }}\n />\n </View>\n );\n}\n\nexport const BudgetPageHeader = React.memo(\n ({ startMonth, onMonthSelect, numMonths, monthBounds, style }) => {\n function getValidMonth(month) {\n let start = monthBounds.start;\n let end = monthUtils.subMonths(monthBounds.end, numMonths - 1);\n\n if (month < start) {\n return start;\n } else if (month > end) {\n return end;\n }\n return month;\n }\n\n return (\n <View style={{ marginLeft: 200 + 5, flexShrink: 0 }}>\n <View style={{ marginRight: 5 + getScrollbarWidth() }}>\n <MonthPicker\n startMonth={startMonth}\n numDisplayed={numMonths}\n monthBounds={monthBounds}\n style={{ paddingTop: 5 }}\n onSelect={month => onMonthSelect(getValidMonth(month))}\n />\n </View>\n </View>\n );\n }\n);\n\nexport const MonthPicker = scope(lively => {\n function getRangeForYear(year) {\n return monthUtils.rangeInclusive(\n monthUtils.getYearStart(year),\n monthUtils.getYearEnd(year)\n );\n }\n\n function getMonth(year, idx) {\n return monthUtils.addMonths(year, idx);\n }\n\n function getCurrentMonthName(startMonth, currentMonth) {\n return monthUtils.getYear(startMonth) === monthUtils.getYear(currentMonth)\n ? monthUtils.format(currentMonth, 'MMM')\n : null;\n }\n\n function getInitialState({ props: { startMonth, monthBounds } }) {\n const currentMonth = monthUtils.currentMonth();\n const range = getRangeForYear(currentMonth);\n const monthNames = range.map(month => {\n return monthUtils.format(month, 'MMM');\n });\n\n return {\n monthNames,\n currentMonthName: getCurrentMonthName(startMonth, currentMonth)\n };\n }\n\n function componentWillReceiveProps({ props }, nextProps) {\n if (\n monthUtils.getYear(props.startMonth) !==\n monthUtils.getYear(nextProps.startMonth)\n ) {\n return {\n currentMonthName: getCurrentMonthName(\n nextProps.startMonth,\n monthUtils.currentMonth()\n )\n };\n }\n }\n\n function MonthPicker({\n state: { monthNames, currentMonthName },\n props: { startMonth, numDisplayed, monthBounds, style, onSelect }\n }) {\n const year = monthUtils.getYear(startMonth);\n const selectedIndex = monthUtils.getMonthIndex(startMonth);\n\n return (\n <View\n style={[\n {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between'\n },\n style\n ]}\n >\n <View\n style={{\n padding: '3px 0px',\n margin: '3px 0',\n fontWeight: 'bold',\n fontSize: 14,\n flex: '0 0 40px'\n }}\n >\n {monthUtils.format(year, 'yyyy')}\n </View>\n <ElementQuery\n sizes={[\n { width: 320, size: 'small' },\n { width: 400, size: 'medium' },\n { size: 'big' }\n ]}\n >\n {(matched, ref) => (\n <View\n innerRef={ref}\n style={{\n flexDirection: 'row',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n {monthNames.map((monthName, idx) => {\n const lastSelectedIndex = selectedIndex + numDisplayed;\n const selected =\n idx >= selectedIndex && idx < lastSelectedIndex;\n const current = monthName === currentMonthName;\n const month = getMonth(year, idx);\n const isMonthBudgeted =\n month >= monthBounds.start && month <= monthBounds.end;\n\n return (\n <View\n key={monthName}\n style={[\n {\n marginRight: 1,\n padding:\n matched && matched.size === 'big'\n ? '3px 5px'\n : '3px 3px',\n textAlign: 'center',\n cursor: 'default',\n borderRadius: 2,\n ':hover': isMonthBudgeted && {\n backgroundColor: colors.p6,\n color: 'white'\n }\n },\n !isMonthBudgeted && { color: colors.n7 },\n styles.smallText,\n selected && {\n backgroundColor: colors.p6,\n color: 'white',\n borderRadius: 0\n },\n idx === selectedIndex && {\n borderTopLeftRadius: 2,\n borderBottomLeftRadius: 2\n },\n idx === lastSelectedIndex - 1 && {\n borderTopRightRadius: 2,\n borderBottomRightRadius: 2\n },\n idx >= selectedIndex &&\n idx < lastSelectedIndex - 1 && {\n marginRight: 0,\n borderRight: 'solid 1px',\n borderColor: colors.p6\n },\n current && { textDecoration: 'underline' }\n ]}\n onClick={() => onSelect(month)}\n >\n {matched && matched.size === 'small'\n ? monthName[0]\n : monthName}\n </View>\n );\n })}\n </View>\n )}\n </ElementQuery>\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n flex: '0 0 50px',\n justifyContent: 'flex-end'\n }}\n >\n <Button\n onClick={() => onSelect(monthUtils.subMonths(startMonth, 1))}\n bare\n >\n <ArrowThinLeft width={12} height={12} />\n </Button>\n <Button\n onClick={() => onSelect(monthUtils.addMonths(startMonth, 1))}\n bare\n >\n <ArrowThinRight width={12} height={12} />\n </Button>\n </View>\n </View>\n );\n }\n\n return lively(MonthPicker, { getInitialState, componentWillReceiveProps });\n});\n","import React, { useEffect } from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { View } from '../common';\nimport { BudgetPageHeader, BudgetTable } from './index';\nimport { CategoryGroupsContext } from './util';\nimport { useBudgetMonthCount } from './BudgetMonthCountContext';\n\nfunction getNumPossibleMonths(width) {\n let estimatedTableWidth = width - 200;\n\n if (estimatedTableWidth < 500) {\n return 1;\n } else if (estimatedTableWidth < 750) {\n return 2;\n } else if (estimatedTableWidth < 1000) {\n return 3;\n } else if (estimatedTableWidth < 1250) {\n return 4;\n } else if (estimatedTableWidth < 1500) {\n return 5;\n }\n\n return 6;\n}\n\nconst DynamicBudgetTableInner = React.forwardRef(\n (\n {\n width,\n height,\n categoryGroups,\n prewarmStartMonth,\n startMonth,\n maxMonths = 3,\n monthBounds,\n onMonthSelect: onMonthSelect_,\n onPreload,\n ...props\n },\n ref\n ) => {\n let { setDisplayMax } = useBudgetMonthCount();\n\n let numPossible = getNumPossibleMonths(width);\n let numMonths = Math.min(numPossible, maxMonths);\n let maxWidth = 200 + 500 * numMonths;\n\n useEffect(() => {\n setDisplayMax(numPossible);\n }, [numPossible]);\n\n function onMonthSelect(month) {\n onMonthSelect_(month, numMonths);\n }\n\n return (\n <CategoryGroupsContext.Provider value={categoryGroups}>\n <View\n style={{\n width,\n height,\n alignItems: 'center',\n opacity: width <= 0 || height <= 0 ? 0 : 1\n }}\n >\n <View style={{ width: '100%', maxWidth }}>\n <BudgetPageHeader\n startMonth={prewarmStartMonth}\n numMonths={numMonths}\n monthBounds={monthBounds}\n onMonthSelect={onMonthSelect}\n />\n <BudgetTable\n ref={ref}\n categoryGroups={categoryGroups}\n prewarmStartMonth={prewarmStartMonth}\n startMonth={startMonth}\n numMonths={numMonths}\n monthBounds={monthBounds}\n {...props}\n />\n </View>\n </View>\n </CategoryGroupsContext.Provider>\n );\n }\n);\n\nexport default React.forwardRef((props, ref) => {\n return (\n <AutoSizer>\n {({ width, height }) => (\n <DynamicBudgetTableInner\n ref={ref}\n width={width}\n height={height}\n {...props}\n />\n )}\n </AutoSizer>\n );\n});\n","export function addCategory(categoryGroups, cat) {\n return categoryGroups.map(group => {\n if (group.id === cat.cat_group) {\n group.categories = [cat, ...group.categories];\n }\n return { ...group };\n });\n}\n\nexport function updateCategory(categoryGroups, category) {\n return categoryGroups.map(group => {\n if (group.id === category.cat_group) {\n group.categories = group.categories.map(c => {\n if (c.id === category.id) {\n return { ...c, ...category };\n }\n return c;\n });\n }\n return group;\n });\n}\n\nexport function moveCategory(categoryGroups, id, groupId, targetId) {\n if (id === targetId) {\n return categoryGroups;\n }\n\n let moveCat = categoryGroups.reduce((value, group) => {\n return value || group.categories.find(cat => cat.id === id);\n }, null);\n\n // Update the group id on the category\n moveCat = { ...moveCat, cat_group: groupId };\n\n return categoryGroups.map(group => {\n if (group.id === groupId) {\n group.categories = group.categories.reduce((cats, cat) => {\n if (cat.id === targetId) {\n cats.push(moveCat);\n cats.push(cat);\n } else if (cat.id !== id) {\n cats.push(cat);\n }\n return cats;\n }, []);\n\n if (!targetId) {\n group.categories.push(moveCat);\n }\n } else {\n group.categories = group.categories.filter(cat => cat.id !== id);\n }\n\n return { ...group };\n });\n}\n\nexport function moveCategoryGroup(categoryGroups, id, targetId) {\n if (id === targetId) {\n return categoryGroups;\n }\n\n let moveGroup = categoryGroups.find(g => g.id === id);\n\n categoryGroups = categoryGroups.reduce((groups, group) => {\n if (group.id === targetId) {\n groups.push(moveGroup);\n groups.push(group);\n } else if (group.id !== id) {\n groups.push(group);\n }\n return groups;\n }, []);\n\n if (!targetId) {\n categoryGroups.push(moveGroup);\n }\n\n return categoryGroups;\n}\n\nexport function deleteCategory(categoryGroups, id) {\n return categoryGroups.map(group => {\n group.categories = group.categories.filter(c => c.id !== id);\n return group;\n });\n}\n\nexport function addGroup(categoryGroups, group) {\n return [...categoryGroups, group];\n}\n\nexport function updateGroup(categoryGroups, group) {\n return categoryGroups.map(g => {\n if (g.id === group.id) {\n return { ...g, ...group };\n }\n return g;\n });\n}\n\nexport function deleteGroup(categoryGroups, id) {\n return categoryGroups.filter(g => g.id !== id);\n}\n","import React, { useEffect, useContext, useMemo } from 'react';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport { bindActionCreators } from 'redux';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport memoizeOne from 'memoize-one';\nimport * as actions from 'loot-core/src/client/actions';\nimport { send, listen } from 'loot-core/src/platform/client/fetch';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { getValidMonthBounds } from 'loot-design/src/components/budget/MonthsContext';\nimport { TitlebarContext } from '../Titlebar';\n\nimport * as rollover from 'loot-design/src/components/budget/rollover/rollover-components';\nimport { RolloverContext } from 'loot-design/src/components/budget/rollover/RolloverContext';\n\nimport * as report from 'loot-design/src/components/budget/report/components';\nimport { ReportProvider } from 'loot-design/src/components/budget/report/ReportContext';\n\nimport DynamicBudgetTable from 'loot-design/src/components/budget/DynamicBudgetTable';\nimport SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext';\nimport { View } from 'loot-design/src/components/common';\nimport { styles, colors } from 'loot-design/src/style';\nimport {\n addCategory,\n updateCategory,\n moveCategory,\n moveCategoryGroup,\n deleteCategory,\n addGroup,\n updateGroup,\n deleteGroup\n} from 'loot-core/src/shared/categories.js';\n\nlet _initialBudgetMonth = null;\n\nclass Budget extends React.PureComponent {\n constructor(props) {\n super(props);\n\n const currentMonth = _initialBudgetMonth || monthUtils.currentMonth();\n this.state = {\n initialized: false,\n prewarmStartMonth: currentMonth,\n startMonth: currentMonth,\n newCategoryForGroup: null,\n isAddingGroup: false,\n collapsed: props.collapsedPrefs || [],\n bounds: { start: currentMonth, end: currentMonth },\n categoryGroups: null,\n summaryCollapsed: props.summaryCollapsed\n };\n }\n\n async loadCategories() {\n let result = await this.props.getCategories();\n this.setState({ categoryGroups: result.grouped });\n }\n\n async componentDidMount() {\n let { titlebar, budgetType } = this.props;\n this.loadCategories();\n\n let { start, end } = await send('get-budget-bounds');\n this.setState({ bounds: { start, end } });\n\n this.prewarmAllMonths({ start, end }, budgetType);\n\n let unlistens = [\n listen('sync-event', ({ type, tables }) => {\n if (\n type === 'success' &&\n (tables.includes('categories') ||\n tables.includes('category_mapping') ||\n tables.includes('category_groups'))\n ) {\n this.loadCategories();\n }\n }),\n\n listen('undo-event', ({ tables }) => {\n if (this.table) {\n // g dammit\n // We need to clear the editing cell, otherwise when\n // the user navigates away from the page they will\n // accidentally clear the undo stack if they have pressed\n // undo, since the cell will save itself on blur (worst case:\n // undo takes you to another screen and then you can't redo\n // any of the budget changes)\n this.table.clearEditing();\n }\n\n if (tables.includes('categories')) {\n this.loadCategories();\n }\n }),\n\n titlebar.subscribe(this.onTitlebarEvent)\n ];\n\n this.cleanup = () => {\n unlistens.forEach(unlisten => unlisten());\n };\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (prevState.collapsed !== this.state.collapsed) {\n this.props.savePrefs({ 'budget.collapsed': this.state.collapsed });\n }\n\n if (prevState.startMonth !== this.state.startMonth) {\n // Save it off into a global state so if the component re-mounts\n // we keep this state (but don't need to subscribe to it)\n _initialBudgetMonth = this.state.startMonth;\n }\n\n if (this.props.match && !prevProps.match) {\n // Make to sure to check if the budget bounds have changed, and\n // if so reload the budget data\n send('get-budget-bounds').then(({ start, end }) => {\n let { bounds } = this.state;\n if (bounds.start !== start || bounds.end !== end) {\n this.setState({ bounds: { start, end } });\n }\n });\n }\n }\n\n componentWillUnmount() {\n if (this.cleanup) {\n this.cleanup();\n }\n }\n\n prewarmMonth = async (month, type = null) => {\n type = type || this.props.budgetType;\n\n let method =\n type === 'report' ? 'report-budget-month' : 'rollover-budget-month';\n\n let values = await send(method, { month });\n\n for (let value of values) {\n this.props.spreadsheet.prewarmCache(value.name, value);\n }\n };\n\n async prewarmAllMonths(bounds, type = null) {\n let { startMonth } = this.state;\n let numMonths = 3;\n\n bounds = getValidMonthBounds(\n bounds,\n monthUtils.subMonths(startMonth, 1),\n monthUtils.addMonths(startMonth, numMonths + 1)\n );\n let months = monthUtils.rangeInclusive(bounds.start, bounds.end);\n\n await Promise.all(months.map(month => this.prewarmMonth(month, type)));\n\n this.setState({ initialized: true });\n }\n\n onMonthSelect = async (month, numDisplayed) => {\n let { startMonth } = this.state;\n\n this.setState({ prewarmStartMonth: month });\n\n this.warmingMonth = month;\n\n // We could be smarter about this, but this is a good start. We\n // optimize for the case where users press the left/right button\n // to move between months. This loads the month data all at once\n // and \"prewarms\" the spreadsheet cache. This uses a simple\n // heuristic that will fail if the user clicks an arbitrary month,\n // but it will just load in some unnecessary data.\n if (month < startMonth) {\n // pre-warm prev month\n await this.prewarmMonth(monthUtils.subMonths(month, 1));\n } else if (month > startMonth) {\n // pre-warm next month\n await this.prewarmMonth(monthUtils.addMonths(month, numDisplayed));\n }\n\n if (this.warmingMonth === month) {\n this.setState({ startMonth: month });\n }\n };\n\n onShowNewCategory = groupId => {\n this.setState({\n newCategoryForGroup: groupId,\n collapsed: this.state.collapsed.filter(c => c !== groupId)\n });\n };\n\n onHideNewCategory = () => {\n this.setState({ newCategoryForGroup: null });\n };\n\n onShowNewGroup = () => {\n this.setState({ isAddingGroup: true });\n };\n\n onHideNewGroup = () => {\n this.setState({ isAddingGroup: false });\n };\n\n setCollapsed = collapsed => {\n this.setState({ collapsed });\n };\n\n onCopy(month) {\n this.props.copyPreviousMonthInto(month, this.props.categories);\n }\n\n onSaveCategory = async category => {\n let { categoryGroups } = this.state;\n\n if (category.id === 'new') {\n let id = await this.props.createCategory(\n category.name,\n category.cat_group,\n category.is_income\n );\n\n this.setState({\n newCategoryForGroup: null,\n categoryGroups: addCategory(categoryGroups, {\n ...category,\n is_income: category.is_income ? 1 : 0,\n id\n })\n });\n } else {\n this.props.updateCategory(category);\n\n this.setState({\n categoryGroups: updateCategory(categoryGroups, category)\n });\n }\n };\n\n onDeleteCategory = async id => {\n const mustTransfer = await send('must-category-transfer', { id });\n let { categoryGroups } = this.state;\n\n if (mustTransfer) {\n this.props.pushModal('confirm-category-delete', {\n category: id,\n onDelete: transferCategory => {\n if (id !== transferCategory) {\n this.props.deleteCategory(id, transferCategory);\n\n this.setState({\n categoryGroups: deleteCategory(categoryGroups, id)\n });\n }\n }\n });\n } else {\n this.props.deleteCategory(id);\n\n this.setState({\n categoryGroups: deleteCategory(categoryGroups, id)\n });\n }\n };\n\n onSaveGroup = async group => {\n let { categoryGroups } = this.state;\n\n if (group.id === 'new') {\n let id = await this.props.createGroup(group.name);\n this.setState({\n isAddingGroup: false,\n categoryGroups: addGroup(categoryGroups, {\n ...group,\n is_income: 0,\n categories: group.categories || [],\n id\n })\n });\n } else {\n this.props.updateGroup(group);\n this.setState({\n categoryGroups: updateGroup(categoryGroups, group)\n });\n }\n };\n\n onDeleteGroup = async id => {\n let { categoryGroups } = this.state;\n let group = categoryGroups.find(g => g.id === id);\n\n let mustTransfer = false;\n for (let category of group.categories) {\n if (await send('must-category-transfer', { id: category.id })) {\n mustTransfer = true;\n break;\n }\n }\n\n if (mustTransfer) {\n this.props.pushModal('confirm-category-delete', {\n group: id,\n onDelete: transferCategory => {\n this.props.deleteGroup(id, transferCategory);\n\n this.setState({\n categoryGroups: deleteGroup(categoryGroups, id)\n });\n }\n });\n } else {\n this.props.deleteGroup(id);\n\n this.setState({\n categoryGroups: deleteGroup(categoryGroups, id)\n });\n }\n };\n\n onBudgetAction = (month, type, args) => {\n this.props.applyBudgetAction(month, type, args);\n };\n\n onShowActivity = (categoryName, categoryId, month) => {\n const after = `${month}-01`;\n const before = `${month}-31`;\n\n this.props.history.push({\n pathname: '/accounts',\n state: {\n goBack: true,\n filterName: `${categoryName} (${monthUtils.format(\n month,\n 'MMMM yyyy'\n )})`,\n filter: {\n category: categoryId,\n date: { $transform: '$month', $eq: month }\n }\n }\n });\n };\n\n onReorderCategory = async sortInfo => {\n let { categoryGroups } = this.state;\n\n this.props.moveCategory(sortInfo.id, sortInfo.groupId, sortInfo.targetId);\n this.setState({\n categoryGroups: moveCategory(\n categoryGroups,\n sortInfo.id,\n sortInfo.groupId,\n sortInfo.targetId\n )\n });\n };\n\n onReorderGroup = async sortInfo => {\n let { categoryGroups } = this.state;\n\n this.props.moveCategoryGroup(sortInfo.id, sortInfo.targetId);\n this.setState({\n categoryGroups: moveCategoryGroup(\n categoryGroups,\n sortInfo.id,\n sortInfo.targetId\n )\n });\n };\n\n onToggleCollapse = () => {\n let collapsed = !this.state.summaryCollapsed;\n this.setState({ summaryCollapsed: collapsed });\n this.props.savePrefs({ 'budget.summaryCollapsed': collapsed });\n };\n\n onTitlebarEvent = async msg => {\n switch (msg) {\n case 'budget/switch-type': {\n let type = this.props.budgetType;\n let newType = type === 'rollover' ? 'report' : 'rollover';\n\n this.props.spreadsheet.disableObservers();\n await send('budget-set-type', { type: newType });\n await this.prewarmAllMonths(this.state.bounds, newType);\n this.props.spreadsheet.enableObservers();\n this.props.loadPrefs();\n break;\n }\n default:\n }\n };\n\n render() {\n let {\n maxMonths,\n budgetType: type,\n reportComponents,\n rolloverComponents\n } = this.props;\n let {\n initialized,\n categoryGroups,\n prewarmStartMonth,\n startMonth,\n newCategoryForGroup,\n isAddingGroup,\n collapsed,\n summaryCollapsed,\n bounds\n } = this.state;\n\n maxMonths = maxMonths || 1;\n\n if (!initialized || !categoryGroups) {\n return null;\n }\n\n let table;\n if (type === 'report') {\n table = (\n <ReportProvider\n summaryCollapsed={summaryCollapsed}\n onBudgetAction={this.onBudgetAction}\n onToggleSummaryCollapse={this.onToggleCollapse}\n >\n <DynamicBudgetTable\n ref={el => (this.table = el)}\n type={type}\n categoryGroups={categoryGroups}\n prewarmStartMonth={prewarmStartMonth}\n startMonth={startMonth}\n monthBounds={bounds}\n maxMonths={maxMonths}\n collapsed={collapsed}\n setCollapsed={this.setCollapsed}\n newCategoryForGroup={newCategoryForGroup}\n isAddingGroup={isAddingGroup}\n dataComponents={reportComponents}\n onMonthSelect={this.onMonthSelect}\n onShowNewCategory={this.onShowNewCategory}\n onHideNewCategory={this.onHideNewCategory}\n onShowNewGroup={this.onShowNewGroup}\n onHideNewGroup={this.onHideNewGroup}\n onDeleteCategory={this.onDeleteCategory}\n onDeleteGroup={this.onDeleteGroup}\n onSaveCategory={this.onSaveCategory}\n onSaveGroup={this.onSaveGroup}\n onBudgetAction={this.onBudgetAction}\n onShowActivity={this.onShowActivity}\n onReorderCategory={this.onReorderCategory}\n onReorderGroup={this.onReorderGroup}\n />\n </ReportProvider>\n );\n } else {\n table = (\n <RolloverContext\n categoryGroups={categoryGroups}\n summaryCollapsed={summaryCollapsed}\n onBudgetAction={this.onBudgetAction}\n onToggleSummaryCollapse={this.onToggleCollapse}\n >\n <DynamicBudgetTable\n ref={el => (this.table = el)}\n type={type}\n categoryGroups={categoryGroups}\n prewarmStartMonth={prewarmStartMonth}\n startMonth={startMonth}\n monthBounds={bounds}\n maxMonths={maxMonths}\n collapsed={collapsed}\n setCollapsed={this.setCollapsed}\n newCategoryForGroup={newCategoryForGroup}\n isAddingGroup={isAddingGroup}\n dataComponents={rolloverComponents}\n onMonthSelect={this.onMonthSelect}\n onShowNewCategory={this.onShowNewCategory}\n onHideNewCategory={this.onHideNewCategory}\n onShowNewGroup={this.onShowNewGroup}\n onHideNewGroup={this.onHideNewGroup}\n onDeleteCategory={this.onDeleteCategory}\n onDeleteGroup={this.onDeleteGroup}\n onSaveCategory={this.onSaveCategory}\n onSaveGroup={this.onSaveGroup}\n onBudgetAction={this.onBudgetAction}\n onShowActivity={this.onShowActivity}\n onReorderCategory={this.onReorderCategory}\n onReorderGroup={this.onReorderGroup}\n />\n </RolloverContext>\n );\n }\n\n return (\n <View style={{ flex: 1 }} innerRef={el => (this.page = el)}>\n {table}\n </View>\n );\n }\n}\n\nfunction BudgetWrapper(props) {\n let spreadsheet = useContext(SpreadsheetContext);\n let titlebar = useContext(TitlebarContext);\n\n let reportComponents = useMemo(\n () => ({\n SummaryComponent: report.BudgetSummary,\n ExpenseCategoryComponent: report.ExpenseCategoryMonth,\n ExpenseGroupComponent: report.ExpenseGroupMonth,\n IncomeCategoryComponent: report.IncomeCategoryMonth,\n IncomeGroupComponent: report.IncomeGroupMonth,\n BudgetTotalsComponent: report.BudgetTotalsMonth,\n IncomeHeaderComponent: report.IncomeHeaderMonth\n }),\n [report]\n );\n\n let rolloverComponents = useMemo(\n () => ({\n SummaryComponent: rollover.BudgetSummary,\n ExpenseCategoryComponent: rollover.ExpenseCategoryMonth,\n ExpenseGroupComponent: rollover.ExpenseGroupMonth,\n IncomeCategoryComponent: rollover.IncomeCategoryMonth,\n IncomeGroupComponent: rollover.IncomeGroupMonth,\n BudgetTotalsComponent: rollover.BudgetTotalsMonth,\n IncomeHeaderComponent: rollover.IncomeHeaderMonth\n }),\n [rollover]\n );\n\n // In a previous iteration, the wrapper needs `overflow: hidden` for\n // some reason. Without it at certain dimensions the width/height\n // that autosizer gives us is slightly wrong, causing scrollbars to\n // appear. We might not need it anymore?\n return (\n <View\n style={[\n styles.page,\n { paddingLeft: 8, paddingRight: 8, overflow: 'hidden' }\n ]}\n >\n <Budget\n {...props}\n reportComponents={reportComponents}\n rolloverComponents={rolloverComponents}\n spreadsheet={spreadsheet}\n titlebar={titlebar}\n />\n </View>\n );\n}\n\nexport default connect(\n state => ({\n collapsedPrefs: state.prefs.local['budget.collapsed'],\n summaryCollapsed: state.prefs.local['budget.summaryCollapsed'],\n budgetType: state.prefs.local.budgetType || 'rollover',\n maxMonths: state.prefs.global.maxMonths,\n categoryGroups: state.queries.categories.grouped\n }),\n actions\n)(BudgetWrapper);\n","import { useMemo } from 'react';\nimport q, { runQuery } from 'loot-core/src/client/query-helpers';\n\nexport function useArgsMemo(func) {\n return (...args) => {\n return useMemo(() => func(...args), args);\n };\n}\n\nexport function fromDateRepr(date) {\n return date.slice(0, 7);\n}\n\nexport function fromDateReprToDay(date) {\n return date;\n}\n\nexport function toDateRepr(str) {\n return parseInt(str.replace(/-/g, ''), 10);\n}\n\nexport async function runAll(queries, cb) {\n let data = await Promise.all(\n queries.map(q => {\n return runQuery(q).then(({ data }) => data);\n })\n );\n cb(data);\n}\n\nexport function index(data, field, mapper) {\n const result = {};\n data.forEach(item => {\n result[mapper ? mapper(item[field]) : item[field]] = item;\n });\n return result;\n}\n","import { colors } from 'loot-design/src/style';\n\nlet colorFades = {\n blueFadeStart: 'rgba(229, 245, 255, 1)',\n blueFadeEnd: 'rgba(229, 245, 255, 0)',\n redFadeStart: 'rgba(255, 243, 242, 1)',\n redFadeEnd: 'rgba(255, 243, 242, 0)'\n};\n\n// Typography\nconst sansSerif =\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", \"Helvetica\", \"Arial\", sans-serif';\nconst letterSpacing = 'normal';\nconst fontSize = 13;\n\n// Labels\nconst baseLabelStyles = {\n fontFamily: sansSerif,\n fontSize,\n letterSpacing,\n fill: colors.n1,\n stroke: 'transparent'\n};\n\nexport default {\n colors: {\n ...colorFades,\n red: colors.r7,\n blue: colors.b6\n },\n area: {\n style: {\n data: {\n stroke: colors.b6,\n strokeWidth: 2,\n strokeLinejoin: 'round',\n strokeLinecap: 'round'\n }\n }\n },\n axis: {\n style: {\n axis: {\n fill: 'transparent',\n stroke: 'none'\n },\n grid: {\n fill: 'none',\n stroke: 'none',\n pointerEvents: 'none'\n },\n ticks: {\n fill: 'transparent',\n size: 1,\n stroke: 'none'\n },\n tickLabels: baseLabelStyles\n }\n },\n dependentAxis: {\n style: {\n grid: { stroke: 'rgba(0,0,0,.2)', strokeDasharray: '1,1' },\n tickLabels: { padding: 5 }\n }\n },\n independentAxis: {\n style: {\n axis: { stroke: 'rgba(0,0,0,.2)' },\n tickLabels: { padding: 10 }\n }\n },\n bar: {\n style: {\n data: { fill: colors.b6, stroke: 'none' }\n }\n },\n line: {\n style: {\n data: {\n fill: 'none',\n stroke: colors.b6,\n strokeWidth: 2,\n strokeLinejoin: 'round',\n strokeLinecap: 'round'\n }\n }\n },\n chart: {\n padding: {\n top: 20,\n left: 65,\n right: 20,\n bottom: 50\n }\n }\n};\n","import React from 'react';\nimport { View } from 'loot-design/src/components/common';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nclass Container extends React.Component {\n render() {\n const { style, children } = this.props;\n\n return (\n <View\n style={[{ height: 300, position: 'relative', flexShrink: 0 }, style]}\n >\n <div ref={el => (this.portalHost = el)} />\n <AutoSizer>\n {({ width, height }) => (\n <div style={{ width, height }}>\n {children(width, height, this.portalHost)}\n </div>\n )}\n </AutoSizer>\n </View>\n );\n }\n}\n\nexport default Container;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { VictoryTooltip } from 'victory';\nimport { css, before } from 'glamor';\nimport { colors } from 'loot-design/src/style';\n\nclass Tooltip extends React.Component {\n static defaultEvents = VictoryTooltip.defaultEvents;\n\n render() {\n let {\n active,\n x,\n y,\n scale,\n datum,\n portalHost,\n offsetX = 0,\n offsetY,\n position,\n light,\n forceActive,\n style\n } = this.props;\n const xRange = scale.x.range();\n const xPos = x - xRange[0];\n\n if (!position) {\n if (datum.labelPosition) {\n position = datum.labelPosition;\n } else {\n position = xPos < 150 ? 'right' : 'left';\n }\n }\n\n if (!portalHost || (!active && !forceActive)) {\n return null;\n }\n\n y = offsetY ? offsetY(y) : y;\n\n return ReactDOM.createPortal(\n <div\n {...css(\n {\n position: 'absolute',\n top: 0,\n left: offsetX,\n // prettier-ignore\n transform: position === 'right' ?\n `translate(calc(${x}px + 15px), calc(${y}px ${light ? '' : '- 50%'}))` :\n `translate(calc(${x}px - 100% - 15px), calc(${y}px ${light ? '' : '- 50%'}))`,\n zIndex: 1000,\n pointerEvents: 'none',\n borderRadius: 2,\n boxShadow: light ? 'none' : '0 1px 6px rgba(0, 0, 0, .20)',\n // TODO: Transparent background\n backgroundColor: light ? 'transparent' : colors.n1,\n color: light ? 'inherit' : 'white',\n padding: 10\n },\n !light &&\n before({\n position: 'absolute',\n display: 'inline-block',\n borderTop: '7px solid transparent',\n borderBottom: '7px solid transparent',\n [position === 'right' ? 'borderRight' : 'borderLeft']:\n '7px solid ' + colors.n1,\n [position === 'right' ? 'left' : 'right']: -6,\n top: 'calc(50% - 7px)',\n content: '\" \"'\n }),\n style\n )}\n >\n {datum.premadeLabel}\n </div>,\n portalHost\n );\n }\n}\n\nexport default Tooltip;\n","import { useContext, useState, useEffect } from 'react';\n\nimport SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext';\n\nfunction useReport(sheetName, getData) {\n const spreadsheet = useContext(SpreadsheetContext);\n const [results, setResults] = useState(null);\n\n useEffect(() => {\n let cleanup;\n getData(spreadsheet, results => setResults(results)).then(c => {\n cleanup = c;\n });\n return () => {\n cleanup && cleanup();\n };\n }, [getData]);\n\n return results;\n}\n\nexport default useReport;\n","import React from 'react';\nimport { mergeObjects, flattenArray } from 'loot-core/src/shared/util';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport * as d from 'date-fns';\nimport { AlignedText } from 'loot-design/src/components/common';\nimport q, { runQuery } from 'loot-core/src/client/query-helpers';\nimport {\n integerToCurrency,\n integerToAmount,\n amountToInteger\n} from 'loot-core/src/shared/util';\nimport { fromDateRepr, runAll, index } from '../util';\n\nexport default function createSpreadsheet(start, end, accounts) {\n return async (spreadsheet, setData) => {\n if (accounts.length === 0) {\n return null;\n }\n\n const data = await Promise.all(\n accounts.map(async acct => {\n let [starting, balances] = await Promise.all([\n runQuery(\n q('transactions')\n .filter({ account: acct.id, date: { $lt: start + '-01' } })\n .calculate({ $sum: '$amount' })\n ).then(({ data }) => data),\n\n runQuery(\n q('transactions')\n .filter({\n account: acct.id,\n $and: [\n { date: { $gte: start + '-01' } },\n { date: { $lte: end + '-31' } }\n ]\n })\n .groupBy({ $month: '$date' })\n .select([\n { date: { $month: '$date' } },\n { amount: { $sum: '$amount' } }\n ])\n ).then(({ data }) => data)\n ]);\n\n return {\n id: acct.id,\n balances: index(balances, 'date'),\n starting\n };\n })\n );\n\n setData(recalculate(data, start, end));\n };\n}\n\nfunction recalculate(data, start, end) {\n const months = monthUtils.rangeInclusive(start, end);\n\n const accountBalances = data.map(account => {\n // Start off with the balance at that point in time\n let balance = account.starting;\n return months.map(month => {\n if (account.balances[month]) {\n balance += account.balances[month].amount;\n }\n return balance;\n });\n });\n\n let hasNegative = false;\n let startNetWorth = 0;\n let endNetWorth = 0;\n\n const graphData = months.reduce((arr, month, idx) => {\n let debt = 0;\n let assets = 0;\n let total = 0;\n const last = arr.length === 0 ? null : arr[arr.length - 1];\n\n accountBalances.forEach(balances => {\n const balance = balances[idx];\n if (balance < 0) {\n debt += -balance;\n } else {\n assets += balance;\n }\n total += balance;\n });\n\n if (total < 0) {\n hasNegative = true;\n }\n\n const x = d.parseISO(month + '-01');\n const change = last ? total - amountToInteger(last.y) : 0;\n\n const label = (\n <div>\n <div style={{ marginBottom: 10 }}>\n <strong>{d.format(x, 'MMMM yyyy')}</strong>\n </div>\n <div style={{ lineHeight: 1.5 }}>\n <AlignedText left=\"Assets:\" right={integerToCurrency(assets)} />\n <AlignedText left=\"Debt:\" right={`-${integerToCurrency(debt)}`} />\n <AlignedText\n left=\"Net worth:\"\n right={<strong>{integerToCurrency(total)}</strong>}\n />\n <AlignedText left=\"Change:\" right={integerToCurrency(change)} />\n </div>\n </div>\n );\n\n if (arr.length === 0) {\n startNetWorth = total;\n }\n endNetWorth = total;\n\n arr.push({ x, y: integerToAmount(total), premadeLabel: label });\n return arr;\n }, []);\n\n return {\n graphData: {\n data: graphData,\n hasNegative,\n start,\n end\n },\n netWorth: endNetWorth,\n totalChange: endNetWorth - startNetWorth\n };\n}\n","import React from 'react';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport * as d from 'date-fns';\nimport { AlignedText } from 'loot-design/src/components/common';\nimport { integerToCurrency, integerToAmount } from 'loot-core/src/shared/util';\nimport q from 'loot-core/src/client/query-helpers';\nimport { fromDateRepr, fromDateReprToDay, runAll, index } from '../util';\n\nexport function simpleCashFlow(start, end) {\n return async (spreadsheet, setData) => {\n function makeQuery() {\n return q('transactions')\n .filter({\n $and: [{ date: { $gte: start } }, { date: { $lte: end } }],\n 'account.offbudget': false,\n $or: [\n {\n 'payee.transfer_acct.offbudget': true,\n 'payee.transfer_acct': null\n }\n ]\n })\n .calculate({ $sum: '$amount' });\n }\n\n return runAll(\n [\n makeQuery().filter({ amount: { $gt: 0 } }),\n makeQuery().filter({ amount: { $lt: 0 } })\n ],\n data => {\n setData({\n graphData: {\n income: data[0],\n expense: data[1]\n }\n });\n }\n );\n };\n}\n\nexport function cashFlowByDate(start, end, isConcise) {\n return async (spreadsheet, setData) => {\n function makeQuery(where) {\n let query = q('transactions').filter({\n $and: [\n { date: { $transform: '$month', $gte: start } },\n { date: { $transform: '$month', $lte: end } }\n ],\n 'account.offbudget': false,\n $or: [\n {\n 'payee.transfer_acct.offbudget': true,\n 'payee.transfer_acct': null\n }\n ]\n });\n\n if (isConcise) {\n return query\n .groupBy({ $month: '$date' })\n .select([\n { date: { $month: '$date' } },\n { amount: { $sum: '$amount' } }\n ]);\n }\n\n return query\n .groupBy('date')\n .select(['date', { amount: { $sum: '$amount' } }]);\n }\n\n return runAll(\n [\n q('transactions')\n .filter({\n date: { $transform: '$month', $lt: start },\n 'account.offbudget': false\n })\n .calculate({ $sum: '$amount' }),\n makeQuery('amount > 0').filter({ amount: { $gt: 0 } }),\n makeQuery('amount < 0').filter({ amount: { $lt: 0 } })\n ],\n data => {\n setData(recalculate(data, start, end, isConcise));\n }\n );\n };\n}\n\nfunction recalculate(data, start, end, isConcise) {\n let [startingBalance, income, expense] = data;\n const dates = isConcise\n ? monthUtils.rangeInclusive(\n monthUtils.getMonth(start),\n monthUtils.getMonth(end)\n )\n : monthUtils.dayRangeInclusive(start, end);\n const incomes = index(\n income,\n 'date',\n isConcise ? fromDateRepr : fromDateReprToDay\n );\n const expenses = index(\n expense,\n 'date',\n isConcise ? fromDateRepr : fromDateReprToDay\n );\n\n let balance = startingBalance;\n let totalExpenses = 0;\n let totalIncome = 0;\n const graphData = dates.reduce(\n (res, date) => {\n let income = 0;\n let expense = 0;\n\n if (incomes[date]) {\n income = incomes[date].amount;\n }\n if (expenses[date]) {\n expense = expenses[date].amount;\n }\n\n totalExpenses += expense;\n totalIncome += income;\n balance += income + expense;\n const x = d.parseISO(date);\n\n const label = (\n <div>\n <div style={{ marginBottom: 10 }}>\n <strong>\n {d.format(x, isConcise ? 'MMMM yyyy' : 'MMMM d, yyyy')}\n </strong>\n </div>\n <div style={{ lineHeight: 1.5 }}>\n <AlignedText left=\"Income:\" right={integerToCurrency(income)} />\n <AlignedText left=\"Expenses:\" right={integerToCurrency(expense)} />\n <AlignedText\n left=\"Change:\"\n right={<strong>{integerToCurrency(income + expense)}</strong>}\n />\n <AlignedText left=\"Balance:\" right={integerToCurrency(balance)} />\n </div>\n </div>\n );\n\n res.income.push({ x, y: integerToAmount(income) });\n res.expenses.push({ x, y: integerToAmount(expense) });\n res.balances.push({\n x,\n y: integerToAmount(balance),\n premadeLabel: label,\n amount: balance\n });\n return res;\n },\n { expenses: [], income: [], balances: [] }\n );\n\n const { balances } = graphData;\n\n return {\n graphData,\n balance: balances[balances.length - 1].amount,\n totalExpenses,\n totalIncome,\n totalChange: balances[balances.length - 1].amount - balances[0].amount\n };\n}\n","import React from 'react';\nimport {\n VictoryChart,\n VictoryBar,\n VictoryArea,\n VictoryAxis,\n VictoryVoronoiContainer,\n VictoryGroup\n} from 'victory';\nimport * as d from 'date-fns';\nimport Container from '../Container';\nimport Tooltip from '../Tooltip';\nimport theme from '../chart-theme';\n\nfunction Area({ start, end, data, style, scale, range }) {\n const zero = scale.y(0);\n\n const startX = scale.x(d.parseISO(start + '-01'));\n const endX = scale.x(d.parseISO(end + '-01'));\n\n if (startX < 0 || endX < 0) {\n return null;\n }\n\n return (\n <svg>\n <defs>\n <clipPath id=\"positive\">\n <rect\n x={startX}\n y={range.y[1]}\n width={endX - startX}\n height={zero - range.y[1] + 1}\n fill=\"#ffffff\"\n />\n </clipPath>\n <clipPath id=\"negative\">\n <rect\n x={startX}\n y={zero + 1}\n width={endX - startX}\n height={range.y[0] - zero - 1}\n fill=\"#ffffff\"\n />\n </clipPath>\n <linearGradient\n id=\"positive-gradient\"\n gradientUnits=\"userSpaceOnUse\"\n x1={0}\n y1={range.y[1]}\n x2={0}\n y2={zero}\n >\n <stop offset=\"0%\" stopColor={theme.colors.blueFadeStart} />\n <stop offset=\"100%\" stopColor={theme.colors.blueFadeEnd} />\n </linearGradient>\n <linearGradient\n id=\"negative-gradient\"\n gradientUnits=\"userSpaceOnUse\"\n x1={0}\n y1={zero}\n x2={0}\n y2={range.y[0]}\n >\n <stop offset=\"0%\" stopColor={theme.colors.redFadeEnd} />\n <stop offset=\"100%\" stopColor={theme.colors.redFadeStart} />\n </linearGradient>\n </defs>\n </svg>\n );\n}\n\nfunction NetWorthGraph({ style, start, end, graphData, compact }) {\n const Chart = compact ? VictoryGroup : VictoryChart;\n\n return (\n <Container style={[style, compact && { height: 'auto' }]}>\n {(width, height, portalHost) =>\n graphData && (\n <Chart\n scale={{ x: 'time' }}\n theme={theme}\n domainPadding={{ x: 0, y: 10 }}\n width={width}\n height={height}\n containerComponent={\n <VictoryVoronoiContainer voronoiDimension=\"x\" />\n }\n padding={\n compact && {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n }\n }\n >\n <Area\n start={graphData.start}\n end={graphData.end}\n data={graphData.data}\n />\n {React.createElement(\n graphData.data.length === 1 ? VictoryBar : VictoryArea,\n {\n data: graphData.data,\n labelComponent: <Tooltip portalHost={portalHost} />,\n labels: x => x.premadeLabel,\n style: {\n data:\n graphData.data.length === 1\n ? { width: 50 }\n : {\n clipPath: 'url(#positive)',\n fill: 'url(#positive-gradient)'\n }\n }\n }\n )}\n {graphData.data.length > 1 && (\n <VictoryArea\n data={graphData.data}\n style={{\n data: {\n clipPath: 'url(#negative)',\n fill: 'url(#negative-gradient)',\n stroke: theme.colors.red,\n strokeLinejoin: 'round'\n }\n }}\n />\n )}\n {!compact && (\n <VictoryAxis\n tickFormat={x => d.format(x, \"MMM ''yy\")}\n tickValues={graphData.data.map(item => item.x)}\n tickCount={Math.min(5, graphData.data.length)}\n offsetY={50}\n />\n )}\n {!compact && (\n <VictoryAxis dependentAxis crossAxis={!graphData.hasNegative} />\n )}\n </Chart>\n )\n }\n </Container>\n );\n}\n\nexport default NetWorthGraph;\n","import React from 'react';\nimport { styles } from 'loot-design/src/style';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { Block } from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style'\n\nfunction Change({ amount, style }) {\n return (\n <Block\n style={[styles.smallText, { color: amount < 0 ? colors.r5 : colors.g5 }]}\n >\n {amount >= 0 ? '+' : ''}\n {integerToCurrency(amount)}\n </Block>\n );\n}\n\nexport default Change;\n","import React from 'react';\nimport * as d from 'date-fns';\nimport { colors } from 'loot-design/src/style';\nimport { Block } from 'loot-design/src/components/common';\n\nfunction DateRange({ start, end }) {\n start = d.parseISO(start);\n end = d.parseISO(end);\n\n let content;\n if (start.getYear() !== end.getYear()) {\n content = (\n <div>\n {d.format(start, 'MMM yyyy')} - {d.format(end, 'MMM yyyy')}\n </div>\n );\n } else if (start.getMonth() !== end.getMonth()) {\n content = (\n <div>\n {d.format(start, 'MMM')} - {d.format(end, 'MMM yyyy')}\n </div>\n );\n } else {\n content = d.format(end, 'MMMM yyyy');\n }\n\n return <Block style={{ color: colors.n6 }}>{content}</Block>;\n}\n\nexport default DateRange;\n","import React from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport { VictoryBar, VictoryGroup, VictoryVoronoiContainer } from 'victory';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View, Block, AnchorLink } from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { useArgsMemo } from './util';\nimport theme from './chart-theme';\nimport Container from './Container';\nimport Tooltip from './Tooltip';\nimport useReport from './useReport';\nimport netWorthSpreadsheet from './graphs/net-worth-spreadsheet';\nimport { simpleCashFlow } from './graphs/cash-flow-spreadsheet';\nimport NetWorthGraph from './graphs/NetWorthGraph';\nimport Change from './Change';\nimport DateRange from './DateRange';\n\nfunction Card({ flex, to, style, children }) {\n const containerProps = { flex, margin: 15 };\n\n const content = (\n <View\n style={[\n {\n backgroundColor: 'white',\n borderRadius: 2,\n height: 200,\n boxShadow: '0 2px 6px rgba(0, 0, 0, .15)',\n transition: 'box-shadow .25s',\n ':hover': to && {\n boxShadow: '0 4px 6px rgba(0, 0, 0, .15)'\n }\n },\n to ? null : containerProps,\n style\n ]}\n >\n {children}\n </View>\n );\n\n if (to) {\n return (\n <AnchorLink\n to={to}\n exact\n style={[{ textDecoration: 'none', flex }, containerProps]}\n >\n {content}\n </AnchorLink>\n );\n }\n return content;\n}\n\nfunction NetWorthCard({ accounts }) {\n const end = monthUtils.currentMonth();\n const start = monthUtils.subMonths(end, 5);\n\n const data = useReport(\n 'net_worth',\n useArgsMemo(netWorthSpreadsheet)(start, end, accounts)\n );\n\n if (!data) {\n return null;\n }\n\n return (\n <Card flex={2} to=\"/reports/net-worth\">\n <View style={{ flex: 1 }}>\n <View style={{ flexDirection: 'row', padding: 20 }}>\n <View style={{ flex: 1 }}>\n <Block\n style={[styles.mediumText, { fontWeight: 500, marginBottom: 5 }]}\n >\n Net Worth\n </Block>\n <DateRange start={start} end={end} />\n </View>\n <View style={{ textAlign: 'right' }}>\n <Block\n style={[styles.mediumText, { fontWeight: 500, marginBottom: 5 }]}\n >\n {integerToCurrency(data.netWorth)}\n </Block>\n <Change\n amount={data.totalChange}\n style={{ color: colors.n6, fontWeight: 300 }}\n />\n </View>\n </View>\n\n <NetWorthGraph\n start={start}\n end={end}\n graphData={data.graphData}\n compact={true}\n style={{ height: 'auto', flex: 1 }}\n />\n </View>\n </Card>\n );\n}\n\nfunction CashFlowCard() {\n const end = monthUtils.currentDay();\n const start = monthUtils.currentMonth() + '-01';\n\n const data = useReport('cash_flow_simple', useArgsMemo(simpleCashFlow)(start, end));\n if (!data) {\n return null;\n }\n\n const { graphData } = data;\n const expense = -(graphData.expense || 0);\n const income = graphData.income || 0;\n\n return (\n <Card flex={1} to=\"/reports/cash-flow\">\n <View style={{ flex: 1 }}>\n <View style={{ flexDirection: 'row', padding: 20 }}>\n <View style={{ flex: 1 }}>\n <Block\n style={[styles.mediumText, { fontWeight: 500, marginBottom: 5 }]}\n >\n Cash Flow\n </Block>\n <DateRange start={start} end={end} />\n </View>\n <View style={{ textAlign: 'right' }}>\n <Change\n amount={income - expense}\n style={{ color: colors.n6, fontWeight: 300 }}\n />\n </View>\n </View>\n\n <Container style={{ height: 'auto', flex: 1 }}>\n {(width, height, portalHost) => (\n <VictoryGroup\n colorScale={[theme.colors.blue, theme.colors.red]}\n width={100}\n height={height}\n theme={theme}\n domain={{\n x: [0, 100],\n y: [0, Math.max(income, expense, 100)]\n }}\n containerComponent={\n <VictoryVoronoiContainer voronoiDimension=\"x\" />\n }\n labelComponent={\n <Tooltip\n portalHost={portalHost}\n offsetX={(width - 100) / 2}\n offsetY={y => (y + 40 > height ? height - 40 : y)}\n light={true}\n forceActive={true}\n style={{\n padding: 0\n }}\n />\n }\n padding={{\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n }}\n >\n <VictoryBar\n data={[\n {\n x: 30,\n y: Math.max(income, 5),\n width: 20,\n premadeLabel: (\n <div style={{ textAlign: 'right' }}>\n <div>Income</div>\n <div>{integerToCurrency(income)}</div>\n </div>\n ),\n labelPosition: 'left'\n }\n ]}\n labels={d => d.premadeLabel}\n />\n <VictoryBar\n data={[\n {\n x: 60,\n y: Math.max(expense, 5),\n width: 20,\n premadeLabel: (\n <div>\n <div>Expenses</div>\n <div>{integerToCurrency(expense)}</div>\n </div>\n ),\n labelPosition: 'right',\n fill: theme.colors.red\n }\n ]}\n labels={d => d.premadeLabel}\n />\n </VictoryGroup>\n )}\n </Container>\n </View>\n </Card>\n );\n}\n\nfunction Overview({ accounts }) {\n return (\n <View\n style={[\n styles.page,\n { paddingLeft: 40, paddingRight: 40, minWidth: 700 }\n ]}\n >\n <View\n style={{\n flexDirection: 'row',\n flex: '0 0 auto'\n }}\n >\n <NetWorthCard accounts={accounts} />\n <CashFlowCard />\n </View>\n\n <View\n style={{\n flex: '0 0 auto',\n flexDirection: 'row'\n }}\n >\n <Card\n style={[\n {\n color: '#a0a0a0',\n justifyContent: 'center',\n alignItems: 'center',\n width: 200\n },\n styles.mediumText\n ]}\n >\n More reports\n <br /> coming soon!\n </Card>\n </View>\n </View>\n );\n}\n\nexport default connect(\n state => ({ accounts: state.queries.accounts }),\n dispatch => bindActionCreators(actions, dispatch)\n)(Overview);\n","import React from 'react';\nimport { colors, styles } from 'loot-design/src/style';\nimport {\n View,\n Select,\n Link,\n Button,\n ButtonLink\n} from 'loot-design/src/components/common';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport ArrowLeft from 'loot-design/src/svg/v1/ArrowLeft';\n\nfunction validateStart(allMonths, start, end) {\n const earliest = allMonths[allMonths.length - 1].name;\n if (end < start) {\n end = monthUtils.addMonths(start, 6);\n }\n return boundedRange(earliest, start, end);\n}\n\nfunction validateEnd(allMonths, start, end) {\n const earliest = allMonths[allMonths.length - 1].name;\n if (start > end) {\n start = monthUtils.subMonths(end, 6);\n }\n return boundedRange(earliest, start, end);\n}\n\nfunction boundedRange(earliest, start, end) {\n const latest = monthUtils.currentMonth();\n if (end > latest) {\n end = latest;\n }\n if (start < earliest) {\n start = earliest;\n }\n return [start, end];\n}\n\nfunction getLatestRange(offset) {\n const end = monthUtils.currentMonth();\n const start = monthUtils.subMonths(end, offset);\n return [start, end];\n}\n\nfunction getFullRange(allMonths) {\n const start = allMonths[allMonths.length - 1].name;\n const end = monthUtils.currentMonth();\n return [start, end];\n}\n\nfunction Header({ title, start, end, show1Month, allMonths, onChangeDates }) {\n return (\n <View\n style={{\n padding: 20,\n paddingTop: 0,\n flexShrink: 0\n }}\n >\n <ButtonLink\n to=\"/reports\"\n bare\n style={{ marginBottom: '15', alignSelf: 'flex-start' }}\n >\n <ArrowLeft width={10} height={10} style={{ marginRight: 5 }} /> Back\n </ButtonLink>\n <View style={styles.veryLargeText}>{title}</View>\n\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n marginTop: 15\n }}\n >\n <div>\n <Select\n style={{ flex: 0, backgroundColor: 'white' }}\n onChange={e =>\n onChangeDates(...validateStart(allMonths, e.target.value, end))\n }\n value={start}\n >\n {allMonths.map(month => (\n <option key={month.name} value={month.name}>\n {month.pretty}\n </option>\n ))}\n </Select>{' '}\n to{' '}\n <Select\n style={{ flex: 0, backgroundColor: 'white' }}\n onChange={e =>\n onChangeDates(...validateEnd(allMonths, start, e.target.value))\n }\n value={end}\n >\n {allMonths.map(month => (\n <option key={month.name} value={month.name}>\n {month.pretty}\n </option>\n ))}\n </Select>\n </div>\n {show1Month && (\n <Button\n bare\n style={{ marginLeft: 15 }}\n onClick={() => onChangeDates(...getLatestRange(1))}\n >\n 1 month\n </Button>\n )}\n <Button\n bare\n style={{ marginLeft: 15 }}\n onClick={() => onChangeDates(...getLatestRange(2))}\n >\n 3 months\n </Button>\n <Button\n bare\n style={{ marginLeft: 15 }}\n onClick={() => onChangeDates(...getLatestRange(5))}\n >\n 6 months\n </Button>\n <Button\n bare\n style={{ marginLeft: 15 }}\n onClick={() => onChangeDates(...getLatestRange(12))}\n >\n 1 Year\n </Button>\n <Button\n bare\n style={{ marginLeft: 15 }}\n onClick={() => onChangeDates(...getFullRange(allMonths))}\n >\n All Time\n </Button>\n </View>\n </View>\n );\n}\n\nexport default Header;\n","import React, { useState, useEffect } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport * as d from 'date-fns';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View, P } from 'loot-design/src/components/common';\nimport { styles } from 'loot-design/src/style';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport Header from './Header';\nimport { fromDateRepr } from './util';\nimport useReport from './useReport';\nimport netWorthSpreadsheet from './graphs/net-worth-spreadsheet';\nimport NetWorthGraph from './graphs/NetWorthGraph';\nimport Change from './Change';\nimport { useArgsMemo } from './util';\n\nfunction NetWorth({ accounts }) {\n const [earliestMonth, setEarliestMonth] = useState(null);\n const [allMonths, setAllMonths] = useState(null);\n const [start, setStart] = useState(\n monthUtils.subMonths(monthUtils.currentMonth(), 5)\n );\n const [end, setEnd] = useState(monthUtils.currentMonth());\n\n const data = useReport(\n 'net_worth',\n useArgsMemo(netWorthSpreadsheet)(start, end, accounts)\n );\n\n useEffect(() => {\n async function run() {\n const trans = await send('get-earliest-transaction');\n const currentMonth = monthUtils.currentMonth();\n let earliestMonth = trans\n ? monthUtils.monthFromDate(d.parseISO(fromDateRepr(trans.date)))\n : currentMonth;\n\n // Make sure the month selects are at least populates with a\n // year's worth of months. We can undo this when we have fancier\n // date selects.\n const yearAgo = monthUtils.subMonths(monthUtils.currentMonth(), 12);\n if (earliestMonth > yearAgo) {\n earliestMonth = yearAgo;\n }\n\n const allMonths = monthUtils\n .rangeInclusive(earliestMonth, monthUtils.currentMonth())\n .map(month => ({\n name: month,\n pretty: monthUtils.format(month, 'MMMM, yyyy')\n }))\n .reverse();\n\n setEarliestMonth(earliestMonth);\n setAllMonths(allMonths);\n }\n run();\n }, []);\n\n function onChangeDates(start, end) {\n setStart(start);\n setEnd(end);\n }\n\n if (!allMonths || !data) {\n return null;\n }\n\n return (\n <View style={[styles.page, { minWidth: 650, overflow: 'hidden' }]}>\n <Header\n title=\"Net Worth\"\n allMonths={allMonths}\n start={start}\n end={end}\n onChangeDates={onChangeDates}\n />\n <View\n style={{\n backgroundColor: 'white',\n padding: '30px',\n overflow: 'auto'\n }}\n >\n <View style={{ textAlign: 'right', paddingRight: 20, flexShrink: 0 }}>\n <View\n style={[styles.largeText, { fontWeight: 400, marginBottom: 5 }]}\n >\n {integerToCurrency(data.netWorth)}\n </View>\n <Change amount={data.totalChange} />\n </View>\n\n <NetWorthGraph start={start} end={end} graphData={data.graphData} />\n\n <View style={{ marginTop: 30 }}>\n <P>\n <strong>How is net worth calculated?</strong>\n </P>\n <P>\n Net worth shows the balance of all accounts over time, including all\n of your investments. Your \"net worth\" is considered to be the amount\n you'd have if you sold all your assets and paid off as much debt as\n possible. If you hover over the graph, you can also see the amount\n of assets and debt individually.\n </P>\n </View>\n </View>\n </View>\n );\n}\n\nexport default connect(\n state => ({ accounts: state.queries.accounts }),\n dispatch => bindActionCreators(actions, dispatch)\n)(NetWorth);\n","import React from 'react';\nimport {\n VictoryChart,\n VictoryBar,\n VictoryLine,\n VictoryAxis,\n VictoryVoronoiContainer,\n VictoryGroup\n} from 'victory';\nimport * as d from 'date-fns';\nimport Container from '../Container';\nimport Tooltip from '../Tooltip';\nimport theme from '../chart-theme';\nimport { colors } from 'loot-design/src/style';\n\nfunction CashFlowGraph({ style, start, end, graphData, isConcise, compact }) {\n return (\n <Container>\n {(width, height, portalHost) =>\n graphData && (\n <VictoryChart\n scale={{ x: 'time' }}\n theme={theme}\n domainPadding={10}\n width={width}\n height={height}\n containerComponent={\n <VictoryVoronoiContainer voronoiDimension=\"x\" />\n }\n >\n <VictoryGroup>\n <VictoryBar\n data={graphData.expenses}\n style={{ data: { fill: theme.colors.red } }}\n />\n <VictoryBar data={graphData.income} />\n </VictoryGroup>\n <VictoryLine\n data={graphData.balances}\n labelComponent={<Tooltip portalHost={portalHost} />}\n labels={x => x.premadeLabel}\n style={{\n data: { stroke: colors.n5 }\n }}\n />\n <VictoryAxis\n tickFormat={x => d.format(x, isConcise ? \"MMM ''yy\" : 'MMM d')}\n tickValues={graphData.balances.map(item => item.x)}\n tickCount={Math.min(5, graphData.balances.length)}\n offsetY={50}\n />\n <VictoryAxis dependentAxis crossAxis={false} />\n </VictoryChart>\n )\n }\n </Container>\n );\n}\n\nexport default CashFlowGraph;\n","import React, { useState, useEffect } from 'react';\nimport * as d from 'date-fns';\nimport {\n View,\n Text,\n Block,\n P,\n AlignedText\n} from 'loot-design/src/components/common';\nimport { styles } from 'loot-design/src/style';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { fromDateRepr } from './util';\nimport Header from './Header';\nimport Change from './Change';\nimport CashFlowGraph from './graphs/CashFlowGraph';\nimport { cashFlowByDate } from './graphs/cash-flow-spreadsheet';\nimport useReport from './useReport';\nimport { useArgsMemo } from './util';\nimport { colors } from 'loot-design/src/style';\n\nfunction CashFlow() {\n const [earliestMonth, setEarliestMonth] = useState(null);\n const [allMonths, setAllMonths] = useState(null);\n const [start, setStart] = useState(\n monthUtils.subMonths(monthUtils.currentMonth(), 30)\n );\n const [end, setEnd] = useState(monthUtils.currentDay());\n\n const [isConcise, setIsConcise] = useState(() => {\n const numDays = d.differenceInCalendarDays(\n d.parseISO(end),\n d.parseISO(start)\n );\n return numDays > 31 * 3;\n });\n\n const data = useReport(\n 'cash_flow',\n useArgsMemo(cashFlowByDate)(start, end, isConcise)\n );\n\n useEffect(() => {\n async function run() {\n const trans = await send('get-earliest-transaction');\n const earliestMonth = trans\n ? monthUtils.monthFromDate(d.parseISO(trans.date))\n : monthUtils.currentMonth();\n\n const allMonths = monthUtils\n .rangeInclusive(earliestMonth, monthUtils.currentMonth())\n .map(month => ({\n name: month,\n pretty: monthUtils.format(month, 'MMMM, yyyy')\n }))\n .reverse();\n\n setEarliestMonth(earliestMonth);\n setAllMonths(allMonths);\n }\n run();\n }, []);\n\n function onChangeDates(start, end) {\n const numDays = d.differenceInCalendarDays(\n d.parseISO(end),\n d.parseISO(start)\n );\n const isConcise = numDays > 31 * 3;\n\n let endDay = end + '-31';\n if (endDay > monthUtils.currentDay()) {\n endDay = monthUtils.currentDay();\n }\n\n setStart(start + '-01');\n setEnd(endDay);\n setIsConcise(isConcise);\n }\n\n if (!allMonths || !data) {\n return null;\n }\n\n const { graphData, balance, totalChange, totalExpenses, totalIncome } = data;\n\n return (\n <View style={[styles.page, { minWidth: 650, overflow: 'hidden' }]}>\n <Header\n title=\"Cash Flow\"\n allMonths={allMonths}\n start={monthUtils.getMonth(start)}\n end={monthUtils.getMonth(end)}\n show1Month={true}\n onChangeDates={onChangeDates}\n />\n <View\n style={{\n backgroundColor: 'white',\n paddingLeft: 30,\n paddingRight: 30,\n overflow: 'auto'\n }}\n >\n <View\n style={{\n paddingTop: 20,\n paddingRight: 20,\n flexShrink: 0,\n alignItems: 'flex-end',\n color: colors.n3\n }}\n >\n <AlignedText\n style={{ marginBottom: 5, minWidth: 160 }}\n left={<Block>Income:</Block>}\n right={\n <Text style={{ fontWeight: 600 }}>\n {integerToCurrency(totalIncome)}\n </Text>\n }\n />\n\n <AlignedText\n style={{ marginBottom: 5, minWidth: 160 }}\n left={<Block>Expenses:</Block>}\n right={\n <Text style={{ fontWeight: 600 }}>\n {integerToCurrency(totalExpenses)}\n </Text>\n }\n />\n <Text style={{ fontWeight: 600 }}>\n <Change amount={totalIncome + totalExpenses} />\n </Text>\n </View>\n\n <CashFlowGraph\n start={start}\n end={end}\n graphData={graphData}\n isConcise={isConcise}\n />\n\n <View style={{ marginTop: 30 }}>\n <P>\n <strong>How is cash flow calculated?</strong>\n </P>\n <P>\n Cash flow shows the balance of your budgeted accounts over time, and\n the amount of expenses/income each day or month. Your budgeted\n accounts are considered to be \"cash on hand\", so this gives you a\n picture of how available money fluctuates.\n </P>\n </View>\n </View>\n </View>\n );\n}\n\nexport default CashFlow;\n","import React from 'react';\nimport { Route } from 'react-router-dom';\nimport { View } from 'loot-design/src/components/common';\nimport Overview from './Overview';\nimport NetWorth from './NetWorth';\nimport CashFlow from './CashFlow';\n\nclass Reports extends React.Component {\n render() {\n return (\n <View style={{ flex: 1 }}>\n <Route path=\"/reports\" exact component={Overview} />\n <Route path=\"/reports/net-worth\" exact component={NetWorth} />\n <Route path=\"/reports/cash-flow\" exact component={CashFlow} />\n </View>\n );\n }\n}\n\nexport default Reports;\n","import React from 'react';\n\nconst SvgCheck = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCheck;\n","import React, { useMemo, useEffect, useState } from 'react';\nimport { CachedPayees } from 'loot-core/src/client/data-hooks/payees';\nimport { CachedAccounts } from 'loot-core/src/client/data-hooks/accounts';\nimport { getPayeesById } from 'loot-core/src/client/reducers/queries';\nimport { groupById } from 'loot-core/src/shared/util';\nimport { Text } from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\n\nexport default function DisplayId({ type, id, noneColor = colors.n8 }) {\n let DataComponent;\n\n switch (type) {\n case 'payees':\n DataComponent = CachedPayees;\n break;\n case 'accounts':\n DataComponent = CachedAccounts;\n break;\n default:\n throw new Error('DisplayId: unknown object type: ' + type);\n }\n\n return (\n <DataComponent idKey={true}>\n {data => {\n let item = data[id];\n\n return (\n <Text\n style={item == null ? { color: noneColor } : null}\n title={item ? item.name : 'None'}\n >\n {item ? item.name : 'None'}\n </Text>\n );\n }}\n </DataComponent>\n );\n}\n","import React, { useState, useMemo } from 'react';\nimport { useSelector } from 'react-redux';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { colors, styles } from 'loot-design/src/style';\nimport {\n View,\n Text,\n Button,\n Tooltip,\n Menu\n} from 'loot-design/src/components/common';\nimport {\n Table,\n TableHeader,\n Row,\n Field,\n Cell,\n SelectCell\n} from 'loot-design/src/components/table';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { getScheduledAmount } from 'loot-core/src/shared/schedules';\nimport DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple';\nimport Check from 'loot-design/src/svg/v2/Check';\nimport DisplayId from '../util/DisplayId';\nimport { StatusBadge } from './StatusBadge';\n\nexport let ROW_HEIGHT = 43;\n\nfunction OverflowMenu({ schedule, status, onAction }) {\n let [open, setOpen] = useState(false);\n\n return (\n <View>\n <Button\n bare\n onClick={e => {\n e.stopPropagation();\n setOpen(true);\n }}\n >\n <DotsHorizontalTriple\n width={15}\n height={15}\n style={{ color: 'inherit', transform: 'rotateZ(90deg)' }}\n />\n </Button>\n {open && (\n <Tooltip\n position=\"bottom-right\"\n width={150}\n style={{ padding: 0 }}\n onClose={() => setOpen(false)}\n >\n <Menu\n onMenuSelect={name => {\n onAction(name, schedule.id);\n setOpen(false);\n }}\n items={[\n status === 'due' && {\n name: 'post-transaction',\n text: 'Post transaction'\n },\n ...(schedule.completed\n ? [{ name: 'restart', text: 'Restart' }]\n : [\n { name: 'skip', text: 'Skip next date' },\n { name: 'complete', text: 'Complete' }\n ]),\n { name: 'delete', text: 'Delete' }\n ]}\n />\n </Tooltip>\n )}\n </View>\n );\n}\n\nexport function ScheduleAmountCell({ amount, op }) {\n let num = getScheduledAmount(amount);\n let str = integerToCurrency(Math.abs(num || 0));\n let isApprox = op === 'isapprox' || op === 'isbetween';\n\n return (\n <Cell\n width={100}\n plain\n style={{\n textAlign: 'right',\n flexDirection: 'row',\n alignItems: 'center',\n padding: '0 5px'\n }}\n >\n {isApprox && (\n <View\n style={{\n textAlign: 'left',\n color: colors.n7,\n lineHeight: '1em',\n marginRight: 10\n }}\n title={(isApprox ? 'Approximately ' : '') + str}\n >\n ~\n </View>\n )}\n <Text\n style={{\n flex: 1,\n color: num > 0 ? colors.g5 : null,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }}\n title={(isApprox ? 'Approximately ' : '') + str}\n >\n {num > 0 ? `+${str}` : `${str}`}\n </Text>\n </Cell>\n );\n}\n\nexport function SchedulesTable({\n schedules,\n statuses,\n minimal,\n allowCompleted,\n style,\n onSelect,\n onAction\n}) {\n let dateFormat = useSelector(state => {\n return state.prefs.local.dateFormat || 'MM/dd/yyyy';\n });\n\n let [showCompleted, setShowCompleted] = useState(false);\n\n let items = useMemo(() => {\n if (!allowCompleted) {\n return schedules.filter(s => !s.completed);\n }\n if (showCompleted) {\n return schedules;\n }\n let arr = schedules.filter(s => !s.completed);\n if (schedules.find(s => s.completed)) {\n arr.push({ type: 'show-completed' });\n }\n return arr;\n }, [schedules, showCompleted, allowCompleted]);\n\n function renderSchedule({ item }) {\n return (\n <Row\n height={ROW_HEIGHT}\n inset={15}\n backgroundColor=\"transparent\"\n onClick={() => onSelect(item.id)}\n style={{\n cursor: 'pointer',\n backgroundColor: 'white',\n ':hover': { backgroundColor: colors.hover }\n }}\n >\n <Field width=\"flex\">\n <DisplayId type=\"payees\" id={item._payee} />\n </Field>\n <Field width=\"flex\">\n <DisplayId type=\"accounts\" id={item._account} />\n </Field>\n <Field width={110}>\n {item.next_date\n ? monthUtils.format(item.next_date, dateFormat)\n : null}\n </Field>\n <Field width={120} style={{ alignItems: 'flex-start' }}>\n <StatusBadge status={statuses.get(item.id)} />\n </Field>\n <ScheduleAmountCell amount={item._amount} op={item._amountOp} />\n {!minimal && (\n <Field width={80} style={{ textAlign: 'center' }}>\n {item._date && item._date.frequency && (\n <Check style={{ width: 13, height: 13 }} />\n )}\n </Field>\n )}\n {!minimal && (\n <Field width={40}>\n <OverflowMenu\n schedule={item}\n status={statuses.get(item.id)}\n onAction={onAction}\n />\n </Field>\n )}\n </Row>\n );\n }\n\n function renderItem({ item }) {\n if (item.type === 'show-completed') {\n return (\n <Row\n height={ROW_HEIGHT}\n inset={15}\n backgroundColor=\"transparent\"\n style={{\n cursor: 'pointer',\n backgroundColor: 'white',\n ':hover': { backgroundColor: colors.hover }\n }}\n onClick={() => setShowCompleted(true)}\n >\n <Field\n width=\"flex\"\n style={{\n fontStyle: 'italic',\n textAlign: 'center',\n color: colors.n6\n }}\n >\n Show completed schedules\n </Field>\n </Row>\n );\n }\n return renderSchedule({ item });\n }\n\n return (\n <>\n <TableHeader height={ROW_HEIGHT} inset={15} version=\"v2\">\n <Field width=\"flex\">Payee</Field>\n <Field width=\"flex\">Account</Field>\n <Field width={110}>Next date</Field>\n <Field width={120}>Status</Field>\n <Field width={100} style={{ textAlign: 'right' }}>\n Amount\n </Field>\n {!minimal && (\n <Field width={80} style={{ textAlign: 'center' }}>\n Recurring\n </Field>\n )}\n {!minimal && <Field width={40}></Field>}\n </TableHeader>\n <Table\n rowHeight={ROW_HEIGHT}\n backgroundColor=\"transparent\"\n version=\"v2\"\n style={[{ flex: 1, backgroundColor: 'transparent' }, style]}\n items={items}\n renderItem={renderItem}\n renderEmpty=\"No schedules\"\n allowPopupsEscape={items.length < 6}\n />\n </>\n );\n}\n","import React, { useMemo, useEffect, useState } from 'react';\nimport { useHistory } from 'react-router-dom';\nimport {\n View,\n Text,\n Button,\n Tooltip,\n Menu\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { Page } from '../Page';\nimport { useSchedules } from 'loot-core/src/client/data-hooks/schedules';\nimport { SchedulesTable, ROW_HEIGHT } from './SchedulesTable';\n\nexport default function Schedules() {\n let history = useHistory();\n\n let scheduleData = useSchedules();\n\n if (scheduleData == null) {\n return null;\n }\n\n let { schedules, statuses } = scheduleData;\n\n function onEdit(id) {\n history.push(`/schedule/edit/${id}`, { locationPtr: history.location });\n }\n\n function onAdd() {\n history.push(`/schedule/edit`, { locationPtr: history.location });\n }\n\n async function onAction(name, id) {\n switch (name) {\n case 'post-transaction':\n await send('schedule/post-transaction', { id });\n break;\n case 'skip':\n await send('schedule/skip-next-date', { id });\n break;\n case 'complete':\n await send('schedule/update', { schedule: { id, completed: true } });\n break;\n case 'restart':\n await send('schedule/update', {\n schedule: { id, completed: false },\n resetNextDate: true\n });\n break;\n case 'delete':\n await send('schedule/delete', { id });\n break;\n default:\n }\n }\n\n return (\n <Page title=\"Schedules\">\n <View\n style={{\n marginTop: 20,\n flexBasis: (ROW_HEIGHT - 1) * (Math.max(schedules.length, 1) + 1),\n overflow: 'hidden'\n }}\n >\n <SchedulesTable\n schedules={schedules}\n statuses={statuses}\n allowCompleted={true}\n onSelect={onEdit}\n onAction={onAction}\n style={{ backgroundColor: 'white' }}\n />\n </View>\n\n <View style={{ alignItems: 'flex-end', margin: '20px 0', flexShrink: 0 }}>\n <Button primary onClick={onAdd}>\n Add new schedule\n </Button>\n </View>\n </Page>\n );\n}\n","import React from 'react';\nimport { css } from 'glamor';\nimport { View, Text } from './common';\nimport { colors } from '../style';\n\nexport function SectionLabel({ title, style }) {\n return (\n <View\n style={[\n {\n fontWeight: 500,\n textTransform: 'uppercase',\n color: colors.b3,\n marginBottom: 5,\n lineHeight: '1em'\n },\n style\n ]}\n >\n {title}\n </View>\n );\n}\n\nexport function FormLabel({ style, title }) {\n return (\n <Text style={[{ fontSize: 13, marginBottom: 3, color: colors.n3 }, style]}>\n {title}\n </Text>\n );\n}\n\nexport function FormField({ style, children }) {\n return <View style={style}>{children}</View>;\n}\n\n// Custom inputs\n\nexport function Checkbox(props) {\n return (\n <input\n type=\"checkbox\"\n {...props}\n {...css(\n [\n {\n position: 'relative',\n margin: 0,\n marginRight: 6,\n width: 15,\n height: 15,\n appearance: 'none',\n outline: 0,\n border: '1px solid #d0d0d0',\n borderRadius: 4,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: 'white',\n backgroundColor: 'white',\n ':checked': {\n border: '1px solid ' + colors.b6,\n backgroundColor: colors.b6,\n '::after': {\n display: 'block',\n background:\n colors.b6 +\n ' 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',\n width: 9,\n height: 9,\n content: ' '\n }\n },\n '&.focus-visible:focus': {\n '::before': {\n position: 'absolute',\n top: -5,\n bottom: -5,\n left: -5,\n right: -5,\n border: '2px solid ' + colors.b5,\n borderRadius: 6,\n content: ' '\n }\n }\n }\n ],\n props.style\n )}\n />\n );\n}\n","import React, { useMemo, useCallback } from 'react';\nimport { useSelector } from 'react-redux';\nimport {\n format as formatDate,\n parse as parseDate,\n parseISO,\n isValid as isDateValid\n} from 'date-fns';\nimport {\n Table,\n Row,\n Field,\n Cell,\n SelectCell\n} from 'loot-design/src/components/table';\nimport {\n useSelectedItems,\n useSelectedDispatch\n} from 'loot-design/src/components/useSelected';\nimport {\n integerToAmount,\n amountToInteger,\n integerToCurrency\n} from 'loot-core/src/shared/util';\nimport {\n getAccountsById,\n getPayeesById,\n getCategoriesById\n} from 'loot-core/src/client/reducers/queries';\nimport ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize';\nimport { styles } from 'loot-design/src/style';\nimport DisplayId from '../util/DisplayId';\n\nfunction serializeTransaction(transaction, dateFormat) {\n let { date } = transaction;\n\n if (!isDateValid(parseISO(date))) {\n date = null;\n }\n\n return {\n ...transaction,\n date: date ? formatDate(parseISO(date), dateFormat) : null\n };\n}\n\nconst TransactionRow = React.memo(function TransactionRow({\n transaction,\n fields,\n payees,\n categories,\n accounts,\n selected\n}) {\n // TODO: Convert these to use fetched queries\n let c = getCategoriesById(categories)[transaction.category];\n let a = getAccountsById(accounts)[transaction.account];\n\n let dispatchSelected = useSelectedDispatch();\n let schedule = transaction.schedule;\n\n return (\n <Row>\n <SelectCell\n exposed={true}\n focused={false}\n onSelect={() => {\n dispatchSelected({ type: 'select', id: transaction.id });\n }}\n selected={selected}\n />\n {fields.map((field, i) => {\n switch (field) {\n case 'date':\n return (\n <Field key={i} width={100}>\n {transaction.date}\n </Field>\n );\n case 'imported_payee':\n return (\n <Field key={i} width=\"flex\">\n {transaction.imported_payee}\n </Field>\n );\n case 'payee':\n return (\n <Cell\n key={i}\n width=\"flex\"\n exposed={true}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-start'\n }}\n >\n {() => (\n <>\n {transaction.schedule && (\n <ArrowsSynchronize\n style={{\n width: 13,\n height: 13,\n margin: '0 5px'\n }}\n />\n )}\n <DisplayId type=\"payees\" id={transaction.payee} />\n </>\n )}\n </Cell>\n );\n case 'category':\n return (\n <Field key={i} width=\"flex\" title={c && c.name}>\n {c ? c.name : ''}\n </Field>\n );\n case 'account':\n return (\n <Field key={i} width=\"flex\" title={a.name}>\n {a.name}\n </Field>\n );\n case 'notes':\n return (\n <Field key={i} width=\"flex\" title={transaction.notes}>\n {transaction.notes}\n </Field>\n );\n case 'amount':\n return (\n <Field\n key={i}\n width={75}\n style={[{ textAlign: 'right' }, styles.tnum]}\n >\n {integerToCurrency(transaction.amount)}\n </Field>\n );\n default:\n return null;\n }\n })}\n </Row>\n );\n});\n\nexport default function SimpleTransactionsTable({\n transactions,\n schedules,\n fields = ['date', 'payee', 'amount'],\n style\n}) {\n let { payees, categories, accounts, dateFormat } = useSelector(state => {\n return {\n payees: state.queries.payees,\n accounts: state.queries.accounts,\n categories: state.queries.categories.grouped,\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy'\n };\n });\n let selectedItems = useSelectedItems();\n let dispatchSelected = useSelectedDispatch();\n let memoFields = useMemo(() => fields, [JSON.stringify(fields)]);\n\n let serializedTransactions = useMemo(() => {\n return transactions.map(trans => serializeTransaction(trans, dateFormat));\n }, [transactions]);\n\n let renderItem = useCallback(\n ({ item }) => {\n return (\n <TransactionRow\n transaction={item}\n payees={payees}\n categories={categories}\n accounts={accounts}\n fields={memoFields}\n selected={selectedItems && selectedItems.has(item.id)}\n />\n );\n },\n [payees, categories, memoFields, selectedItems]\n );\n\n return (\n <Table\n style={style}\n items={serializedTransactions}\n headers={\n <>\n <SelectCell\n exposed={true}\n focused={false}\n selected={selectedItems.size > 0}\n width={20}\n onSelect={() => dispatchSelected({ type: 'select-all' })}\n />\n {fields.map((field, i) => {\n switch (field) {\n case 'date':\n return (\n <Field key={i} width={100}>\n Date\n </Field>\n );\n case 'imported_payee':\n return (\n <Field key={i} width=\"flex\">\n Imported payee\n </Field>\n );\n case 'payee':\n return (\n <Field key={i} width=\"flex\">\n Payee\n </Field>\n );\n case 'category':\n return (\n <Field key={i} width=\"flex\">\n Category\n </Field>\n );\n case 'account':\n return (\n <Field key={i} width=\"flex\">\n Account\n </Field>\n );\n case 'notes':\n return (\n <Field key={i} width=\"flex\">\n Notes\n </Field>\n );\n case 'amount':\n return (\n <Field key={i} width={75} style={{ textAlign: 'right' }}>\n Amount\n </Field>\n );\n default:\n return null;\n }\n })}\n </>\n }\n renderItem={renderItem}\n />\n );\n}\n","import React from 'react';\n\nconst SvgSubtract = props => (\n <svg\n {...props}\n viewBox=\"0 0 23 3\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fillRule=\"nonzero\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgSubtract;\n","import React, { useState } from 'react';\nimport {\n integerToCurrency,\n currencyToInteger\n} from 'loot-core/src/shared/util';\nimport {\n View,\n Button,\n InputWithContent\n} from 'loot-design/src/components/common';\nimport Add from 'loot-design/src/svg/v1/Add';\nimport Subtract from 'loot-design/src/svg/v1/Subtract';\n\nexport function AmountInput({ defaultValue, onChange }) {\n let [negative, setNegative] = useState(defaultValue <= 0);\n let [value, setValue] = useState(integerToCurrency(Math.abs(defaultValue)));\n\n function onSwitch() {\n setNegative(!negative);\n fireChange(!negative);\n }\n\n function fireChange(neg = negative) {\n let v = currencyToInteger(value);\n let amount = neg ? (v < 0 ? v : -v) : v > 0 ? v : -v;\n\n onChange(amount);\n }\n\n return (\n <InputWithContent\n leftContent={\n <Button bare style={{ padding: '0 7px' }} onClick={onSwitch}>\n {negative ? (\n <Subtract style={{ width: 8, height: 8 }} />\n ) : (\n <Add style={{ width: 8, height: 8 }} />\n )}\n </Button>\n }\n value={value}\n style={{ flex: 1, alignItems: 'stretch' }}\n inputStyle={{ paddingLeft: 0 }}\n onChange={e => setValue(e.target.value)}\n onBlur={e => fireChange()}\n />\n );\n}\n\nexport function BetweenAmountInput({ defaultValue, onChange }) {\n let [num1, setNum1] = useState(defaultValue.num1);\n let [num2, setNum2] = useState(defaultValue.num2);\n\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n <AmountInput\n defaultValue={num1}\n onChange={value => {\n setNum1(value);\n onChange({ num1: value, num2 });\n }}\n />\n <View style={{ margin: '0 5px' }}>and</View>\n <AmountInput\n defaultValue={num2}\n onChange={value => {\n setNum2(value);\n onChange({ num1, num2: value });\n }}\n />\n </View>\n );\n}\n","import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { useDispatch, useSelector } from 'react-redux';\nimport {\n initiallyLoadPayees,\n setUndoEnabled\n} from 'loot-core/src/client/actions/queries';\nimport * as undo from 'loot-core/src/platform/client/undo';\nimport q, { runQuery } from 'loot-core/src/client/query-helpers';\nimport {\n View,\n Text,\n Modal,\n Button,\n Select,\n Stack,\n Input,\n CustomSelect,\n Tooltip\n} from 'loot-design/src/components/common';\nimport GenericInput from '../util/GenericInput';\nimport { keys } from 'loot-design/src/util/keys';\nimport { send, listen, unlisten } from 'loot-core/src/platform/client/fetch';\nimport { getStatus } from 'loot-core/src/shared/schedules';\nimport { colors, styles } from 'loot-design/src/style';\nimport SubtractIcon from 'loot-design/src/svg/Subtract';\nimport AddIcon from 'loot-design/src/svg/Add';\nimport InformationOutline from 'loot-design/src/svg/v1/InformationOutline';\nimport {\n mapField,\n friendlyOp,\n getFieldError,\n parse,\n unparse,\n makeValue,\n FIELD_TYPES,\n TYPE_INFO\n} from 'loot-core/src/shared/rules';\nimport useSelected, {\n SelectedProvider\n} from 'loot-design/src/components/useSelected';\nimport SimpleTransactionsTable from '../accounts/SimpleTransactionsTable';\nimport { StatusBadge } from '../schedules/StatusBadge';\nimport DisplayId from '../util/DisplayId';\nimport { useSchedules } from 'loot-core/src/client/data-hooks/schedules';\nimport {\n integerToCurrency,\n integerToAmount,\n amountToInteger\n} from 'loot-core/src/shared/util';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { BetweenAmountInput } from '../util/AmountInput';\n\nfunction updateValue(array, value, update) {\n return array.map(v => (v === value ? update() : v));\n}\n\nfunction applyErrors(array, errorsArray) {\n return array.map((item, i) => {\n return { ...item, error: errorsArray[i] };\n });\n}\n\nfunction getTransactionFields(conditions, actions) {\n let fields = ['date'];\n\n if (conditions.find(c => c.field === 'imported_payee')) {\n fields.push('imported_payee');\n }\n\n fields.push('payee');\n\n if (actions.find(a => a.field === 'category')) {\n fields.push('category');\n } else if (\n actions.length > 0 &&\n !['payee', 'date', 'amount'].includes(actions[0].field)\n ) {\n fields.push(actions[0].field);\n }\n\n fields.push('amount');\n\n return fields;\n}\n\nexport function FieldSelect({ fields, style, value, onChange }) {\n return (\n <View style={style}>\n <CustomSelect\n options={fields}\n value={value}\n onChange={value => onChange('field', value)}\n style={{ color: colors.p4 }}\n />\n </View>\n );\n}\n\nexport function OpSelect({\n ops,\n type,\n style,\n value,\n formatOp = friendlyOp,\n onChange\n}) {\n // We don't support the `contains` operator for the id type for\n // rules yet\n if (type === 'id') {\n ops = ops.filter(op => op !== 'contains');\n }\n\n return (\n <CustomSelect\n options={ops.map(op => [op, formatOp(op, type)])}\n value={value}\n onChange={value => onChange('op', value)}\n style={style}\n />\n );\n}\n\nfunction EditorButtons({ onAdd, onDelete, style }) {\n return (\n <>\n {onDelete && (\n <Button bare onClick={onDelete} style={{ padding: 7 }}>\n <SubtractIcon style={{ width: 8, height: 8 }} />\n </Button>\n )}\n {onAdd && (\n <Button bare onClick={onAdd} style={{ padding: 7 }}>\n <AddIcon style={{ width: 10, height: 10 }} />\n </Button>\n )}\n </>\n );\n}\n\nfunction FieldError({ type }) {\n return (\n <Text\n style={{\n fontSize: 12,\n textAlign: 'center',\n color: colors.r5,\n marginBottom: 5\n }}\n >\n {getFieldError(type)}\n </Text>\n );\n}\n\nfunction Editor({ error, style, children }) {\n return (\n <View style={style}>\n <Stack\n direction=\"row\"\n align=\"center\"\n spacing={1}\n style={{\n padding: '3px 5px'\n }}\n >\n {children}\n </Stack>\n {error && <FieldError type={error} />}\n </View>\n );\n}\n\nexport function ConditionEditor({\n conditionFields,\n ops,\n condition,\n editorStyle,\n onChange,\n onDelete,\n onAdd\n}) {\n let { field, op, value, type, options, error, inputKey } = condition;\n\n if (field === 'amount' && options) {\n if (options.inflow) {\n field = 'amount-inflow';\n } else if (options.outflow) {\n field = 'amount-outflow';\n }\n }\n\n let valueEditor;\n if (type === 'number' && op === 'isbetween') {\n valueEditor = (\n <BetweenAmountInput\n defaultValue={value}\n onChange={v => onChange('value', v)}\n />\n );\n } else {\n valueEditor = (\n <GenericInput\n field={field}\n type={type}\n value={value}\n multi={op === 'oneOf'}\n onChange={v => onChange('value', v)}\n />\n );\n }\n\n return (\n <Editor style={editorStyle} error={error}>\n <FieldSelect fields={conditionFields} value={field} onChange={onChange} />\n <OpSelect ops={ops} value={op} type={type} onChange={onChange} />\n\n <View style={{ flex: 1 }}>{valueEditor}</View>\n\n <Stack direction=\"row\">\n <EditorButtons onAdd={onAdd} onDelete={onDelete} />\n </Stack>\n </Editor>\n );\n}\n\nfunction ScheduleDescription({ id }) {\n let dateFormat = useSelector(state => {\n return state.prefs.local.dateFormat || 'MM/dd/yyyy';\n });\n let scheduleData = useSchedules({\n transform: useCallback(q => q.filter({ id }), [])\n });\n\n if (scheduleData == null) {\n return null;\n }\n\n if (scheduleData.schedules.length === 0) {\n return <View style={{ flex: 1 }}>{id}</View>;\n }\n\n let [schedule] = scheduleData.schedules;\n let status = schedule && scheduleData.statuses.get(schedule.id);\n\n return (\n <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}>\n <View style={{ marginRight: 15, flexDirection: 'row' }}>\n <Text\n style={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }}\n >\n Payee:{' '}\n <DisplayId type=\"payees\" id={schedule._payee} noneColor={colors.n5} />\n </Text>\n <Text style={{ margin: '0 5px' }}> — </Text>\n <Text style={{ flexShrink: 0 }}>\n Amount: {integerToCurrency(schedule._amount || 0)}\n </Text>\n <Text style={{ margin: '0 5px' }}> — </Text>\n <Text style={{ flexShrink: 0 }}>\n Next: {monthUtils.format(schedule.next_date, dateFormat)}\n </Text>\n </View>\n <StatusBadge status={status} />\n </View>\n );\n}\n\nlet actionFields = [\n 'payee',\n 'notes',\n 'date',\n 'amount',\n 'category',\n 'account'\n].map(field => [field, mapField(field)]);\nfunction ActionEditor({ ops, action, editorStyle, onChange, onDelete, onAdd }) {\n let { field, op, value, type, error, inputKey = 'initial' } = action;\n\n return (\n <Editor style={editorStyle} error={error}>\n {/*<OpSelect ops={ops} value={op} onChange={onChange} />*/}\n\n {op === 'set' ? (\n <>\n <View style={{ padding: '5px 10px', lineHeight: '1em' }}>\n {friendlyOp(op)}\n </View>\n\n <FieldSelect\n fields={actionFields}\n value={field}\n onChange={onChange}\n />\n\n <View style={{ flex: 1 }}>\n <GenericInput\n key={inputKey}\n field={field}\n type={type}\n op={op}\n value={value}\n onChange={v => onChange('value', v)}\n />\n </View>\n </>\n ) : op === 'link-schedule' ? (\n <>\n <View style={{ padding: '5px 10px', color: colors.p4 }}>\n {friendlyOp(op)}\n </View>\n <ScheduleDescription id={value || null} />\n </>\n ) : null}\n\n <Stack direction=\"row\">\n <EditorButtons\n onAdd={onAdd}\n onDelete={op !== 'link-schedule' && onDelete}\n />\n </Stack>\n </Editor>\n );\n}\n\nfunction StageInfo() {\n let [open, setOpen] = useState();\n\n return (\n <View style={{ position: 'relative', marginLeft: 5 }}>\n <View\n onMouseEnter={() => setOpen(true)}\n onMouseLeave={() => setOpen(false)}\n >\n <InformationOutline\n style={{ width: 11, height: 11, color: colors.n4 }}\n />\n </View>\n {open && (\n <Tooltip\n position=\"bottom-left\"\n style={{\n padding: 10,\n color: colors.n4,\n maxWidth: 450,\n lineHeight: 1.5\n }}\n >\n The stage of a rule allows you to force a specific order. Pre rules\n always run first, and post rules always run last. Within each stage\n rules are automatically ordered from least to most specific.\n </Tooltip>\n )}\n </View>\n );\n}\n\nfunction StageButton({ selected, children, style, onSelect }) {\n return (\n <Button\n bare\n style={[\n { fontSize: 'inherit' },\n selected && {\n backgroundColor: colors.b9,\n ':hover': { backgroundColor: colors.b9 }\n },\n style\n ]}\n onClick={onSelect}\n >\n {children}\n </Button>\n );\n}\n\nfunction newInput(item) {\n return { ...item, inputKey: '' + Math.random() };\n}\n\nexport function ConditionsList({\n conditions,\n conditionFields,\n editorStyle,\n onChangeConditions\n}) {\n function addCondition(index) {\n let field = 'payee';\n let copy = [...conditions];\n copy.splice(index + 1, 0, {\n type: FIELD_TYPES.get(field),\n field,\n op: 'is',\n value: null\n });\n onChangeConditions(copy);\n }\n\n function addInitialCondition() {\n addCondition(-1);\n }\n\n function removeCondition(cond) {\n onChangeConditions(conditions.filter(c => c !== cond));\n }\n\n function updateCondition(cond, field, value) {\n onChangeConditions(\n updateValue(conditions, cond, () => {\n if (field === 'field') {\n let newCond = { field: value };\n\n if (value === 'amount-inflow') {\n newCond.field = 'amount';\n newCond.options = { inflow: true };\n } else if (value === 'amount-outflow') {\n newCond.field = 'amount';\n newCond.options = { outflow: true };\n }\n\n newCond.type = FIELD_TYPES.get(newCond.field);\n\n let prevType = FIELD_TYPES.get(cond.field);\n if (\n (prevType === 'string' || prevType === 'number') &&\n prevType === newCond.type &&\n cond.op !== 'isbetween'\n ) {\n // Don't clear the value & op if the type is string/number and\n // the type hasn't changed\n newCond.op = cond.op;\n return newInput(makeValue(cond.value, newCond));\n } else {\n newCond.op = TYPE_INFO[newCond.type].ops[0];\n return newInput(makeValue(null, newCond));\n }\n } else if (field === 'op') {\n let op = value;\n\n // Switching between oneOf and other operators is a\n // special-case. It changes the input type, so we need to\n // clear the value\n if (cond.op !== 'oneOf' && op === 'oneOf') {\n return newInput(\n makeValue(cond.value != null ? [cond.value] : [], {\n ...cond,\n op: value\n })\n );\n } else if (cond.op === 'oneOf' && op !== 'oneOf') {\n return newInput(\n makeValue(cond.value.length > 0 ? cond.value[0] : null, {\n ...cond,\n op: value\n })\n );\n } else if (cond.op !== 'isbetween' && op === 'isbetween') {\n // TODO: I don't think we need `makeValue` anymore. It\n // tries to parse the value as a float and we had to\n // special-case isbetween. I don't know why we need that\n // behavior and we can probably get rid of `makeValue`\n return makeValue(\n {\n num1: amountToInteger(cond.value),\n num2: amountToInteger(cond.value)\n },\n { ...cond, op: value }\n );\n } else if (cond.op === 'isbetween' && op !== 'isbetween') {\n return makeValue(integerToAmount(cond.value.num1 || 0), {\n ...cond,\n op: value\n });\n } else {\n return { ...cond, op: value };\n }\n } else if (field === 'value') {\n return makeValue(value, cond);\n }\n\n return cond;\n })\n );\n }\n\n return conditions.length === 0 ? (\n <Button style={{ alignSelf: 'flex-start' }} onClick={addInitialCondition}>\n Add condition\n </Button>\n ) : (\n <Stack spacing={2}>\n {conditions.map((cond, i) => {\n let ops = TYPE_INFO[cond.type].ops;\n\n // Hack for now, these ops should be the only ones available\n // for recurring dates\n if (cond.type === 'date' && cond.value && cond.value.frequency) {\n ops = ['is', 'isapprox'];\n } else if (\n cond.options &&\n (cond.options.inflow || cond.options.outflow)\n ) {\n ops = ops.filter(op => op !== 'isbetween');\n }\n\n return (\n <View>\n <ConditionEditor\n key={i}\n conditionFields={conditionFields}\n editorStyle={editorStyle}\n ops={ops}\n condition={cond}\n onChange={(name, value) => {\n updateCondition(cond, name, value);\n }}\n onDelete={() => removeCondition(cond)}\n onAdd={() => addCondition(i)}\n />\n </View>\n );\n })}\n </Stack>\n );\n}\n\n// TODO:\n// * Dont touch child transactions?\n\nlet conditionFields = [\n 'account',\n 'imported_payee',\n 'payee',\n 'category',\n 'date',\n 'notes',\n 'amount'\n]\n .map(field => [field, mapField(field)])\n .concat([\n ['amount-inflow', mapField('amount', { inflow: true })],\n ['amount-outflow', mapField('amount', { outflow: true })]\n ]);\n\nexport default function EditRule({\n history,\n modalProps,\n defaultRule,\n onSave: originalOnSave\n}) {\n let [conditions, setConditions] = useState(defaultRule.conditions.map(parse));\n let [actions, setActions] = useState(defaultRule.actions.map(parse));\n let [stage, setStage] = useState(defaultRule.stage);\n let [transactions, setTransactions] = useState([]);\n let dispatch = useDispatch();\n let scrollableEl = useRef();\n\n useEffect(() => {\n dispatch(initiallyLoadPayees());\n\n // Disable undo while this modal is open\n setUndoEnabled(false);\n return () => setUndoEnabled(true);\n }, []);\n\n useEffect(() => {\n // Flash the scrollbar\n if (scrollableEl.current) {\n let el = scrollableEl.current;\n let top = el.scrollTop;\n el.scrollTop = top + 1;\n el.scrollTop = top;\n }\n\n // Run it here\n async function run() {\n let { filters } = await send('make-filters-from-conditions', {\n conditions: conditions.map(unparse)\n });\n\n if (filters.length > 0) {\n let { data: transactions } = await runQuery(\n q('transactions')\n .filter({ $and: filters })\n .select('*')\n );\n setTransactions(transactions);\n } else {\n setTransactions([]);\n }\n }\n run();\n }, [actions, conditions]);\n\n let selectedInst = useSelected('transactions', transactions, []);\n\n function addInitialAction() {\n addAction(-1);\n }\n\n function addAction(index) {\n let field = 'category';\n\n let copy = [...actions];\n copy.splice(index + 1, 0, {\n type: FIELD_TYPES.get(field),\n field,\n op: 'set',\n value: null\n });\n setActions(copy);\n }\n\n function onChangeAction(action, field, value) {\n setActions(\n updateValue(actions, action, () => {\n let a = { ...action };\n a[field] = value;\n\n if (field === 'field') {\n a.type = FIELD_TYPES.get(a.field);\n a.value = null;\n return newInput(a);\n } else if (field === 'op') {\n a.value = null;\n a.inputKey = '' + Math.random();\n return newInput(a);\n }\n\n return a;\n })\n );\n }\n\n function onChangeStage(stage) {\n setStage(stage);\n }\n\n function onRemoveAction(action) {\n setActions(actions.filter(a => a !== action));\n }\n\n function onApply() {\n send('rule-apply-actions', {\n transactionIds: [...selectedInst.items],\n actions\n }).then(() => {\n // This makes it refetch the transactions\n setActions([...actions]);\n });\n }\n\n async function onSave() {\n let rule = {\n ...defaultRule,\n stage,\n conditions: conditions.map(unparse),\n actions: actions.map(unparse)\n };\n\n let method = rule.id ? 'rule-update' : 'rule-add';\n let { error, id: newId } = await send(method, rule);\n\n if (error) {\n if (error.conditionErrors) {\n setConditions(applyErrors(conditions, error.conditionErrors));\n }\n\n if (error.actionErrors) {\n setActions(applyErrors(actions, error.actionErrors));\n }\n } else {\n // If adding a rule, we got back an id\n if (newId) {\n rule.id = newId;\n }\n\n originalOnSave && originalOnSave(rule);\n modalProps.onClose();\n }\n }\n\n let editorStyle = {\n backgroundColor: colors.n10,\n borderRadius: 4\n };\n\n return (\n <Modal\n title=\"Rule\"\n padding={0}\n {...modalProps}\n style={[modalProps.style, { flex: 'inherit', maxWidth: '90%' }]}\n >\n {() => (\n <View\n style={{\n maxWidth: '100%',\n width: 900,\n height: '80vh',\n flexGrow: 0,\n flexShrink: 0,\n flexBasis: 'auto',\n overflow: 'hidden'\n }}\n >\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n marginBottom: 15,\n padding: '0 20px'\n }}\n >\n <Text style={{ color: colors.n4, marginRight: 15 }}>\n Stage of rule:\n </Text>\n\n <Stack direction=\"row\" align=\"center\" spacing={1}>\n <StageButton\n selected={stage === 'pre'}\n onSelect={() => onChangeStage('pre')}\n >\n Pre\n </StageButton>\n <StageButton\n selected={stage === null}\n onSelect={() => onChangeStage(null)}\n >\n Default\n </StageButton>\n <StageButton\n selected={stage === 'post'}\n onSelect={() => onChangeStage('post')}\n >\n Post\n </StageButton>\n\n <StageInfo />\n </Stack>\n </View>\n\n <View\n innerRef={scrollableEl}\n style={{\n borderBottom: '1px solid ' + colors.border,\n padding: 20,\n overflow: 'auto',\n maxHeight: 'calc(100% - 300px)'\n }}\n >\n <View style={{ flexShrink: 0 }}>\n <View style={{ marginBottom: 30 }}>\n <Text style={{ color: colors.n4, marginBottom: 15 }}>\n If all these conditions match:\n </Text>\n\n <ConditionsList\n conditions={conditions}\n conditionFields={conditionFields}\n editorStyle={editorStyle}\n onChangeConditions={conds => setConditions(conds)}\n />\n </View>\n\n <Text style={{ color: colors.n4, marginBottom: 15 }}>\n Then apply these actions:\n </Text>\n <View style={{ flex: 1 }}>\n {actions.length === 0 ? (\n <Button\n style={{ alignSelf: 'flex-start' }}\n onClick={addInitialAction}\n >\n Add action\n </Button>\n ) : (\n <Stack spacing={2}>\n {actions.map((action, i) => (\n <View>\n <ActionEditor\n key={i}\n ops={['set', 'link-schedule']}\n action={action}\n editorStyle={editorStyle}\n onChange={(name, value) => {\n onChangeAction(action, name, value);\n }}\n onDelete={() => onRemoveAction(action)}\n onAdd={() => addAction(i)}\n />\n </View>\n ))}\n </Stack>\n )}\n </View>\n </View>\n </View>\n\n <SelectedProvider instance={selectedInst}>\n <View style={{ padding: '20px', flex: 1 }}>\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n marginBottom: 12\n }}\n >\n <Text style={{ color: colors.n4, marginBottom: 0 }}>\n This rule applies to these transactions:\n </Text>\n\n <View style={{ flex: 1 }} />\n <Button\n disabled={selectedInst.items.size === 0}\n onClick={onApply}\n >\n Apply actions ({selectedInst.items.size})\n </Button>\n </View>\n\n <SimpleTransactionsTable\n transactions={transactions}\n fields={getTransactionFields(conditions, actions)}\n style={{ border: '1px solid ' + colors.border }}\n />\n\n <Stack\n direction=\"row\"\n justify=\"flex-end\"\n style={{ marginTop: 20 }}\n >\n <Button onClick={() => modalProps.onClose()}>Cancel</Button>\n <Button primary onClick={() => onSave()}>\n Save\n </Button>\n </Stack>\n </View>\n </SelectedProvider>\n </View>\n )}\n </Modal>\n );\n}\n","import React, { useEffect, useState, useReducer } from 'react';\nimport { useParams, useHistory } from 'react-router-dom';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { pushModal } from 'loot-core/src/client/actions/modals';\nimport { css } from 'glamor';\nimport { send, sendCatch } from 'loot-core/src/platform/client/fetch';\nimport q, { runQuery, liveQuery } from 'loot-core/src/client/query-helpers';\nimport { extractScheduleConds } from 'loot-core/src/shared/schedules';\nimport * as monthUtils from 'loot-core/src/shared/months';\nimport { useCachedPayees } from 'loot-core/src/client/data-hooks/payees';\nimport {\n FormField,\n FormLabel,\n Checkbox\n} from 'loot-design/src/components/forms';\nimport { colors, styles } from 'loot-design/src/style';\nimport PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete';\nimport AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete';\nimport {\n Stack,\n Input,\n InputWithContent,\n View,\n Text,\n Button,\n ModalButtons\n} from 'loot-design/src/components/common';\nimport DateSelect from 'loot-design/src/components/DateSelect';\nimport { SelectedItemsButton } from 'loot-design/src/components/table';\nimport SimpleTransactionsTable from '../accounts/SimpleTransactionsTable';\nimport { usePageType } from '../Page';\nimport { Page } from '../Page';\nimport useSelected, {\n SelectedProvider\n} from 'loot-design/src/components/useSelected';\nimport { OpSelect } from '../modals/EditRule';\nimport { AmountInput, BetweenAmountInput } from '../util/AmountInput';\nimport { SchedulesProviderRaw } from 'loot-core/src/client/data-hooks/schedules';\n\nimport RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker';\n\nfunction mergeFields(defaults, initial) {\n let res = { ...defaults };\n if (initial) {\n // Only merge in fields from `initial` that exist in `defaults`\n Object.keys(initial).forEach(key => {\n if (key in defaults) {\n res[key] = initial[key];\n }\n });\n }\n return res;\n}\n\nfunction updateScheduleConditions(schedule, fields) {\n let conds = extractScheduleConds(schedule._conditions);\n\n let updateCond = (cond, op, field, value) => {\n if (cond) {\n return { ...cond, value };\n }\n\n if (value != null) {\n return { op, field, value };\n }\n\n return null;\n };\n\n // Validate\n if (fields.date == null) {\n return { error: 'Date is required' };\n }\n\n if (fields.amount == null) {\n return { error: 'A valid amount is required' };\n }\n\n return {\n conditions: [\n updateCond(conds.payee, 'is', 'payee', fields.payee),\n updateCond(conds.account, 'is', 'account', fields.account),\n updateCond(conds.date, 'isapprox', 'date', fields.date),\n // We don't use `updateCond` for amount because we want to\n // overwrite it completely\n {\n op: fields.amountOp,\n field: 'amount',\n value: fields.amount\n }\n ].filter(Boolean)\n };\n}\n\nexport default function ScheduleDetails() {\n let { id, initialFields } = useParams();\n let adding = id == null;\n let payees = useCachedPayees({ idKey: true });\n let history = useHistory();\n let globalDispatch = useDispatch();\n let dateFormat = useSelector(state => {\n return state.prefs.local.dateFormat || 'MM/dd/yyyy';\n });\n\n let pageType = usePageType();\n\n let [state, dispatch] = useReducer(\n (state, action) => {\n switch (action.type) {\n case 'set-schedule': {\n let schedule = action.schedule;\n\n // See if there are custom rules\n let conds = extractScheduleConds(schedule._conditions);\n let condsSet = new Set(Object.values(conds));\n let isCustom =\n schedule._conditions.find(c => !condsSet.has(c)) ||\n schedule._actions.find(a => a.op !== 'link-schedule');\n\n return {\n ...state,\n schedule: action.schedule,\n isCustom,\n fields: {\n payee: schedule._payee,\n account: schedule._account,\n amount: schedule._amount || 0,\n amountOp: schedule._amountOp || 'isapprox',\n date: schedule._date,\n posts_transaction: action.schedule.posts_transaction\n }\n };\n }\n case 'set-field':\n if (!(action.field in state.fields)) {\n throw new Error('Unknown field: ' + action.field);\n }\n\n let fields = { [action.field]: action.value };\n\n // If we are changing the amount operator either to or\n // away from the `isbetween` operator, the amount value is\n // different and we need to convert it\n if (\n action.field === 'amountOp' &&\n action.value !== state.fields.amountOp\n ) {\n if (action.value === 'isbetween') {\n // We need a range if switching to `isbetween`. The\n // amount field should be a number since we are\n // switching away from the other ops, but check just in\n // case\n fields.amount =\n typeof state.fields.amount === 'number'\n ? { num1: state.fields.amount, num2: state.fields.amount }\n : { num1: 0, num2: 0 };\n } else if (state.fields.amountOp === 'isbetween') {\n // We need just a number if switching away from\n // `isbetween`. The amount field should be a range, but\n // also check just in case. We grab just the first\n // number and use it\n fields.amount =\n typeof state.fields.amount === 'number'\n ? state.fields.amount\n : state.fields.amount.num1;\n }\n }\n\n return {\n ...state,\n fields: { ...state.fields, ...fields }\n };\n case 'set-transactions':\n return { ...state, transactions: action.transactions };\n case 'set-repeats':\n return {\n ...state,\n fields: {\n ...state.fields,\n date: action.repeats\n ? {\n frequency: 'monthly',\n start: monthUtils.currentDay(),\n patterns: []\n }\n : monthUtils.currentDay()\n }\n };\n case 'set-upcoming-dates':\n return {\n ...state,\n upcomingDates: action.dates\n };\n\n case 'form-error':\n return { ...state, error: action.error };\n\n case 'switch-transactions':\n return { ...state, transactionsMode: action.mode };\n\n default:\n throw new Error('Unknown action: ' + action.type);\n }\n },\n {\n schedule: null,\n upcomingDates: null,\n error: null,\n fields: mergeFields(\n {\n payee: null,\n account: null,\n amount: null,\n amountOp: null,\n date: null,\n posts_transaction: false\n },\n initialFields\n ),\n transactions: [],\n transactionsMode: adding ? 'matched' : 'linked'\n }\n );\n\n async function loadSchedule() {\n let { data } = await runQuery(\n q('schedules')\n .filter({ id })\n .select('*')\n );\n return data[0];\n }\n\n useEffect(() => {\n async function run() {\n if (adding) {\n let date = {\n start: monthUtils.currentDay(),\n frequency: 'monthly',\n patterns: []\n };\n let schedule = {\n posts_transaction: false,\n _date: date,\n _conditions: [{ op: 'isapprox', field: 'date', value: date }],\n _actions: []\n };\n\n dispatch({ type: 'set-schedule', schedule });\n } else {\n let schedule = await loadSchedule();\n\n if (schedule && state.schedule == null) {\n dispatch({ type: 'set-schedule', schedule });\n }\n }\n }\n run();\n }, []);\n\n useEffect(() => {\n async function run() {\n let date = state.fields.date;\n let dates = null;\n\n if (date == null) {\n dispatch({ type: 'set-upcoming-dates', dates: null });\n } else {\n if (date.frequency) {\n let { data } = await sendCatch('schedule/get-upcoming-dates', {\n config: date,\n count: 3\n });\n dispatch({ type: 'set-upcoming-dates', dates: data });\n } else {\n let today = monthUtils.currentDay();\n if (date === today || monthUtils.isAfter(date, today)) {\n dispatch({ type: 'set-upcoming-dates', dates: [date] });\n } else {\n dispatch({ type: 'set-upcoming-dates', dates: null });\n }\n }\n }\n }\n run();\n }, [state.fields.date]);\n\n useEffect(() => {\n if (\n state.schedule &&\n state.schedule.id &&\n state.transactionsMode === 'linked'\n ) {\n let live = liveQuery(\n q('transactions')\n .filter({ schedule: state.schedule.id })\n .select('*')\n .options({ splits: 'none' }),\n data => dispatch({ type: 'set-transactions', transactions: data })\n );\n return live.unsubscribe;\n }\n }, [state.schedule, state.transactionsMode]);\n\n useEffect(() => {\n let current = true;\n let unsubscribe;\n\n if (state.schedule && state.transactionsMode === 'matched') {\n let { error, conditions } = updateScheduleConditions(\n state.schedule,\n state.fields\n );\n\n dispatch({ type: 'set-transactions', transactions: [] });\n\n // *Extremely* gross hack because the rules are not mapped to\n // public names automatically. We really should be doing that\n // at the database layer\n conditions = conditions.map(cond => {\n if (cond.field === 'description') {\n return { ...cond, field: 'payee' };\n } else if (cond.field === 'acct') {\n return { ...cond, field: 'account' };\n }\n return cond;\n });\n\n send('make-filters-from-conditions', {\n conditions: conditions\n }).then(({ filters }) => {\n if (current) {\n let live = liveQuery(\n q('transactions')\n .filter({ $and: filters })\n .select('*')\n .options({ splits: 'none' }),\n data => dispatch({ type: 'set-transactions', transactions: data })\n );\n unsubscribe = live.unsubscribe;\n }\n });\n }\n\n return () => {\n current = false;\n if (unsubscribe) {\n unsubscribe();\n }\n };\n }, [state.schedule, state.transactionsMode, state.fields]);\n\n let selectedInst = useSelected('transactions', state.transactions, []);\n\n async function onSave() {\n dispatch({ type: 'form-error', error: null });\n\n let { error, conditions } = updateScheduleConditions(\n state.schedule,\n state.fields\n );\n\n if (error) {\n dispatch({ type: 'form-error', error });\n return;\n }\n\n let res = await sendCatch(adding ? 'schedule/create' : 'schedule/update', {\n schedule: {\n id: state.schedule.id,\n posts_transaction: state.fields.posts_transaction\n },\n conditions\n });\n\n if (res.error) {\n dispatch({\n type: 'form-error',\n error:\n 'An error occurred while saving. Please contact help@actualbudget.com for support.'\n });\n } else {\n if (adding) {\n await onLinkTransactions([...selectedInst.items], res.data);\n }\n history.goBack();\n }\n }\n\n async function onEditRule(ruleId) {\n let rule = await send('rule-get', { id: ruleId || state.schedule.rule });\n\n globalDispatch(\n pushModal('edit-rule', {\n rule,\n onSave: async () => {\n let schedule = await loadSchedule();\n dispatch({ type: 'set-schedule', schedule });\n }\n })\n );\n }\n\n async function onLinkTransactions(ids, scheduleId) {\n await send('transactions-batch-update', {\n updated: ids.map(id => ({\n id,\n schedule: scheduleId || state.schedule.id\n }))\n });\n selectedInst.dispatch({ type: 'select-none' });\n }\n\n async function onUnlinkTransactions(ids) {\n await send('transactions-batch-update', {\n updated: ids.map(id => ({ id, schedule: null }))\n });\n selectedInst.dispatch({ type: 'select-none' });\n }\n\n if (state.schedule == null) {\n return null;\n }\n\n function onSwitchTransactions(mode) {\n dispatch({ type: 'switch-transactions', mode });\n selectedInst.dispatch({ type: 'select-none' });\n }\n\n let payee = payees ? payees[state.fields.payee] : null;\n\n // This is derived from the date\n let repeats = state.fields.date ? !!state.fields.date.frequency : false;\n\n return (\n <Page\n title={payee ? `Schedule: ${payee.name}` : 'Schedule'}\n modalSize=\"medium\"\n >\n <Stack direction=\"row\" style={{ marginTop: 20 }}>\n <FormField style={{ flex: 1 }}>\n <FormLabel title=\"Payee\" />\n <PayeeAutocomplete\n value={state.fields.payee}\n inputProps={{ placeholder: '(none)' }}\n onSelect={id =>\n dispatch({ type: 'set-field', field: 'payee', value: id })\n }\n />\n </FormField>\n\n <FormField style={{ flex: 1 }}>\n <FormLabel title=\"Account\" />\n <AccountAutocomplete\n value={state.fields.account}\n inputProps={{ placeholder: '(none)' }}\n onSelect={id =>\n dispatch({ type: 'set-field', field: 'account', value: id })\n }\n />\n </FormField>\n\n <FormField style={{ flex: 1 }}>\n <Stack direction=\"row\" align=\"center\" style={{ marginBottom: 3 }}>\n <FormLabel title=\"Amount\" style={{ margin: 0, flex: 1 }} />\n <OpSelect\n ops={['is', 'isapprox', 'isbetween']}\n value={state.fields.amountOp}\n formatOp={op => {\n switch (op) {\n case 'is':\n return 'is exactly';\n case 'isapprox':\n return 'is approximately';\n case 'isbetween':\n return 'is between';\n default:\n throw new Error('Invalid op for select: ' + op);\n }\n }}\n style={{\n padding: '0 10px',\n color: colors.n5,\n fontSize: 12\n }}\n onChange={(_, op) =>\n dispatch({ type: 'set-field', field: 'amountOp', value: op })\n }\n />\n </Stack>\n {state.fields.amountOp === 'isbetween' ? (\n <BetweenAmountInput\n defaultValue={state.fields.amount}\n onChange={value =>\n dispatch({\n type: 'set-field',\n field: 'amount',\n value\n })\n }\n />\n ) : (\n <AmountInput\n defaultValue={state.fields.amount}\n onChange={value =>\n dispatch({\n type: 'set-field',\n field: 'amount',\n value\n })\n }\n />\n )}\n </FormField>\n </Stack>\n\n <View style={{ marginTop: 20 }}>\n <FormLabel title=\"Date\" />\n </View>\n\n <Stack direction=\"row\" align=\"flex-start\">\n <View style={{ flex: 1 }}>\n {repeats ? (\n <RecurringSchedulePicker\n value={state.fields.date}\n onChange={value =>\n dispatch({ type: 'set-field', field: 'date', value })\n }\n />\n ) : (\n <DateSelect\n value={state.fields.date}\n onSelect={date =>\n dispatch({ type: 'set-field', field: 'date', value: date })\n }\n dateFormat={dateFormat}\n />\n )}\n\n {state.upcomingDates && (\n <View style={{ fontSize: 13, marginTop: 20 }}>\n <Text style={{ color: colors.n4, fontWeight: 600 }}>\n Upcoming dates\n </Text>\n <Stack\n direction=\"column\"\n spacing={1}\n style={{ marginTop: 10, color: colors.n4 }}\n >\n {state.upcomingDates.map(date => (\n <View>{monthUtils.format(date, `${dateFormat} EEEE`)}</View>\n ))}\n </Stack>\n </View>\n )}\n </View>\n\n <View\n style={{\n marginTop: 5,\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n userSelect: 'none'\n }}\n >\n <Checkbox\n id=\"form_repeats\"\n checked={repeats}\n onChange={e => {\n dispatch({ type: 'set-repeats', repeats: e.target.checked });\n }}\n />\n <label for=\"form_repeats\" style={{ userSelect: 'none' }}>\n Repeats\n </label>\n </View>\n\n <View\n style={{\n alignItems: 'flex-end',\n flex: 1\n }}\n >\n <View\n style={{\n marginTop: 5,\n flexDirection: 'row',\n alignItems: 'center',\n userSelect: 'none',\n justifyContent: 'flex-end'\n }}\n >\n <Checkbox\n id=\"form_posts_transaction\"\n checked={state.fields.posts_transaction}\n onChange={e => {\n dispatch({\n type: 'set-field',\n field: 'posts_transaction',\n value: e.target.checked\n });\n }}\n />\n <label for=\"form_posts_transaction\" style={{ userSelect: 'none' }}>\n Automatically add transaction\n </label>\n </View>\n\n <Text\n style={{\n width: 350,\n textAlign: 'right',\n color: colors.n4,\n marginTop: 10,\n fontSize: 13,\n lineHeight: '1.4em'\n }}\n >\n If checked, the schedule will automatically create transactions for\n you in the specified account\n </Text>\n\n {!adding && state.schedule.rule && (\n <Stack direction=\"row\" align=\"center\" style={{ marginTop: 30 }}>\n {state.isCustom && (\n <Text\n style={{\n color: colors.b5,\n fontSize: 13,\n textAlign: 'right',\n width: 350\n }}\n >\n This schedule has custom conditions and actions\n </Text>\n )}\n <Button onClick={() => onEditRule()} disabled={adding}>\n Edit as rule\n </Button>\n </Stack>\n )}\n </View>\n </Stack>\n\n <View style={{ marginTop: 30, flex: 1 }}>\n <SelectedProvider instance={selectedInst}>\n {adding ? (\n <View style={{ flexDirection: 'row', padding: '5px 0' }}>\n <Text style={{ color: colors.n4 }}>\n These transactions match this schedule:\n </Text>\n <View style={{ flex: 1 }} />\n <Text style={{ color: colors.n6 }}>\n Select transactions to link on save\n </Text>\n </View>\n ) : (\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n <Button\n bare\n style={{\n color:\n state.transactionsMode === 'linked' ? colors.b4 : colors.n7,\n marginRight: 10,\n fontSize: 14\n }}\n onClick={() => onSwitchTransactions('linked')}\n >\n Linked transactions\n </Button>{' '}\n <Button\n bare\n style={{\n color:\n state.transactionsMode === 'matched'\n ? colors.b4\n : colors.n7,\n fontSize: 14\n }}\n onClick={() => onSwitchTransactions('matched')}\n >\n Find matching transactions\n </Button>\n <View style={{ flex: 1 }} />\n <SelectedItemsButton\n name=\"transactions\"\n items={\n state.transactionsMode === 'linked'\n ? [{ name: 'unlink', text: 'Unlink from schedule' }]\n : [{ name: 'link', text: 'Link to schedule' }]\n }\n onSelect={(name, ids) => {\n switch (name) {\n case 'link':\n onLinkTransactions(ids);\n break;\n case 'unlink':\n onUnlinkTransactions(ids);\n break;\n default:\n }\n }}\n />\n </View>\n )}\n\n <SimpleTransactionsTable\n transactions={state.transactions}\n fields={['date', 'payee', 'amount']}\n style={{\n border: '1px solid ' + colors.border,\n borderRadius: 4,\n overflow: 'hidden',\n marginTop: 5\n }}\n />\n </SelectedProvider>\n </View>\n\n <Stack\n direction=\"row\"\n justify=\"flex-end\"\n align=\"center\"\n style={{ marginTop: 20 }}\n >\n {state.error && <Text style={{ color: colors.r4 }}>{state.error}</Text>}\n <Button style={{ marginRight: 10 }} onClick={() => history.goBack()}>\n Cancel\n </Button>\n <Button primary onClick={onSave}>\n {adding ? 'Add' : 'Save'}\n </Button>\n </Stack>\n </Page>\n );\n}\n","import React, { useCallback } from 'react';\nimport { useSelector } from 'react-redux';\nimport { useLocation, useHistory } from 'react-router-dom';\nimport { useSchedules } from 'loot-core/src/client/data-hooks/schedules';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { View, Text } from 'loot-design/src/components/common';\nimport { Page } from '../Page';\nimport { SchedulesTable } from './SchedulesTable';\n\nexport default function ScheduleLink() {\n let location = useLocation();\n let history = useHistory();\n let scheduleData = useSchedules(\n useCallback(query => query.filter({ completed: false }), [])\n );\n let dateFormat = useSelector(state => {\n return state.prefs.local.dateFormat || 'MM/dd/yyyy';\n });\n\n if (scheduleData == null) {\n return null;\n }\n\n let { schedules, statuses } = scheduleData;\n\n async function onSelect(scheduleId) {\n let { state } = location;\n let ids = state.transactionIds;\n if (ids && ids.length > 0) {\n await send('transactions-batch-update', {\n updated: ids.map(id => ({ id, schedule: scheduleId }))\n });\n }\n history.goBack();\n }\n\n return (\n <Page title=\"Link Schedule\" modalSize=\"medium\">\n <Text style={{ marginBottom: 20 }}>\n Choose a schedule to link these transactions to:\n </Text>\n\n <SchedulesTable\n schedules={schedules}\n statuses={statuses}\n minimal={true}\n onSelect={onSelect}\n />\n </Page>\n );\n}\n","import React, { useCallback, useState, useEffect } from 'react';\nimport { useSelector } from 'react-redux';\nimport { useLocation, useHistory } from 'react-router-dom';\nimport q, { runQuery } from 'loot-core/src/client/query-helpers';\nimport Platform from 'loot-core/src/client/platform';\nimport { useSchedules } from 'loot-core/src/client/data-hooks/schedules';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport {\n View,\n Text,\n Stack,\n Button,\n ButtonWithLoading,\n P\n} from 'loot-design/src/components/common';\nimport {\n Table,\n TableHeader,\n Row,\n Field,\n Cell,\n SelectCell\n} from 'loot-design/src/components/table';\nimport { getRecurringDescription } from 'loot-core/src/shared/schedules';\nimport { colors, styles } from 'loot-design/src/style';\nimport useSelected, {\n useSelectedDispatch,\n useSelectedItems,\n SelectedProvider\n} from 'loot-design/src/components/useSelected';\nimport { Page } from '../Page';\nimport { ScheduleAmountCell } from './SchedulesTable';\nimport DisplayId from '../util/DisplayId';\n\nlet ROW_HEIGHT = 43;\n\nfunction DiscoverSchedulesTable({ schedules, loading }) {\n let selectedItems = useSelectedItems();\n let dispatchSelected = useSelectedDispatch();\n\n function renderItem({ item }) {\n let selected = selectedItems.has(item.id);\n let amountOp = item._conditions.find(c => c.field === 'amount').op;\n let recurDescription = getRecurringDescription(item.date);\n\n return (\n <Row\n height={ROW_HEIGHT}\n inset={15}\n backgroundColor=\"transparent\"\n onClick={() => {\n dispatchSelected({ type: 'select', id: item.id });\n }}\n borderColor={selected ? colors.b8 : colors.border}\n style={{\n cursor: 'pointer',\n backgroundColor: selected ? colors.selected : 'white',\n ':hover': {\n backgroundColor: selected ? colors.selected : colors.hover\n }\n }}\n >\n <SelectCell\n exposed={true}\n focused={false}\n selected={selected}\n onSelect={() => {\n dispatchSelected({ type: 'select', id: item.id });\n }}\n />\n <Field width=\"flex\">\n <DisplayId type=\"payees\" id={item.payee} />\n </Field>\n <Field width=\"flex\">\n <DisplayId type=\"accounts\" id={item.account} />\n </Field>\n <Field width=\"auto\" title={recurDescription} style={{ flex: 1.5 }}>\n {recurDescription}\n </Field>\n <ScheduleAmountCell amount={item.amount} op={amountOp} />\n </Row>\n );\n }\n\n return (\n <View style={{ flex: 1 }}>\n <TableHeader height={ROW_HEIGHT} inset={15} version=\"v2\">\n <SelectCell\n exposed={true}\n focused={false}\n selected={selectedItems.size > 0}\n onSelect={() => dispatchSelected({ type: 'select-all' })}\n />\n <Field width=\"flex\">Payee</Field>\n <Field width=\"flex\">Account</Field>\n <Field width=\"auto\" style={{ flex: 1.5 }}>\n When\n </Field>\n <Field width={100} style={{ textAlign: 'right' }}>\n Amount\n </Field>\n </TableHeader>\n <Table\n rowHeight={ROW_HEIGHT}\n backgroundColor=\"transparent\"\n version=\"v2\"\n style={{ flex: 1, backgroundColor: 'transparent' }}\n items={schedules}\n loading={loading}\n isSelected={id => selectedItems.has(id)}\n renderItem={renderItem}\n renderEmpty=\"No schedules found\"\n />\n </View>\n );\n}\n\nexport default function DiscoverSchedules() {\n let location = useLocation();\n let history = useHistory();\n let [schedules, setSchedules] = useState();\n let [creating, setCreating] = useState(false);\n\n let selectedInst = useSelected('discover-schedules', schedules, []);\n\n useEffect(() => {\n async function run() {\n setSchedules(await send('schedule/discover'));\n }\n run();\n }, []);\n\n async function onCreate() {\n let items = selectedInst.items;\n let selected = schedules.filter(s => selectedInst.items.has(s.id));\n setCreating(true);\n\n for (let schedule of selected) {\n let scheduleId = await send('schedule/create', {\n conditions: schedule._conditions\n });\n\n // Now query for matching transactions and link them automatically\n let { filters } = await send('make-filters-from-conditions', {\n conditions: schedule._conditions\n });\n\n if (filters.length > 0) {\n let { data: transactions } = await runQuery(\n q('transactions')\n .filter({ $and: filters })\n .select('id')\n );\n await send('transactions-batch-update', {\n updated: transactions.map(t => ({\n id: t.id,\n schedule: scheduleId\n }))\n });\n }\n }\n\n setCreating(false);\n history.goBack();\n }\n\n return (\n <Page title=\"Found schedules\" modalSize={{ width: 850, height: 650 }}>\n <P>\n We found some possible schedules in your current transactions. Select\n the ones you want to create.\n </P>\n <P>\n If you expected a schedule here and don't see it, it might be because\n the payees of the transactions don't match. Make sure you rename payees\n on all transactions for a schedule to be the same payee.\n </P>\n <P>\n You can always do this later\n {Platform.isBrowser\n ? ' from the \"Find schedules\" item in the sidebar menu'\n : ' from the \"Tools > Find schedules\" menu item'}\n .\n </P>\n\n <SelectedProvider instance={selectedInst}>\n <DiscoverSchedulesTable\n loading={schedules == null}\n schedules={schedules}\n />\n </SelectedProvider>\n\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-end\"\n style={{ paddingTop: 20 }}\n >\n <Button onClick={() => history.goBack()}>Do nothing</Button>\n <ButtonWithLoading\n primary\n loading={creating}\n disabled={selectedInst.items.size === 0}\n onClick={onCreate}\n >\n Create schedules\n </ButtonWithLoading>\n </Stack>\n </Page>\n );\n}\n","import React from 'react';\nimport { useSelector } from 'react-redux';\nimport { useLocation, useHistory } from 'react-router-dom';\nimport { useSchedules } from 'loot-core/src/client/data-hooks/schedules';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport {\n View,\n Text,\n P,\n Button,\n Stack\n} from 'loot-design/src/components/common';\nimport { Page } from '../Page';\nimport { SchedulesTable } from './SchedulesTable';\nimport DisplayId from '../util/DisplayId';\nimport { colors, styles } from 'loot-design/src/style';\n\nexport default function PostsOfflineNotification() {\n let location = useLocation();\n let history = useHistory();\n\n let payees = (location.state && location.state.payees) || [];\n let plural = payees.length > 1;\n\n function onClose() {\n history.goBack();\n }\n\n async function onPost() {\n await send('schedule/force-run-service');\n history.goBack();\n }\n\n return (\n <Page title=\"Post transactions?\" modalSize=\"small\">\n <P>\n {payees.length > 0 ? (\n <Text>\n The {plural ? 'payees ' : 'payee '}\n {payees.map((id, idx) => (\n <Text>\n <Text style={{ color: colors.p4 }}>\n <DisplayId key={id} id={id} type=\"payees\" />\n </Text>\n {idx === payees.length - 1\n ? ' '\n : idx === payees.length - 2\n ? ', and '\n : ', '}\n </Text>\n ))}\n </Text>\n ) : (\n <Text>There {plural ? 'are payees ' : 'is a payee '} that </Text>\n )}\n\n <Text>\n {plural ? 'have ' : 'has '} schedules that are due today. Usually we\n automatically post transactions for these, but you are offline or\n syncing failed. In order to avoid duplicate transactions, we let you\n choose whether or not to create transactions for these schedules.\n </Text>\n </P>\n <P>\n Be aware that other devices may have already created these transactions.\n If you have multiple devices, make sure you only do this on one device\n or you will have duplicate transactions.\n </P>\n <P>\n You can always manually post a transaction later for a due schedule by\n selecting the schedule and clicking \"Post transaction\" in the action\n menu.\n </P>\n <Stack\n direction=\"row\"\n justify=\"flex-end\"\n style={{ marginTop: 20 }}\n spacing={2}\n >\n <Button onClick={onClose}>Decide later</Button>\n <Button primary onClick={onPost}>\n Post transactions\n </Button>\n </Stack>\n </Page>\n );\n}\n","import React, { useCallback, useState, useEffect } from 'react';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { colors } from 'loot-design/src/style';\nimport {\n View,\n Text,\n P,\n ButtonWithLoading\n} from 'loot-design/src/components/common';\nimport { Page } from '../Page';\n\nfunction renderResults(results) {\n let { numBlankPayees, numCleared, numDeleted } = results;\n if (numBlankPayees === 0 && numCleared === 0 && numDeleted === 0) {\n return (\n <P style={{ alignSelf: 'center', color: colors.g3 }}>\n No split transactions found needing repair.\n </P>\n );\n }\n\n let fixed = '';\n if (numBlankPayees > 0) {\n fixed += `${numBlankPayees} split transactions with a blank payee`;\n }\n if (numCleared > 0) {\n if (fixed !== '') {\n fixed += ', and ';\n }\n fixed += `${numCleared} split transactions with the wrong cleared flag`;\n }\n if (numDeleted > 0) {\n if (fixed !== '') {\n fixed += ', and ';\n }\n fixed += `${numDeleted} split transactions that weren't properly deleted`;\n }\n\n return (\n <P style={{ alignSelf: 'center', color: colors.g3 }}>Fixed {fixed}.</P>\n );\n}\n\nexport default function FixSplitsTool() {\n let [loading, setLoading] = useState(false);\n let [results, setResults] = useState(null);\n\n async function onFix() {\n setLoading(true);\n let res = await send('tools/fix-split-transactions');\n setResults(res);\n setLoading(false);\n }\n\n return (\n <Page title=\"Repair Split Transactions\" modalSize={{ width: 650 }}>\n <View style={{ alignItems: 'flex-start' }}>\n <P>This tool does two things:</P>\n <P>\n <ul style={{ margin: 0 }}>\n <li style={{ marginBottom: '1em' }}>\n Ensures that deleted split transactions are fully deleted. In\n previous versions of the app, certain split transactions may\n appear deleted but not all of them are actually deleted. This\n causes the transactions list to look correct, but certain balances\n may be incorrect when filtering.\n </li>\n <li>\n Sync the payee and cleared flag of a split transaction to the main\n or \"parent\" transaction, if appropriate. The payee will only be\n set if it currently doesn't have one.\n </li>\n </ul>\n </P>\n <P>\n If you see blank payees on splits or account balances (or any\n balances) are incorrect, this may fix it.\n </P>\n <ButtonWithLoading\n primary\n loading={loading}\n onClick={onFix}\n style={{ alignSelf: 'center', margin: '15px 0' }}\n >\n Repair split transactions\n </ButtonWithLoading>\n {results && renderResults(results)}\n </View>\n </Page>\n );\n}\n","import React from 'react';\nimport { View, Text } from './common';\nimport { styles, colors } from '../style';\nimport InformationOutline from '../svg/v1/InformationOutline';\nimport ExclamationOutline from '../svg/v1/ExclamationOutline';\n\nexport function Alert({ icon: Icon, color, backgroundColor, style, children }) {\n return (\n <View\n style={[\n {\n color,\n fontSize: 13,\n boxShadow: styles.shadow,\n borderRadius: 4,\n backgroundColor,\n padding: 10,\n flexDirection: 'row',\n '& a, & a:active, & a:visited': {\n color: colors.b3\n }\n },\n style\n ]}\n >\n <View\n style={{\n paddingLeft: 2,\n paddingTop: '.11em',\n alignSelf: 'stretch',\n flexShrink: 0,\n marginRight: 5\n }}\n >\n <Icon width={13} style={{ color, marginTop: 2 }} />\n </View>\n <Text style={{ zIndex: 1, lineHeight: 1.5 }}>{children}</Text>\n </View>\n );\n}\n\nexport function Information({ style, children }) {\n return (\n <Alert\n icon={InformationOutline}\n color={colors.n4}\n backgroundColor=\"transparent\"\n style={[style, { boxShadow: 'none', padding: 5 }]}\n >\n {children}\n </Alert>\n );\n}\n\nexport function Warning({ style, children }) {\n return (\n <Alert\n icon={ExclamationOutline}\n color={colors.y2}\n backgroundColor={colors.y10}\n style={style}\n >\n {children}\n </Alert>\n );\n}\n\nexport function Error({ style, children }) {\n return (\n <Alert\n icon={ExclamationOutline}\n color={colors.r2}\n backgroundColor={colors.r10}\n style={style}\n >\n {children}\n </Alert>\n );\n}\n","import React, { useState, useEffect, useRef } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport { css } from 'glamor';\nimport { Route, Switch, Redirect } from 'react-router-dom';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Button,\n ButtonLink,\n ButtonWithLoading,\n AnchorLink,\n Link,\n Input\n} from 'loot-design/src/components/common';\nimport { send, listen } from 'loot-core/src/platform/client/fetch';\nimport { numberFormats } from 'loot-core/src/shared/util';\nimport { styles, colors } from 'loot-design/src/style';\nimport { Information, Warning, Error } from 'loot-design/src/components/alerts';\nimport Checkmark from 'loot-design/src/svg/v1/Checkmark';\nimport CheveronDown from 'loot-design/src/svg/v1/CheveronDown';\nimport ExpandArrow from 'loot-design/src/svg/ExpandArrow';\nimport ExclamationSolid from 'loot-design/src/svg/v1/ExclamationSolid';\nimport Platform from 'loot-core/src/client/platform';\n\nlet dateFormats = [\n { value: 'MM/dd/yyyy', label: 'MM/DD/YYYY' },\n { value: 'dd/MM/yyyy', label: 'DD/MM/YYYY' },\n { value: 'yyyy-MM-dd', label: 'YYYY-MM-DD' },\n { value: 'MM.dd.yyyy', label: 'MM.DD.YYYY' },\n { value: 'dd.MM.yyyy', label: 'DD.MM.YYYY' }\n];\n\nfunction Title({ name, style }) {\n return (\n <View\n style={[\n { fontSize: 20, fontWeight: 500, marginBottom: 20, flexShrink: 0 },\n style\n ]}\n >\n {name}\n </View>\n );\n}\n\nfunction Advanced({ prefs, userData, pushModal, resetSync }) {\n let [expanded, setExpanded] = useState(true);\n let [resetting, setResetting] = useState(false);\n let [resettingCache, setResettingCache] = useState(false);\n\n async function onResetSync() {\n setResetting(true);\n await resetSync();\n setResetting(false);\n }\n\n async function onResetCache() {\n setResettingCache(true);\n await send('reset-budget-cache');\n setResettingCache(false);\n }\n\n return (\n <View style={{ alignItems: 'flex-start', marginTop: 55 }}>\n <View\n style={[\n {\n fontSize: 15,\n marginBottom: 20,\n flexDirection: 'row',\n alignItems: 'center'\n },\n styles.staticText\n ]}\n onClick={() => setExpanded(!expanded)}\n >\n <ExpandArrow\n width={8}\n height={8}\n style={{\n marginRight: 5,\n transition: 'transform .2s',\n transform: !expanded && 'rotateZ(-90deg)'\n }}\n />\n Advanced\n </View>\n\n {expanded && (\n <View style={{ marginBottom: 20, alignItems: 'flex-start' }}>\n <Text>\n <strong>Budget ID</strong>: {prefs.id}\n </Text>\n\n <View\n style={{\n backgroundColor: colors.n9,\n alignItems: 'flex-start',\n padding: 15,\n borderRadius: 4,\n marginTop: 20,\n border: '1px solid ' + colors.n8\n }}\n >\n <Text style={{ marginBottom: 10, width: 500, lineHeight: 1.5 }}>\n <strong>Reset budget cache</strong> will clear all cached values\n for the budget and recalculate the entire budget. All values in\n the budget are cached for performance reasons, and if there is a\n bug in the cache you won't see correct values. There is no danger\n in resetting the cache. Hopefully you never have to do this.\n </Text>\n <ButtonWithLoading loading={resettingCache} onClick={onResetCache}>\n Reset budget cache\n </ButtonWithLoading>\n </View>\n\n <View\n style={{\n backgroundColor: colors.n9,\n alignItems: 'flex-start',\n padding: 15,\n borderRadius: 4,\n marginTop: 20,\n border: '1px solid ' + colors.n8\n }}\n >\n <Text style={{ marginBottom: 10, width: 500, lineHeight: 1.5 }}>\n <strong>Reset sync</strong> will remove all local data used to\n track changes for syncing, and create a fresh sync id on our\n server. This file on other devices will have to be re-downloaded\n to use the new sync id. Use this if there is a problem with\n syncing and you want to start fresh.\n </Text>\n\n <ButtonWithLoading loading={resetting} onClick={onResetSync}>\n Reset sync\n </ButtonWithLoading>\n <Text style={{ marginTop: 15, color: colors.n4, fontSize: 12 }}>\n Sync ID: {prefs.groupId || '(none)'}\n </Text>\n </View>\n </View>\n )}\n </View>\n );\n}\n\nfunction GlobalSettings({\n globalPrefs,\n userData,\n saveGlobalPrefs,\n pushModal,\n closeBudget\n}) {\n let [documentDirChanged, setDirChanged] = useState(false);\n let dirScrolled = useRef(null);\n\n useEffect(() => {\n if (dirScrolled.current) {\n dirScrolled.current.scrollTo(10000, 0);\n }\n }, []);\n\n async function onChooseDocumentDir() {\n let res = await window.Actual.openFileDialog({\n properties: ['openDirectory']\n });\n if (res) {\n saveGlobalPrefs({ documentDir: res[0] });\n setDirChanged(true);\n }\n }\n\n function onAutoUpdate(e) {\n saveGlobalPrefs({ autoUpdate: e.target.checked });\n }\n\n function onTrackUsage(e) {\n saveGlobalPrefs({ trackUsage: e.target.checked });\n }\n\n return (\n <View>\n <View>\n <Title name=\"General\" />\n\n {!Platform.isBrowser && (\n <View\n style={{\n flexDirection: 'row',\n maxWidth: 550,\n alignItems: 'center',\n overflow: 'hidden'\n }}\n >\n <Text style={{ flexShrink: 0 }}>Store files here: </Text>\n <Text\n innerRef={dirScrolled}\n style={{\n backgroundColor: 'white',\n padding: '7px 10px',\n borderRadius: 4,\n marginLeft: 5,\n overflow: 'auto',\n whiteSpace: 'nowrap',\n // TODO: When we update electron, we should be able to\n // remove this. In previous versions of Chrome, once the\n // scrollbar appears it never goes away\n '::-webkit-scrollbar': { display: 'none' }\n }}\n >\n {globalPrefs.documentDir}\n </Text>\n <Button\n primary\n onClick={onChooseDocumentDir}\n style={{\n fontSize: 14,\n marginLeft: 5,\n flexShrink: 0,\n alignSelf: 'flex-start'\n }}\n >\n Change location\n </Button>\n </View>\n )}\n\n {documentDirChanged && (\n <Information style={{ marginTop: 10 }}>\n A restart is required for this change to take effect\n </Information>\n )}\n\n <View\n style={{\n flexDirection: 'row',\n marginTop: 30,\n alignItems: 'flex-start'\n }}\n >\n <input\n type=\"checkbox\"\n checked={globalPrefs.autoUpdate}\n style={{ marginRight: 5 }}\n onChange={onAutoUpdate}\n />\n\n <View>\n <Text style={{ fontSize: 15 }}>\n Automatically check for updates\n </Text>\n <View\n style={{\n color: colors.n2,\n marginTop: 10,\n maxWidth: 600,\n lineHeight: '1.4em'\n }}\n >\n By default, Actual will automatically apply new updates as they\n are available. Disabling this will avoid updating Actual. You will\n need to go to the About menu to manually check for updates.\n </View>\n </View>\n </View>\n </View>\n\n <View style={{ marginTop: 30 }}>\n <Title name=\"Privacy\" />\n\n <View\n style={{\n flexDirection: 'row',\n marginTop: 30,\n alignItems: 'flex-start'\n }}\n >\n <input\n type=\"checkbox\"\n checked={globalPrefs.trackUsage}\n style={{ marginRight: 5 }}\n onChange={onTrackUsage}\n />\n\n <View>\n <Text style={{ fontSize: 15 }}>\n Send basic usage statistics back to Actual{\"'\"}s servers\n </Text>\n <View\n style={{\n color: colors.n2,\n marginTop: 10,\n maxWidth: 600,\n lineHeight: '1.4em'\n }}\n >\n We don{\"'\"}t track anything specific &mdash; only the fact that\n you{\"'\"}ve opened Actual. This helps by giving us important\n feedback about how popular new features are.\n </View>\n </View>\n </View>\n </View>\n </View>\n );\n}\n\nfunction FileSettings({\n savePrefs,\n prefs,\n userData,\n localServerURL,\n pushModal,\n resetSync,\n setAppState,\n signOut\n}) {\n function onDateFormat(e) {\n let format = e.target.value;\n savePrefs({ dateFormat: format });\n }\n\n function onNumberFormat(e) {\n let format = e.target.value;\n savePrefs({ numberFormat: format });\n }\n\n function onChangeKey() {\n pushModal('create-encryption-key', { recreate: true });\n }\n\n async function onExport() {\n let data = await send('export-budget');\n window.Actual.saveFile(data, 'budget.zip', 'Export budget');\n }\n\n let dateFormat = prefs.dateFormat || 'MM/dd/yyyy';\n let numberFormat = prefs.numberFormat || 'comma-dot';\n\n return (\n <View>\n <View style={{ marginTop: 30 }}>\n <Title name=\"Formatting\" />\n\n <Text>\n Date format:{' '}\n <select\n {...css({ marginLeft: 5, fontSize: 14 })}\n onChange={onDateFormat}\n >\n {dateFormats.map(f => (\n <option value={f.value} selected={f.value === dateFormat}>\n {f.label}\n </option>\n ))}\n </select>\n </Text>\n\n <Text style={{ marginTop: 20 }}>\n Number format:{' '}\n <select\n {...css({ marginLeft: 5, fontSize: 14 })}\n onChange={onNumberFormat}\n >\n {numberFormats.map(f => (\n <option value={f.value} selected={f.value === numberFormat}>\n {f.label}\n </option>\n ))}\n </select>\n </Text>\n </View>\n\n <View style={{ marginTop: 30 }}>\n <Title name=\"Encryption\" />\n <View style={{ flexDirection: 'row' }}>\n <View>\n <Text style={{ fontWeight: 700, fontSize: 15 }}>\n End-to-end encryption\n </Text>\n <View\n style={{\n color: colors.n2,\n marginTop: 10,\n maxWidth: 600,\n lineHeight: '1.4em'\n }}\n >\n {prefs.encryptKeyId ? (\n <Text>\n <Text style={{ color: colors.g4, fontWeight: 600 }}>\n Encryption is turned on.\n </Text>{' '}\n Your data is encrypted with a key that only you have before\n sending it out to the cloud . Local data remains unencrypted\n so if you forget your password you can re-encrypt it.\n <Button\n style={{ marginTop: 10 }}\n onClick={() => onChangeKey()}\n >\n Generate new key\n </Button>\n </Text>\n ) : (\n <View style={{ alignItems: 'flex-start' }}>\n <Text style={{ lineHeight: '1.4em' }}>\n Encryption is not enabled. Any data on our servers is still\n stored safely and securely, but it's not end-to-end\n encrypted which means we have the ability to read it (but we\n won't). If you want, you can use a password to encrypt your\n data on our servers.\n </Text>\n <Button\n style={{ marginTop: 10 }}\n onClick={() => {\n alert(\n 'End-to-end encryption is not supported on the self-hosted service yet'\n );\n // pushModal('create-encryption-key');\n }}\n >\n Enable encryption\n </Button>\n </View>\n )}\n </View>\n </View>\n </View>\n </View>\n\n {Platform.isBrowser && (\n <View style={{ marginTop: 30, alignItems: 'flex-start' }}>\n <Title name=\"Export\" />\n <Button onClick={onExport}>Export data</Button>\n </View>\n )}\n\n <Advanced\n prefs={prefs}\n userData={userData}\n pushModal={pushModal}\n resetSync={resetSync}\n />\n </View>\n );\n}\n\nfunction SettingsLink({ to, name, style, first, last }) {\n return (\n <AnchorLink\n to={to}\n style={[\n {\n fontSize: 14,\n padding: '6px 10px',\n borderBottom: '2px solid transparent',\n textDecoration: 'none',\n borderRadius: first ? '4px 0 0 4px' : last ? '0 4px 4px 0' : 4,\n border: '1px solid ' + colors.n4,\n color: colors.n3\n },\n style\n ]}\n activeStyle={{\n backgroundColor: colors.p6,\n borderColor: colors.p6,\n color: 'white'\n }}\n >\n {name}\n </AnchorLink>\n );\n}\n\nclass Settings extends React.Component {\n componentDidMount() {\n this.unlisten = listen('prefs-updated', () => {\n this.props.loadPrefs();\n });\n\n this.props.getUserData();\n this.props.loadPrefs();\n }\n\n componentWillUnmount() {\n this.unlisten();\n }\n\n render() {\n let { prefs, globalPrefs, localServerURL, userData, match } = this.props;\n\n return (\n <View style={[styles.page, { overflow: 'hidden', fontSize: 14 }]}>\n <View\n style={{\n flexDirection: 'row',\n alignSelf: 'center',\n margin: '15px 0'\n }}\n >\n <SettingsLink to={`${match.path}/file`} name=\"File\" first={true} />\n <SettingsLink to={`${match.path}/global`} name=\"Global\" last={true} />\n </View>\n\n <View\n style={[\n styles.pageContent,\n {\n alignItems: 'flex-start',\n flex: 1,\n overflow: 'auto',\n paddingBottom: 20\n }\n ]}\n >\n <View style={{ flexShrink: 0 }}>\n <Switch>\n <Route path={`${match.path}/`} exact>\n <Redirect to={`${match.path}/file`} />\n </Route>\n <Route path={`${match.path}/global`}>\n <GlobalSettings\n globalPrefs={globalPrefs}\n userData={userData}\n saveGlobalPrefs={this.props.saveGlobalPrefs}\n pushModal={this.props.pushModal}\n closeBudget={this.props.closeBudget}\n />\n </Route>\n <Route path={`${match.path}/file`}>\n <FileSettings\n prefs={prefs}\n localServerURL={localServerURL}\n userData={userData}\n pushModal={this.props.pushModal}\n savePrefs={this.props.savePrefs}\n setAppState={this.props.setAppState}\n signOut={this.props.signOut}\n resetSync={this.props.resetSync}\n />\n </Route>\n </Switch>\n </View>\n </View>\n </View>\n );\n }\n}\n\nexport default connect(\n state => ({\n prefs: state.prefs.local,\n globalPrefs: state.prefs.global,\n localServerURL: state.account.localServerURL,\n userData: state.user.data\n }),\n actions\n)(Settings);\n","import React from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport {\n View,\n Text,\n Modal,\n Button,\n Strong,\n P\n} from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\nimport { authorizeBank } from '../../plaid';\n\nclass CreateAccount extends React.Component {\n onConnect = async () => {\n authorizeBank(this.props.pushModal);\n };\n\n onCreateLocalAccount = () => {\n const { pushModal } = this.props;\n pushModal('add-local-account');\n };\n\n render() {\n const { modalProps } = this.props;\n\n return (\n <Modal title=\"Add Account\" {...modalProps}>\n {() => (\n <View style={{ maxWidth: 500 }}>\n <Text\n style={{ marginBottom: 10, lineHeight: '1.4em', fontSize: 15 }}\n >\n <strong>Link your bank accounts</strong> to automatically download\n transactions. We offer hundreds of banks to sync with, and our\n service will provide reliable, up-to-date information.\n </Text>\n\n <Button\n primary\n style={{\n padding: '10px 0',\n fontSize: 15,\n fontWeight: 600,\n marginTop: 10\n }}\n onClick={this.onConnect}\n >\n Link bank account\n </Button>\n\n <View\n style={{\n marginTop: 30,\n marginBottom: 10,\n lineHeight: '1.4em',\n fontSize: 15\n }}\n >\n You can also create a local account if you want to track\n transactions manually. You can add transactions manually or import\n QIF/OFX/QFX files.\n </View>\n\n <Button\n style={{\n padding: '10px 0',\n fontSize: 15,\n fontWeight: 600,\n marginTop: 10,\n color: colors.n3\n }}\n onClick={this.onCreateLocalAccount}\n >\n Create local account\n </Button>\n </View>\n )}\n </Modal>\n );\n }\n}\n\nexport default connect(\n state => ({\n currentModal: state.modals.currentModal\n }),\n dispatch => bindActionCreators(actions, dispatch)\n)(CreateAccount);\n","export function fromPlaidAccountType(type, subtype) {\n switch (type) {\n case 'brokerage':\n case 'investment':\n return 'investment';\n case 'credit':\n return 'credit';\n case 'loan':\n return 'debt';\n case 'other':\n return 'other';\n case 'depository':\n default:\n switch (subtype) {\n case 'money market':\n case 'savings':\n return 'savings';\n case 'cd':\n return 'cd';\n default:\n return 'checking';\n }\n }\n}\n\nexport function prettyAccountType(type) {\n switch (type) {\n case 'checking':\n return 'Checking';\n case 'savings':\n return 'Savings';\n case 'cd':\n return 'CD';\n case 'investment':\n return 'Investment';\n case 'credit':\n return 'Credit Card';\n case 'mortgage':\n return 'Mortgage';\n case 'debt':\n return 'Debt';\n case 'other':\n default:\n return 'Other';\n }\n}\n\nexport function determineOffBudget(type) {\n switch (type) {\n case 'investment':\n case 'mortgage':\n case 'debt':\n case 'other':\n return true;\n default:\n }\n return false;\n}\n","import React from 'react';\nimport { toRelaxedNumber } from 'loot-core/src/shared/util';\nimport { determineOffBudget } from 'loot-core/src/shared/accounts';\nimport { styles, colors } from '../../style';\nimport {\n View,\n Modal,\n ModalButtons,\n Button,\n Input,\n Select,\n P,\n InlineField,\n FormError,\n InitialFocus\n} from '../common';\nimport { Formik } from 'formik';\n\nfunction CreateLocalAccount({ modalProps, actions, history }) {\n return (\n <Modal title=\"Create Local Account\" {...modalProps} showBack={false}>\n {() => (\n <View>\n <Formik\n validateOnChange={false}\n initialValues={{\n name: '',\n type: 'checking',\n balance: '0'\n }}\n validate={() => ({})}\n onSubmit={async (values, { setErrors }) => {\n const errors = {};\n if (!values.type) {\n errors.type = 'required';\n }\n if (!values.name) {\n errors.name = 'required';\n }\n if (isNaN(parseFloat(values.balance))) {\n errors.balance = 'format';\n }\n setErrors(errors);\n\n if (Object.keys(errors).length === 0) {\n modalProps.onClose();\n let id = await actions.createAccount(\n values.name,\n values.type,\n toRelaxedNumber(values.balance),\n values.offbudget\n );\n history.push('/accounts/' + id);\n }\n }}\n render={({\n values,\n errors,\n touched,\n handleChange,\n handleBlur,\n handleSubmit,\n isSubmitting,\n setFieldValue\n }) => (\n <form onSubmit={handleSubmit}>\n <InlineField label=\"Name\" width=\"75%\">\n <InitialFocus>\n <Input\n name=\"name\"\n value={values.name}\n onChange={handleChange}\n onBlur={handleBlur}\n style={{ flex: 1 }}\n />\n </InitialFocus>\n </InlineField>\n {errors.name && (\n <FormError style={{ marginLeft: 75 }}>\n Name is required\n </FormError>\n )}\n\n <InlineField label=\"Type\" width=\"75%\">\n <Select\n name=\"type\"\n value={values.type}\n onChange={e => {\n setFieldValue(\n 'offbudget',\n determineOffBudget(e.target.value)\n );\n handleChange(e);\n }}\n onBlur={handleBlur}\n >\n <option value=\"checking\">Checking / Cash</option>\n <option value=\"savings\">Savings</option>\n <option value=\"credit\">Credit Card</option>\n <option value=\"investment\">Investment</option>\n <option value=\"mortgage\">Mortgage</option>\n <option value=\"debt\">Debt</option>\n <option value=\"other\">Other</option>\n </Select>\n </InlineField>\n {errors.type && (\n <FormError style={{ marginLeft: 75 }}>\n You must select a type\n </FormError>\n )}\n\n <View\n style={{\n width: '75%',\n flexDirection: 'row',\n justifyContent: 'flex-end'\n }}\n >\n <label style={{ userSelect: 'none' }}>\n <input\n name=\"offbudget\"\n type=\"checkbox\"\n checked={!!values.offbudget}\n onChange={handleChange}\n onBlur={handleBlur}\n />{' '}\n Off-budget\n </label>\n </View>\n\n <InlineField label=\"Balance\" width=\"75%\">\n <Input\n name=\"balance\"\n value={values.balance}\n onChange={handleChange}\n onBlur={handleBlur}\n style={{ flex: 1 }}\n />\n </InlineField>\n {errors.balance && (\n <FormError style={{ marginLeft: 75 }}>\n Balance must be a number\n </FormError>\n )}\n\n <ModalButtons>\n <Button onClick={() => modalProps.onBack()}>Back</Button>\n <Button primary style={{ marginLeft: 10 }}>\n Create\n </Button>\n </ModalButtons>\n </form>\n )}\n />\n </View>\n )}\n </Modal>\n );\n}\n\nexport default CreateLocalAccount;\n","import React, { useState } from 'react';\nimport { Formik } from 'formik';\nimport {\n View,\n Text,\n Modal,\n Button,\n P,\n Select,\n FormError,\n AnchorLink\n} from '../common';\nimport { integerToCurrency } from 'loot-core/src/shared/util';\nimport { colors } from '../../style';\n\nfunction needsCategory(account, currentTransfer, accounts) {\n const acct = accounts.find(a => a.id === currentTransfer);\n const isOffBudget = acct && acct.offbudget === 1;\n\n // The user must select a category if transferring from a budgeted\n // account to an off-budget account\n return account.offbudget === 0 && isOffBudget;\n}\n\nfunction CategorySelect({ categoryGroups, ...nativeProps }) {\n return (\n <Select {...nativeProps}>\n <option value=\"\">Select category...</option>\n {categoryGroups.map(group => (\n <optgroup key={group.id} label={group.name}>\n {group.categories.map(category => (\n <option key={category.id} value={category.id}>\n {category.name}\n </option>\n ))}\n </optgroup>\n ))}\n </Select>\n );\n}\n\nfunction CloseAccount({\n account,\n accounts,\n categoryGroups,\n balance,\n canDelete,\n actions,\n modalProps\n}) {\n let [loading, setLoading] = useState(false);\n\n let filtered = accounts.filter(a => a.id !== account.id);\n let onbudget = filtered.filter(a => a.offbudget === 0);\n let offbudget = filtered.filter(a => a.offbudget === 1);\n\n return (\n <Modal\n title=\"Close Account\"\n {...modalProps}\n style={{ flex: 0 }}\n loading={loading}\n >\n {() => (\n <View>\n <P>\n Are you sure you want to close <strong>{account.name}</strong>?{' '}\n {canDelete ? (\n <span>\n This account has no transactions so it will be permanently\n deleted.\n </span>\n ) : (\n <span>\n This account has transactions so we can\n {\"'\"}t permanently delete it.\n </span>\n )}\n </P>\n <Formik\n validateOnChange={false}\n initialValues={{ transfer: '', category: '' }}\n onSubmit={(values, { setErrors }) => {\n const errors = {};\n if (balance !== 0 && values.transfer === '') {\n errors.transfer = 'required';\n }\n if (\n needsCategory(account, values.transfer, accounts) &&\n values.category === ''\n ) {\n errors.category = 'required';\n }\n setErrors(errors);\n\n if (Object.keys(errors).length === 0) {\n setLoading(true);\n\n actions\n .closeAccount(\n account.id,\n values.transfer || null,\n values.category || null\n )\n .then(() => {\n modalProps.onClose();\n });\n }\n }}\n render={({\n values,\n errors,\n touched,\n handleChange,\n handleBlur,\n handleSubmit,\n isSubmitting,\n setFieldValue\n }) => (\n <form onSubmit={handleSubmit}>\n {balance !== 0 && (\n <View>\n <P>\n This account has a balance of{' '}\n <strong>${integerToCurrency(balance)}</strong>. To close\n this account, select a different account to transfer this\n balance to:\n </P>\n\n <Select\n name=\"transfer\"\n value={values.transfer}\n onChange={handleChange}\n onBlur={handleBlur}\n style={{ width: 200, marginBottom: 15 }}\n >\n <option value=\"\">Select account...</option>\n <optgroup label=\"For Budget\">\n {onbudget.map(acct => (\n <option key={acct.id} value={acct.id}>\n {acct.name}\n </option>\n ))}\n </optgroup>\n\n <optgroup label=\"Off Budget\">\n {offbudget.map(acct => (\n <option key={acct.id} value={acct.id}>\n {acct.name}\n </option>\n ))}\n </optgroup>\n </Select>\n {errors.transfer && (\n <FormError style={{ marginBottom: 15 }}>\n Transfer is required\n </FormError>\n )}\n\n {needsCategory(account, values.transfer, accounts) && (\n <View style={{ marginBottom: 15 }}>\n <P>\n Since you are transferring the balance from a budgeted\n account to an off-budget account, this transaction\n must be categorized. Select a category:\n </P>\n\n <CategorySelect\n categoryGroups={categoryGroups}\n name=\"category\"\n value={values.category}\n onChange={handleChange}\n onBlur={handleBlur}\n style={{ width: 200 }}\n />\n {errors.category && (\n <FormError>Category is required</FormError>\n )}\n </View>\n )}\n </View>\n )}\n\n {!canDelete && (\n <View style={{ marginBottom: 15 }}>\n <Text style={{ fontSize: 12 }}>\n You can also {/* eslint-disable-next-line */}\n <a\n href=\"#\"\n onClick={e => {\n e.preventDefault();\n setLoading(true);\n\n actions\n .forceCloseAccount(account.id)\n .then(() => modalProps.onClose());\n }}\n style={{ color: colors.r6 }}\n >\n force close\n </a>{' '}\n the account which will delete it and all its transactions\n permanently. Doing so may change your budget unexpectedly\n since money in it may vanish.\n </Text>\n </View>\n )}\n\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'flex-end'\n }}\n >\n <Button\n type=\"submit\"\n style={{ marginRight: 10 }}\n onClick={modalProps.onClose}\n >\n Cancel\n </Button>\n <Button type=\"submit\" primary>\n Close Account\n </Button>\n </View>\n </form>\n )}\n />\n </View>\n )}\n </Modal>\n );\n}\n\nexport default CloseAccount;\n","import React, { useState } from 'react';\nimport { styles, colors } from '../../style';\nimport { View, Text, Modal, P, Button } from '../common';\nimport { amountToPrettyCurrency } from 'loot-core/src/shared/util';\nimport {\n fromPlaidAccountType,\n prettyAccountType\n} from 'loot-core/src/shared/accounts';\n\nlet selectedStyle = {\n color: colors.n1\n};\n\nfunction EmptyMessage() {\n return null;\n}\n\nfunction Account({ account, selected, onSelect }) {\n return (\n <View\n style={[\n { marginBottom: 8, flexShrink: 0, userSelect: 'none' },\n styles.mediumText\n ]}\n onClick={onSelect}\n >\n <View\n style={[\n {\n padding: 12,\n boxShadow: styles.shadow,\n cursor: 'pointer',\n transition: 'transform .20s',\n fontSize: 14,\n borderRadius: 4,\n flexDirection: 'row',\n alignItems: 'center',\n border: '1px solid ' + colors.n10,\n ':hover': selectedStyle\n },\n selected && {\n ...selectedStyle,\n borderColor: colors.b9,\n backgroundColor: colors.b10\n }\n ]}\n >\n <View>\n <View style={{ fontWeight: 600, flex: 1 }}>{account.name}</View>\n <View\n style={{\n fontSize: 13,\n color: colors.n5,\n flexDirection: 'row'\n }}\n >\n {prettyAccountType(\n fromPlaidAccountType(account.type, account.subtype)\n )}\n <Text style={{ marginLeft: 4 }}>\n ...\n {account.mask}\n </Text>\n </View>\n </View>\n </View>\n </View>\n );\n}\n\nexport default function SelectLinkedAccounts({\n institution,\n publicToken,\n upgradingId,\n modalProps,\n accounts,\n actions\n}) {\n let [selectedAccounts, setSelectedAccounts] = useState([]);\n\n function toggleAccount(id) {\n if (upgradingId) {\n setSelectedAccounts([id]);\n } else {\n if (selectedAccounts.includes(id)) {\n setSelectedAccounts(selectedAccounts.filter(x => x !== id));\n } else {\n setSelectedAccounts([...selectedAccounts, id]);\n }\n }\n }\n\n async function onNext() {\n if (selectedAccounts.length > 0) {\n if (upgradingId) {\n actions.linkAccount(\n institution,\n publicToken,\n selectedAccounts[0],\n upgradingId\n );\n actions.closeModal();\n } else {\n actions.pushModal('configure-linked-accounts', {\n institution,\n publicToken,\n accounts: selectedAccounts.map(id =>\n accounts.find(acct => acct.id === id)\n )\n });\n }\n }\n }\n\n return (\n <Modal\n title={upgradingId ? 'Link Account' : 'Link Accounts'}\n {...modalProps}\n >\n {() => (\n <View style={{ maxWidth: 500 }}>\n {upgradingId ? (\n <P>\n We found the following accounts. Select the one you want to link\n with:\n </P>\n ) : (\n <P>\n We found the following accounts. Select which ones you want to\n add:\n </P>\n )}\n\n <View\n style={{\n maxHeight: 300,\n overflow: 'auto',\n // Allow the shadow to appear on left/right edge\n paddingLeft: 5,\n paddingRight: 5,\n marginLeft: -5,\n marginRight: -5\n }}\n >\n <View>\n {accounts.length === 0 ? (\n <EmptyMessage />\n ) : (\n accounts.map(account => {\n let selected = selectedAccounts.includes(account.id);\n\n return (\n <Account\n key={account.id}\n account={account}\n selected={selected}\n onSelect={() => toggleAccount(account.id)}\n />\n );\n })\n )}\n </View>\n </View>\n\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'flex-end',\n marginTop: 30\n }}\n >\n <Button style={{ marginRight: 10 }} onClick={modalProps.onClose}>\n Cancel\n </Button>\n <Button primary onClick={onNext}>\n {upgradingId ? 'Link Account' : 'Next'}\n </Button>\n </View>\n </View>\n )}\n </Modal>\n );\n}\n","import React, { useState } from 'react';\nimport { View, Text, Modal, Button } from '../common';\nimport { styles, colors } from '../../style';\nimport {\n fromPlaidAccountType,\n determineOffBudget,\n prettyAccountType\n} from 'loot-core/src/shared/accounts';\nimport Checkmark from 'loot-design/src/svg/v1/Checkmark';\n\nfunction EmptyMessage() {\n return null;\n}\n\nfunction Account({ account, offbudget, onSelect }) {\n return (\n <View\n style={[\n { marginBottom: 8, flexShrink: 0, userSelect: 'none' },\n styles.mediumText\n ]}\n onClick={onSelect}\n >\n <View\n style={[\n {\n padding: 12,\n boxShadow: styles.shadow,\n cursor: 'pointer',\n transition: 'transform .20s',\n fontSize: 14,\n borderRadius: 4,\n flexDirection: 'row',\n alignItems: 'center',\n border: '1px solid ' + colors.n10\n }\n ]}\n >\n <View style={{ flex: 1 }}>\n <View style={{ fontWeight: 600 }}>{account.name}</View>\n <View\n style={{\n fontSize: 13,\n color: colors.n5,\n flexDirection: 'row'\n }}\n >\n {prettyAccountType(\n fromPlaidAccountType(account.type, account.subtype)\n )}\n <Text style={{ marginLeft: 4 }}>\n ...\n {account.mask}\n </Text>\n </View>\n </View>\n\n {offbudget ? (\n <Text style={{ color: colors.n8 }}>Off budget</Text>\n ) : (\n <>\n <Checkmark style={{ width: 15, height: 15, color: colors.g5 }} />\n <Text style={{ color: colors.g5, marginLeft: 5 }}>Budgeted</Text>\n </>\n )}\n </View>\n </View>\n );\n}\n\nexport default function ConfigureLinkedAccounts({\n institution,\n publicToken,\n upgradingId,\n modalProps,\n accounts,\n actions\n}) {\n let [offbudgetAccounts, setOffbudgetAccounts] = useState(() =>\n accounts\n .filter(acct => determineOffBudget(fromPlaidAccountType(acct.type)))\n .map(acct => acct.id)\n );\n\n function toggleAccount(id) {\n if (offbudgetAccounts.includes(id)) {\n setOffbudgetAccounts(offbudgetAccounts.filter(x => x !== id));\n } else {\n setOffbudgetAccounts([...offbudgetAccounts, id]);\n }\n }\n\n async function onNext() {\n let ids = await actions.connectAccounts(\n institution,\n publicToken,\n accounts.map(acct => acct.id),\n offbudgetAccounts\n );\n\n actions.closeModal();\n\n if (ids.length === 1) {\n window.location.hash = '/accounts/' + ids[0];\n } else if (ids.length > 0) {\n window.location.hash = '/accounts';\n }\n }\n\n return (\n <Modal\n title={upgradingId ? 'Link Account' : 'Link Accounts'}\n {...modalProps}\n >\n {() => (\n <View style={{ maxWidth: 500 }}>\n <Text style={{ fontSize: 15, marginBottom: 15, lineHeight: '1.4em' }}>\n A <strong>budgeted account</strong> is one where expenses and income\n affect the budget. Usually things like investments are off budget.\n We{\"'\"}ve chosen some defaults here, but you can change the status\n if you like.\n </Text>\n\n <View\n style={{\n maxHeight: 300,\n overflow: 'auto',\n // Allow the shadow to appear on left/right edge\n paddingLeft: 5,\n paddingRight: 5,\n marginLeft: -5,\n marginRight: -5\n }}\n >\n <View>\n {accounts.length === 0 ? (\n <EmptyMessage />\n ) : (\n accounts.map(account => {\n let offbudget = offbudgetAccounts.includes(account.id);\n\n return (\n <Account\n key={account.id}\n account={account}\n offbudget={offbudget}\n onSelect={() => toggleAccount(account.id)}\n />\n );\n })\n )}\n </View>\n </View>\n\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'flex-end',\n marginTop: 30\n }}\n >\n <Button style={{ marginRight: 10 }} onClick={modalProps.onBack}>\n Back\n </Button>\n <Button primary onClick={onNext}>\n {upgradingId ? 'Link Account' : 'Next'}\n </Button>\n </View>\n </View>\n )}\n </Modal>\n );\n}\n","/* This file is auto-generated, do not touch! Please edit the SVG file instead. */\nimport React from \"react\";\nimport { css } from \"glamor\";\n\nfunction Merge({ width, height, style, color = \"currentColor\", ...props }) {\n return (\n <svg\n width={width}\n height={height}\n {...props}\n {...css(style)}\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M24 29H29.3333\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M8.00002 29H2.66669\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 21L8 29\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 21L24 29\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 2.66669V21.3334\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 2.66669L8 9.33335\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M16 2.66669L24 9.33335\"\n stroke={color}\n className=\"path\"\n strokeWidth=\"3.5\"\n strokeMiterlimit=\"10\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n\nexport default Merge;\n","import React, {\n useState,\n useEffect,\n useLayoutEffect,\n useRef,\n useMemo,\n useCallback,\n useImperativeHandle\n} from 'react';\nimport {\n useStableCallback,\n View,\n Text,\n Modal,\n Input,\n Button,\n Tooltip,\n Menu\n} from './common';\nimport memoizeOne from 'memoize-one';\nimport Component from '@reactions/component';\nimport { groupById } from 'loot-core/src/shared/util';\nimport { colors } from '../style';\nimport {\n Table,\n Row,\n Cell,\n InputCell,\n SelectCell,\n CellButton,\n useTableNavigator\n} from './table';\nimport useSelected, {\n SelectedProvider,\n useSelectedItems,\n useSelectedDispatch\n} from './useSelected';\nimport Delete from '../svg/Delete';\nimport Merge from '../svg/merge';\nimport ExpandArrow from '../svg/ExpandArrow';\nimport ArrowThinRight from '../svg/v1/ArrowThinRight';\n\nlet getPayeesById = memoizeOne(payees => groupById(payees));\n\nfunction plural(count, singleText, pluralText) {\n return count === 1 ? singleText : pluralText;\n}\n\nfunction RuleButton({ ruleCount, focused, onEdit, onClick }) {\n return (\n <Cell\n name=\"rule-count\"\n width=\"auto\"\n focused={focused}\n style={{ padding: '0 10px' }}\n plain\n >\n <CellButton\n style={{\n borderRadius: 4,\n padding: '3px 6px',\n backgroundColor: colors.g9,\n border: '1px solid ' + colors.g9,\n color: colors.g1,\n fontSize: 12\n }}\n onEdit={onEdit}\n onSelect={onClick}\n onFocus={onEdit}\n >\n <Text style={{ paddingRight: 5 }}>\n {ruleCount > 0 ? (\n <>\n {ruleCount} associated {plural(ruleCount, 'rule', 'rules')}\n </>\n ) : (\n <>Create rule</>\n )}\n </Text>\n <ArrowThinRight style={{ width: 8, height: 8, color: colors.g1 }} />\n </CellButton>\n </Cell>\n );\n}\n\nlet Payee = React.memo(\n ({\n style,\n payee,\n ruleCount,\n categoryGroups,\n selected,\n highlighted,\n hovered,\n editing,\n focusedField,\n onViewRules,\n onCreateRule,\n onHover,\n onEdit,\n onUpdate,\n ruleActions\n }) => {\n let { id } = payee;\n let dispatchSelected = useSelectedDispatch();\n let borderColor = selected ? colors.b8 : colors.border;\n let backgroundFocus = hovered || focusedField === 'select';\n\n return (\n <Row\n borderColor={borderColor}\n backgroundColor={\n selected ? colors.b9 : backgroundFocus ? colors.hover : 'white'\n }\n highlighted={highlighted}\n style={[\n { alignItems: 'stretch' },\n style,\n {\n backgroundColor: hovered ? colors.hover : null\n },\n selected && {\n backgroundColor: colors.b9,\n zIndex: 100\n }\n ]}\n data-focus-key={payee.id}\n onMouseEnter={() => onHover && onHover(payee.id)}\n >\n <SelectCell\n exposed={\n payee.transfer_acct == null && (hovered || selected || editing)\n }\n focused={focusedField === 'select'}\n selected={selected}\n onSelect={() => {\n dispatchSelected({ type: 'select', id: payee.id });\n }}\n />\n <InputCell\n value={(payee.transfer_acct ? 'Transfer: ' : '') + payee.name}\n valueStyle={!selected && payee.transfer_acct && { color: colors.n7 }}\n exposed={focusedField === 'name'}\n width=\"flex\"\n onUpdate={value =>\n !payee.transfer_acct && onUpdate(id, 'name', value)\n }\n onExpose={() => onEdit(id, 'name')}\n inputProps={{ readOnly: !!payee.transfer_acct }}\n />\n <RuleButton\n ruleCount={ruleCount}\n focused={focusedField === 'rule-count'}\n onEdit={() => onEdit(id, 'rule-count')}\n onClick={() =>\n ruleCount > 0 ? onViewRules(payee.id) : onCreateRule(payee.id)\n }\n />\n </Row>\n );\n }\n);\n\nconst PayeeTable = React.forwardRef(\n (\n {\n payees,\n ruleCounts,\n navigator,\n categoryGroups,\n highlightedRows,\n ruleActions,\n onUpdate,\n onViewRules,\n onCreateRule\n },\n ref\n ) => {\n let [hovered, setHovered] = useState(null);\n let selectedItems = useSelectedItems();\n\n useLayoutEffect(() => {\n let firstSelected = [...selectedItems][0];\n ref.current.scrollTo(firstSelected, 'center');\n navigator.onEdit(firstSelected, 'select');\n }, []);\n\n let onHover = useCallback(id => {\n setHovered(id);\n }, []);\n\n return (\n <View style={[{ flex: 1 }]} onMouseLeave={() => setHovered(null)}>\n <Table\n ref={ref}\n items={payees}\n navigator={navigator}\n renderItem={({ item, editing, focusedField, onEdit }) => {\n return (\n <Payee\n payee={item}\n ruleCount={ruleCounts.get(item.id) || 0}\n categoryGroups={categoryGroups}\n selected={selectedItems.has(item.id)}\n highlighted={highlightedRows && highlightedRows.has(item.id)}\n editing={editing}\n focusedField={focusedField}\n hovered={hovered === item.id}\n onHover={onHover}\n onEdit={onEdit}\n onUpdate={onUpdate}\n onViewRules={onViewRules}\n onCreateRule={onCreateRule}\n />\n );\n }}\n />\n </View>\n );\n }\n);\n\nfunction PayeeTableHeader() {\n let borderColor = colors.border;\n let dispatchSelected = useSelectedDispatch();\n let selectedItems = useSelectedItems();\n\n return (\n <View>\n <Row\n borderColor={borderColor}\n style={{\n backgroundColor: 'white',\n color: colors.n4,\n zIndex: 200,\n userSelect: 'none'\n }}\n collapsed={true}\n >\n <SelectCell\n exposed={true}\n focused={false}\n selected={selectedItems.size > 0}\n onSelect={() => dispatchSelected({ type: 'select-all' })}\n />\n <Cell value=\"Name\" width=\"flex\" />\n </Row>\n </View>\n );\n}\n\nfunction EmptyMessage({ text, style }) {\n return (\n <View\n style={[\n {\n textAlign: 'center',\n color: colors.n7,\n fontStyle: 'italic',\n fontSize: 13,\n marginTop: 5\n },\n style\n ]}\n >\n {text}\n </View>\n );\n}\n\nfunction PayeeMenu({ payeesById, selectedPayees, onDelete, onMerge, onClose }) {\n // Transfer accounts are never editable\n let isDisabled = [...selectedPayees].some(\n id => payeesById[id] == null || payeesById[id].transfer_acct\n );\n\n return (\n <Tooltip\n position=\"bottom\"\n width={250}\n style={{ padding: 0 }}\n onClose={onClose}\n >\n <Menu\n onMenuSelect={type => {\n onClose();\n switch (type) {\n case 'delete':\n onDelete();\n break;\n case 'merge':\n onMerge();\n break;\n default:\n }\n }}\n footer={\n <View\n style={{\n padding: 3,\n fontSize: 11,\n fontStyle: 'italic',\n color: colors.n7\n }}\n >\n {[...selectedPayees]\n .slice(0, 4)\n .map(id => payeesById[id].name)\n .join(', ') + (selectedPayees.size > 4 ? ', and more' : '')}\n </View>\n }\n items={[\n {\n icon: Delete,\n name: 'delete',\n text: 'Delete',\n disabled: isDisabled\n },\n {\n icon: Merge,\n iconSize: 9,\n name: 'merge',\n text: 'Merge',\n disabled: isDisabled || selectedPayees.size < 2\n },\n Menu.line\n ]}\n />\n </Tooltip>\n );\n}\n\nexport const ManagePayees = React.forwardRef(\n (\n {\n modalProps,\n payees,\n ruleCounts,\n categoryGroups,\n tableNavigatorOpts,\n initialSelectedIds,\n ruleActions,\n onBatchChange,\n onViewRules,\n onCreateRule,\n ...props\n },\n ref\n ) => {\n let [highlightedRows, setHighlightedRows] = useState(null);\n let [filter, setFilter] = useState('');\n let table = useRef(null);\n let scrollTo = useRef(null);\n let resetAnimation = useRef(false);\n\n let filteredPayees = useMemo(\n () =>\n filter === ''\n ? payees\n : payees.filter(p =>\n p.name.toLowerCase().includes(filter.toLowerCase())\n ),\n [payees, filter]\n );\n\n let selected = useSelected('payees', filteredPayees, initialSelectedIds);\n\n function applyFilter(f) {\n if (filter !== f) {\n table.current && table.current.setRowAnimation(false);\n setFilter(f);\n resetAnimation.current = true;\n }\n }\n\n function _scrollTo(id) {\n applyFilter('');\n scrollTo.current = id;\n }\n\n useEffect(() => {\n if (resetAnimation.current) {\n // Very annoying, for some reason it's as if the table doesn't\n // actually update its contents until the next tick or\n // something? The table keeps being animated without this\n setTimeout(() => {\n table.current && table.current.setRowAnimation(true);\n }, 0);\n resetAnimation.current = false;\n }\n });\n\n useImperativeHandle(ref, () => ({\n selectRows: (ids, scroll) => {\n tableNavigator.onEdit(null);\n selected.dispatch({ type: 'select-all', ids });\n setHighlightedRows(null);\n\n if (scroll && ids.length > 0) {\n _scrollTo(ids[0]);\n }\n },\n\n highlightRow: id => {\n tableNavigator.onEdit(null);\n setHighlightedRows(new Set([id]));\n _scrollTo(id);\n }\n }));\n\n // `highlightedRows` should only ever be true once, and we\n // immediately discard it. This triggers an animation.\n useEffect(() => {\n if (highlightedRows) {\n setHighlightedRows(null);\n }\n }, [highlightedRows]);\n\n useLayoutEffect(() => {\n if (scrollTo.current) {\n table.current.scrollTo(scrollTo.current);\n scrollTo.current = null;\n }\n });\n\n let onUpdate = useStableCallback((id, name, value) => {\n let payee = payees.find(p => p.id === id);\n if (payee[name] !== value) {\n onBatchChange({ updated: [{ id, [name]: value }] });\n }\n });\n\n let getSelectableIds = useCallback(() => {\n return filteredPayees.filter(p => p.transfer_acct == null).map(p => p.id);\n }, [filteredPayees]);\n\n function onDelete() {\n onBatchChange({ deleted: [...selected.items].map(id => ({ id })) });\n selected.dispatch({ type: 'select-none' });\n }\n\n async function onMerge() {\n let ids = [...selected.items];\n await props.onMerge(ids);\n\n tableNavigator.onEdit(ids[0], 'name');\n selected.dispatch({ type: 'select-none' });\n _scrollTo(ids[0]);\n }\n\n let buttonsDisabled = selected.items.size === 0;\n\n let tableNavigator = useTableNavigator(\n filteredPayees,\n item =>\n ['select', 'name', 'rule-count'].filter(name => {\n switch (name) {\n case 'select':\n return item.transfer_acct == null;\n default:\n return true;\n }\n }),\n tableNavigatorOpts\n );\n\n let payeesById = getPayeesById(payees);\n\n return (\n <Modal\n title=\"Payees\"\n padding={0}\n {...modalProps}\n style={[modalProps.style, { flex: 'inherit', maxWidth: '90%' }]}\n >\n <View\n style={{\n maxWidth: '100%',\n width: 900,\n height: 550\n }}\n >\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n padding: '0 10px'\n }}\n >\n <Component initialState={{ menuOpen: false }}>\n {({ state, setState }) => (\n <View>\n <Button\n bare\n style={{ marginRight: 10 }}\n disabled={buttonsDisabled}\n onClick={() => setState({ menuOpen: true })}\n >\n {buttonsDisabled\n ? 'No payees selected'\n : selected.items.size +\n ' ' +\n plural(selected.items.size, 'payee', 'payees')}\n <ExpandArrow\n width={8}\n height={8}\n style={{ marginLeft: 5 }}\n />\n </Button>\n {state.menuOpen && (\n <PayeeMenu\n payeesById={payeesById}\n selectedPayees={selected.items}\n onClose={() => setState({ menuOpen: false })}\n onDelete={onDelete}\n onMerge={onMerge}\n />\n )}\n </View>\n )}\n </Component>\n <View style={{ flex: 1 }} />\n <Input\n placeholder=\"Filter payees...\"\n value={filter}\n onChange={e => {\n applyFilter(e.target.value);\n tableNavigator.onEdit(null);\n }}\n style={{\n width: 350,\n borderColor: 'transparent',\n backgroundColor: colors.n11,\n ':focus': {\n backgroundColor: 'white',\n '::placeholder': { color: colors.n8 }\n }\n }}\n />\n </View>\n\n <SelectedProvider instance={selected} fetchAllIds={getSelectableIds}>\n <View\n style={{\n flex: 1,\n border: '1px solid ' + colors.border,\n borderRadius: 4,\n overflow: 'hidden',\n margin: 5\n }}\n >\n <PayeeTableHeader />\n {filteredPayees.length === 0 ? (\n <EmptyMessage text=\"No payees\" style={{ marginTop: 15 }} />\n ) : (\n <PayeeTable\n ref={table}\n payees={filteredPayees}\n ruleCounts={ruleCounts}\n categoryGroups={categoryGroups}\n highlightedRows={highlightedRows}\n navigator={tableNavigator}\n onUpdate={onUpdate}\n onViewRules={onViewRules}\n onCreateRule={onCreateRule}\n />\n )}\n </View>\n </SelectedProvider>\n </View>\n </Modal>\n );\n }\n);\n","import React, { useState, useEffect, useRef } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport * as undo from 'loot-core/src/platform/client/undo';\nimport uuid from 'loot-core/src/platform/uuid';\nimport { send, listen, unlisten } from 'loot-core/src/platform/client/fetch';\nimport { ManagePayees } from 'loot-design/src/components/payees';\nimport { applyChanges } from 'loot-core/src/shared/util';\n\nfunction ManagePayeesWithData({\n history,\n modalProps,\n initialSelectedIds,\n lastUndoState,\n initialPayees,\n categoryGroups,\n initiallyLoadPayees,\n getPayees,\n setLastUndoState,\n pushModal\n}) {\n let [payees, setPayees] = useState(initialPayees);\n let [ruleCounts, setRuleCounts] = useState({ value: new Map() });\n let payeesRef = useRef();\n\n async function refetchRuleCounts() {\n let counts = await send('payees-get-rule-counts');\n counts = new Map(Object.entries(counts));\n setRuleCounts({ value: counts });\n }\n\n useEffect(() => {\n async function loadData() {\n let result = await initiallyLoadPayees();\n\n // Wait a bit before setting the data. This lets the modal\n // settle and makes for a smoother experience.\n await new Promise(resolve => setTimeout(resolve, 100));\n\n if (result) {\n setPayees(result);\n }\n\n refetchRuleCounts();\n }\n loadData();\n\n let unlisten = listen('sync-event', async ({ type, tables }) => {\n if (type === 'applied') {\n if (tables.includes('rules')) {\n refetchRuleCounts();\n }\n }\n });\n\n undo.setUndoState('openModal', 'manage-payees');\n\n return () => {\n undo.setUndoState('openModal', null);\n unlisten();\n };\n }, []);\n\n async function onUndo({ tables, messages, meta, url }, scroll = false) {\n if (\n !tables.includes('payees') &&\n !tables.includes('payee_mapping') &&\n !tables.includes('payee_rules')\n ) {\n return;\n }\n\n setPayees(await getPayees());\n\n if (\n (meta && meta.targetId) ||\n messages.find(msg => msg.dataset === 'rules')\n ) {\n refetchRuleCounts();\n }\n\n setLastUndoState(null);\n }\n\n useEffect(() => {\n if (lastUndoState.current) {\n onUndo(lastUndoState.current, true);\n }\n\n return listen('undo-event', onUndo);\n }, []);\n\n function onViewRules(id) {\n pushModal('manage-rules', { payeeId: id });\n }\n\n function onCreateRule(id) {\n let payee = payees.find(p => p.id === id);\n let rule = {\n id: null,\n stage: null,\n conditions: [\n {\n field: 'description',\n op: 'is',\n value: payee.id,\n type: 'id'\n }\n ],\n actions: []\n };\n pushModal('edit-rule', { rule });\n }\n\n return (\n <ManagePayees\n ref={payeesRef}\n modalProps={modalProps}\n payees={payees}\n ruleCounts={ruleCounts.value}\n categoryGroups={categoryGroups}\n initialSelectedIds={initialSelectedIds}\n lastUndoState={lastUndoState}\n onBatchChange={changes => {\n send('payees-batch-change', changes);\n setPayees(applyChanges(changes, payees));\n }}\n onMerge={async ([targetId, ...mergeIds]) => {\n await send('payees-merge', { targetId, mergeIds });\n\n let result = payees.filter(p => !mergeIds.includes(p.id));\n mergeIds.forEach(id => {\n let count = ruleCounts.value.get(id) || 0;\n ruleCounts.value.set(\n targetId,\n (ruleCounts.value.get(targetId) || 0) + count\n );\n });\n\n setPayees(result);\n setRuleCounts({ value: ruleCounts.value });\n }}\n onViewRules={onViewRules}\n onCreateRule={onCreateRule}\n />\n );\n}\n\nexport default connect(\n state => ({\n initialPayees: state.queries.payees,\n lastUndoState: state.app.lastUndoState,\n categoryGroups: state.queries.categories.grouped\n }),\n actions\n)(ManagePayeesWithData);\n","import React, { useState, useRef, useEffect } from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\nimport {\n View,\n Text,\n Modal,\n ModalButtons,\n Button,\n P,\n Stack\n} from 'loot-design/src/components/common';\nimport { Information } from 'loot-design/src/components/alerts';\nimport { colors, styles } from 'loot-design/src/style';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { replaceModal } from 'loot-core/src/client/actions/modals';\n\nlet highlightStyle = { color: colors.p5 };\n\nexport default function MergeUnusedPayees({\n history,\n modalProps,\n payeeIds,\n targetPayeeId\n}) {\n let { payees: allPayees, modalStack } = useSelector(state => ({\n payees: state.queries.payees,\n modalStack: state.modals.modalStack\n }));\n let isEditingRule = !!modalStack.find(m => m.name === 'edit-rule');\n let dispatch = useDispatch();\n let [shouldCreateRule, setShouldCreateRule] = useState(true);\n let flashRef = useRef(null);\n\n useEffect(() => {\n // Flash the scrollbar\n if (flashRef.current) {\n let el = flashRef.current;\n let top = el.scrollTop;\n el.scrollTop = top + 1;\n el.scrollTop = top;\n }\n }, [flashRef.current, true]);\n\n // We store the orphaned payees into state because when we merge it,\n // it will be deleted and this component will automatically\n // rerender. Is there a better pattern for live bindings?\n //\n // TODO: I think a custom `useSelector` hook that doesn't bind would\n // be nice\n let [payees] = useState(() =>\n payeeIds.map(id => allPayees.find(p => p.id === id))\n );\n let targetPayee = allPayees.find(p => p.id === targetPayeeId);\n\n if (!targetPayee) {\n return null;\n }\n\n async function onMerge() {\n await send('payees-merge', {\n targetId: targetPayee.id,\n mergeIds: payees.map(p => p.id)\n });\n\n let ruleId;\n if (shouldCreateRule && !isEditingRule) {\n let id = await send('rule-add-payee-rename', {\n fromNames: payees.map(p => p.name),\n to: targetPayee.id\n });\n ruleId = id;\n }\n\n modalProps.onClose();\n\n return ruleId;\n }\n\n async function onMergeAndCreateRule() {\n let ruleId = await onMerge();\n\n if (ruleId) {\n let rule = await send('rule-get', { id: ruleId });\n dispatch(replaceModal('edit-rule', { rule }));\n }\n }\n\n return (\n <Modal\n title=\"Merge payee?\"\n padding={0}\n showHeader={false}\n {...modalProps}\n style={modalProps.style}\n >\n {() => (\n <View style={{ padding: 20, maxWidth: 500 }}>\n <View>\n <P style={{ marginBottom: 10, fontWeight: 500 }}>\n {payees.length === 1 ? (\n <>\n The payee <Text style={highlightStyle}>{payees[0].name}</Text>{' '}\n is not used by transactions any more. Would like to merge it\n with <Text style={highlightStyle}>{targetPayee.name}</Text>?\n </>\n ) : (\n <>\n The following payees are not used by transactions any more.\n Would like to merge them with{' '}\n <Text style={highlightStyle}>{targetPayee.name}</Text>?\n <ul\n ref={flashRef}\n style={{\n margin: 0,\n marginTop: 10,\n maxHeight: 140,\n overflow: 'auto'\n }}\n >\n {payees.map(p => (\n <li>\n <Text style={highlightStyle}>{p.name}</Text>\n </li>\n ))}\n </ul>\n </>\n )}\n </P>\n\n <Information>\n Merging will remove the payee and transfer any existing rules to\n the new payee. If checked below, a rule will be created to do this\n rename while importing transactions.\n </Information>\n\n {!isEditingRule && (\n <label\n style={{\n fontSize: 13,\n marginTop: 10,\n color: colors.n4,\n userSelect: 'none',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n }}\n >\n <input\n type=\"checkbox\"\n checked={shouldCreateRule}\n onChange={e => setShouldCreateRule(e.target.checked)}\n />\n <Text style={{ marginLeft: 3 }}>\n Automatically rename{' '}\n {payees.length === 1 ? 'this payee' : 'these payees'} in the\n future\n </Text>\n </label>\n )}\n\n <ModalButtons style={{ marginTop: 20 }} focusButton>\n <Button\n primary\n style={{ marginRight: 10 }}\n onClick={onMerge}\n type=\"button\"\n >\n Merge\n </Button>\n {!isEditingRule && (\n <Button\n style={{ marginRight: 10 }}\n onClick={onMergeAndCreateRule}\n type=\"button\"\n >\n Merge and edit rule\n </Button>\n )}\n <Button\n style={{ marginRight: 10 }}\n onClick={() => modalProps.onBack()}\n type=\"button\"\n >\n Do nothing\n </Button>\n </ModalButtons>\n </View>\n </View>\n )}\n </Modal>\n );\n}\n","import React, { useState, useRef } from 'react';\nimport {\n View,\n Text,\n Modal,\n Button,\n P,\n ModalButtons\n} from '../common';\nimport { Error } from '../alerts';\nimport { colors } from '../../style';\nimport AnimatedLoading from '../../svg/v1/AnimatedLoading';\n\nfunction renderError(error) {\n return (\n <Error style={{ alignSelf: 'center' }}>\n {error === 'timeout'\n ? 'Timed out. Please try again.'\n : 'An error occurred while linking your account, sorry!'}\n </Error>\n );\n}\n\nexport default function PlaidExternalMsg({\n modalProps,\n onMoveExternal,\n onSuccess,\n onClose: originalOnClose\n}) {\n let [waiting, setWaiting] = useState(null);\n let [success, setSuccess] = useState(false);\n let [error, setError] = useState(null);\n let data = useRef(null);\n\n async function onJump() {\n setError(null);\n setWaiting('browser');\n\n let res = await onMoveExternal();\n if (res.error) {\n setError(res.error);\n setWaiting(null);\n return;\n }\n\n data.current = res.data;\n setWaiting(null);\n setSuccess(true);\n }\n\n function onClose() {\n originalOnClose && originalOnClose();\n modalProps.onClose();\n }\n\n async function onContinue() {\n setWaiting('accounts');\n await onSuccess(data.current);\n setWaiting(null);\n }\n\n return (\n <Modal\n title=\"Link Your Bank\"\n {...modalProps}\n onClose={onClose}\n style={{ flex: 0 }}\n >\n {() => (\n <View>\n <P style={{ fontSize: 15 }}>\n To link your bank account, you will be moved to your browser for\n enhanced security. Click below and Actual will automatically resume\n when you have given your bank{\"'\"}s credentials.\n </P>\n {error && renderError(error)}\n\n {waiting ? (\n <View style={{ alignItems: 'center', marginTop: 15 }}>\n <AnimatedLoading\n color={colors.n1}\n style={{ width: 20, height: 20 }}\n />\n <View style={{ marginTop: 10, color: colors.n4 }}>\n {waiting === 'browser'\n ? 'Waiting on browser...'\n : waiting === 'accounts'\n ? 'Loading accounts...'\n : null}\n </View>\n </View>\n ) : success ? (\n <Button\n primary\n style={{\n padding: '10px 0',\n fontSize: 15,\n fontWeight: 600,\n marginTop: 10,\n backgroundColor: colors.g4,\n borderColor: colors.g4\n }}\n onClick={onContinue}\n >\n Success! Click to continue &rarr;\n </Button>\n ) : (\n <Button\n primary\n style={{\n padding: '10px 0',\n fontSize: 15,\n fontWeight: 600,\n marginTop: 10\n }}\n onClick={onJump}\n >\n Link bank in browser &rarr;\n </Button>\n )}\n <div style={{ marginTop: waiting ? 30 : 35 }}>\n <Text style={{ color: colors.n5, fontWeight: 600 }}>\n Why not link it in the app?\n </Text>\n </div>\n <Text\n style={{\n marginTop: 10,\n color: colors.n5,\n fontSize: 13,\n '& a, & a:visited': {\n color: colors.n5\n }\n }}\n >\n Typing your bank{\"'\"}s username and password is one of the most\n security-sensitive things you can do, and the browser is the most\n secure app in the world. Why not use it to make sure your\n information is safe?{' '}\n <a href=\"https://actualbudget.com/security-learn-more\">\n Learn more about security\n </a>\n </Text>\n\n <ModalButtons style={{ marginTop: 10 }}>\n <Button onClick={() => modalProps.onBack()}>Back</Button>\n </ModalButtons>\n </View>\n )}\n </Modal>\n );\n}\n","import React from 'react';\nimport {\n View,\n Text,\n Block,\n Modal,\n Button,\n Select\n} from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\nimport { NativeCategorySelect } from 'loot-design/src/components/CategorySelect';\n\nclass ConfirmCategoryDelete extends React.Component {\n state = { transferCategory: null, error: null };\n\n componentDidMount() {\n // Hack: 200ms is the timing of the modal animation\n setTimeout(() => {\n this.input.focus();\n }, 200);\n }\n\n onDelete = () => {\n let { transferCategory } = this.state;\n let { category, group, onDelete } = this.props;\n\n if (!transferCategory) {\n this.setState({ error: 'required-transfer' });\n } else {\n onDelete(transferCategory);\n this.props.modalProps.onClose();\n }\n };\n\n renderError = error => {\n let msg;\n\n switch (error) {\n case 'required-transfer':\n msg = 'You must select a category';\n break;\n default:\n msg = 'Something bad happened, sorry!';\n }\n\n return <Text style={{ marginTop: 15, color: colors.r4 }}>{msg}</Text>;\n };\n\n render() {\n const { modalProps, category, group, categoryGroups } = this.props;\n const { transferCategory, error } = this.state;\n const isIncome = !!(category || group).is_income;\n\n return (\n <Modal title=\"Confirm Delete\" {...modalProps} style={{ flex: 0 }}>\n {() => (\n <View style={{ lineHeight: 1.5 }}>\n {group ? (\n <Block>\n Categories in the group <strong>{group.name}</strong> are used\n by existing transaction\n {!isIncome &&\n ' or it has a positive leftover balance currently'}\n . <strong>Are you sure you want to delete it?</strong> If so,\n you must select another category to transfer existing\n transactions and balance to.\n </Block>\n ) : (\n <Block>\n <strong>{category.name}</strong> is used by existing\n transactions\n {!isIncome &&\n ' or it has a positive leftover balance currently'}\n . <strong>Are you sure you want to delete it?</strong> If so,\n you must select another category to transfer existing\n transactions and balance to.\n </Block>\n )}\n\n {error && this.renderError(error)}\n\n <View\n style={{\n marginTop: 20,\n flexDirection: 'row',\n justifyContent: 'flex-start',\n alignItems: 'center'\n }}\n >\n <Text>Transfer to:</Text>\n\n <View style={{ flex: 1, marginLeft: 10, marginRight: 30 }}>\n <NativeCategorySelect\n ref={el => (this.input = el)}\n categoryGroups={\n group\n ? categoryGroups.filter(\n g => g.id !== group.id && !!g.is_income === isIncome\n )\n : categoryGroups\n .filter(g => !!g.is_income === isIncome)\n .map(g => ({\n ...g,\n categories: g.categories.filter(\n c => c.id !== category.id\n )\n }))\n }\n name=\"category\"\n value={transferCategory}\n onChange={e =>\n this.setState({ transferCategory: e.target.value })\n }\n />\n </View>\n\n <Button primary onClick={() => this.onDelete()}>\n Delete\n </Button>\n </View>\n </View>\n )}\n </Modal>\n );\n }\n}\n\nexport default ConfirmCategoryDelete;\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Modal,\n Button,\n P,\n ExternalLink\n} from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\n\nfunction WelcomeScreen({ modalProps, actions }) {\n return (\n <Modal title=\"Welcome to Actual\" {...modalProps}>\n {() => (\n <View style={{ maxWidth: 500, fontSize: 15 }}>\n <P>\n Actual is a personal finance tool that focuses on beautiful design\n and a slick user experience.{' '}\n <strong>Editing your data should be as fast as possible.</strong> On\n top of that, we want to provide powerful tools to allow you to do\n whatever you want with your data.\n </P>\n <P>\n Currently Actual implements budgeting based on a{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/how-it-works/\"\n >\n monthly envelope system\n </ExternalLink>\n .\n </P>\n <P>\n In the future, we{\"'\"}ll support multiple ways to do budgeting. We\n {\"'\"}re also working hard on custom reports and a lot more things.\n </P>\n <P\n style={{\n color: colors.p5,\n fontWeight: 600,\n '& a, & a:visited': { color: colors.p5 }\n }}\n >\n Read the{' '}\n <ExternalLink asAnchor href=\"https://actualbudget.com/docs/\">\n documentation\n </ExternalLink>{' '}\n to get started and learn about{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/docs/budgeting/how-it-works/\"\n >\n budgeting\n </ExternalLink>\n ,{' '}\n <ExternalLink\n asAnchor\n href=\"https://actualbudget.com/docs/accounts/overview/\"\n >\n accounts\n </ExternalLink>{' '}\n and more.\n </P>\n </View>\n )}\n </Modal>\n );\n}\n\nexport default connect(\n null,\n actions\n)(WelcomeScreen);\n","import React, { useState, useEffect, useMemo } from 'react';\nimport { connect } from 'react-redux';\nimport * as d from 'date-fns';\nimport * as actions from 'loot-core/src/client/actions';\nimport { format as formatDate_ } from 'loot-core/src/shared/months';\nimport {\n amountToCurrency,\n amountToInteger,\n looselyParseAmount\n} from 'loot-core/src/shared/util';\nimport {\n View,\n Text,\n Stack,\n Modal,\n Select,\n Button,\n ButtonWithLoading\n} from '../common';\nimport { Checkbox } from '../forms';\nimport { TableHeader, TableWithNavigator, Row, Field } from '../table';\nimport { SectionLabel, FieldLabel } from '../forms';\nimport { colors, styles } from '../../style';\n\nlet dateFormats = [\n { format: 'yyyy mm dd', label: 'YYYY MM DD' },\n { format: 'yy mm dd', label: 'YY MM DD' },\n { format: 'mm dd yyyy', label: 'MM DD YYYY' },\n { format: 'mm dd yy', label: 'MM DD YY' },\n { format: 'dd mm yyyy', label: 'DD MM YYYY' },\n { format: 'dd mm yy', label: 'DD MM YY' }\n];\n\nfunction parseDate(str, order) {\n if (typeof str !== 'string') {\n return null;\n }\n\n function pad(v) {\n return v && v.length === 1 ? '0' + v : v;\n }\n\n let parts = str.replace(/ /g, '').split(/[^0-9]/);\n\n let year, month, day;\n switch (order) {\n case 'dd mm yyyy':\n year = parts[2];\n month = parts[1];\n day = parts[0];\n break;\n case 'dd mm yy':\n year = `20${parts[2]}`;\n month = parts[1];\n day = parts[0];\n break;\n case 'yyyy mm dd':\n year = parts[0];\n month = parts[1];\n day = parts[2];\n break;\n case 'yy mm dd':\n year = `20${parts[0]}`;\n month = parts[1];\n day = parts[2];\n break;\n case 'mm dd yy':\n year = `20${parts[2]}`;\n month = parts[0];\n day = parts[1];\n break;\n default:\n case 'mm dd yyyy':\n year = parts[2];\n month = parts[0];\n day = parts[1];\n }\n\n let parsed = `${year}-${pad(month)}-${pad(day)}`;\n if (!d.isValid(d.parseISO(parsed))) {\n return null;\n }\n return parsed;\n}\n\nfunction formatDate(date, format) {\n if (!date) {\n return null;\n }\n try {\n return formatDate_(date, format);\n } catch (e) {}\n return null;\n}\n\nfunction getFileType(filepath) {\n let m = filepath.match(/\\.([^.]*)$/);\n return m ? m[1].toLowerCase() : 'ofx';\n}\n\nfunction ParsedDate({ parseDateFormat, showParsed, dateFormat, date }) {\n let parsed =\n date &&\n formatDate(\n parseDateFormat ? parseDate(date, parseDateFormat) : date,\n dateFormat\n );\n return (\n <Text>\n <Text>\n {date || (\n <Text style={{ color: colors.n4, fontStyle: 'italic' }}>Empty</Text>\n )}{' '}\n &rarr;{' '}\n </Text>\n <Text style={{ color: parsed ? colors.g3 : colors.r4 }}>\n {parsed || 'Invalid'}\n </Text>\n </Text>\n );\n}\n\nfunction getInitialDateFormat(transactions, mappings) {\n if (transactions.length === 0 || mappings.date == null) {\n return 'yyyy mm dd';\n }\n\n let transaction = transactions[0];\n let date = transaction[mappings.date];\n\n let found =\n date == null\n ? null\n : dateFormats.find(f => parseDate(date, f.format) != null);\n return found ? found.format : 'mm dd yyyy';\n}\n\nfunction getInitialMappings(transactions) {\n if (transactions.length === 0) {\n return {};\n }\n\n let transaction = transactions[0];\n let fields = Object.entries(transaction);\n\n function key(entry) {\n return entry ? entry[0] : null;\n }\n\n let dateField = key(\n fields.find(([name, value]) => name.toLowerCase().includes('date')) ||\n fields.find(([name, value]) => value.match(/^\\d+[-/]\\d+[-/]\\d+$/))\n );\n\n let amountField = key(\n fields.find(([name, value]) => name.toLowerCase().includes('amount')) ||\n fields.find(([name, value]) => value.match(/^-?[.,\\d]+$/))\n );\n\n let payeeField = key(\n fields.find(([name, value]) => name !== dateField && name !== amountField)\n );\n\n let notesField = key(\n fields.find(\n ([name, value]) =>\n name !== dateField && name !== amountField && name !== payeeField\n )\n );\n\n return {\n date: dateField,\n amount: amountField,\n payee: payeeField,\n notes: notesField\n };\n}\n\nfunction applyFieldMappings(transaction, mappings) {\n let result = {};\n for (let [field, target] of Object.entries(mappings)) {\n if (field === 'payee') {\n field = 'payee_name';\n }\n\n result[field] = transaction[target || field];\n }\n return result;\n}\n\nfunction parseAmount(amount, mapper) {\n if (amount == null) {\n return null;\n }\n let parsed = typeof amount === 'string' ? looselyParseAmount(amount) : amount;\n let value = mapper(parsed);\n return value;\n}\n\nfunction parseAmountFields(trans, splitMode, flipAmount) {\n if (splitMode) {\n // Split mode is a little weird; first we look for an outflow and\n // if that has a value, we never want to show a number in the\n // inflow. Same for `amount`; we choose outflow first and then inflow\n let outflow = parseAmount(trans.outflow, n => -Math.abs(n));\n let inflow = outflow ? 0 : parseAmount(trans.inflow, n => Math.abs(n));\n\n return {\n amount: outflow || inflow,\n outflow,\n inflow\n };\n }\n return {\n amount: parseAmount(trans.amount, n => (flipAmount ? n * -1 : n)),\n outflow: null,\n inflow: null\n };\n}\n\nfunction Transaction({\n transaction: rawTransaction,\n fieldMappings,\n showParsed,\n parseDateFormat,\n dateFormat,\n splitMode,\n flipAmount\n}) {\n let transaction = useMemo(\n () =>\n fieldMappings\n ? applyFieldMappings(rawTransaction, fieldMappings)\n : rawTransaction,\n [rawTransaction, fieldMappings]\n );\n\n let { amount, outflow, inflow } = parseAmountFields(\n transaction,\n splitMode,\n flipAmount\n );\n amount = amountToCurrency(amount);\n outflow = amountToCurrency(outflow);\n inflow = amountToCurrency(inflow);\n\n return (\n <Row style={{ backgroundColor: 'white' }}>\n <Field width={200} borderColor={colors.border}>\n {showParsed ? (\n <ParsedDate\n parseDateFormat={parseDateFormat}\n dateFormat={dateFormat}\n date={transaction.date}\n />\n ) : (\n formatDate(transaction.date, dateFormat)\n )}\n </Field>\n <Field\n width=\"flex\"\n borderColor={colors.border}\n title={transaction.imported_payee || transaction.payee_name}\n >\n {transaction.payee_name}\n </Field>\n <Field width=\"flex\" borderColor={colors.border} title={transaction.notes}>\n {transaction.notes}\n </Field>\n {splitMode ? (\n <>\n <Field\n width={90}\n borderColor={colors.border}\n contentStyle={[{ textAlign: 'right' }, styles.tnum]}\n title={outflow}\n >\n {outflow}\n </Field>\n <Field\n width={90}\n borderColor={colors.border}\n contentStyle={[{ textAlign: 'right' }, styles.tnum]}\n title={inflow}\n >\n {inflow}\n </Field>\n </>\n ) : (\n <Field\n width={90}\n borderColor={colors.border}\n contentStyle={[{ textAlign: 'right' }, styles.tnum]}\n title={amount}\n >\n {amount}\n </Field>\n )}\n </Row>\n );\n}\n\nfunction SubLabel({ title }) {\n return (\n <Text style={{ fontSize: 13, marginBottom: 3, color: colors.n3 }}>\n {title}\n </Text>\n );\n}\n\nfunction SelectField({ width, style, options, value, onChange }) {\n return (\n <Select\n value={value}\n style={style}\n onChange={e => onChange(e.target.value)}\n >\n <option value=\"\">Choose field...</option>\n {options.map(x => (\n <option key={x} value={x}>\n {x}\n </option>\n ))}\n </Select>\n );\n}\n\nfunction DateFormatSelect({\n transactions,\n fieldMappings,\n parseDateFormat,\n onChange\n}) {\n // We don't actually care about the delimiter, but we try to render\n // it based on the data we have so far. Look in a transaction and\n // try to figure out what delimiter the date is using, and default\n // to space if we can't figure it out.\n let delimiter = '-';\n if (\n transactions.length > 0 &&\n (fieldMappings && fieldMappings.date != null)\n ) {\n let date = transactions[0][fieldMappings.date];\n let m = date && date.match(/[/.,-/\\\\]/);\n delimiter = m ? m[0] : ' ';\n }\n\n return (\n <View style={{ width: 120 }}>\n <SectionLabel title=\"Date format\" />\n <Select\n value={parseDateFormat || ''}\n onChange={e => onChange(e.target.value)}\n >\n {dateFormats.map(f => (\n <option key={f.format} value={f.format}>\n {f.label.replace(/ /g, delimiter)}\n </option>\n ))}\n </Select>\n </View>\n );\n}\n\nfunction FlipAmountOption({ value, disabled, onChange }) {\n return (\n <View\n style={{\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n userSelect: 'none'\n }}\n >\n <Checkbox\n id=\"form_flip\"\n checked={value}\n disabled={disabled}\n onChange={onChange}\n />\n <label\n htmlFor=\"form_flip\"\n style={{ userSelect: 'none', color: disabled ? colors.n6 : null }}\n >\n Flip amount\n </label>\n </View>\n );\n}\n\nfunction SplitOption({ value, onChange }) {\n return (\n <View\n style={{\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n userSelect: 'none'\n }}\n >\n <Checkbox id=\"form_split\" checked={value} onChange={onChange} />\n <label htmlFor=\"form_split\" style={{ userSelect: 'none' }}>\n Split amount into separate inflow/outflow columns\n </label>\n </View>\n );\n}\n\nfunction FieldMappings({ transactions, mappings, onChange, splitMode }) {\n if (transactions.length === 0) {\n return null;\n }\n\n let options = Object.keys(transactions[0]);\n mappings = mappings || {};\n\n return (\n <View>\n <SectionLabel title=\"CSV FIELDS\" />\n <Stack\n direction=\"row\"\n align=\"flex-start\"\n spacing={1}\n style={{ marginTop: 5 }}\n >\n <View style={{ width: 200 }}>\n <SubLabel title=\"Date\" />\n <SelectField\n width={200}\n options={options}\n value={mappings.date || ''}\n style={{ marginRight: 5 }}\n onChange={name => onChange('date', name)}\n />\n </View>\n <View style={{ flex: 1 }}>\n <SubLabel title=\"Payee\" />\n <SelectField\n width=\"flex\"\n options={options}\n value={mappings.payee || ''}\n style={{ marginRight: 5 }}\n onChange={name => onChange('payee', name)}\n />\n </View>\n <View style={{ flex: 1 }}>\n <SubLabel title=\"Notes\" />\n <SelectField\n width=\"flex\"\n options={options}\n value={mappings.notes || ''}\n style={{ marginRight: 5 }}\n onChange={name => onChange('notes', name)}\n />\n </View>\n {splitMode ? (\n <>\n <View style={{ width: 90 }}>\n <SubLabel title=\"Outflow\" />\n <SelectField\n width={90}\n options={options}\n value={mappings.outflow || ''}\n onChange={name => onChange('outflow', name)}\n />\n </View>\n <View style={{ width: 90 }}>\n <SubLabel title=\"Inflow\" />\n <SelectField\n width={90}\n options={options}\n value={mappings.inflow || ''}\n onChange={name => onChange('inflow', name)}\n />\n </View>\n </>\n ) : (\n <View style={{ width: 90 }}>\n <SubLabel title=\"Amount\" />\n <SelectField\n width={90}\n options={options}\n value={mappings.amount || ''}\n onChange={name => onChange('amount', name)}\n />\n </View>\n )}\n </Stack>\n </View>\n );\n}\n\nexport function ImportTransactions({\n modalProps,\n options,\n dateFormat = 'MM/dd/yyyy',\n prefs,\n parseTransactions,\n importTransactions,\n getPayees,\n savePrefs\n}) {\n let [loadingState, setLoadingState] = useState('parsing');\n let [error, setError] = useState(null);\n let [filename, setFilename] = useState(options.filename);\n let [transactions, setTransactions] = useState([]);\n let [filetype, setFileType] = useState(null);\n let [fieldMappings, setFieldMappings] = useState(null);\n let [splitMode, setSplitMode] = useState(false);\n let [flipAmount, setFlipAmount] = useState(false);\n let { accountId, onImported } = options;\n\n // This cannot be set after parsing the file, because changing it\n // requires re-parsing the file. This is different from the other\n // options which are simple post-processing. That means if you\n // parsed different files without closing the modal, it wouldn't\n // re-read this.\n let [csvDelimiter, setCsvDelimiter] = useState(\n prefs[`csv-delimiter-${accountId}`] || ','\n );\n\n let [parseDateFormat, setParseDateFormat] = useState(null);\n\n async function parse(filename, options) {\n setLoadingState('parsing');\n\n let { errors, transactions } = await parseTransactions(filename, options);\n\n setLoadingState(null);\n setError(null);\n\n if (errors.length > 0) {\n setError({\n parsed: true,\n message: errors[0].message || 'Internal error'\n });\n } else {\n let filetype = getFileType(filename);\n setFilename(filename);\n setFileType(filetype);\n\n if (filetype === 'csv' || filetype === 'qif') {\n setFlipAmount(prefs[`flip-amount-${accountId}-${filetype}`] || false);\n }\n\n if (filetype === 'csv') {\n let mappings = prefs[`csv-mappings-${accountId}`];\n mappings = mappings\n ? JSON.parse(mappings)\n : getInitialMappings(transactions);\n\n setFieldMappings(mappings);\n\n // Set initial split mode based on any saved mapping\n let initialSplitMode = !!(mappings.outflow || mappings.inflow);\n setSplitMode(initialSplitMode);\n\n setParseDateFormat(\n prefs[`parse-date-${accountId}-${filetype}`] ||\n getInitialDateFormat(transactions, mappings)\n );\n } else if (filetype === 'qif') {\n setParseDateFormat(\n prefs[`parse-date-${accountId}-${filetype}`] ||\n getInitialDateFormat(transactions, { date: 'date' })\n );\n } else {\n setFieldMappings(null);\n setParseDateFormat(null);\n }\n\n // Reverse the transactions because it's very common for them to\n // be ordered ascending, but we show transactions descending by\n // date. This is purely cosmetic.\n setTransactions(transactions.reverse());\n }\n }\n\n useEffect(() => {\n parse(\n options.filename,\n getFileType(options.filename) === 'csv'\n ? { delimiter: csvDelimiter }\n : null\n );\n }, [parseTransactions, options.filename]);\n\n function onSplitMode() {\n if (fieldMappings == null) {\n return;\n }\n\n let isSplit = !splitMode;\n setSplitMode(isSplit);\n\n // Run auto-detection on the fields to try to detect the fields\n // automatically\n let mappings = getInitialMappings(transactions);\n\n let newFieldMappings = isSplit\n ? {\n amount: null,\n outflow: mappings.amount,\n inflow: null\n }\n : {\n amount: mappings.amount,\n outflow: null,\n inflow: null\n };\n setFieldMappings({ ...fieldMappings, ...newFieldMappings });\n }\n\n function onNewFile() {\n const res = window.Actual.openFileDialog({\n filters: [\n { name: 'Financial Files', extensions: ['qif', 'ofx', 'qfx', 'csv'] }\n ]\n });\n\n parse(\n res[0],\n getFileType(res[0]) === 'csv' ? { delimiter: csvDelimiter } : null\n );\n }\n\n function onUpdateFields(field, name) {\n setFieldMappings({ ...fieldMappings, [field]: name === '' ? null : name });\n }\n\n async function onImport() {\n setLoadingState('importing');\n\n let finalTransactions = [];\n let errorMessage;\n\n for (let trans of transactions) {\n trans = fieldMappings ? applyFieldMappings(trans, fieldMappings) : trans;\n\n let date =\n filetype === 'qfx' || filetype === 'ofx'\n ? trans.date\n : parseDate(trans.date, parseDateFormat);\n if (date == null) {\n errorMessage = `Unable to parse date ${trans.date ||\n '(empty)'} with given date format`;\n break;\n }\n\n let { amount } = parseAmountFields(trans, splitMode, flipAmount);\n if (amount == null) {\n errorMessage = `Transaction on ${trans.date} has no amount`;\n break;\n }\n\n let { inflow, outflow, ...finalTransaction } = trans;\n finalTransactions.push({\n ...finalTransaction,\n date,\n amount: amountToInteger(amount)\n });\n }\n\n if (errorMessage) {\n setLoadingState(null);\n setError({ parsed: false, message: errorMessage });\n return;\n }\n\n if (filetype !== 'ofx' && filetype !== 'qfx') {\n let key = `parse-date-${accountId}-${filetype}`;\n savePrefs({ [key]: parseDateFormat });\n }\n\n if (filetype === 'csv') {\n savePrefs({\n [`csv-mappings-${accountId}`]: JSON.stringify(fieldMappings)\n });\n savePrefs({ [`csv-delimiter-${accountId}`]: csvDelimiter });\n }\n\n if (filetype === 'csv' || filetype === 'qif') {\n savePrefs({ [`flip-amount-${accountId}-${filetype}`]: flipAmount });\n }\n\n let didChange = await importTransactions(accountId, finalTransactions);\n if (didChange) {\n await getPayees();\n }\n\n if (onImported) {\n onImported(didChange);\n }\n\n modalProps.onClose();\n }\n\n let headers = [\n { name: 'Date', width: 200 },\n { name: 'Payee', width: 'flex' },\n { name: 'Notes', width: 'flex' }\n ];\n\n if (splitMode) {\n headers.push({ name: 'Outflow', width: 90, style: { textAlign: 'right' } });\n headers.push({ name: 'Inflow', width: 90, style: { textAlign: 'right' } });\n } else {\n headers.push({ name: 'Amount', width: 90, style: { textAlign: 'right' } });\n }\n\n return (\n <Modal\n title={\n 'Import transactions' + (filetype ? ` (${filetype.toUpperCase()})` : '')\n }\n {...modalProps}\n loading={loadingState === 'parsing'}\n style={{ width: 800 }}\n >\n {error && !error.parsed && (\n <View style={{ alignItems: 'center', marginBottom: 15 }}>\n <Text style={{ marginRight: 10, color: colors.r4 }}>\n <strong>Error:</strong> {error.message}\n </Text>\n </View>\n )}\n {(!error || !error.parsed) && (\n <View\n style={{\n flex: 'unset',\n height: 300,\n border: '1px solid ' + colors.border\n }}\n >\n <TableHeader headers={headers} />\n\n <TableWithNavigator\n items={transactions}\n fields={['payee', 'amount']}\n style={{ backgroundColor: colors.n11 }}\n getItemKey={index => index}\n renderEmpty={() => {\n return (\n <View\n style={{\n textAlign: 'center',\n marginTop: 25,\n color: colors.n4,\n fontStyle: 'italic'\n }}\n >\n No transactions found\n </View>\n );\n }}\n renderItem={({ key, style, item, editing, focusedField }) => (\n <View key={key} style={style}>\n <Transaction\n transaction={item}\n showParsed={filetype === 'csv' || filetype === 'qif'}\n parseDateFormat={parseDateFormat}\n dateFormat={dateFormat}\n fieldMappings={fieldMappings}\n splitMode={splitMode}\n flipAmount={flipAmount}\n />\n </View>\n )}\n />\n </View>\n )}\n {error && error.parsed && (\n <View\n style={{\n color: colors.r4,\n alignItems: 'center',\n marginTop: 10\n }}\n >\n <Text style={{ maxWidth: 450, marginBottom: 15 }}>\n <strong>Error:</strong> {error.message}\n </Text>\n {error.parsed && (\n <Button onClick={() => onNewFile()}>Select new file...</Button>\n )}\n </View>\n )}\n\n {filetype === 'csv' && (\n <View style={{ marginTop: 25 }}>\n <FieldMappings\n transactions={transactions}\n onChange={onUpdateFields}\n mappings={fieldMappings}\n splitMode={splitMode}\n />\n </View>\n )}\n\n {(filetype === 'qif' || filetype === 'csv') && (\n <View style={{ marginTop: 25 }}>\n <SectionLabel title=\"IMPORT OPTIONS\" />\n <View style={{ marginTop: 5 }}>\n <FlipAmountOption\n value={flipAmount}\n disabled={splitMode}\n onChange={() => {\n setFlipAmount(!flipAmount);\n }}\n />\n </View>\n {filetype === 'csv' && (\n <View style={{ marginTop: 10 }}>\n <SplitOption value={splitMode} onChange={onSplitMode} />\n </View>\n )}\n </View>\n )}\n\n <View style={{ flexDirection: 'row', marginTop: 25 }}>\n {(filetype === 'qif' || filetype === 'csv') && (\n <DateFormatSelect\n transactions={transactions}\n fieldMappings={fieldMappings}\n parseDateFormat={parseDateFormat}\n onChange={setParseDateFormat}\n />\n )}\n\n {filetype === 'csv' && (\n <View style={{ marginLeft: 25 }}>\n <SectionLabel title=\"CSV DELIMITER\" />\n <Select\n value={csvDelimiter}\n onChange={e => {\n setCsvDelimiter(e.target.value);\n parse(filename, { delimiter: e.target.value });\n }}\n >\n <option value=\",\">,</option>\n <option value=\";\">;</option>\n </Select>\n </View>\n )}\n\n <View style={{ flex: 1 }} />\n\n <View\n style={{\n alignSelf: 'flex-end',\n flexDirection: 'row',\n alignItems: 'center'\n }}\n >\n <ButtonWithLoading\n primary\n disabled={transactions.length === 0}\n loading={loadingState === 'importing'}\n onClick={onImport}\n >\n Import {transactions.length} transactions\n </ButtonWithLoading>\n </View>\n </View>\n </Modal>\n );\n}\n\nexport default connect(\n state => ({\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy',\n prefs: state.prefs.local\n }),\n actions\n)(ImportTransactions);\n","import React, { useRef } from 'react';\nimport { connect } from 'react-redux';\nimport { parseISO, format as formatDate, parse as parseDate } from 'date-fns';\nimport * as actions from 'loot-core/src/client/actions';\nimport { amountToInteger } from 'loot-core/src/shared/util';\nimport { currentDay, dayFromDate } from 'loot-core/src/shared/months';\nimport { View, Modal, Stack, Button, Input } from '../common';\nimport DateSelect from '../DateSelect';\nimport CategoryAutocomplete from '../CategorySelect';\nimport AccountAutocomplete from '../AccountAutocomplete';\nimport PayeeAutocomplete from '../PayeeAutocomplete';\nimport { SectionLabel } from '../forms';\nimport { colors } from '../../style';\n// import { colors } from '../../style';\n\nfunction EditField({\n actions,\n modalProps,\n name,\n accounts,\n categoryGroups,\n payees,\n onSubmit,\n dateFormat,\n createPayee\n}) {\n let submitRef = useRef();\n\n function onSelect(value) {\n // Process the value if needed\n if (name === 'amount') {\n value = amountToInteger(value);\n }\n\n onSubmit(name, value);\n modalProps.onClose();\n }\n\n let label, editor, minWidth;\n let inputStyle = { ':focus': { boxShadow: 0 } };\n let autocompleteProps = {\n inputProps: { style: inputStyle },\n containerProps: { style: { height: 275 } }\n };\n\n switch (name) {\n case 'date': {\n let today = currentDay();\n label = 'Date';\n minWidth = 350;\n editor = (\n <DateSelect\n value={formatDate(parseISO(today), dateFormat)}\n dateFormat={dateFormat}\n focused={true}\n embedded={true}\n onUpdate={() => {}}\n onSelect={date => {\n onSelect(dayFromDate(parseDate(date, 'yyyy-MM-dd', new Date())));\n }}\n />\n );\n break;\n }\n\n case 'account':\n label = 'Account';\n editor = (\n <AccountAutocomplete\n value={null}\n accounts={accounts}\n focused={true}\n embedded={true}\n onSelect={value => {\n if (value) {\n onSelect(value);\n }\n }}\n {...autocompleteProps}\n />\n );\n break;\n\n case 'payee':\n label = 'Payee';\n editor = (\n <PayeeAutocomplete\n payees={payees}\n accounts={accounts}\n value={null}\n focused={true}\n embedded={true}\n showManagePayees={false}\n onSelect={async value => {\n if (value && value.startsWith('new:')) {\n value = await createPayee(value.slice('new:'.length));\n }\n\n onSelect(value);\n }}\n {...autocompleteProps}\n />\n );\n break;\n\n case 'notes':\n label = 'Notes';\n editor = (\n <Input\n focused={true}\n onEnter={e => onSelect(e.target.value)}\n style={inputStyle}\n />\n );\n break;\n\n case 'category':\n label = 'Category';\n editor = (\n <CategoryAutocomplete\n categoryGroups={categoryGroups}\n value={null}\n focused={true}\n embedded={true}\n showSplitOption={false}\n onUpdate={() => {}}\n onSelect={value => {\n onSelect(value);\n }}\n {...autocompleteProps}\n />\n );\n break;\n\n case 'amount':\n label = 'Amount';\n editor = (\n <Input\n focused={true}\n onEnter={e => onSelect(e.target.value)}\n style={inputStyle}\n />\n );\n break;\n\n default:\n }\n\n return (\n <Modal\n noAnimation={true}\n showHeader={false}\n focusAfterClose={false}\n {...modalProps}\n padding={0}\n style={[\n {\n flex: 0,\n padding: '15px 10px',\n backgroundColor: colors.n1,\n color: 'white'\n },\n minWidth && { minWidth }\n ]}\n >\n {() => (\n <View>\n <SectionLabel\n title={label}\n style={{\n alignSelf: 'center',\n color: colors.b10,\n marginBottom: 10\n }}\n />\n <View style={{ flex: 1 }}>{editor}</View>\n </View>\n )}\n </Modal>\n );\n}\n\nexport default connect(\n state => ({\n dateFormat: state.prefs.local.dateFormat || 'MM/dd/yyyy',\n categoryGroups: state.queries.categories.grouped,\n accounts: state.queries.accounts,\n payees: state.queries.payees\n }),\n actions\n)(EditField);\n","import React from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport { Route, Switch } from 'react-router-dom';\nimport { createLocation } from 'history';\nimport Component from '@reactions/component';\nimport * as actions from 'loot-core/src/client/actions';\nimport { send, listen, unlisten } from 'loot-core/src/platform/client/fetch';\nimport { getModalRoute } from '../util';\n\nimport CreateAccount from './modals/CreateAccount';\nimport CreateLocalAccount from 'loot-design/src/components/modals/CreateLocalAccount';\nimport CloseAccount from 'loot-design/src/components/modals/CloseAccount';\nimport SelectLinkedAccounts from 'loot-design/src/components/modals/SelectLinkedAccounts';\nimport ConfigureLinkedAccounts from 'loot-design/src/components/modals/ConfigureLinkedAccounts';\nimport LoadBackup from 'loot-design/src/components/modals/LoadBackup';\nimport ManagePayeesWithData from './payees/ManagePayeesWithData';\nimport ManageRules from './modals/ManageRules';\nimport EditRule from './modals/EditRule';\nimport MergeUnusedPayees from './modals/MergeUnusedPayees';\nimport PlaidExternalMsg from 'loot-design/src/components/modals/PlaidExternalMsg';\nimport ConfirmCategoryDelete from './modals/ConfirmCategoryDelete';\nimport WelcomeScreen from './modals/WelcomeScreen';\nimport ImportTransactions from 'loot-design/src/components/modals/ImportTransactions';\nimport CreateEncryptionKey from './modals/CreateEncryptionKey';\nimport FixEncryptionKey from './modals/FixEncryptionKey';\nimport EditField from 'loot-design/src/components/modals/EditField';\n\nfunction Modals({\n history,\n modalStack,\n isHidden,\n accounts,\n categoryGroups,\n categories,\n payees,\n budgetId,\n actions\n}) {\n return modalStack.map(({ name, options = {} }, idx) => {\n const modalProps = {\n onClose: actions.popModal,\n onBack: actions.popModal,\n showBack: idx > 0,\n isCurrent: idx === modalStack.length - 1,\n isHidden,\n stackIndex: idx\n };\n\n let location = createLocation('/' + name);\n return (\n <Switch key={name} location={location}>\n <Route path=\"/import-transactions\">\n <ImportTransactions modalProps={modalProps} options={options} />\n </Route>\n\n <Route path=\"/add-account\">\n <CreateAccount modalProps={modalProps} actions={actions} />\n </Route>\n\n <Route path=\"/add-local-account\">\n <CreateLocalAccount\n modalProps={modalProps}\n actions={actions}\n history={history}\n />\n </Route>\n\n <Route path=\"/close-account\">\n <CloseAccount\n modalProps={modalProps}\n account={options.account}\n balance={options.balance}\n canDelete={options.canDelete}\n accounts={accounts.filter(acct => acct.closed === 0)}\n categoryGroups={categoryGroups}\n actions={actions}\n />\n </Route>\n\n <Route path=\"/select-linked-accounts\">\n <SelectLinkedAccounts\n modalProps={modalProps}\n institution={options.institution}\n publicToken={options.publicToken}\n accounts={options.accounts}\n upgradingId={options.upgradingId}\n actions={actions}\n />\n </Route>\n\n <Route path=\"/configure-linked-accounts\">\n <ConfigureLinkedAccounts\n modalProps={modalProps}\n institution={options.institution}\n publicToken={options.publicToken}\n accounts={options.accounts}\n upgradingId={options.upgradingId}\n actions={actions}\n />\n </Route>\n\n <Route\n path=\"/confirm-category-delete\"\n render={() => {\n const { category, group, onDelete } = options;\n return (\n <ConfirmCategoryDelete\n modalProps={modalProps}\n actions={actions}\n category={categories.find(c => c.id === category)}\n group={categoryGroups.find(g => g.id === group)}\n categoryGroups={categoryGroups}\n onDelete={onDelete}\n />\n );\n }}\n />\n\n <Route\n path=\"/load-backup\"\n render={() => {\n return (\n <Component\n initialState={{ backups: [] }}\n didMount={async ({ setState }) => {\n setState({\n backups: await send('backups-get', { id: budgetId })\n });\n\n listen('backups-updated', backups => {\n setState({ backups });\n });\n }}\n willUnmount={() => {\n unlisten('backups-updated');\n }}\n >\n {({ state }) => (\n <LoadBackup\n budgetId={budgetId}\n modalProps={modalProps}\n actions={actions}\n backups={state.backups}\n />\n )}\n </Component>\n );\n }}\n />\n\n <Route\n path=\"/manage-payees\"\n render={() => {\n return (\n <ManagePayeesWithData\n history={history}\n modalProps={modalProps}\n initialSelectedIds={\n options.selectedPayee ? [options.selectedPayee] : undefined\n }\n />\n );\n }}\n />\n\n <Route\n path=\"/manage-rules\"\n render={() => {\n return (\n <ManageRules\n history={history}\n modalProps={modalProps}\n payeeId={options.payeeId}\n />\n );\n }}\n />\n\n <Route\n path=\"/edit-rule\"\n render={() => {\n return (\n <EditRule\n history={history}\n modalProps={modalProps}\n defaultRule={options.rule}\n onSave={options.onSave}\n />\n );\n }}\n />\n\n <Route\n path=\"/merge-unused-payees\"\n render={() => {\n return (\n <MergeUnusedPayees\n history={history}\n modalProps={modalProps}\n payeeIds={options.payeeIds}\n targetPayeeId={options.targetPayeeId}\n />\n );\n }}\n />\n\n <Route\n path=\"/plaid-external-msg\"\n render={() => {\n return (\n <PlaidExternalMsg\n modalProps={modalProps}\n actions={actions}\n onMoveExternal={options.onMoveExternal}\n onClose={() => {\n options.onClose && options.onClose();\n send('poll-web-token-stop');\n }}\n onSuccess={options.onSuccess}\n />\n );\n }}\n />\n\n <Route\n path=\"/create-encryption-key\"\n render={() => {\n return (\n <CreateEncryptionKey\n key={name}\n modalProps={modalProps}\n actions={actions}\n options={options}\n />\n );\n }}\n />\n\n <Route\n path=\"/fix-encryption-key\"\n render={() => {\n return (\n <FixEncryptionKey\n key={name}\n modalProps={modalProps}\n actions={actions}\n options={options}\n />\n );\n }}\n />\n\n <Route\n path=\"/edit-field\"\n render={() => {\n return (\n <EditField\n key={name}\n modalProps={modalProps}\n actions={actions}\n name={options.name}\n onSubmit={options.onSubmit}\n />\n );\n }}\n />\n\n <Route path=\"/welcome-screen\">\n <WelcomeScreen modalProps={modalProps} actions={actions} />\n </Route>\n </Switch>\n );\n });\n}\n\nexport default connect(\n state => ({\n modalStack: state.modals.modalStack,\n isHidden: state.modals.isHidden,\n accounts: state.queries.accounts,\n categoryGroups: state.queries.categories.grouped,\n categories: state.queries.categories.list,\n payees: state.queries.payees,\n budgetId: state.prefs.local && state.prefs.local.id\n }),\n dispatch => ({ actions: bindActionCreators(actions, dispatch) })\n)(Modals);\n","import React from 'react';\nimport { withRouter } from 'react-router-dom';\nimport Platform from 'loot-core/src/client/platform';\n\nclass GlobalKeys extends React.Component {\n componentDidMount() {\n const handleKeys = e => {\n if (Platform.isBrowser) {\n return;\n }\n\n if (e.metaKey) {\n const { history } = this.props;\n switch (e.keyCode) {\n case 49:\n history.push('/budget');\n break;\n case 50:\n history.push('/reports');\n break;\n case 51:\n history.push('/accounts');\n break;\n case 188: // ,\n if (Platform.OS === 'mac') {\n history.push('/settings');\n }\n break;\n default:\n }\n }\n };\n\n document.addEventListener('keydown', handleKeys);\n\n this.cleanupListeners = () => {\n document.removeEventListener('keydown', handleKeys);\n };\n }\n\n componentWillUnmount() {\n this.cleanupListeners();\n }\n\n render() {\n return null;\n }\n}\n\nexport default withRouter(GlobalKeys);\n","import React, { useMemo } from 'react';\nimport { Router, Route, Redirect, Switch, useLocation } from 'react-router-dom';\nimport { createBrowserHistory } from 'history';\nimport { connect } from 'react-redux';\nimport { DndProvider } from 'react-dnd';\nimport Backend from 'react-dnd-html5-backend';\nimport hotkeys from 'hotkeys-js';\nimport * as actions from 'loot-core/src/client/actions';\nimport { SpreadsheetProvider } from 'loot-core/src/client/SpreadsheetProvider';\nimport checkForUpgradeNotifications from 'loot-core/src/client/upgrade-notifications';\nimport { colors } from 'loot-design/src/style';\nimport { View } from 'loot-design/src/components/common';\nimport BankSyncStatus from './BankSyncStatus';\nimport { BudgetMonthCountProvider } from 'loot-design/src/components/budget/BudgetMonthCountContext';\nimport * as undo from 'loot-core/src/platform/client/undo';\nimport { PageTypeProvider } from './Page';\nimport { getLocationState } from '../util/location-state';\nimport { ActiveLocationProvider } from './ActiveLocation';\nimport { makeLocationState } from '../util/location-state';\nimport { PayeesProvider } from 'loot-core/src/client/data-hooks/payees';\nimport { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts';\n\nimport Titlebar, { TitlebarProvider } from './Titlebar';\nimport FloatableSidebar, { SidebarProvider } from './FloatableSidebar';\nimport Account from './accounts/Account';\nimport Budget from './budget';\nimport Reports from './reports';\nimport Schedules from './schedules';\nimport EditSchedule from './schedules/EditSchedule';\nimport LinkSchedule from './schedules/LinkSchedule';\nimport DiscoverSchedules from './schedules/DiscoverSchedules';\nimport PostsOfflineNotification from './schedules/PostsOfflineNotification';\nimport FixSplitsTool from './tools/FixSplitsTool';\nimport Settings from './Settings';\nimport Modals from './Modals';\nimport Notifications from './Notifications';\nimport GlobalKeys from './GlobalKeys';\n// import Debugger from './Debugger';\n\nfunction URLBar() {\n let location = useLocation();\n\n return (\n <View\n style={{\n position: 'absolute',\n bottom: 0,\n right: 0,\n margin: 15,\n backgroundColor: colors.n9,\n padding: 8,\n borderRadius: 6\n }}\n >\n {location.pathname}\n </View>\n );\n}\n\nfunction PageRoute({ path, component: Component }) {\n return (\n <Route\n path={path}\n children={props => {\n return (\n <View\n style={{\n flex: 1,\n display: props.match ? 'flex' : 'none'\n }}\n >\n <Component {...props} />\n </View>\n );\n }}\n />\n );\n}\n\nfunction Routes({ location }) {\n return (\n <Switch location={location}>\n <Route path=\"/\">\n <Route path=\"/\" exact render={() => <Redirect to=\"/budget\" />} />\n\n <PageRoute path=\"/reports\" component={Reports} />\n <PageRoute path=\"/budget\" component={Budget} />\n\n <Route path=\"/schedules\" exact component={Schedules} />\n <Route path=\"/schedule/edit\" exact component={EditSchedule} />\n <Route path=\"/schedule/edit/:id\" component={EditSchedule} />\n <Route path=\"/schedule/link\" component={LinkSchedule} />\n <Route path=\"/schedule/discover\" component={DiscoverSchedules} />\n <Route\n path=\"/schedule/posts-offline-notification\"\n component={PostsOfflineNotification}\n />\n\n <Route path=\"/tools/fix-splits\" exact component={FixSplitsTool} />\n\n <Route\n path=\"/accounts/:id\"\n exact\n children={props => {\n return (\n props.match && <Account key={props.match.params.id} {...props} />\n );\n }}\n />\n <Route path=\"/accounts\" exact component={Account} />\n <Route path=\"/settings\" component={Settings} />\n </Route>\n </Switch>\n );\n}\n\nfunction StackedRoutes() {\n let location = useLocation();\n let locationPtr = getLocationState(location, 'locationPtr');\n\n let locations = [location];\n while (locationPtr) {\n locations.unshift(locationPtr);\n locationPtr = getLocationState(locationPtr, 'locationPtr');\n }\n\n let base = locations[0];\n let stack = locations.slice(1);\n\n return (\n <ActiveLocationProvider location={locations[locations.length - 1]}>\n <Routes location={base} />\n {stack.map((location, idx) => (\n <PageTypeProvider\n key={location.key}\n type=\"modal\"\n current={idx === stack.length - 1}\n >\n <Routes location={location} />\n </PageTypeProvider>\n ))}\n </ActiveLocationProvider>\n );\n}\n\nclass FinancesApp extends React.Component {\n constructor(props) {\n super(props);\n this.history = createBrowserHistory();\n\n let oldPush = this.history.push;\n this.history.push = (to, state) => {\n return oldPush.call(this.history, to, makeLocationState(state));\n };\n\n // I'm not sure if this is the best approach but we need this to\n // globally. We could instead move various workflows inside global\n // React components, but that's for another day.\n window.__history = this.history;\n\n undo.setUndoState('url', window.location.href);\n\n this.cleanup = this.history.listen(location => {\n undo.setUndoState('url', window.location.href);\n });\n }\n\n componentDidMount() {\n // TODO: quick hack fix for showing the demo\n if (this.history.location.pathname === '/subscribe') {\n this.history.push('/');\n }\n\n // Get the accounts and check if any exist. If there are no\n // accounts, we want to redirect the user to the All Accounts\n // screen which will prompt them to add an account\n this.props.getAccounts().then(accounts => {\n if (accounts.length === 0) {\n this.history.push('/accounts');\n }\n });\n\n // The default key handler scope\n hotkeys.setScope('app');\n\n // Wait a little bit to make sure the sync button will get the\n // sync start event. This can be improved later.\n setTimeout(async () => {\n await this.props.sync();\n\n // Check for upgrade notifications. We do this after syncing\n // because these states are synced across devices, so they will\n // only see it once for this file\n checkForUpgradeNotifications(\n this.props.addNotification,\n this.props.resetSync,\n this.history\n );\n }, 100);\n }\n\n componentWillUnmount() {\n this.cleanup();\n }\n\n render() {\n return (\n <Router history={this.history}>\n <View style={{ height: '100%', backgroundColor: colors.n10 }}>\n <GlobalKeys />\n\n <View style={{ flexDirection: 'row', flex: 1 }}>\n <FloatableSidebar />\n\n <div\n style={{\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n overflow: 'hidden',\n position: 'relative'\n }}\n >\n <Titlebar\n style={{\n WebkitAppRegion: 'drag',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 1000\n }}\n />\n <div\n style={{\n flex: 1,\n display: 'flex',\n overflow: 'auto',\n position: 'relative'\n }}\n >\n <Notifications />\n <BankSyncStatus />\n\n <StackedRoutes />\n\n {/*window.Actual.IS_DEV && <Debugger />*/}\n {/*window.Actual.IS_DEV && <URLBar />*/}\n\n <Modals history={this.history} />\n </div>\n </div>\n </View>\n </View>\n </Router>\n );\n }\n}\n\nfunction FinancesAppWithContext(props) {\n let app = useMemo(() => <FinancesApp {...props} />, [props]);\n\n return (\n <SpreadsheetProvider>\n <TitlebarProvider>\n <SidebarProvider>\n <BudgetMonthCountProvider>\n <PayeesProvider>\n <AccountsProvider>\n <DndProvider backend={Backend}>{app}</DndProvider>\n </AccountsProvider>\n </PayeesProvider>\n </BudgetMonthCountProvider>\n </SidebarProvider>\n </TitlebarProvider>\n </SpreadsheetProvider>\n );\n}\n\nexport default connect(\n null,\n actions\n)(FinancesAppWithContext);\n","import React, { useState, useEffect } from 'react';\nimport {\n View,\n Text,\n AnchorLink,\n Button\n} from 'loot-design/src/components/common';\nimport { send } from 'loot-core/src/platform/client/fetch';\n\nexport default function ServerURL() {\n let [url, setUrl] = useState(null);\n\n useEffect(() => {\n async function run() {\n let url = await send('get-server-url');\n setUrl(url);\n }\n run();\n }, []);\n\n return (\n <View\n style={{\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n justifyContent: 'center',\n flexDirection: 'row',\n marginBottom: 15,\n zIndex: 5000\n }}\n >\n <Text>\n Using server: <strong>{url}</strong>\n </Text>\n <AnchorLink bare to=\"/config-server\" style={{ marginLeft: 15 }}>\n Change\n </AnchorLink>\n </View>\n );\n}\n","import React from 'react';\n\nconst SvgCloudCheck = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCloudCheck;\n","import React from 'react';\n\nconst SvgCloudDownload = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCloudDownload;\n","import React from 'react';\n\nconst SvgCloudUnknown = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgCloudUnknown;\n","import React from 'react';\n\nconst SvgFileDouble = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgFileDouble;\n","import React from 'react';\n\nconst SvgKey = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgKey;\n","import React from 'react';\n\nconst SvgRefreshArrow = props => (\n <svg\n {...props}\n viewBox=\"0 0 24 24\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgRefreshArrow;\n","import React, { useState, useRef } from 'react';\nimport { View, Text, Modal, Button, Tooltip, Menu } from '../common';\nimport { styles, colors } from '../../style';\nimport CloudCheck from '../../svg/v1/CloudCheck';\nimport CloudDownload from '../../svg/v1/CloudDownload';\nimport CloudUnknown from '../../svg/v2/CloudUnknown';\nimport FileDouble from '../../svg/v1/FileDouble';\nimport Key from 'loot-design/src/svg/v2/Key';\nimport DotsHorizontalTriple from '../../svg/v1/DotsHorizontalTriple';\nimport RefreshArrow from 'loot-design/src/svg/v2/RefreshArrow';\nimport Loading from 'loot-design/src/svg/v1/AnimatedLoading';\n\nfunction getFileDescription(file) {\n if (file.state === 'unknown') {\n return (\n \"This is a cloud-based file but it's state is unknown because you \" +\n 'are offline.'\n );\n }\n\n if (file.encryptKeyId) {\n if (file.hasKey) {\n return 'This file is encrypted and you have key to access it.';\n }\n return 'This file is encrypted and you do not have the key for it.';\n }\n\n return null;\n}\n\nfunction FileMenu({ state, onDelete, onUpload, onClose, onDownload }) {\n function onMenuSelect(type) {\n onClose();\n\n switch (type) {\n case 'delete':\n onDelete();\n break;\n default:\n }\n }\n\n let items = [{ name: 'delete', text: 'Delete' }];\n\n return <Menu onMenuSelect={onMenuSelect} items={items} />;\n}\n\nfunction DetailButton({ state, onDelete }) {\n let [menuOpen, setMenuOpen] = useState(false);\n\n return (\n <View>\n <Button\n bare\n onClick={e => {\n e.stopPropagation();\n setMenuOpen(true);\n }}\n >\n <DotsHorizontalTriple style={{ width: 16, height: 16 }} />\n </Button>\n {menuOpen && (\n <Tooltip\n position=\"bottom-right\"\n style={{ padding: 0 }}\n onClose={() => setMenuOpen(false)}\n >\n <FileMenu\n state={state}\n onDelete={onDelete}\n onClose={() => setMenuOpen(false)}\n />\n </Tooltip>\n )}\n </View>\n );\n}\n\nfunction FileState({ file }) {\n let Icon;\n let status;\n let color;\n\n switch (file.state) {\n case 'unknown':\n Icon = CloudUnknown;\n status = 'Network unavailable';\n color = colors.n7;\n break;\n case 'remote':\n Icon = CloudDownload;\n status = 'Available for download';\n break;\n case 'local':\n case 'broken':\n Icon = FileDouble;\n status = 'Local';\n break;\n default:\n Icon = CloudCheck;\n status = 'Syncing';\n break;\n }\n\n return (\n <View\n style={{\n color,\n alignItems: 'center',\n flexDirection: 'row',\n marginTop: 8\n }}\n >\n <Icon\n color={color}\n style={{\n width: 18,\n height: 18,\n color: 'currentColor'\n }}\n />\n\n <Text style={{ marginLeft: 5 }}>{status}</Text>\n </View>\n );\n}\n\nfunction File({ file, onSelect, onDelete }) {\n let selecting = useRef(false);\n\n async function _onSelect(file) {\n // Never allow selecting the file while uploading/downloading, and\n // make sure to never allow duplicate clicks\n if (!selecting.current) {\n selecting.current = true;\n await onSelect(file);\n selecting.current = false;\n }\n }\n\n return (\n <View\n onClick={() => _onSelect(file)}\n title={getFileDescription(file)}\n style={[\n {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n boxShadow: styles.shadow,\n margin: 10,\n padding: '12px 15px',\n backgroundColor: 'white',\n borderRadius: 6,\n flexShrink: 0,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: colors.hover\n }\n }\n ]}\n >\n <View style={{ alignItems: 'flex-start' }}>\n <Text style={[{ fontSize: 16, fontWeight: 700 }]}>{file.name}</Text>\n\n <FileState file={file} />\n </View>\n\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n {file.encryptKeyId && (\n <Key\n style={{\n width: 13,\n height: 13,\n marginRight: 8,\n color: file.hasKey ? colors.b5 : colors.n8\n }}\n />\n )}\n\n <DetailButton state={file.state} onDelete={() => onDelete(file)} />\n </View>\n </View>\n );\n}\n\nclass BudgetTable extends React.Component {\n render() {\n const { files, onSelect, onDelete } = this.props;\n\n return (\n <View\n style={{\n flex: 1,\n maxHeight: 310,\n overflow: 'auto',\n '& *': { userSelect: 'none' }\n }}\n >\n {files.map((file, idx) => (\n <File\n key={file.id || file.cloudFileId}\n file={file}\n onSelect={onSelect}\n onDelete={onDelete}\n />\n ))}\n </View>\n );\n }\n}\n\nfunction RefreshButton({ onRefresh }) {\n let [loading, setLoading] = useState(false);\n\n async function _onRefresh() {\n setLoading(true);\n await onRefresh();\n setLoading(false);\n }\n\n let Icon = loading ? Loading : RefreshArrow;\n\n return (\n <Button bare style={{ padding: 10, marginRight: 5 }} onClick={_onRefresh}>\n <Icon\n color={colors.n1}\n style={{ width: 18, height: 18, color: colors.n1 }}\n />\n </Button>\n );\n}\n\nclass BudgetList extends React.Component {\n creating = false;\n\n onCreate = ({ testMode } = {}) => {\n if (!this.creating) {\n this.creating = true;\n this.props.actions.createBudget({ testMode });\n }\n };\n\n render() {\n let { modalProps, files = [], actions, onDownload } = this.props;\n\n return (\n <Modal\n {...modalProps}\n noAnimation={true}\n showHeader={false}\n showOverlay={false}\n padding={0}\n style={{ boxShadow: 'none', backgroundColor: 'transparent' }}\n >\n {() => (\n <View style={{ flex: 1 }}>\n <View>\n <Text style={[styles.veryLargeText, { margin: 20 }]}>Files</Text>\n <View\n style={{\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n justifyContent: 'center',\n marginRight: 5\n }}\n >\n <RefreshButton\n onRefresh={() => {\n actions.getUserData();\n actions.loadAllFiles();\n }}\n />\n </View>\n </View>\n <BudgetTable\n files={files}\n actions={actions}\n onSelect={file => {\n if (file.state === 'remote') {\n onDownload(file.cloudFileId);\n } else {\n actions.loadBudget(file.id);\n }\n }}\n onDelete={file => actions.pushModal('delete-budget', { file })}\n />\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'flex-end',\n padding: 25,\n paddingLeft: 5\n }}\n >\n <Button\n bare\n style={{\n marginLeft: 10,\n color: colors.n4\n }}\n onClick={e => {\n e.preventDefault();\n actions.pushModal('import');\n }}\n >\n Import file\n </Button>\n\n <Button\n primary\n onClick={() => this.onCreate()}\n style={{ marginLeft: 15 }}\n >\n Create new file\n </Button>\n\n {process.env.NODE_ENV === 'development' && (\n <Button\n primary\n onClick={() => this.onCreate({ testMode: true })}\n style={{ marginLeft: 15 }}\n >\n Create test file\n </Button>\n )}\n </View>\n </View>\n )}\n </Modal>\n );\n }\n}\n\nexport default BudgetList;\n","import React, { useState } from 'react';\nimport { View, Block, Modal, Button, Link } from '../common';\nimport { styles, colors } from '../../style';\n\nfunction getErrorMessage(error) {\n switch (error) {\n case 'not-ynab4':\n return 'This file is not valid. Please select a .ynab4 file';\n default:\n return 'An unknown error occurred while importing. Sorry! We have been notified of this issue.';\n }\n}\n\n// const res = await window.Actual.openFileDialog({\n// // Windows treats the ynab4 file as a directroy, while Mac\n// // treats it like a normal file\n// properties: ['openDirectory', 'openFile'],\n// filters: [{ name: 'ynab', extensions: ['ynab4'] }]\n// });\n// if (res) {\n// this.doImport(res[0]);\n// }\n// this.props.actions.importBudget(filepath).catch(err => {\n// this.setState({ error: err.message, importing: false });\n// });\n\nfunction Import({ modalProps, actions, availableImports }) {\n const [error, setError] = useState(false);\n const [importing, setImporting] = useState(false);\n const [type, setType] = useState(null);\n\n function onSelectType(type) {\n switch (type) {\n case 'ynab4':\n actions.pushModal('import-ynab4');\n break;\n case 'ynab5':\n actions.pushModal('import-ynab5');\n break;\n default:\n }\n }\n\n let itemStyle = {\n padding: 10,\n border: '1px solid ' + colors.border,\n borderRadius: 6,\n marginBottom: 10,\n display: 'block'\n };\n\n return (\n <Modal\n {...modalProps}\n noAnimation={true}\n showHeader={false}\n showOverlay={false}\n style={{ width: 400 }}\n >\n {() => (\n <View style={[styles.smallText, { lineHeight: 1.5, marginTop: 20 }]}>\n {error && (\n <Block style={{ color: colors.r4, marginBottom: 15 }}>\n {getErrorMessage(error)}\n </Block>\n )}\n\n <View>\n <View style={{ fontSize: 25, fontWeight: 700, marginBottom: 20 }}>\n Import from:\n </View>\n\n <View>\n <Button style={itemStyle} onClick={() => onSelectType('ynab4')}>\n <span style={{ fontWeight: 700 }}>YNAB4</span>\n <View style={{ color: colors.n5 }}>\n The old unsupported desktop app\n </View>\n </Button>\n <Button style={itemStyle} onClick={() => onSelectType('ynab5')}>\n <span style={{ fontWeight: 700 }}>nYNAB</span>\n <View style={{ color: colors.n5 }}>\n <div>The newer web app</div>\n </View>\n </Button>\n {false && (\n <Button style={itemStyle}>\n <span style={{ fontWeight: 700 }}>Actual</span>\n <View style={{ color: colors.n5 }}>\n <div>Import a backup or external file</div>\n </View>\n </Button>\n )}\n </View>\n </View>\n\n <View\n style={{\n flexDirection: 'row',\n marginTop: 20,\n alignItems: 'center'\n }}\n >\n <View style={{ flex: 1 }} />\n <Button\n style={{ marginRight: 10 }}\n onClick={() => modalProps.onBack()}\n >\n Back\n </Button>\n </View>\n </View>\n )}\n </Modal>\n );\n}\n\nexport default Import;\n","import React, { useState } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { importBudget } from 'loot-core/src/client/actions/budgets';\nimport {\n View,\n Block,\n Modal,\n Button,\n ButtonWithLoading,\n Link,\n P\n} from '../common';\nimport { styles, colors } from '../../style';\n\nfunction getErrorMessage(error) {\n switch (error) {\n case 'not-ynab4':\n return 'This file is not valid. Please select a compressed ynab4 zip file.';\n default:\n return 'An unknown error occurred while importing. Sorry! We have been notified of this issue.';\n }\n}\n\nfunction Import({ modalProps, availableImports }) {\n const dispatch = useDispatch();\n const [error, setError] = useState(false);\n const [importing, setImporting] = useState(false);\n\n async function onImport() {\n const res = await window.Actual.openFileDialog({\n properties: ['openFile'],\n filters: [{ name: 'ynab', extensions: ['zip'] }]\n });\n if (res) {\n setImporting(true);\n setError(false);\n try {\n await dispatch(importBudget(res[0], 'ynab4'));\n } catch (err) {\n setError(err.message);\n } finally {\n setImporting(false);\n }\n }\n }\n\n return (\n <Modal\n {...modalProps}\n showHeader={false}\n showOverlay={false}\n noAnimation={true}\n style={{ width: 400 }}\n >\n {() => (\n <View style={[styles.smallText, { lineHeight: 1.5, marginTop: 20 }]}>\n {error && (\n <Block style={{ color: colors.r4, marginBottom: 15 }}>\n {getErrorMessage(error)}\n </Block>\n )}\n\n <View style={{ alignItems: 'center' }}>\n <P>\n To import data from YNAB4, locate where your YNAB4 data is stored.\n It is usually in your Documents folder under YNAB. Your data is a\n directory inside that with the \".ynab4\" suffix.\n </P>\n <P>\n When you've located your data,{' '}\n <strong>compress it into a zip file</strong>. On macOS, right-click\n the folder and select \"Compress\". On Windows, right-click and\n select \"Send to > Compressed (zipped) folder\". Upload the zipped\n folder for importing.\n </P>\n <View>\n <ButtonWithLoading loading={importing} primary onClick={onImport}>\n Select zip file...\n </ButtonWithLoading>\n </View>\n </View>\n\n <View\n style={{\n flexDirection: 'row',\n marginTop: 20,\n alignItems: 'center'\n }}\n >\n <View style={{ flex: 1 }} />\n <Button\n style={{ marginRight: 10 }}\n onClick={() => modalProps.onBack()}\n >\n Back\n </Button>\n </View>\n </View>\n )}\n </Modal>\n );\n}\n\nexport default Import;\n","import React, { useState } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { importBudget } from 'loot-core/src/client/actions/budgets';\nimport {\n View,\n Block,\n Modal,\n ButtonWithLoading,\n Button,\n Link,\n P,\n ExternalLink\n} from '../common';\nimport { styles, colors } from '../../style';\n\nfunction getErrorMessage(error) {\n switch (error) {\n case 'parse-error':\n return 'Unable to parse file. Please select a JSON file exported from nYNAB.';\n case 'not-ynab5':\n return 'This file is not valid. Please select a JSON file exported from nYNAB.';\n default:\n return 'An unknown error occurred while importing. Sorry! We have been notified of this issue.';\n }\n}\n\nfunction Import({ modalProps, availableImports }) {\n const dispatch = useDispatch();\n const [error, setError] = useState(false);\n const [importing, setImporting] = useState(false);\n\n async function onImport() {\n const res = await window.Actual.openFileDialog({\n properties: ['openFile'],\n filters: [{ name: 'ynab', extensions: ['json'] }]\n });\n if (res) {\n setImporting(true);\n setError(false);\n try {\n await dispatch(importBudget(res[0], 'ynab5'));\n } catch (err) {\n setError(err.message);\n } finally {\n setImporting(false);\n }\n }\n }\n\n return (\n <Modal\n {...modalProps}\n showHeader={false}\n showOverlay={false}\n noAnimation={true}\n style={{ width: 400 }}\n >\n {() => (\n <View style={[styles.smallText, { lineHeight: 1.5, marginTop: 20 }]}>\n {error && (\n <Block style={{ color: colors.r4, marginBottom: 15 }}>\n {getErrorMessage(error)}\n </Block>\n )}\n\n <View\n style={{ alignItems: 'center', '& > div': { lineHeight: '1.7em' } }}\n >\n <P>\n <ExternalLink\n asAnchor={true}\n href=\"https://actualbudget.com/blog/importing-from-ynab\"\n target=\"_blank\"\n >\n Read here\n </ExternalLink>{' '}\n for instructions on how to migrate your data from YNAB. You need\n to export your data as JSON, and that page explains how to do\n that.\n </P>\n <P>\n Once you have exported your data, select the file and Actual will\n import it. Budgets may not match up exactly because things work\n slightly differently, but you should be able to fix up any\n problems.\n </P>\n <View>\n <ButtonWithLoading loading={importing} primary onClick={onImport}>\n Select file...\n </ButtonWithLoading>\n </View>\n </View>\n\n <View\n style={{\n flexDirection: 'row',\n marginTop: 20,\n alignItems: 'center'\n }}\n >\n <View style={{ flex: 1 }} />\n <Button\n style={{ marginRight: 10 }}\n onClick={() => modalProps.onBack()}\n >\n Back\n </Button>\n </View>\n </View>\n )}\n </Modal>\n );\n}\n\nexport default Import;\n","import React, { useState } from 'react';\nimport { View, Text, Modal, Button, ButtonWithLoading } from '../common';\nimport { styles, colors } from '../../style';\n\nexport default function DeleteMenu({ modalProps, actions, file }) {\n let [loadingState, setLoadingState] = useState(null);\n let { state } = file;\n\n async function onDeleteCloud() {\n setLoadingState('cloud');\n await actions.deleteBudget(file.id, file.cloudFileId);\n setLoadingState(null);\n\n modalProps.onBack();\n }\n\n async function onDeleteLocal() {\n setLoadingState('local');\n await actions.deleteBudget(file.id);\n setLoadingState(null);\n\n modalProps.onBack();\n }\n\n // If the state is \"broken\" that means it was created by another\n // user. The current user should be able to delete the local file,\n // but not the remote one\n let isRemote = file.cloudFileId && file.state !== 'broken';\n\n return (\n <Modal\n {...modalProps}\n title={'Delete ' + file.name}\n padding={0}\n showOverlay={false}\n onClose={modalProps.onBack}\n >\n {() => (\n <View\n style={{\n padding: 15,\n paddingTop: 0,\n paddingBottom: 25,\n width: 500,\n lineHeight: '1.5em'\n }}\n >\n {isRemote && (\n <>\n <Text>\n This is a <strong>hosted file</strong> which we store to make it\n available for download on any device. You can delete it from our\n servers which will remove it from all of your devices.\n </Text>\n\n <ButtonWithLoading\n primary\n loading={loadingState === 'cloud'}\n style={{\n backgroundColor: colors.r4,\n alignSelf: 'center',\n border: 0,\n marginTop: 10,\n padding: '10px 30px',\n fontSize: 14\n }}\n onClick={onDeleteCloud}\n >\n Delete file from all devices\n </ButtonWithLoading>\n </>\n )}\n\n {file.id && (\n <>\n <Text style={[isRemote && { marginTop: 20 }]}>\n {isRemote ? (\n <Text>\n You can also delete just the local copy. This will remove\n all local data and the file will be listed as available for\n download.\n </Text>\n ) : (\n <Text>\n {file.state === 'broken' ? (\n <Text>\n This is a <strong>hosted file</strong> but it was\n created by another user. You can only delete the local\n copy.\n </Text>\n ) : (\n <Text>\n This a <strong>local file</strong> which is not stored\n on our servers.\n </Text>\n )}{' '}\n Deleting it will remove it and all of its backup\n permanently.\n </Text>\n )}\n </Text>\n\n <ButtonWithLoading\n primary={!isRemote}\n loading={loadingState === 'local'}\n style={[\n {\n alignSelf: 'center',\n marginTop: 10,\n padding: '10px 30px',\n fontSize: 14\n },\n isRemote\n ? {\n color: colors.r4,\n borderColor: colors.r4\n }\n : {\n border: 0,\n backgroundColor: colors.r4\n }\n ]}\n onClick={onDeleteLocal}\n >\n Delete file locally\n </ButtonWithLoading>\n </>\n )}\n </View>\n )}\n </Modal>\n );\n}\n","import React from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport Component from '@reactions/component';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View } from 'loot-design/src/components/common';\nimport BudgetList from 'loot-design/src/components/manager/BudgetList';\nimport LoadBackup from 'loot-design/src/components/modals/LoadBackup';\nimport Import from 'loot-design/src/components/manager/Import';\nimport ImportYNAB4 from 'loot-design/src/components/manager/ImportYNAB4';\nimport ImportYNAB5 from 'loot-design/src/components/manager/ImportYNAB5';\nimport DeleteFile from 'loot-design/src/components/manager/DeleteFile';\nimport CreateEncryptionKey from '../modals/CreateEncryptionKey';\nimport FixEncryptionKey from '../modals/FixEncryptionKey';\nimport { colors } from 'loot-design/src/style';\n\nfunction Modals({\n modalStack,\n isHidden,\n allFiles,\n availableImports,\n globalPrefs,\n isLoggedIn,\n actions\n}) {\n let stack = modalStack.map(({ name, options }, idx) => {\n const modalProps = {\n onClose: actions.closeModal,\n onPush: actions.pushModal,\n onBack: actions.popModal,\n isCurrent: idx === modalStack.length - 1,\n isHidden,\n stackIndex: idx\n };\n\n switch (name) {\n case 'select-budget':\n return (\n <BudgetList\n key={name}\n modalProps={modalProps}\n files={allFiles}\n actions={actions}\n isLoggedIn={isLoggedIn}\n onDownload={cloudFileId => actions.downloadBudget(cloudFileId)}\n />\n );\n case 'delete-budget':\n return (\n <DeleteFile\n key={name}\n modalProps={modalProps}\n actions={actions}\n file={options.file}\n />\n );\n case 'import':\n return (\n <Import\n key={name}\n modalProps={modalProps}\n actions={actions}\n availableImports={availableImports}\n />\n );\n case 'import-ynab4':\n return (\n <ImportYNAB4 key={name} modalProps={modalProps} actions={actions} />\n );\n case 'import-ynab5':\n return (\n <ImportYNAB5 key={name} modalProps={modalProps} actions={actions} />\n );\n case 'load-backup': {\n return (\n <Component\n key={name}\n initialState={{ backups: [] }}\n didMount={async ({ setState }) => {\n setState({\n backups: await send('backups-get', { id: options.budgetId })\n });\n }}\n >\n {({ state }) => (\n <LoadBackup\n budgetId={options.budgetId}\n modalProps={{\n ...modalProps,\n onClose: actions.popModal\n }}\n backupDisabled={true}\n actions={actions}\n backups={state.backups}\n />\n )}\n </Component>\n );\n }\n case 'create-encryption-key':\n return (\n <CreateEncryptionKey\n key={name}\n modalProps={modalProps}\n actions={actions}\n options={options}\n />\n );\n case 'fix-encryption-key':\n return (\n <FixEncryptionKey\n key={name}\n modalProps={modalProps}\n actions={actions}\n options={options}\n />\n );\n default:\n throw new Error('Unknown modal: ' + name);\n }\n });\n\n return <View style={{ flex: 1, padding: 50 }}>{stack}</View>;\n}\n\nexport default connect(\n state => ({\n modalStack: state.modals.modalStack,\n isHidden: state.modals.isHidden,\n budgets: state.budgets.budgets,\n availableImports: state.budgets.availableImports,\n globalPrefs: state.prefs.global,\n allFiles: state.budgets.allFiles,\n isLoggedIn: !!state.user.data\n }),\n dispatch => ({ actions: bindActionCreators(actions, dispatch) })\n)(Modals);\n","import React, { useEffect, useState } from 'react';\nimport { useHistory, useLocation } from 'react-router-dom';\nimport {\n AnchorLink,\n Text,\n Button,\n ButtonLink,\n Input as BaseInput\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { send } from 'loot-core/src/platform/client/fetch';\n\n// There are two URLs that dance with each other: `/login` and\n// `/bootstrap`. Both of these URLs check the state of the the server\n// and make sure the user is looking at the right page. For example,\n// it doesn't make sense to show the login page if the server doesn't\n// have any accounts yet. It also doesn't make sense to show the\n// bootstrap page if the server already has been setup with a\n// password. Both pages will redirect to the other depending on state;\n// they will also potentially redirect to other pages which do *not*\n// do any checks.\nexport function useBootstrapped() {\n let [checked, setChecked] = useState(false);\n let history = useHistory();\n let location = useLocation();\n\n useEffect(() => {\n async function run() {\n let ensure = url => {\n if (location.pathname !== url) {\n history.push(url);\n } else {\n setChecked(true);\n }\n };\n\n let url = await send('get-server-url');\n if (url == null) {\n // A server hasn't been specified yet\n history.push('/config-server');\n } else {\n let { error, bootstrapped } = await send('subscribe-needs-bootstrap');\n if (error) {\n history.push('/error', { error });\n } else if (bootstrapped) {\n console.log('ensuring login');\n ensure('/login');\n } else {\n ensure('/bootstrap');\n }\n }\n }\n run();\n }, [history, location]);\n\n return { checked };\n}\n\nexport function getEmail(location) {\n let m = location.search.match(/email=([^&]*)/);\n if (!m) {\n return '';\n }\n return decodeURIComponent(m[1]);\n}\n\nexport function Title({ text }) {\n return (\n <Text\n style={{\n fontSize: 40,\n fontWeight: 700,\n color: colors.p3,\n marginBottom: 20\n }}\n >\n {text}\n </Text>\n );\n}\n\nexport const Input = React.forwardRef((props, ref) => {\n return (\n <BaseInput\n {...props}\n style={[\n {\n padding: 10,\n fontSize: 15,\n border: 'none',\n boxShadow: styles.shadow,\n ':focus': { border: 'none', boxShadow: styles.shadow }\n },\n props.style\n ]}\n />\n );\n});\n\nexport const BareButton = React.forwardRef((props, ref) => {\n return (\n <Button\n ref={ref}\n bare\n {...props}\n style={[\n {\n color: colors.p4,\n fontSize: 15,\n textDecoration: 'none',\n padding: '5px 7px',\n borderRadius: 4,\n ':hover': {\n backgroundColor: colors.n9\n },\n ':active': {\n backgroundColor: colors.n9\n }\n },\n props.style\n ]}\n />\n );\n});\n\nexport const ExternalLink = React.forwardRef((props, ref) => {\n let { href, ...linkProps } = props;\n return (\n <BareButton\n to=\"/\"\n {...linkProps}\n onClick={e => {\n e.preventDefault();\n window.Actual.openURLInBrowser(href);\n }}\n />\n );\n});\n\nexport const BackLink = React.forwardRef((props, ref) => {\n return (\n <BareButton\n ref={ref}\n to=\"/\"\n onClick={e => {\n e.preventDefault();\n props.history.goBack();\n }}\n >\n Back\n </BareButton>\n );\n});\n\nexport function Paragraph({ style, children }) {\n return (\n <Text\n style={[\n {\n fontSize: 15,\n color: colors.n2,\n lineHeight: 1.5,\n marginTop: 20\n },\n style\n ]}\n >\n {children}\n </Text>\n );\n}\n","import React, { useState, useCallback } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Button,\n ButtonWithLoading\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { loggedIn } from 'loot-core/src/client/actions/user';\nimport { createBudget } from 'loot-core/src/client/actions/budgets';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { useBootstrapped, Title, Input, Link, ExternalLink } from './common';\n\nexport default function Login() {\n let dispatch = useDispatch();\n let history = useHistory();\n let [password, setPassword] = useState('');\n let [loading, setLoading] = useState(false);\n let [error, setError] = useState(null);\n\n let { checked } = useBootstrapped();\n\n function getErrorMessage(error) {\n switch (error) {\n case 'invalid-password':\n return 'Invalid password';\n case 'network-failure':\n return 'Unable to contact the server';\n default:\n return \"Whoops, an error occurred on our side! We'll try to get it fixed soon.\";\n }\n }\n\n async function onSubmit(e) {\n e.preventDefault();\n if (password === '' || loading) {\n return;\n }\n\n setError(null);\n setLoading(true);\n let { error } = await send('subscribe-sign-in', { password });\n setLoading(false);\n\n if (error) {\n setError(error);\n } else {\n dispatch(loggedIn());\n }\n }\n\n async function onDemo() {\n await dispatch(createBudget({ demoMode: true }));\n }\n\n if (!checked) {\n return null;\n }\n\n return (\n <>\n <View style={{ width: 450, marginTop: -30 }}>\n <Title text=\"Sign in to this Actual instance\" />\n <Text\n style={{\n fontSize: 16,\n color: colors.n2,\n lineHeight: 1.4\n }}\n >\n If you lost your password, you likely still have access to your server\n to manually reset it.\n </Text>\n\n {error && (\n <Text\n style={{\n marginTop: 20,\n color: colors.r4,\n borderRadius: 4,\n fontSize: 15\n }}\n >\n {getErrorMessage(error)}\n </Text>\n )}\n\n <form\n style={{ display: 'flex', flexDirection: 'row', marginTop: 30 }}\n onSubmit={onSubmit}\n >\n <Input\n autoFocus={true}\n placeholder=\"Password\"\n type=\"password\"\n onChange={e => setPassword(e.target.value)}\n style={{ flex: 1, marginRight: 10 }}\n />\n <ButtonWithLoading primary loading={loading} style={{ fontSize: 15 }}>\n Sign in\n </ButtonWithLoading>\n </form>\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'center',\n marginTop: 15\n }}\n >\n <Button\n bare\n style={{ fontSize: 15, color: colors.b4, marginLeft: 10 }}\n onClick={onDemo}\n >\n Try Demo &rarr;\n </Button>\n </View>\n </View>\n </>\n );\n}\n","import React, { useState } from 'react';\nimport {\n View,\n Button,\n ButtonWithLoading\n} from 'loot-design/src/components/common';\nimport { Input } from './common';\n\nexport function ConfirmPasswordForm({ buttons, onSetPassword, onError }) {\n let [password1, setPassword1] = useState('');\n let [password2, setPassword2] = useState('');\n let [showPassword, setShowPassword] = useState(false);\n let [loading, setLoading] = useState(false);\n\n async function onSubmit(e) {\n e.preventDefault();\n if (loading) {\n return;\n }\n\n if (password1 === password2) {\n setLoading(true);\n await onSetPassword(password1);\n setLoading(false);\n } else {\n onError('password-match');\n }\n }\n\n function onShowPassword(e) {\n setShowPassword(e.target.checked);\n }\n\n return (\n <form\n style={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'stretch',\n marginTop: 30\n }}\n onSubmit={onSubmit}\n >\n <Input\n autoFocus={true}\n placeholder=\"Password\"\n type={showPassword ? 'text' : 'password'}\n value={password1}\n onChange={e => setPassword1(e.target.value)}\n />\n <Input\n placeholder=\"Confirm password\"\n type={showPassword ? 'text' : 'password'}\n value={password2}\n onChange={e => setPassword2(e.target.value)}\n style={{ marginTop: 10 }}\n />\n\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n fontSize: 15,\n marginTop: 20\n }}\n >\n <label style={{ userSelect: 'none' }}>\n <input type=\"checkbox\" onChange={onShowPassword} /> Show password\n </label>\n <View style={{ flex: 1 }} />\n {buttons}\n <ButtonWithLoading\n primary\n loading={loading}\n >\n OK\n </ButtonWithLoading>\n </View>\n </form>\n );\n}\n","import React, { useState, useEffect, useCallback } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View, Text, Button } from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { loggedIn } from 'loot-core/src/client/actions/user';\nimport { createBudget } from 'loot-core/src/client/actions/budgets';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { ConfirmPasswordForm } from './ConfirmPasswordForm';\nimport { useBootstrapped, Title, Input, Link, ExternalLink } from './common';\n\nexport default function Bootstrap() {\n let dispatch = useDispatch();\n let history = useHistory();\n let [error, setError] = useState(null);\n\n let { checked } = useBootstrapped();\n\n function getErrorMessage(error) {\n switch (error) {\n case 'invalid-password':\n return 'Password cannot be empty';\n case 'password-match':\n return 'Passwords do not match';\n case 'network-failure':\n return 'Unable to contact the server';\n default:\n return \"Whoops, an error occurred on our side! We'll try to get it fixed soon.\";\n }\n }\n\n async function onSetPassword(password) {\n setError(null);\n let { error } = await send('subscribe-bootstrap', { password });\n\n if (error) {\n setError(error);\n } else {\n dispatch(loggedIn());\n }\n }\n\n async function onDemo() {\n await dispatch(createBudget({ demoMode: true }));\n }\n\n if (!checked) {\n return null;\n }\n\n return (\n <>\n <View style={{ width: 450, marginTop: -30 }}>\n <Title text=\"Bootstrap this Actual instance\" />\n <Text\n style={{\n fontSize: 16,\n color: colors.n2,\n lineHeight: 1.4\n }}\n >\n Set a password for this server instance\n </Text>\n\n {error && (\n <Text\n style={{\n marginTop: 20,\n color: colors.r4,\n borderRadius: 4,\n fontSize: 15\n }}\n >\n {getErrorMessage(error)}\n </Text>\n )}\n\n <ConfirmPasswordForm\n buttons={\n <Button\n bare\n style={{ fontSize: 15, color: colors.b4, marginRight: 15 }}\n onClick={onDemo}\n >\n Try Demo\n </Button>\n }\n onSetPassword={onSetPassword}\n onError={setError}\n />\n </View>\n </>\n );\n}\n","import React, { useState, useEffect } from 'react';\nimport { useHistory, useLocation } from 'react-router-dom';\nimport {\n View,\n Text,\n Button,\n ButtonWithLoading\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\n\nfunction getErrorMessage(reason) {\n switch (reason) {\n case 'network-failure':\n return 'Unable to access server. Make sure the configured URL for the server is accessible.';\n default:\n return 'Server returned an error while checking its status.';\n }\n}\n\nexport default function Error() {\n let history = useHistory();\n let location = useLocation();\n let { error } = location.state || {};\n\n function onTryAgain() {\n history.push('/');\n }\n\n return (\n <View style={{ alignItems: 'center' }}>\n <Text\n style={{\n fontSize: 16,\n color: colors.n2,\n lineHeight: 1.4\n }}\n >\n {getErrorMessage(error)}\n </Text>\n <Button onClick={onTryAgain} style={{ marginTop: 20 }}>\n Try again\n </Button>\n </View>\n );\n}\n","import React, { useState, useCallback } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Button,\n ButtonWithLoading\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { loggedIn } from 'loot-core/src/client/actions/user';\nimport { createBudget } from 'loot-core/src/client/actions/budgets';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport { ConfirmPasswordForm } from './ConfirmPasswordForm';\nimport { useBootstrapped, Title, Input, Link, ExternalLink } from './common';\n\nexport default function ChangePassword() {\n let dispatch = useDispatch();\n let history = useHistory();\n let [error, setError] = useState(null);\n let [msg, setMessage] = useState(null);\n\n function getErrorMessage(error) {\n switch (error) {\n case 'invalid-password':\n return 'Password cannot be empty';\n case 'password-match':\n return 'Passwords do not match';\n case 'network-failure':\n return 'Unable to contact the server';\n default:\n return 'Internal server error';\n }\n }\n\n async function onSetPassword(password) {\n setError(null);\n let { error } = await send('subscribe-change-password', { password });\n\n if (error) {\n setError(error);\n } else {\n setMessage('Password successfully changed');\n\n setTimeout(() => {\n history.push('/');\n }, 1500);\n }\n }\n\n return (\n <>\n <View style={{ width: 500, marginTop: -30 }}>\n <Title text=\"Change server password\" />\n <Text\n style={{\n fontSize: 16,\n color: colors.n2,\n lineHeight: 1.4\n }}\n >\n This will change the password for this server instance. All existing\n sessions will stay logged in.\n </Text>\n\n {error && (\n <Text\n style={{\n marginTop: 20,\n color: colors.r4,\n borderRadius: 4,\n fontSize: 15\n }}\n >\n {getErrorMessage(error)}\n </Text>\n )}\n\n {msg && (\n <Text\n style={{\n marginTop: 20,\n color: colors.g4,\n borderRadius: 4,\n fontSize: 15\n }}\n >\n {msg}\n </Text>\n )}\n\n <ConfirmPasswordForm\n buttons={\n <Button\n bare\n type=\"button\"\n style={{ fontSize: 15, marginRight: 10 }}\n onClick={() => history.push('/')}\n >\n Cancel\n </Button>\n }\n onSetPassword={onSetPassword}\n onError={setError}\n />\n </View>\n </>\n );\n}\n","import React, { useState, useEffect, useCallback } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Button,\n ButtonWithLoading\n} from 'loot-design/src/components/common';\nimport { colors, styles } from 'loot-design/src/style';\nimport { signOut } from 'loot-core/src/client/actions/user';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport {\n useBootstrapped,\n Title,\n Input,\n Link,\n ExternalLink\n} from './subscribe/common';\n\nexport default function ConfigServer() {\n let dispatch = useDispatch();\n let history = useHistory();\n let [url, setUrl] = useState('');\n let [loading, setLoading] = useState(false);\n let [error, setError] = useState(null);\n\n let [currentUrl, setCurrentUrl] = useState(null);\n\n useEffect(() => {\n async function run() {\n let url = await send('get-server-url');\n setUrl(url);\n setCurrentUrl(url);\n }\n run();\n }, []);\n\n function getErrorMessage(error) {\n switch (error) {\n case 'network-failure':\n return 'Server is not running at this URL';\n default:\n return 'Server does not look like an Actual server. Is it set up correctly?';\n }\n }\n\n async function onSubmit(e) {\n e.preventDefault();\n if (url === '' || loading) {\n return;\n }\n\n setError(null);\n setLoading(true);\n let { error } = await send('set-server-url', { url });\n setLoading(false);\n\n if (error) {\n setError(error);\n } else {\n await dispatch(signOut());\n history.push('/');\n }\n }\n\n return (\n <>\n <View style={{ width: 500, marginTop: -30 }}>\n <Title text=\"Where's the server?\" />\n\n <Text\n style={{\n fontSize: 16,\n color: colors.n2,\n lineHeight: 1.5\n }}\n >\n {currentUrl ? (\n <>\n Existing sessions will be logged out and you will log in to this\n server. We will validate that Actual is running at this URL.\n </>\n ) : (\n <>\n There is no server configured. After running the server, specify\n the URL here to use the app. You can always change this later. We\n will validate that Actual is running at this URL.\n </>\n )}\n </Text>\n\n {error && (\n <Text\n style={{\n marginTop: 20,\n color: colors.r4,\n borderRadius: 4,\n fontSize: 15\n }}\n >\n {getErrorMessage(error)}\n </Text>\n )}\n\n <form\n style={{ display: 'flex', flexDirection: 'row', marginTop: 30 }}\n onSubmit={onSubmit}\n >\n <Input\n autoFocus={true}\n placeholder={'https://example.com'}\n value={url}\n onChange={e => setUrl(e.target.value)}\n style={{ flex: 1, marginRight: 10 }}\n />\n <ButtonWithLoading primary loading={loading} style={{ fontSize: 15 }}>\n OK\n </ButtonWithLoading>\n <Button\n bare\n type=\"button\"\n loading={loading}\n style={{ fontSize: 15, marginLeft: 10 }}\n onClick={() => history.goBack()}\n >\n Cancel\n </Button>\n </form>\n </View>\n </>\n );\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport { createBrowserHistory } from 'history';\nimport { Switch, Redirect, Router, Route } from 'react-router-dom';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport * as actions from 'loot-core/src/client/actions';\nimport { View, ExternalLink, Button } from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\nimport ServerURL from './ServerURL';\nimport LoggedInUser from '../LoggedInUser';\nimport Notifications from '../Notifications';\n\nimport Modals from './Modals';\nimport Login from './subscribe/Login';\nimport Bootstrap from './subscribe/Bootstrap';\nimport Error from './subscribe/Error';\nimport ChangePassword from './subscribe/ChangePassword';\nimport ConfigServer from './ConfigServer';\n\nfunction Version() {\n return (\n <ExternalLink\n style={{\n position: 'absolute',\n bottom: 0,\n right: 0,\n color: colors.n7,\n margin: 15,\n marginRight: 17,\n ':hover': { color: colors.n2 },\n zIndex: 5001\n }}\n href={'https://actualbudget.com/blog/' + window.Actual.ACTUAL_VERSION}\n >\n {window.Actual.ACTUAL_VERSION}\n </ExternalLink>\n );\n}\n\nclass ManagementApp extends React.Component {\n constructor(props) {\n super(props);\n this.mounted = true;\n this.history = createBrowserHistory();\n window.__history = this.history;\n console.log('SETTING', window.__history);\n }\n\n async componentDidMount() {\n // An action may have been triggered from outside, and we don't\n // want to override its loading message so we only show the\n // initial loader if there isn't already a message\n let alreadyLoading = this.props.loadingText != null;\n\n // Remember: this component is remounted every time the user\n // closes a budget. That's why we keep `managerHasInitialized` in\n // redux so that it persists across renders. This will show the\n // loading spinner on first run, but never again since we'll have\n // a cached list of files and can show them\n if (!this.props.managerHasInitialized) {\n if (!alreadyLoading) {\n this.props.setAppState({ loadingText: '' });\n }\n } else {\n // If it's not the first time rendering, immediately show the\n // modal since we should have cached data\n this.showModal();\n }\n\n let userData = await this.props.getUserData();\n if (userData) {\n await this.props.loadAllFiles();\n }\n\n // TODO: There is a race condition here. The user could perform an\n // action that starts loading in between where `alreadyLoading`\n // was captured and this would clear it. We really only want to\n // ever clear the initial loading screen, so we need a \"loading\n // id\" of some kind.\n this.props.setAppState({\n managerHasInitialized: true,\n ...(!alreadyLoading ? { loadingText: null } : null)\n });\n }\n\n async showModal() {\n // This runs when `files` has changed, and we need to perform\n // actions based on whether or not files is empty or not\n if (this.props.managerHasInitialized) {\n let { currentModals, userData, files, replaceModal } = this.props;\n\n // We want to decide where to take the user if they have logged\n // in and we've tried to load their files\n if (files && userData) {\n if (files.length > 0) {\n // If the user is logged in and files exist, show the budget\n // list screen\n if (!currentModals.includes('select-budget')) {\n replaceModal('select-budget');\n }\n } else {\n // If the user is logged in and there's no existing files,\n // automatically create one. This will load the budget and\n // swap out the manager with the new budget, so there's\n // nothing else we need to do\n this.props.createBudget();\n }\n }\n }\n }\n\n componentDidUpdate(prevProps) {\n if (!this.mounted) {\n return;\n }\n\n if (\n this.props.managerHasInitialized !== prevProps.managerHasInitialized ||\n this.props.files !== prevProps.files ||\n this.props.userData !== prevProps.userData\n ) {\n this.showModal();\n }\n }\n\n componentWillUnmount() {\n this.mounted = false;\n }\n\n render() {\n let { userData, managerHasInitialized, loadingText } = this.props;\n\n if (!managerHasInitialized) {\n return null;\n }\n\n let isHidden = loadingText != null;\n\n console.log('his', this.history.location);\n\n return (\n <Router history={this.history}>\n <View style={{ height: '100%', minHeight: 500 }}>\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n height: 40,\n WebkitAppRegion: 'drag'\n }}\n />\n <View\n style={{\n position: 'absolute',\n bottom: 40,\n right: 15\n }}\n >\n <Notifications\n style={{\n position: 'relative',\n left: 'initial',\n right: 'initial'\n }}\n />\n </View>\n\n {!isHidden && (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center'\n }}\n >\n {userData ? (\n <>\n <Switch>\n <Route\n exact\n path=\"/config-server\"\n component={ConfigServer}\n />\n <Route\n exact\n path=\"/change-password\"\n component={ChangePassword}\n />\n <Route exact path=\"/\" component={Modals} />\n {/* Redirect all other pages to this route */}\n <Route path=\"/\" render={() => <Redirect to=\"/\" />} />\n </Switch>\n\n <View\n style={{\n position: 'absolute',\n top: 0,\n right: 0,\n padding: '6px 10px',\n zIndex: 4000\n }}\n >\n <LoggedInUser />\n </View>\n </>\n ) : (\n <Switch>\n <Route exact path=\"/login\" component={Login} />\n <Route exact path=\"/error\" component={Error} />\n <Route exact path=\"/config-server\" component={ConfigServer} />\n <Route exact path=\"/bootstrap\" component={Bootstrap} />\n {/* Redirect all other pages to this route */}\n <Route path=\"/\" render={() => <Redirect to=\"/bootstrap\" />} />\n </Switch>\n )}\n </View>\n )}\n\n <ServerURL />\n <Version />\n </View>\n </Router>\n );\n }\n}\n\nexport default connect(\n state => {\n let { modalStack } = state.modals;\n\n return {\n files: state.budgets.allFiles,\n userData: state.user.data,\n managerHasInitialized: state.app.managerHasInitialized,\n loadingText: state.app.loadingText,\n currentModals: modalStack.map(modal => modal.name)\n };\n },\n actions\n)(ManagementApp);\n","import React from 'react';\n\nconst SvgClose = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgClose;\n","import React from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport * as actions from 'loot-core/src/client/actions';\nimport {\n View,\n Text,\n Block,\n Link,\n Button\n} from 'loot-design/src/components/common';\nimport { colors } from 'loot-design/src/style';\nimport Close from 'loot-design/src/svg/v1/Close';\n\nfunction closeNotification(setAppState) {\n // Set a flag to never show an update notification again for this session\n setAppState({\n updateInfo: null,\n showUpdateNotification: false\n });\n}\n\nfunction UpdateNotification({\n updateInfo,\n showUpdateNotification,\n updateApp,\n setAppState\n}) {\n if (updateInfo && showUpdateNotification) {\n let notes = updateInfo.releaseNotes;\n\n return (\n <View\n style={{\n position: 'absolute',\n bottom: 0,\n right: 0,\n margin: '15px 17px',\n backgroundColor: colors.p6,\n color: 'white',\n padding: '7px 10px',\n borderRadius: 4,\n zIndex: 10000,\n maxWidth: 450\n }}\n >\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n <View style={{ marginRight: 10, fontWeight: 700 }}>\n <Text>App updated to {updateInfo.version}</Text>\n </View>\n <View style={{ flex: 1 }} />\n <View style={{ marginTop: -1 }}>\n <Text>\n <Link\n onClick={updateApp}\n style={{ color: 'white', textDecoration: 'underline' }}\n >\n Restart\n </Link>{' '}\n (\n <Link\n style={{ color: 'white', textDecoration: 'underline' }}\n onClick={() =>\n window.Actual.openURLInBrowser(\n 'https://actualbudget.com/blog/' + updateInfo.version\n )\n }\n >\n notes\n </Link>\n )\n <Button\n bare\n style={{ display: 'inline', padding: '1px 7px 2px 7px' }}\n onClick={() => closeNotification(setAppState)}\n >\n <Close width={9} style={{ color: 'white' }} />\n </Button>\n </Text>\n </View>\n </View>\n {notes && (\n <View style={{ marginTop: 10, fontWeight: 500 }}>{notes}</View>\n )}\n </View>\n );\n }\n\n return null;\n}\n\nexport default connect(\n state => ({\n updateInfo: state.app.updateInfo,\n showUpdateNotification: state.app.showUpdateNotification\n }),\n dispatch => bindActionCreators(actions, dispatch)\n)(UpdateNotification);\n","import * as Sentry from '@sentry/browser';\nimport { SentryMetricIntegration } from '@jlongster/sentry-metrics-actual';\nimport { initBackend as initSQLBackend } from 'absurd-sql/dist/indexeddb-main-thread';\n// eslint-disable-next-line import/no-webpack-loader-syntax\nimport BackendWorker from 'worker-loader!./browser-server';\n\n// This file installs global variables that the app expects.\n// Normally these are already provided by electron, but in a real\n// browser environment this is where we initialize the backend and\n// everything else.\n\nlet IS_DEV = process.env.NODE_ENV === 'development';\nlet IS_PERF_BUILD = process.env.PERF_BUILD != null;\nlet ACTUAL_VERSION = process.env.REACT_APP_ACTUAL_VERSION;\n\nif (!IS_DEV) {\n Sentry.init({\n dsn: 'https://9e6094adfc9f43b5b5b9994cee44d7c2@sentry.io/5169928',\n release: ACTUAL_VERSION,\n ignoreErrors: ['ResizeObserver loop'],\n integrations: [\n new SentryMetricIntegration({\n url: 'https://sync.actualbudget.com/metrics',\n metric: 'app-errors',\n dimensions: { platform: 'web' }\n })\n ]\n });\n\n window.SentryClient = Sentry;\n}\n\n// *** Start the backend ***\nlet worker;\n\nfunction createBackendWorker() {\n worker = new BackendWorker();\n initSQLBackend(worker);\n\n worker.postMessage({\n type: 'init',\n version: ACTUAL_VERSION,\n isDev: IS_DEV,\n hash: process.env.REACT_APP_BACKEND_WORKER_HASH\n });\n\n if (IS_DEV || IS_PERF_BUILD) {\n worker.addEventListener('message', e => {\n if (e.data.type === '__actual:backend-running') {\n let activity = document.querySelector('.debugger .activity');\n if (activity) {\n let original = window.getComputedStyle(activity)['background-color'];\n activity.style.transition = 'none';\n activity.style.backgroundColor = '#3EBD93';\n setTimeout(() => {\n activity.style.transition = 'background-color 1s';\n activity.style.backgroundColor = original;\n }, 100);\n }\n }\n });\n\n import('perf-deets/frontend').then(({ listenForPerfData }) => {\n listenForPerfData(worker);\n });\n }\n}\n\ncreateBackendWorker();\n\nglobal.SentryClient = Sentry;\n\nif (IS_DEV || IS_PERF_BUILD) {\n import('perf-deets/frontend').then(({ listenForPerfData }) => {\n listenForPerfData(window);\n\n global.__startProfile = () => {\n window.postMessage({ type: '__perf-deets:start-profile' });\n worker.postMessage({ type: '__perf-deets:start-profile' });\n };\n global.__stopProfile = () => {\n window.postMessage({ type: '__perf-deets:stop-profile' });\n worker.postMessage({ type: '__perf-deets:stop-profile' });\n };\n });\n}\n\nglobal.Actual = {\n IS_DEV,\n ACTUAL_VERSION,\n IS_FAKE_WEB: true,\n IS_BETA: process.env.REACT_APP_RELEASE_TYPE === 'beta',\n\n logToTerminal: (...args) => {\n console.log(...args);\n },\n\n relaunch: () => {\n window.location.reload();\n },\n\n openFileDialog: async ({ filters = [], properties }) => {\n return new Promise(resolve => {\n let input = document.createElement('input');\n input.type = 'file';\n\n let filter = filters.find(filter => filter.extensions);\n if (filter) {\n input.accept = filter.extensions.map(ext => '.' + ext).join(',');\n }\n\n input.style.position = 'absolute';\n input.style.top = '0px';\n input.style.left = '0px';\n input.dispatchEvent(\n new MouseEvent('click', {\n view: window,\n bubbles: true,\n cancelable: true\n })\n );\n\n input.addEventListener('change', e => {\n let file = e.target.files[0];\n let filename = file.name.replace(/.*(\\.[^.]*)/, 'file$1');\n\n if (file) {\n var reader = new FileReader();\n reader.readAsArrayBuffer(file);\n reader.onload = async function(ev) {\n let filepath = `/uploads/${filename}`;\n\n window.__actionsForMenu\n .uploadFile(filename, ev.target.result)\n .then(() => resolve([filepath]));\n };\n reader.onerror = function(ev) {\n alert('Error reading file');\n };\n }\n });\n });\n },\n\n saveFile: (contents, defaultFilename, dialogTitle) => {\n const temp = document.createElement('a');\n temp.style = 'display: none';\n temp.download = defaultFilename;\n temp.rel = 'noopener';\n\n const blob = new Blob([contents]);\n temp.href = URL.createObjectURL(blob);\n temp.dispatchEvent(new MouseEvent('click'));\n },\n\n openURLInBrowser: url => {\n window.open(url, '_blank');\n },\n onEventFromMain: (type, handler) => {},\n applyAppUpdate: () => {},\n updateAppMenu: isBudgetOpen => {},\n\n ipcConnect: () => {},\n getServerSocket: async () => {\n return worker;\n }\n};\n\nif (IS_DEV) {\n global.Actual.reloadBackend = () => {\n worker.postMessage({ type: '__actual:shutdown' });\n createBackendWorker();\n };\n}\n\ndocument.addEventListener('keydown', e => {\n if (e.metaKey || e.ctrlKey) {\n // Cmd/Ctrl+o\n if (e.keyCode === 79) {\n e.preventDefault();\n window.__actionsForMenu.closeBudget();\n }\n // Cmd/Ctrl+z\n else if (e.keyCode === 90) {\n if (e.shiftKey) {\n // Redo\n window.__actionsForMenu.redo();\n } else {\n // Undo\n window.__actionsForMenu.undo();\n }\n }\n }\n});\n","/* global SentryClient */\n\nexport function captureException(exc) {\n console.log('[Exception]', exc);\n SentryClient.captureException(exc);\n}\n\nexport function captureBreadcrumb(breadcrumb) {\n SentryClient.addBreadcrumb(breadcrumb);\n}\n","import React from 'react';\nimport { css } from 'glamor';\n\nfunction View(props) {\n // The default styles are special-cased and pulled out into static\n // styles, and hardcode the class name here. View is used almost\n // everywhere and we can avoid any perf penalty that glamor would\n // incur.\n\n const { style, nativeStyle, innerRef, ...restProps } = props;\n return (\n <div\n {...restProps}\n ref={innerRef}\n style={nativeStyle}\n className={`view ${props.className || ''} ${css(props.style)}`}\n />\n );\n}\n\nexport default View;\n","import constants from '../constants';\n\nexport function pushModal(name, options) {\n return { type: constants.PUSH_MODAL, name, options };\n}\n\nexport function replaceModal(name, options) {\n return { type: constants.REPLACE_MODAL, name, options };\n}\n\nexport function hideModals() {\n return { type: constants.HIDE_MODALS };\n}\n\nexport function showModals() {\n return { type: constants.SHOW_MODALS };\n}\n\nexport function popModal() {\n return { type: constants.POP_MODAL };\n}\n\nexport function closeModal() {\n return { type: constants.CLOSE_MODAL };\n}\n","const isWindows =\n navigator.platform && navigator.platform.toLowerCase() === 'win32';\n\nconst isMac =\n navigator.platform && navigator.platform.toUpperCase().indexOf('MAC') >= 0;\n\nconst isProbablySafari = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent\n);\n\nexport default {\n OS: isWindows ? 'windows' : isMac ? 'mac' : 'linux',\n env: 'web',\n isBrowser: !!window.Actual.IS_FAKE_WEB,\n isReactNativeWeb: false,\n isProbablySafari\n};\n","import constants from '../constants';\n\nexport const initialState = {\n loadingText: null,\n updateInfo: null,\n showUpdateNotification: true,\n managerHasInitialized: false,\n lastUndoState: { current: null },\n lastSplitState: { current: null }\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.SET_APP_STATE:\n return {\n ...state,\n ...action.state\n };\n case constants.SET_LAST_UNDO_STATE:\n // Intentionally mutate it. Components should never rerender\n // looking at this, so we put it in a \"box\" like a ref. They\n // only ever need to look at this on mount.\n state.lastUndoState.current = action.undoState;\n return state;\n\n case constants.SET_LAST_SPLIT_STATE:\n state.lastSplitState.current = action.splitState;\n return state;\n\n default:\n }\n return state;\n}\n","import constants from '../constants';\n\nconst initialState = {\n banks: [],\n failedAccounts: new Map(),\n accountsSyncing: null\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.LOAD_BANKS:\n return {\n ...state,\n banks: action.banks\n };\n case constants.SET_ACCOUNTS_SYNCING:\n return {\n ...state,\n accountsSyncing: action.name\n };\n case constants.ACCOUNT_SYNC_STATUS: {\n let failedAccounts = new Map(state.failedAccounts);\n if (action.failed) {\n failedAccounts.set(action.id, {\n type: action.errorType,\n code: action.errorCode\n });\n } else {\n failedAccounts.delete(action.id);\n }\n\n return { ...state, failedAccounts };\n }\n case constants.ACCOUNT_SYNC_FAILURES: {\n let failures = new Map();\n action.syncErrors.forEach(error => {\n failures.set(error.id, {\n type: error.type,\n code: error.code\n });\n });\n\n return { ...state, failedAccounts: failures };\n }\n default:\n }\n return state;\n}\n","import constants from '../constants';\n\nconst initialState = {\n selectedCell: null\n};\n\nfunction update(state = initialState, action) {\n switch (action.type) {\n case constants.DEBUG_CELL:\n return {\n ...state,\n selectedCell: action.sheet\n ? { sheet: action.sheet, name: action.name }\n : null\n };\n default:\n }\n return state;\n}\n\nexport default update;\n","import constants from '../constants';\n\nconst initialState = {};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.SET_PROFILE:\n return {\n ...state,\n ...action.profile\n };\n default:\n }\n return state;\n}\n","import constants from '../constants';\nimport { setNumberFormat } from '../../shared/util.js';\n\nconst initialState = {\n local: null,\n global: null\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.SET_PREFS:\n if (action.prefs) {\n setNumberFormat(action.prefs.numberFormat || 'comma-dot');\n }\n return { local: action.prefs, global: action.globalPrefs };\n case constants.MERGE_LOCAL_PREFS:\n if (action.prefs.numberFormat) {\n setNumberFormat(action.prefs.numberFormat);\n }\n\n return {\n ...state,\n local: { ...state.local, ...action.prefs }\n };\n case constants.MERGE_GLOBAL_PREFS:\n return {\n ...state,\n global: { ...state.global, ...action.globalPrefs }\n };\n\n default:\n }\n return state;\n}\n","import constants from '../constants';\n\nconst initialState = {\n modalStack: [],\n isHidden: false\n};\n\nfunction update(state = initialState, action) {\n switch (action.type) {\n case constants.PUSH_MODAL:\n return {\n ...state,\n modalStack: [\n ...state.modalStack,\n { name: action.name, options: action.options }\n ]\n };\n case constants.REPLACE_MODAL:\n return {\n ...state,\n modalStack: [{ name: action.name, options: action.options }]\n };\n case constants.POP_MODAL:\n return { ...state, modalStack: state.modalStack.slice(0, -1) };\n case constants.CLOSE_MODAL:\n return { ...state, modalStack: [] };\n case constants.HIDE_MODALS:\n return { ...state, isHidden: true };\n case constants.SHOW_MODALS:\n return { ...state, isHidden: false };\n case constants.SET_APP_STATE:\n if ('loadingText' in action.state) {\n return {\n ...state,\n isHidden: action.state.loadingText != null\n };\n }\n break;\n case constants.SIGN_OUT:\n return initialState;\n default:\n }\n\n return state;\n}\n\nexport default update;\n","import constants from '../constants';\n\nconst initialState = {\n notifications: []\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.ADD_NOTIFICATION:\n if (state.notifications.find(n => n.id === action.notification.id)) {\n return state;\n }\n\n return {\n ...state,\n notifications: [...state.notifications, action.notification]\n };\n case constants.REMOVE_NOTIFICATION:\n return {\n ...state,\n notifications: state.notifications.filter(n => n.id !== action.id)\n };\n default:\n }\n\n return state;\n}\n","import constants from '../constants';\n\nfunction sortFiles(arr) {\n arr.sort((x, y) => {\n let name1 = x.name.toLowerCase();\n let name2 = y.name.toLowerCase();\n let i = name1 < name2 ? -1 : name1 > name2 ? 1 : 0;\n if (i === 0) {\n i = x.id < y.id ? -1 : x.id > y.id ? 1 : 0;\n }\n return i;\n });\n return arr;\n}\n\n// States of a file:\n// 1. local - Only local (not uploaded/synced)\n// 2. remote - Unavailable locally, available to download\n// 3. synced - Downloaded & synced\n// 4. detached - Downloaded but broken group id (reset sync state)\n// 5. broken - user shouldn't have access to this file\n// 6. unknown - user is offline so can't determine the status\nexport function reconcileFiles(localFiles, remoteFiles) {\n let reconciled = new Set();\n\n let files = localFiles.map(localFile => {\n if (localFile.cloudFileId) {\n // This is the case where for some reason getting the files from\n // the server failed. We don't want to scare the user, just show\n // an unknown state and tell them it'll be OK once they come\n // back online\n\n if (remoteFiles == null) {\n return { ...localFile, state: 'unknown' };\n }\n\n let remote = remoteFiles.find(f => localFile.cloudFileId === f.fileId);\n if (remote) {\n // Mark reconciled\n reconciled.add(remote.fileId);\n\n if (remote.groupId === localFile.groupId) {\n return {\n ...localFile,\n name: remote.name,\n deleted: remote.deleted,\n encryptKeyId: remote.encryptKeyId,\n hasKey: remote.hasKey,\n state: 'synced'\n };\n } else {\n return {\n ...localFile,\n name: remote.name,\n deleted: remote.deleted,\n encryptKeyId: remote.encryptKeyId,\n hasKey: remote.hasKey,\n state: 'detached'\n };\n }\n } else {\n return { ...localFile, state: 'broken' };\n }\n } else {\n return { ...localFile, state: 'local' };\n }\n });\n\n let sorted = sortFiles(\n files\n .concat(\n (remoteFiles || [])\n .filter(f => !reconciled.has(f.fileId))\n .map(f => {\n return {\n cloudFileId: f.fileId,\n groupId: f.groupId,\n name: f.name,\n deleted: f.deleted,\n encryptKeyId: f.encryptKeyId,\n hasKey: f.hasKey,\n state: 'remote'\n };\n })\n )\n .filter(f => !f.deleted)\n );\n\n // One last pass to list all the broken (unauthorized) files at the\n // bottom\n return sorted\n .filter(f => f.state !== 'broken')\n .concat(sorted.filter(f => f.state === 'broken'));\n}\n\nconst initialState = {\n budgets: [],\n availableImports: [],\n remoteFiles: null,\n allFiles: null\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.SET_BUDGETS:\n return {\n ...state,\n budgets: action.budgets,\n allFiles: reconcileFiles(action.budgets, state.remoteFiles)\n };\n case constants.SET_REMOTE_FILES:\n return {\n ...state,\n remoteFiles: action.files,\n allFiles: reconcileFiles(state.budgets, action.files)\n };\n case constants.SET_ALL_FILES:\n return {\n ...state,\n budgets: action.budgetes,\n remoteFiles: action.remoteFiles,\n allFiles: reconcileFiles(action.budgets, action.remoteFiles)\n };\n case constants.SET_AVAILABLE_IMPORTS:\n return {\n ...state,\n availableImports: action.imports\n };\n case constants.SIGN_OUT:\n // If the user logs out, make sure to reset all the files\n return { ...state, allFiles: null };\n default:\n }\n return state;\n}\n","import constants from '../constants';\n\nconst initialState = {\n stage: null,\n fromYNAB: false\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.SET_TUTORIAL_STAGE:\n return {\n ...state,\n deactivated: false,\n stage: action.stage,\n fromYNAB: 'fromYNAB' in action ? action.fromYNAB : state.fromYNAB\n };\n case constants.DEACTIVATE_TUTORIAL:\n return { ...state, stage: null };\n default:\n }\n\n return state;\n}\n","import constants from '../constants';\n\nconst initialState = {\n data: null\n};\n\nexport default function update(state = initialState, action) {\n switch (action.type) {\n case constants.GET_USER_DATA:\n return { ...state, data: action.data };\n default:\n }\n\n return state;\n}\n","import app from './app';\nimport queries from './queries';\nimport account from './account';\nimport debug from './debug';\nimport profile from './profile';\nimport prefs from './prefs';\nimport modals from './modals';\nimport notifications from './notifications';\nimport budgets from './budgets';\nimport tutorial from './tutorial';\nimport user from './user';\n\nexport default {\n app,\n queries,\n account,\n debug,\n profile,\n prefs,\n modals,\n notifications,\n budgets,\n tutorial,\n user\n};\n","// This file will initialize the app if we are in a real browser\n// environment (not electron)\nimport './browser-preload';\n\n// A hack for now: this makes sure it's appended before glamor\nimport '@reach/listbox/styles.css';\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './components/App';\nimport {\n createStore,\n combineReducers,\n applyMiddleware,\n bindActionCreators\n} from 'redux';\nimport { Provider } from 'react-redux';\nimport constants from 'loot-core/src/client/constants';\nimport reducers from 'loot-core/src/client/reducers';\nimport { send } from 'loot-core/src/platform/client/fetch';\nimport q, { runQuery } from 'loot-core/src/client/query-helpers';\nimport * as actions from 'loot-core/src/client/actions';\nimport thunk from 'redux-thunk';\nimport { handleGlobalEvents } from './global-events';\nimport { initialState as initialAppState } from 'loot-core/src/client/reducers/app';\n\n// See https://github.com/WICG/focus-visible. Only makes the blue\n// focus outline appear from keyboard events.\nrequire('focus-visible');\n\nfunction lightweightStringify(obj) {\n return JSON.stringify(obj, function(k, v) {\n return k ? '' + v : v;\n });\n}\n\nfunction log() {\n return next => action => {\n if (window.Actual.IS_DEV) {\n console.log(action);\n }\n\n if (window.SentryClient) {\n window.SentryClient.addBreadcrumb({\n message: lightweightStringify(action).slice(0, 500),\n category: 'redux',\n level: 'info'\n });\n }\n\n return next(action);\n };\n}\n\nconst appReducer = combineReducers(reducers);\nfunction rootReducer(state, action) {\n if (action.type === constants.CLOSE_BUDGET) {\n // Reset the state and only keep around things intentionally. This\n // blows away everything else\n state = {\n budgets: state.budgets,\n user: state.user,\n prefs: { local: null, global: state.prefs.global },\n app: {\n ...initialAppState,\n updateInfo: state.updateInfo,\n showUpdateNotification: state.showUpdateNotification,\n managerHasInitialized: state.app.managerHasInitialized,\n loadingText: state.app.loadingText\n }\n };\n }\n\n return appReducer(state, action);\n}\n\nconst store = createStore(\n rootReducer,\n undefined,\n applyMiddleware(thunk /*log*/)\n);\nconst boundActions = bindActionCreators(actions, store.dispatch);\n\n// Listen for global events from the server or main process\nhandleGlobalEvents(boundActions, store);\n\n// Expose this to the main process to menu items can access it\nwindow.__actionsForMenu = boundActions;\n\n// Expose send for fun!\nwindow.$send = send;\nwindow.$query = runQuery;\nwindow.$q = q;\n\nReactDOM.render(\n <Provider store={store}>\n <App />\n </Provider>,\n document.getElementById('root')\n);\n","import constants from '../constants';\nimport { closeModal, pushModal } from './modals';\nimport { loadPrefs, loadGlobalPrefs } from './prefs';\nimport { send } from '../../platform/client/fetch';\nimport { setAppState } from './app';\nimport { startTutorialFirstTime } from './tutorial';\nimport { getDownloadError } from '../../shared/errors';\nconst uuid = require('../../platform/uuid');\n\nexport function updateStatusText(text) {\n return (dispatch, getState) => {\n const { loadingText } = getState().app;\n // The presence of any loading text puts the app in a \"loading\"\n // state. We only ever want to update the text, we never want to\n // set the app into a loading state. It's expected for workflows\n // to set a blank loading text to show the loading screen.\n if (loadingText != null) {\n dispatch(setAppState({ loadingText: text }));\n }\n };\n}\n\nexport function loadBudgets() {\n return async dispatch => {\n const budgets = await send('get-budgets');\n\n dispatch({\n type: constants.SET_BUDGETS,\n budgets\n });\n };\n}\n\nexport function loadRemoteFiles() {\n return async dispatch => {\n const files = await send('get-remote-files');\n\n dispatch({\n type: constants.SET_REMOTE_FILES,\n files\n });\n };\n}\n\nexport function loadAllFiles() {\n return async (dispatch, getState) => {\n const budgets = await send('get-budgets');\n const files = await send('get-remote-files');\n\n dispatch({\n type: constants.SET_ALL_FILES,\n budgets,\n remoteFiles: files\n });\n\n return getState().budgets.allFiles;\n };\n}\n\nexport function loadBudget(id, loadingText = '', options = {}) {\n return async (dispatch, getState) => {\n dispatch(setAppState({ loadingText }));\n\n // Loading a budget may fail\n let { error } = await send('load-budget', { id, ...options });\n\n if (error) {\n if (error === 'out-of-sync-migrations' || error === 'out-of-sync-data') {\n // confirm is not available on iOS\n // eslint-disable-next-line\n if (typeof confirm !== 'undefined') {\n // eslint-disable-next-line\n let showBackups = confirm(\n 'This budget cannot be loaded with this version of the app. ' +\n 'Make sure the app is up-to-date. Do you want to load a backup?'\n );\n\n if (showBackups) {\n dispatch(pushModal('load-backup', { budgetId: id }));\n }\n } else {\n alert(\n 'This budget cannot be loaded with this version of the app. ' +\n 'Make sure the app is up-to-date.'\n );\n }\n } else if (error === 'budget-not-found') {\n alert(\n 'Budget file could not be found. If you changed something manually, please restart the app.'\n );\n } else {\n alert(\n 'Error loading budget. Please contact help@actualbudget.com for support.'\n );\n }\n\n dispatch(setAppState({ loadingText: null }));\n return;\n }\n\n dispatch(closeModal());\n\n await dispatch(loadPrefs());\n\n const prefs = getState().prefs.local;\n dispatch(setAppState({ loadingText: null }));\n dispatch(setAppState({ maxMonths: prefs.maxMonths }));\n dispatch(startTutorialFirstTime());\n };\n}\n\nexport function closeBudget() {\n return async (dispatch, getState) => {\n const prefs = getState().prefs.local;\n if (prefs && prefs.id) {\n // This clears out all the app state so the user starts fresh\n dispatch({ type: constants.CLOSE_BUDGET });\n\n dispatch(setAppState({ loadingText: 'Closing...' }));\n await send('close-budget');\n dispatch(setAppState({ loadingText: null }));\n }\n };\n}\n\nexport function closeBudgetUI() {\n return async (dispatch, getState) => {\n let prefs = getState().prefs.local;\n if (prefs && prefs.id) {\n dispatch({ type: constants.CLOSE_BUDGET });\n }\n };\n}\n\nexport function deleteBudget(id, cloudFileId) {\n return async dispatch => {\n await send('delete-budget', { id, cloudFileId });\n await dispatch(loadAllFiles());\n };\n}\n\nexport function createBudget({ testMode, demoMode } = {}) {\n return async (dispatch, getState) => {\n dispatch(\n setAppState({ loadingText: testMode || demoMode ? 'Making demo...' : '' })\n );\n\n if (demoMode) {\n await send('create-demo-budget');\n } else {\n await send('create-budget', { testMode });\n }\n\n dispatch(closeModal());\n\n await dispatch(loadAllFiles());\n await dispatch(loadPrefs());\n dispatch(startTutorialFirstTime());\n\n // Set the loadingText to null after we've loaded the budget prefs\n // so that the existing manager page doesn't flash\n dispatch(setAppState({ loadingText: null }));\n };\n}\n\nexport function importBudget(filepath, type) {\n return async (dispatch, getState) => {\n const { error } = await send('import-budget', { filepath, type });\n if (error) {\n throw new Error(error);\n }\n\n dispatch(closeModal());\n\n await dispatch(loadPrefs());\n dispatch(startTutorialFirstTime());\n };\n}\n\nexport function uploadBudget(id) {\n return async dispatch => {\n let { error } = await send('upload-budget', { id });\n if (error) {\n return { error };\n }\n\n await dispatch(loadAllFiles());\n return {};\n };\n}\n\nexport function closeAndDownloadBudget(cloudFileId) {\n return async dispatch => {\n // It's very important that we set this loading message before\n // closing the budget. Otherwise, the manager will ignore our\n // loading message and clear it when it loads, showing the file\n // list which we don't want\n dispatch(setAppState({ loadingText: 'Downloading...' }));\n await dispatch(closeBudget());\n dispatch(downloadBudget(cloudFileId, { replace: true }));\n };\n}\n\nexport function downloadBudget(cloudFileId, { replace } = {}) {\n return async dispatch => {\n dispatch(setAppState({ loadingText: 'Downloading...' }));\n\n let { id, error } = await send('download-budget', {\n fileId: cloudFileId,\n replace\n });\n\n if (error) {\n if (error.reason === 'decrypt-failure') {\n let opts = {\n hasExistingKey: error.meta && error.meta.isMissingKey,\n cloudFileId,\n onSuccess: () => {\n dispatch(downloadBudget(cloudFileId, { replace }));\n }\n };\n\n dispatch(pushModal('fix-encryption-key', opts));\n dispatch(setAppState({ loadingText: null }));\n } else if (error.reason === 'file-exists') {\n alert(\n `A file with id \"${error.meta.id}\" already exists with the name \"${error.meta.name}\". ` +\n 'This file will be replaced. This probably happened because files were manually ' +\n 'moved around outside of Actual.'\n );\n\n return dispatch(downloadBudget(cloudFileId, { replace: true }));\n } else {\n dispatch(setAppState({ loadingText: null }));\n alert(getDownloadError(error));\n }\n return null;\n } else {\n await Promise.all([\n dispatch(loadGlobalPrefs()),\n dispatch(loadAllFiles()),\n dispatch(loadBudget(id))\n ]);\n dispatch(setAppState({ loadingText: null }));\n }\n\n return id;\n };\n}\n\nexport function getYNAB4Imports() {\n return async dispatch => {\n let imports = await send('get-ynab4-files');\n dispatch({\n type: 'SET_AVAILABLE_IMPORTS',\n imports\n });\n return imports;\n };\n}\n","import React, {\n useState,\n useCallback,\n useRef,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useContext,\n useMemo\n} from 'react';\nimport { useStore } from 'react-redux';\nimport { scope } from '@jlongster/lively';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { FixedSizeList } from './FixedSizeList';\nimport { styles, colors } from '../style';\nimport DeleteIcon from '../svg/Delete';\nimport Checkmark from '../svg/v1/Checkmark';\nimport ExpandArrow from '../svg/ExpandArrow';\nimport AnimatedLoading from '../svg/v1/AnimatedLoading';\nimport {\n View,\n Text,\n Button,\n Input,\n Tooltip,\n IntersectionBoundary,\n Menu\n} from './common';\nimport { KeyHandlers } from './KeyHandlers';\nimport SheetValue from './spreadsheet/SheetValue';\nimport DateSelect from './DateSelect';\nimport format from './spreadsheet/format';\nimport { keys } from '../util/keys';\nimport {\n AvoidRefocusScrollProvider,\n useProperFocus,\n focusElement\n} from './useProperFocus';\nimport { useSelectedItems } from './useSelected';\n\nexport const ROW_HEIGHT = 32;\nexport const TABLE_BACKGROUND_COLOR = colors.n11;\n\nfunction fireBlur(onBlur, e) {\n if (document.hasFocus()) {\n // We only fire the blur event if the app is still focused\n // because the blur event is fired when the app goes into\n // the background and we want to ignore that\n onBlur && onBlur(e);\n } else {\n // Otherwise, stop React from bubbling this event and swallow it\n e.stopPropagation();\n }\n}\n\nconst CellContext = React.createContext({\n backgroundColor: 'white',\n borderColor: colors.n9\n});\n\nfunction CellProvider({ backgroundColor, borderColor, children }) {\n let value = useMemo(\n () => ({\n backgroundColor,\n borderColor\n }),\n [backgroundColor, borderColor]\n );\n\n return <CellContext.Provider value={value}>{children}</CellContext.Provider>;\n}\n\nexport const Field = React.forwardRef(function Field(\n {\n width,\n name,\n borderColor: oldBorderColor,\n truncate = true,\n children,\n style,\n contentStyle,\n ...props\n },\n ref\n) {\n let { backgroundColor, borderColor } = useContext(CellContext);\n\n // TODO: Get rid of this. Go through and remove all the places where\n // the border color is manually passed in.\n if (oldBorderColor) {\n borderColor = oldBorderColor;\n }\n\n return (\n <View\n innerRef={ref}\n {...props}\n style={[\n width === 'flex' ? { flex: 1, flexBasis: 0 } : { width },\n {\n position: 'relative',\n borderTopWidth: borderColor ? 1 : 0,\n borderBottomWidth: borderColor ? 1 : 0,\n borderColor,\n backgroundColor\n },\n styles.smallText,\n style\n ]}\n data-testid={name}\n >\n {/* This is wrapped so that the padding is not taken into\n account with the flex width (which aligns it with the Cell\n component) */}\n <View\n style={[\n {\n flex: 1,\n padding: '0 5px',\n justifyContent: 'center'\n },\n contentStyle\n ]}\n >\n {truncate ? (\n <Text\n style={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }}\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </View>\n </View>\n );\n});\n\nexport function Cell({\n width,\n name,\n exposed,\n focused,\n value,\n formatter,\n textAlign,\n onExpose,\n borderColor: oldBorderColor,\n children,\n plain,\n style,\n valueStyle,\n ...viewProps\n}) {\n let mouseCoords = useRef(null);\n let viewRef = useRef(null);\n\n let { backgroundColor, borderColor } = useContext(CellContext);\n\n useProperFocus(viewRef, focused !== undefined ? focused : exposed);\n\n // TODO: Get rid of this. Go through and remove all the places where\n // the border color is manually passed in.\n if (oldBorderColor) {\n borderColor = oldBorderColor;\n }\n\n const widthStyle = width === 'flex' ? { flex: 1, flexBasis: 0 } : { width };\n const cellStyle = {\n position: 'relative',\n textAlign: textAlign || 'left',\n justifyContent: 'center',\n borderTopWidth: borderColor ? 1 : 0,\n borderBottomWidth: borderColor ? 1 : 0,\n borderColor,\n backgroundColor\n };\n\n return (\n <View\n innerRef={viewRef}\n style={[widthStyle, cellStyle, style]}\n className=\"animated-cell\"\n {...viewProps}\n data-testid={name}\n >\n {plain ? (\n children\n ) : exposed ? (\n children()\n ) : (\n <View\n style={[\n {\n flex: 1,\n padding: '0 5px',\n justifyContent: 'center'\n },\n styles.smallText,\n valueStyle\n ]}\n // Can't use click because we only want to expose the cell if\n // the user does a direct click, not if they also drag the\n // mouse to select something\n onMouseDown={e => (mouseCoords.current = [e.clientX, e.clientY])}\n onMouseUp={e => {\n if (\n mouseCoords.current &&\n Math.abs(e.clientX - mouseCoords.current[0]) < 5 &&\n Math.abs(e.clientY - mouseCoords.current[1]) < 5\n ) {\n onExpose && onExpose(name);\n }\n }}\n // When testing, allow the click handler to be used instead\n onClick={global.IS_TESTING && (() => onExpose && onExpose(name))}\n >\n <Text\n style={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }}\n >\n {formatter ? formatter(value) : value}\n </Text>\n </View>\n )}\n </View>\n );\n}\n\nexport function Row({\n backgroundColor = 'white',\n borderColor = colors.border,\n inset = 0,\n collapsed,\n focused,\n highlighted,\n children,\n height,\n style,\n ...nativeProps\n}) {\n let [shouldHighlight, setShouldHighlight] = useState(false);\n let prevHighlighted = useRef(false);\n let rowRef = useRef(null);\n let timer = useRef(null);\n\n useEffect(\n () => {\n if (highlighted && !prevHighlighted.current && rowRef.current) {\n rowRef.current.classList.add('animated');\n setShouldHighlight(true);\n\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setShouldHighlight(false);\n\n timer.current = setTimeout(() => {\n if (rowRef.current) {\n rowRef.current.classList.remove('animated');\n }\n }, 500);\n }, 500);\n }\n },\n [highlighted]\n );\n\n useEffect(() => {\n prevHighlighted.current = highlighted;\n });\n\n return (\n <CellProvider\n backgroundColor={shouldHighlight ? colors.y9 : backgroundColor}\n borderColor={shouldHighlight ? colors.y8 : borderColor}\n >\n <View\n innerRef={rowRef}\n style={[\n {\n flexDirection: 'row',\n height: height || ROW_HEIGHT,\n flex: '0 0 ' + (height || ROW_HEIGHT) + 'px',\n userSelect: 'text',\n '&.animated .animated-cell': {\n transition: '.7s background-color'\n }\n },\n collapsed && { marginTop: -1 },\n style\n ]}\n data-testid=\"row\"\n {...nativeProps}\n >\n {inset !== 0 && <Field width={inset} />}\n {children}\n {inset !== 0 && <Field width={inset} />}\n </View>\n </CellProvider>\n );\n}\n\nconst inputCellStyle = {\n backgroundColor: 'white',\n padding: '5px 3px',\n margin: '0 1px'\n};\n\nconst readonlyInputStyle = {\n backgroundColor: 'transparent',\n '::selection': { backgroundColor: '#d9d9d9' }\n};\n\nfunction InputValue({ value: defaultValue, onUpdate, onBlur, ...props }) {\n let [value, setValue] = useState(defaultValue);\n\n function onBlur_(e) {\n onUpdate && onUpdate(value);\n onBlur && fireBlur(onBlur, e);\n }\n\n function onKeyDown(e) {\n // Only enter and tab to escape (which allows the user to move\n // around)\n if (e.keyCode !== keys.ENTER && e.keyCode !== keys.TAB) {\n e.stopPropagation();\n }\n\n if (e.keyCode === keys.ESC) {\n if (value !== defaultValue) {\n setValue(defaultValue);\n }\n } else if (shouldSaveFromKey(e)) {\n onUpdate && onUpdate(value);\n }\n }\n\n return (\n <Input\n {...props}\n value={value}\n onUpdate={text => setValue(text)}\n onBlur={onBlur_}\n onKeyDown={onKeyDown}\n style={[\n inputCellStyle,\n props.readOnly ? readonlyInputStyle : null,\n props.style\n ]}\n />\n );\n}\n\nexport function InputCell({\n inputProps,\n onUpdate,\n onBlur,\n textAlign,\n error,\n ...props\n}) {\n return (\n <Cell textAlign={textAlign} {...props}>\n {() => (\n <React.Fragment>\n <InputValue\n value={props.value}\n onUpdate={onUpdate}\n onBlur={onBlur}\n style={[{ textAlign }, inputProps && inputProps.style]}\n {...inputProps}\n />\n {error && (\n <Tooltip\n key=\"error\"\n targetHeight={ROW_HEIGHT}\n width={180}\n position=\"bottom-left\"\n >\n {error}\n </Tooltip>\n )}\n </React.Fragment>\n )}\n </Cell>\n );\n}\n\nexport function shouldSaveFromKey(e) {\n switch (e.keyCode) {\n case keys.TAB:\n case keys.ENTER:\n e.preventDefault();\n return true;\n default:\n }\n}\n\nexport function CustomCell({\n value: defaultValue,\n children,\n onUpdate,\n onBlur,\n ...props\n}) {\n let [value, setValue] = useState(defaultValue);\n let [prevDefaultValue, setPrevDefaultValue] = useState(defaultValue);\n\n if (prevDefaultValue !== defaultValue) {\n setValue(defaultValue);\n setPrevDefaultValue(defaultValue);\n }\n\n function onBlur_(e) {\n // Only save on blur if the app is focused. Blur events fire when\n // the app unfocuses, and it's unintuitive to save the value since\n // the input will be focused again when the app regains focus\n if (document.hasFocus()) {\n onUpdate && onUpdate(value);\n fireBlur(onBlur, e);\n }\n }\n\n function onKeyDown(e) {\n if (shouldSaveFromKey(e)) {\n onUpdate && onUpdate(value);\n }\n }\n\n return (\n <Cell {...props} value={defaultValue}>\n {() =>\n children({\n onBlur: onBlur_,\n onKeyDown,\n onUpdate: val => setValue(val),\n onSave: val => {\n setValue(val);\n onUpdate && onUpdate(val);\n },\n shouldSaveFromKey,\n inputStyle: inputCellStyle\n })\n }\n </Cell>\n );\n}\n\nexport const DateSelectCell = scope(lively => {\n function DateSelectCell({ props: { dateSelectProps, ...props }, updater }) {\n const { inputProps = {} } = dateSelectProps;\n return (\n <Cell\n {...props}\n style={{\n zIndex: props.exposed ? 1 : 0,\n ...props.style\n }}\n >\n {() => (\n <DateSelect\n {...dateSelectProps}\n tooltipStyle={{ minWidth: 225 }}\n inputProps={{\n ...inputProps,\n onBlur: e => fireBlur(inputProps && inputProps.onBlur, e),\n style: [inputCellStyle, { zIndex: 300 }]\n }}\n />\n )}\n </Cell>\n );\n }\n\n return lively(DateSelectCell);\n});\n\nexport function DeleteCell({ onDelete, style, ...props }) {\n return (\n <Cell\n {...props}\n name=\"delete\"\n width={20}\n style={[{ alignItems: 'center', userSelect: 'none' }, style]}\n onClick={e => {\n e.stopPropagation();\n onDelete && onDelete();\n }}\n >\n {() => <DeleteIcon width={7} height={7} />}\n </Cell>\n );\n}\n\nexport const CellButton = React.forwardRef(\n ({ style, disabled, clickBehavior, onSelect, onEdit, children }, ref) => {\n // This represents a cell that acts like a button: it's clickable,\n // focusable, etc. The reason we don't use a button is because the\n // full behavior is undesirable: we really don't want stuff like\n // \"click is fired when enter is pressed\". We have very custom\n // controls and focus/active states.\n //\n // Important behavior:\n // * X/SPACE/etc keys select the button _on key down_ and not on key\n // up. This means it instantly selects and if you hold it down it\n // will repeatedly select.\n // * The cell begins editing on focus. That means if the user does a\n // mouse down, but moves out of the element and then does mouse\n // up, it will properly still receive focus & being editing\n return (\n <View\n innerRef={ref}\n className=\"cell-button\"\n tabIndex=\"0\"\n onKeyDown={e => {\n if (e.keyCode === keys.X || e.keyCode === keys.SPACE) {\n e.preventDefault();\n if (!disabled) {\n onSelect && onSelect();\n }\n }\n }}\n style={[\n {\n flexDirection: 'row',\n alignItems: 'center',\n cursor: 'default',\n transition: 'box-shadow .15s',\n ':focus': {\n outline: 0,\n boxShadow: `0 0 0 3px white, 0 0 0 5px ${colors.b5}`\n }\n },\n style\n ]}\n onFocus={() => onEdit && onEdit()}\n data-testid=\"cell-button\"\n onClick={\n clickBehavior === 'none'\n ? null\n : () => {\n if (!disabled) {\n onSelect && onSelect();\n onEdit && onEdit();\n }\n }\n }\n >\n {children}\n </View>\n );\n }\n);\n\nexport function SelectCell({\n focused,\n selected,\n partial,\n style,\n onSelect,\n onEdit,\n ...props\n}) {\n return (\n <Cell\n {...props}\n focused={focused}\n name=\"select\"\n width={20}\n style={[{ alignItems: 'center', userSelect: 'none' }, style]}\n onClick={e => {\n e.stopPropagation();\n onSelect && onSelect();\n onEdit && onEdit();\n }}\n >\n {() => (\n <CellButton\n style={[\n {\n width: 12,\n height: 12,\n border: '1px solid ' + colors.n8,\n borderRadius: 3,\n justifyContent: 'center',\n alignItems: 'center',\n\n ':focus': {\n border: '1px solid ' + colors.b5,\n boxShadow: '0 1px 2px ' + colors.b5\n }\n },\n selected && {\n backgroundColor: partial ? colors.b9 : colors.b5,\n borderColor: partial ? colors.b9 : colors.b5\n }\n ]}\n onEdit={onEdit}\n onSelect={onSelect}\n clickBehavior=\"none\"\n >\n {selected && (\n <Checkmark width={6} height={6} style={{ color: 'white' }} />\n )}\n </CellButton>\n )}\n </Cell>\n );\n}\n\nexport function SheetCell({\n valueProps,\n valueStyle,\n inputProps,\n sync,\n textAlign,\n onSave,\n ...props\n}) {\n const { binding, type, getValueStyle, formatExpr, unformatExpr } = valueProps;\n\n return (\n <SheetValue\n binding={binding}\n onChange={() => {\n // \"close\" the cell if it's editing\n if (props.exposed && inputProps && inputProps.onBlur) {\n inputProps.onBlur();\n }\n }}\n >\n {node => {\n return (\n <Cell\n valueStyle={\n getValueStyle\n ? [valueStyle, getValueStyle(node.value)]\n : valueStyle\n }\n textAlign={textAlign}\n {...props}\n value={node.value}\n formatter={value =>\n props.formatter\n ? props.formatter(value, type)\n : format(value, type)\n }\n data-cellname={node.name}\n >\n {() => {\n return (\n <InputValue\n value={formatExpr ? formatExpr(node.value) : node.value}\n onUpdate={value => {\n onSave(unformatExpr ? unformatExpr(value) : value);\n }}\n style={{ textAlign }}\n {...inputProps}\n />\n );\n }}\n </Cell>\n );\n }}\n </SheetValue>\n );\n}\n\nexport const Highlight = scope(lively => {\n function Highlight({ inst, state: { activated, highlightOff } }) {\n return (\n <View\n innerRef={el => (inst.el = el)}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n transition: 'background-color 1.8s',\n backgroundColor: 'white'\n }}\n />\n );\n }\n\n function activate({ inst }) {\n inst.el.style.transitionDuration = '0s';\n inst.el.style.backgroundColor = colors.y9;\n setTimeout(() => {\n if (inst.el) {\n inst.el.style.transitionDuration = '1.8s';\n inst.el.style.backgroundColor = 'white';\n }\n }, 0);\n }\n\n return lively(Highlight, {\n getInitialState({ props }) {\n return { activated: false, highlightOff: true };\n },\n\n componentWillReceiveProps(bag, nextProps) {\n if (!bag.props.active && nextProps.active) {\n return activate(bag);\n }\n },\n\n componentDidMount(bag) {\n if (bag.props.active) {\n return activate(bag);\n }\n }\n });\n});\n\nexport function TableHeader({ headers, children, version, ...rowProps }) {\n return (\n <View\n style={\n version === 'v2' && { borderRadius: '6px 6px 0 0', overflow: 'hidden' }\n }\n >\n <Row\n backgroundColor=\"white\"\n borderColor={colors.border}\n collapsed={true}\n {...rowProps}\n style={[\n { zIndex: 200 },\n version === 'v2'\n ? { color: colors.n4, fontWeight: 500 }\n : { color: colors.n4 },\n rowProps.style\n ]}\n >\n {headers\n ? headers.map(header => {\n return (\n <Cell\n key={header.name}\n value={header.name}\n width={header.width}\n style={header.style}\n valueStyle={header.valueStyle}\n />\n );\n })\n : children}\n </Row>\n </View>\n );\n}\n\nexport function SelectedItemsButton({ name, keyHandlers, items, onSelect }) {\n let selectedItems = useSelectedItems();\n let [menuOpen, setMenuOpen] = useState(null);\n\n if (selectedItems.size === 0) {\n return null;\n }\n\n return (\n <View>\n <KeyHandlers keys={keyHandlers || {}} />\n\n <Button\n bare\n style={{ color: colors.b3 }}\n onClick={() => setMenuOpen(true)}\n >\n <ExpandArrow width={8} height={8} style={{ marginRight: 5 }} />\n {selectedItems.size} {name}\n </Button>\n\n {menuOpen && (\n <Tooltip\n position=\"bottom-right\"\n width={200}\n style={{ padding: 0 }}\n onClose={() => setMenuOpen(false)}\n >\n <Menu\n onMenuSelect={name => {\n onSelect(name, [...selectedItems]);\n setMenuOpen(false);\n }}\n items={items}\n />\n </Tooltip>\n )}\n </View>\n );\n}\n\nlet rowStyle = { position: 'absolute', willChange: 'transform', width: '100%' };\n\nexport const TableWithNavigator = React.forwardRef(\n ({ fields, ...props }, ref) => {\n let navigator = useTableNavigator(props.items, fields);\n return <Table {...props} navigator={navigator} />;\n }\n);\n\nexport const Table = React.forwardRef(\n (\n {\n items,\n count,\n headers,\n contentHeader,\n loading,\n rowHeight = ROW_HEIGHT,\n backgroundColor = TABLE_BACKGROUND_COLOR,\n renderItem,\n renderEmpty,\n getItemKey,\n loadMore,\n style,\n navigator,\n listRef,\n onScroll,\n version = 'v1',\n animated,\n allowPopupsEscape,\n isSelected,\n ...props\n },\n ref\n ) => {\n if (!navigator) {\n navigator = {\n onEdit: () => {},\n editingId: null,\n focusedField: null,\n getNavigatorProps: props => props\n };\n }\n\n let { onEdit, editingId, focusedField, getNavigatorProps } = navigator;\n let list = useRef(null);\n let listContainer = useRef(null);\n let scrollContainer = useRef(null);\n let initialScrollTo = useRef(null);\n let listInitialized = useRef(false);\n\n useImperativeHandle(ref, () => ({\n scrollTo: (id, alignment = 'smart') => {\n let index = items.findIndex(item => item.id === id);\n if (index !== -1) {\n if (!list.current) {\n // If the table hasn't been laid out yet, we need to wait for\n // that to happen before we can scroll to something\n initialScrollTo.current = index;\n } else {\n list.current.scrollToItem(index, alignment);\n }\n }\n },\n\n scrollToTop: () => {\n list.current && list.current.scrollTo(0);\n },\n\n getScrolledItem: () => {\n if (scrollContainer.current) {\n let offset = scrollContainer.current.scrollTop;\n let index = list.current.getStartIndexForOffset(offset);\n return items[index].id;\n }\n return 0;\n },\n\n setRowAnimation: flag => {\n list.current && list.current.setRowAnimation(flag);\n },\n\n edit(id, field, shouldScroll) {\n onEdit(id, field);\n\n if (id && shouldScroll) {\n ref.scrollTo(id);\n }\n },\n\n anchor() {\n list.current && list.current.anchor();\n },\n\n unanchor() {\n list.current && list.current.unanchor();\n },\n\n isAnchored() {\n return list.current && list.current.isAnchored();\n }\n }));\n\n useLayoutEffect(() => {\n // We wait for the list to mount because AutoSizer needs to run\n // before it's mounted\n if (!listInitialized.current && listContainer.current) {\n // Animation is on by default\n list.current && list.current.setRowAnimation(true);\n listInitialized.current = true;\n }\n });\n\n function renderRow({ index, style, key }) {\n let item = items[index];\n let editing = editingId === item.id;\n let selected = isSelected && isSelected(item.id);\n\n let row = renderItem({\n item,\n editing,\n focusedField: editing && focusedField,\n onEdit,\n index,\n position: style.top\n });\n\n // TODO: Need to also apply zIndex if item is selected\n // * Port over ListAnimation to Table\n // * Move highlighted functionality into here\n return (\n <View\n key={key}\n className=\"animated-row\"\n style={[\n rowStyle,\n {\n zIndex: editing || selected ? 101 : 'auto',\n transform: 'translateY(var(--pos))'\n }\n ]}\n nativeStyle={{ '--pos': `${style.top - 1}px` }}\n data-focus-key={item.id}\n >\n {row}\n </View>\n );\n }\n\n function getScrollOffset(height, index) {\n return (\n index * (rowHeight - 1) +\n (rowHeight - 1) / 2 -\n height / 2 +\n (rowHeight - 1) * 2\n );\n }\n\n function onItemsRendered({ overscanStartIndex, overscanStopIndex }) {\n if (loadMore && overscanStopIndex > items.length - 100) {\n loadMore();\n }\n }\n\n function getEmptyContent(empty) {\n if (empty == null) {\n return null;\n } else if (typeof empty === 'function') {\n return empty();\n }\n\n return (\n <View\n style={{\n justifyContent: 'center',\n alignItems: 'center',\n fontStyle: 'italic',\n color: colors.n6,\n flex: 1\n }}\n >\n {empty}\n </View>\n );\n }\n\n if (loading) {\n return (\n <View\n style={[{ flex: 1, justifyContent: 'center', alignItems: 'center' }]}\n >\n <AnimatedLoading width={25} color={colors.n1} />\n </View>\n );\n }\n\n let isEmpty = (count || items.length) === 0;\n\n return (\n <View\n style={[\n {\n flex: 1,\n outline: 'none',\n '& .animated .animated-row': { transition: '.25s transform' }\n },\n style\n ]}\n tabIndex=\"1\"\n {...getNavigatorProps(props)}\n data-testid=\"table\"\n >\n {headers && (\n <TableHeader\n version={version}\n height={rowHeight}\n {...(Array.isArray(headers) ? { headers } : { children: headers })}\n />\n )}\n <View style={{ flex: 1, backgroundColor }}>\n {isEmpty ? (\n getEmptyContent(renderEmpty)\n ) : (\n <AutoSizer>\n {({ width, height }) => {\n if (width === 0 || height === 0) {\n return null;\n }\n\n return (\n <IntersectionBoundary.Provider\n value={!allowPopupsEscape && listContainer}\n >\n <AvoidRefocusScrollProvider>\n <FixedSizeList\n ref={list}\n header={contentHeader}\n innerRef={listContainer}\n outerRef={scrollContainer}\n width={width}\n height={height}\n renderRow={renderRow}\n itemCount={count || items.length}\n itemSize={rowHeight - 1}\n itemKey={\n getItemKey || ((index, data) => items[index].id)\n }\n indexForKey={key =>\n items.findIndex(item => item.id === key)\n }\n initialScrollOffset={\n initialScrollTo.current\n ? getScrollOffset(height, initialScrollTo.current)\n : 0\n }\n version={version}\n animated={animated}\n overscanCount={5}\n onItemsRendered={onItemsRendered}\n onScroll={onScroll}\n />\n </AvoidRefocusScrollProvider>\n </IntersectionBoundary.Provider>\n );\n }}\n </AutoSizer>\n )}\n </View>\n </View>\n );\n }\n);\n\nexport function useTableNavigator(data, fields, opts = {}) {\n let getFields = typeof fields !== 'function' ? () => fields : fields;\n let { initialEditingId, initialFocusedField, moveKeys } = opts;\n let [editingId, setEditingId] = useState(initialEditingId || null);\n let [focusedField, setFocusedField] = useState(initialFocusedField || null);\n let containerRef = useRef();\n\n // See `onBlur` for why we need this\n let store = useStore();\n let modalStackLength = useRef(0);\n\n // onEdit is passed to children, so make sure it maintains identity\n let onEdit = useCallback((id, field) => {\n setEditingId(id);\n setFocusedField(id ? field : null);\n }, []);\n\n useEffect(() => {\n modalStackLength.current = store.getState().modals.modalStack.length;\n }, []);\n\n function flashInput() {\n // Force the container to be focused which suppresses the \"space\n // pages down\" behavior. If we don't do this and the user presses\n // up + space down quickly while nothing is focused, it would page\n // down.\n containerRef.current.focus();\n\n // Not ideal, but works for now. Let the UI show the input\n // go away, and then bring it back on the same row/field\n onEdit(null);\n\n setTimeout(() => {\n onEdit(editingId, focusedField);\n }, 100);\n }\n\n function onFocusPrevious() {\n let idx = data.findIndex(item => item.id === editingId);\n if (idx > 0) {\n let item = data[idx - 1];\n let fields = getFields(item);\n onEdit(item.id, fields[fields.length - 1]);\n } else {\n flashInput();\n }\n }\n\n function onFocusNext() {\n let idx = data.findIndex(item => item.id === editingId);\n if (idx < data.length - 1) {\n let item = data[idx + 1];\n let fields = getFields(item);\n onEdit(item.id, fields[0]);\n } else {\n flashInput();\n }\n }\n\n function moveHorizontally(dir) {\n if (editingId) {\n let fields = getFields(data.find(item => item.id === editingId));\n let idx = fields.indexOf(focusedField) + dir;\n\n if (idx < 0) {\n onFocusPrevious();\n } else if (idx >= fields.length) {\n onFocusNext();\n } else {\n setFocusedField(fields[idx]);\n }\n }\n }\n\n function moveVertically(dir) {\n if (editingId) {\n let idx = data.findIndex(item => item.id === editingId);\n let nextIdx = idx;\n\n while (true) {\n nextIdx = nextIdx + dir;\n if (nextIdx >= 0 && nextIdx < data.length) {\n const next = data[nextIdx];\n if (getFields(next).includes(focusedField)) {\n onEdit(next.id, focusedField);\n break;\n }\n } else {\n flashInput();\n break;\n }\n }\n }\n }\n\n function onMove(dir) {\n switch (dir) {\n case 'left':\n moveHorizontally(-1);\n break;\n case 'right':\n moveHorizontally(1);\n break;\n case 'up':\n moveVertically(-1);\n break;\n case 'down':\n moveVertically(1);\n break;\n default:\n throw new Error('Unknown direction: ' + dir);\n }\n }\n\n function getNavigatorProps(userProps) {\n return {\n ...userProps,\n\n innerRef: containerRef,\n\n onKeyDown: e => {\n userProps && userProps.onKeyDown && userProps.onKeyDown(e);\n if (e.isPropagationStopped()) {\n return;\n }\n\n let fieldKeys =\n moveKeys && moveKeys[focusedField] && moveKeys[focusedField];\n\n if (fieldKeys && fieldKeys[e.keyCode]) {\n e.preventDefault();\n e.stopPropagation();\n\n onMove(fieldKeys[e.keyCode]);\n } else {\n switch (e.keyCode) {\n case keys.UP:\n case keys.K:\n if (e.target.tagName !== 'INPUT') {\n onMove('up');\n }\n break;\n\n case keys.DOWN:\n case keys.J:\n if (e.target.tagName !== 'INPUT') {\n onMove('down');\n }\n break;\n\n case keys.ENTER:\n case keys.TAB:\n e.preventDefault();\n e.stopPropagation();\n\n onMove(\n e.keyCode === keys.ENTER\n ? e.shiftKey\n ? 'up'\n : 'down'\n : e.shiftKey\n ? 'left'\n : 'right'\n );\n break;\n default:\n }\n }\n },\n\n onBlur: e => {\n // We want to hide the editing field if the user clicked away\n // from the table. We use `relatedTarget` to figure out where\n // the focus is going, and if it's nothing (the user clicked\n // somewhere that doesn't have an editable field) or if it's\n // anything outside of the table, clear editing.\n //\n // Also important: only do this if the app is focused. The\n // blur event is fired when the app loses focus and we don't\n // want to hide the input.\n\n // The last tricky edge case: we don't want to blur if a new\n // modal just opened. This way the field still shows an\n // input, and it will be refocused when the modal closes.\n let prevNumModals = modalStackLength.current;\n let numModals = store.getState().modals.modalStack.length;\n\n if (\n document.hasFocus() &&\n (e.relatedTarget == null ||\n !containerRef.current.contains(e.relatedTarget)) &&\n prevNumModals === numModals\n ) {\n onEdit(null);\n }\n }\n };\n }\n\n return { onEdit, editingId, focusedField, getNavigatorProps };\n}\n","const uuid = require('../../uuid');\nconst { getChangedValues } = require('../../../shared/util');\n\n// List of recently used states. We don't use a true MRU structure\n// because our needs are simple and we also do some custom reordering.\nlet HISTORY_SIZE = 40;\nlet UNDO_STATE_MRU = [];\n\nlet currentUndoState = {\n url: null,\n openModal: null,\n selectedItems: null\n};\n\nfunction setUndoState(name, value) {\n currentUndoState[name] = value;\n currentUndoState.id = uuid.v4Sync();\n}\n\nfunction getUndoState(name) {\n return currentUndoState[name];\n}\n\nfunction getTaggedState(id) {\n return UNDO_STATE_MRU.find(state => state.id === id);\n}\n\nfunction snapshot() {\n let tagged = { ...currentUndoState, id: uuid.v4Sync() };\n UNDO_STATE_MRU.unshift(tagged);\n UNDO_STATE_MRU = UNDO_STATE_MRU.slice(0, HISTORY_SIZE);\n return tagged.id;\n}\n\nfunction gc(id) {\n UNDO_STATE_MRU = UNDO_STATE_MRU.filter(state => state.id !== id);\n}\n\nmodule.exports = { setUndoState, getUndoState, getTaggedState, snapshot, gc };\n","import throttle from 'throttleit';\nimport { send } from '../../platform/client/fetch';\nimport constants from '../constants';\nimport { addNotification, addGenericErrorNotification } from './notifications';\nimport { pushModal } from './modals';\n\nexport function applyBudgetAction(month, type, args) {\n return async function() {\n switch (type) {\n case 'budget-amount':\n await send('budget/budget-amount', {\n month,\n category: args.category,\n amount: args.amount\n });\n break;\n case 'copy-last':\n await send('budget/copy-previous-month', { month });\n break;\n case 'set-zero':\n await send('budget/set-zero', { month });\n break;\n case 'set-3-avg':\n await send('budget/set-3month-avg', { month });\n break;\n case 'set-all-future':\n await send('budget/set-all-future', { startMonth: month });\n break;\n case 'hold':\n await send('budget/hold-for-next-month', {\n month,\n amount: args.amount\n });\n break;\n case 'hold-all-future':\n await send('budget/hold-for-future-months', {\n startMonth: month,\n amount: args.amount\n });\n break;\n case 'reset-hold':\n await send('budget/reset-hold', { month });\n break;\n case 'cover':\n await send('budget/cover-overspending', {\n month,\n to: args.to,\n from: args.from\n });\n break;\n case 'transfer-available':\n await send('budget/transfer-available', {\n month,\n amount: args.amount,\n category: args.category\n });\n break;\n case 'transfer-category':\n await send('budget/transfer-category', {\n month,\n amount: args.amount,\n from: args.from,\n to: args.to\n });\n break;\n case 'carryover': {\n await send('budget/set-carryover', {\n startMonth: month,\n category: args.category,\n flag: args.flag\n });\n break;\n }\n default:\n }\n };\n}\n\nexport function getCategories() {\n return async function(dispatch) {\n const categories = await send('get-categories');\n dispatch({\n type: constants.LOAD_CATEGORIES,\n categories\n });\n return categories;\n };\n}\n\nexport function createCategory(name, groupId, isIncome) {\n return async function(dispatch) {\n let id = await send('category-create', {\n name,\n groupId,\n isIncome\n });\n dispatch(getCategories());\n return id;\n };\n}\n\nexport function deleteCategory(id, transferId) {\n return async function(dispatch, getState) {\n let { error } = await send('category-delete', { id, transferId });\n\n if (error) {\n let msg;\n switch (error) {\n case 'category-type':\n dispatch(\n addNotification({\n type: 'error',\n message:\n 'A category must be transferred to another of the same type (expense or income)'\n })\n );\n break;\n default:\n dispatch(addGenericErrorNotification());\n }\n\n throw new Error(error);\n } else {\n dispatch(getCategories());\n // Also need to refresh payees because they might use one of the\n // deleted categories as the default category\n dispatch(getPayees());\n }\n };\n}\n\nexport function updateCategory(category) {\n return async dispatch => {\n await send('category-update', category);\n dispatch(getCategories());\n };\n}\n\nexport function moveCategory(id, groupId, targetId) {\n return async (dispatch, getState) => {\n await send('category-move', { id, groupId, targetId });\n await dispatch(getCategories());\n };\n}\n\nexport function moveCategoryGroup(id, targetId) {\n return async dispatch => {\n await send('category-group-move', { id, targetId });\n await dispatch(getCategories());\n };\n}\n\nexport function createGroup(name) {\n return async dispatch => {\n let id = await send('category-group-create', { name });\n dispatch(getCategories());\n return id;\n };\n}\n\nexport function updateGroup(group) {\n // Strip off the categories field if it exist. It's not a real db\n // field but groups have this extra field in the client most of the\n // time\n const { categories, ...rawGroup } = group;\n\n return async dispatch => {\n await send('category-group-update', rawGroup);\n await dispatch(getCategories());\n };\n}\n\nexport function deleteGroup(id, transferId) {\n return async function(dispatch, getState) {\n const group = getState().queries.categories.grouped.find(g => g.id === id);\n await send('category-group-delete', { id, transferId });\n await dispatch(getCategories());\n // See `deleteCategory` for why we need this\n await dispatch(getPayees());\n };\n}\n\nexport function getPayees() {\n return async function(dispatch) {\n let payees = await send('payees-get');\n dispatch({\n type: constants.LOAD_PAYEES,\n payees\n });\n return payees;\n };\n}\n\nexport function initiallyLoadPayees() {\n return async function(dispatch, getState) {\n if (getState().queries.payees.length === 0) {\n return dispatch(getPayees());\n }\n };\n}\n\nexport function createPayee(name) {\n return async dispatch => {\n return send('payee-create', { name: name.trim() });\n };\n}\n\nexport function getAccounts() {\n return async function(dispatch) {\n const accounts = await send('accounts-get');\n dispatch({ type: constants.LOAD_ACCOUNTS, accounts });\n return accounts;\n };\n}\n\nexport function updateAccount(account) {\n return async function(dispatch) {\n dispatch({ type: constants.UPDATE_ACCOUNT, account });\n await send('account-update', account);\n };\n}\n\nexport function createAccount(name, type, balance, offBudget) {\n return async function(dispatch) {\n let id = await send('account-create', { name, type, balance, offBudget });\n await dispatch(getAccounts());\n await dispatch(getPayees());\n return id;\n };\n}\n\nexport function openAccountCloseModal(accountId) {\n return async function(dispatch, getState) {\n const { balance, numTransactions } = await send('account-properties', {\n id: accountId\n });\n const account = getState().queries.accounts.find(\n acct => acct.id === accountId\n );\n\n dispatch(\n pushModal('close-account', {\n account,\n balance,\n canDelete: numTransactions === 0\n })\n );\n };\n}\n\nexport function closeAccount(accountId, transferAccountId, categoryId, forced) {\n return async function(dispatch) {\n await send('account-close', {\n id: accountId,\n transferAccountId,\n categoryId,\n forced\n });\n dispatch(getAccounts());\n };\n}\n\nexport function reopenAccount(accountId) {\n return async function(dispatch) {\n await send('account-reopen', { id: accountId });\n dispatch(getAccounts());\n };\n}\n\nexport function forceCloseAccount(accountId) {\n return closeAccount(accountId, null, null, true);\n}\n\nlet _undo = throttle(() => send('undo'), 100);\nlet _redo = throttle(() => send('redo'), 100);\n\nlet _undoEnabled = true;\nexport function setUndoEnabled(flag) {\n _undoEnabled = flag;\n}\n\nexport function undo() {\n return async () => {\n if (_undoEnabled) {\n _undo();\n }\n };\n}\n\nexport function redo() {\n return async () => {\n if (_undoEnabled) {\n _redo();\n }\n };\n}\n","import React from 'react';\n\nexport default React.createContext(undefined);\n","import React, { useState } from 'react';\n\nconst SvgLoading = props => {\n let { color = '#fff' } = props;\n let [gradientId] = useState('gradient-' + Math.random());\n\n return (\n <svg {...props} viewBox=\"0 0 38 38\" style={{ ...props.style }}>\n <defs>\n <linearGradient\n x1=\"8.042%\"\n y1=\"0%\"\n x2=\"65.682%\"\n y2=\"23.865%\"\n id={gradientId}\n >\n <stop stopColor={color} stopOpacity={0} offset=\"0%\" />\n <stop stopColor={color} stopOpacity={0.631} offset=\"63.146%\" />\n <stop stopColor={color} offset=\"100%\" />\n </linearGradient>\n </defs>\n <g transform=\"translate(1 2)\" fill=\"none\" fillRule=\"evenodd\">\n <path\n d=\"M36 18c0-9.94-8.06-18-18-18\"\n stroke={'url(#' + gradientId + ')'}\n strokeWidth={2}\n fill=\"none\"\n />\n <circle fill={color} cx={36} cy={18} r={1} />\n </g>\n </svg>\n );\n};\n\nexport default SvgLoading;\n","import React from 'react';\nimport Loading from './Loading';\nimport { css } from 'glamor';\n\nconst rotation = css.keyframes({\n '0%': { transform: 'rotate(-90deg)' },\n '100%': { transform: 'rotate(666deg)' }\n});\n\nfunction AnimatedLoading(props) {\n return (\n <span\n {...css({\n animationName: rotation,\n animationDuration: '1.6s',\n animationTimingFunction: 'cubic-bezier(0.17, 0.67, 0.83, 0.67)',\n animationIterationCount: 'infinite',\n lineHeight: 0\n })}\n >\n <Loading {...props} />\n </span>\n );\n}\n\nexport default AnimatedLoading;\n","import React from 'react';\n\nexport default React.createContext(undefined);\n","export class Query {\n constructor(state) {\n this.state = {\n filterExpressions: state.filterExpressions || [],\n selectExpressions: state.selectExpressions || [],\n groupExpressions: state.groupExpressions || [],\n orderExpressions: state.orderExpressions || [],\n calculation: false,\n rawMode: false,\n withDead: false,\n validateRefs: true,\n limit: null,\n offset: null,\n ...state\n };\n }\n\n filter(expr) {\n return new Query({\n ...this.state,\n filterExpressions: [...this.state.filterExpressions, expr]\n });\n }\n\n unfilter(exprs) {\n let exprSet = new Set(exprs);\n return new Query({\n ...this.state,\n filterExpressions: this.state.filterExpressions.filter(\n expr => !exprSet.has(Object.keys(expr)[0])\n )\n });\n }\n\n select(exprs = []) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n let query = new Query({ ...this.state, selectExpressions: exprs });\n query.state.calculation = false;\n return query;\n }\n\n calculate(expr) {\n let query = this.select({ result: expr });\n query.state.calculation = true;\n return query;\n }\n\n groupBy(exprs) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n return new Query({\n ...this.state,\n groupExpressions: [...this.state.groupExpressions, ...exprs]\n });\n }\n\n orderBy(exprs) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n return new Query({\n ...this.state,\n orderExpressions: [...this.state.orderExpressions, ...exprs]\n });\n }\n\n limit(num) {\n return new Query({ ...this.state, limit: num });\n }\n\n offset(num) {\n return new Query({ ...this.state, offset: num });\n }\n\n raw() {\n return new Query({ ...this.state, rawMode: true });\n }\n\n withDead() {\n return new Query({ ...this.state, withDead: true });\n }\n\n withoutValidatedRefs() {\n return new Query({ ...this.state, validateRefs: false });\n }\n\n options(opts) {\n return new Query({ ...this.state, tableOptions: opts });\n }\n\n serialize() {\n return this.state;\n }\n}\n\nexport function getPrimaryOrderBy(query, defaultOrderBy) {\n let orderExprs = query.serialize().orderExpressions;\n if (orderExprs.length === 0) {\n if (defaultOrderBy) {\n return { order: 'asc', ...defaultOrderBy };\n }\n return null;\n }\n\n let firstOrder = orderExprs[0];\n if (typeof firstOrder === 'string') {\n return { field: firstOrder, order: 'asc' };\n }\n // Handle this form: { field: 'desc' }\n let [field] = Object.keys(firstOrder);\n return { field, order: firstOrder[field] };\n}\n\nexport default function q(table) {\n return new Query({ table });\n}\n","import React from 'react';\n\nconst SvgDotsHorizontalTriple = props => (\n <svg\n {...props}\n viewBox=\"0 0 20 20\"\n style={{\n color: '#242134',\n ...props.style\n }}\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport default SvgDotsHorizontalTriple;\n","import React, {\n useState,\n useRef,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useMemo\n} from 'react';\nimport * as d from 'date-fns';\nimport { css } from 'glamor';\nimport Pikaday from 'pikaday';\nimport 'pikaday/css/pikaday.css';\nimport { styles, colors } from '../style';\nimport { View, Input, Tooltip } from './common';\nimport {\n getDayMonthFormat,\n getDayMonthRegex,\n getShortYearFormat,\n getShortYearRegex\n} from 'loot-core/src/shared/months';\n\nimport DateSelectLeft from './DateSelect.left.png';\nimport DateSelectRight from './DateSelect.right.png';\n\nlet pickerStyles = {\n '& .pika-single.actual-date-picker': {\n color: colors.n11,\n background: colors.n1,\n border: 'none',\n boxShadow: '0 0px 4px rgba(0, 0, 0, .25)',\n borderRadius: 4\n },\n\n '& .actual-date-picker': {\n '& .pika-lendar': {\n float: 'none',\n width: 'auto'\n },\n '& .pika-label': {\n backgroundColor: colors.n1\n },\n '& .pika-prev': {\n backgroundImage: `url(${DateSelectLeft})`\n },\n '& .pika-next': {\n backgroundImage: `url(${DateSelectRight})`\n },\n '& .pika-table th': {\n color: colors.n11,\n '& abbr': { textDecoration: 'none' }\n },\n '& .pika-button': {\n backgroundColor: colors.n2,\n color: colors.n11\n },\n '& .is-today .pika-button': {\n textDecoration: 'underline'\n },\n '& .is-selected .pika-button': {\n backgroundColor: colors.n5,\n boxShadow: 'none'\n }\n }\n};\n\nexport let DatePicker = React.forwardRef(\n ({ value, dateFormat, onUpdate, onSelect }, ref) => {\n let picker = useRef(null);\n let mountPoint = useRef(null);\n\n useImperativeHandle(\n ref,\n () => ({\n handleInputKeyDown(e) {\n let newDate = null;\n switch (e.keyCode) {\n case 37:\n e.preventDefault();\n newDate = d.subDays(picker.current.getDate(), 1);\n break;\n case 38:\n e.preventDefault();\n newDate = d.subDays(picker.current.getDate(), 7);\n break;\n case 39:\n e.preventDefault();\n newDate = d.addDays(picker.current.getDate(), 1);\n break;\n case 40:\n e.preventDefault();\n newDate = d.addDays(picker.current.getDate(), 7);\n break;\n default:\n }\n if (newDate) {\n picker.current.setDate(newDate, true);\n onUpdate && onUpdate(newDate);\n }\n }\n }),\n []\n );\n\n useLayoutEffect(() => {\n picker.current = new Pikaday({\n theme: 'actual-date-picker',\n keyboardInput: false,\n defaultDate: value\n ? d.parse(value, dateFormat, new Date())\n : new Date(),\n setDefaultDate: true,\n toString(date) {\n return d.format(date, dateFormat);\n },\n parse(dateString) {\n return d.parse(dateString, dateFormat, new Date());\n },\n onSelect\n });\n\n mountPoint.current.appendChild(picker.current.el);\n\n return () => {\n picker.current.destroy();\n };\n }, []);\n\n useEffect(() => {\n if (picker.current.getDate() !== value) {\n picker.current.setDate(d.parse(value, dateFormat, new Date()), true);\n }\n }, [value, dateFormat]);\n\n return (\n <View style={[pickerStyles, { flex: 1 }]} innerRef={mountPoint}></View>\n );\n }\n);\n\nfunction defaultShouldSaveFromKey(e) {\n // Enter\n return e.keyCode === 13;\n}\n\nexport default function DateSelect({\n containerProps,\n inputProps,\n tooltipStyle,\n value: defaultValue,\n isOpen,\n embedded,\n dateFormat = 'yyyy-MM-dd',\n focused,\n openOnFocus = true,\n inputRef: originalInputRef,\n shouldSaveFromKey = defaultShouldSaveFromKey,\n tableBehavior,\n onUpdate,\n onSelect\n}) {\n let parsedDefaultValue = useMemo(() => {\n if (defaultValue) {\n let date = d.parseISO(defaultValue);\n if (d.isValid(date)) {\n return d.format(date, dateFormat);\n }\n }\n return null;\n }, [defaultValue, dateFormat]);\n\n let picker = useRef(null);\n let [value, setValue] = useState(parsedDefaultValue || '');\n let [open, setOpen] = useState(embedded || isOpen || false);\n let inputRef = useRef(null);\n\n useLayoutEffect(() => {\n if (originalInputRef) {\n originalInputRef.current = inputRef.current;\n }\n }, []);\n\n // This is confusing, so let me explain: `selectedValue` should be\n // renamed to `currentValue`. It represents the current highlighted\n // value in the date select and always changes as the user moves\n // around. `userSelectedValue` represents the last value that the\n // user actually selected (with enter or click). Having both allows\n // us to make various UX decisions\n let [selectedValue, setSelectedValue] = useState(value);\n let userSelectedValue = useRef(selectedValue);\n\n useEffect(() => {\n userSelectedValue.current = value;\n }, [value]);\n\n useEffect(() => setValue(parsedDefaultValue), [parsedDefaultValue]);\n\n useEffect(() => {\n if (getDayMonthRegex(dateFormat).test(value)) {\n // Support only entering the month and day (4/5). This is complex\n // because of the various date formats - we need to derive\n // the right day/month format from it\n let test = d.parse(value, getDayMonthFormat(dateFormat), new Date());\n if (d.isValid(test)) {\n onUpdate && onUpdate(d.format(test, 'yyyy-MM-dd'));\n setSelectedValue(d.format(test, dateFormat));\n }\n } else if (getShortYearRegex(dateFormat).test(value)) {\n // Support entering the year as only two digits (4/5/19)\n let test = d.parse(value, getShortYearFormat(dateFormat), new Date());\n if (d.isValid(test)) {\n onUpdate && onUpdate(d.format(test, 'yyyy-MM-dd'));\n setSelectedValue(d.format(test, dateFormat));\n }\n } else {\n let test = d.parse(value, dateFormat, new Date());\n if (d.isValid(test)) {\n let date = d.format(test, 'yyyy-MM-dd');\n onUpdate && onUpdate(date);\n setSelectedValue(value);\n }\n }\n }, [value]);\n\n function onKeyDown(e) {\n let ENTER = 13;\n let UP = 38;\n let DOWN = 40;\n let ESC = 27;\n\n if (\n e.keyCode >= 37 &&\n e.keyCode <= 40 &&\n !e.shiftKey &&\n !e.metaKey &&\n !e.altKey &&\n open\n ) {\n picker.current.handleInputKeyDown(e);\n } else if (e.keyCode === ESC) {\n setValue(parsedDefaultValue);\n setSelectedValue(parsedDefaultValue);\n\n if (parsedDefaultValue === value) {\n if (open) {\n if (!embedded) {\n e.stopPropagation();\n }\n\n setOpen(false);\n }\n } else {\n setOpen(true);\n onUpdate && onUpdate(defaultValue);\n }\n } else if (shouldSaveFromKey(e)) {\n setValue(selectedValue);\n setOpen(false);\n\n let date = d.parse(selectedValue, dateFormat, new Date());\n onSelect(d.format(date, 'yyyy-MM-dd'));\n\n if (open) {\n if (userSelectedValue.current !== selectedValue) {\n // This stops the event from propagating up\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n let { onKeyDown } = inputProps || {};\n onKeyDown && onKeyDown(e);\n } else if (!open) {\n setOpen(true);\n if (inputRef.current) {\n inputRef.current.setSelectionRange(0, 10000);\n }\n }\n }\n\n function onChange(e) {\n setValue(e.target.value);\n }\n\n let maybeWrapTooltip = content => {\n return embedded ? (\n content\n ) : (\n <Tooltip\n position=\"bottom-left\"\n offset={2}\n style={[{ padding: 0, minWidth: 225 }, tooltipStyle]}\n >\n {content}\n </Tooltip>\n );\n };\n\n return (\n <View {...containerProps}>\n <Input\n focused={focused}\n {...inputProps}\n inputRef={inputRef}\n value={value}\n onKeyDown={onKeyDown}\n onChange={onChange}\n onFocus={e => {\n if (!embedded && openOnFocus) {\n setOpen(true);\n }\n inputProps && inputProps.onFocus && inputProps.onFocus(e);\n }}\n onBlur={e => {\n if (!embedded) {\n setOpen(false);\n }\n inputProps && inputProps.onBlur && inputProps.onBlur(e);\n\n if (!tableBehavior) {\n // If value is empty, that drives what gets selected.\n // Otherwise the input is reset to whatever is already\n // selected\n if (value === '') {\n setSelectedValue(null);\n onSelect(null);\n } else {\n setValue(selectedValue || '');\n\n let date = d.parse(selectedValue, dateFormat, new Date());\n onSelect(d.format(date, 'yyyy-MM-dd'));\n }\n }\n }}\n />\n {open &&\n maybeWrapTooltip(\n <DatePicker\n ref={picker}\n value={selectedValue}\n dateFormat={dateFormat}\n onUpdate={date => {\n setSelectedValue(d.format(date, dateFormat));\n onUpdate && onUpdate(d.format(date, 'yyyy-MM-dd'));\n }}\n onSelect={date => {\n setValue(d.format(date, dateFormat));\n onSelect(d.format(date, 'yyyy-MM-dd'));\n setOpen(false);\n }}\n />\n )}\n </View>\n );\n}\n","import * as d from 'date-fns';\nimport memoizeOne from 'memoize-one';\n\nfunction _parse(value) {\n if (typeof value === 'string') {\n // Dates are hard. We just want to deal with months in the format\n // 2020-01 and days in the format 2020-01-01, but life is never\n // simple. We want to rely on native dates for date logic because\n // days are complicated (leap years, etc). But relying on native\n // dates mean we're exposed to craziness.\n //\n // The biggest problem is that JS dates work with local time by\n // default. We could try to only work with UTC, but there's not an\n // easy way to make `format` avoid local time, and not sure if we\n // want that anyway (`currentMonth` should surely print the local\n // time). We need to embrace local time, and as long as inputs to\n // date logic and outputs from format are local time, it should\n // work.\n //\n // To make sure we're in local time, always give Date integer\n // values. If you pass in a string to parse, different string\n // formats produce different results.\n //\n // A big problem is daylight savings, however. Usually, when\n // giving the time to the Date constructor, you get back a date\n // specifically for that time in your local timezone. However, if\n // daylight savings occurs on that exact time, you will get back\n // something different:\n //\n // This is fine:\n // > new Date(2017, 2, 12, 1).toString()\n // > 'Sun Mar 12 2017 01:00:00 GMT-0500 (Eastern Standard Time)'\n //\n // But wait, we got back a different time (3AM instead of 2AM):\n // > new Date(2017, 2, 12, 2).toString()\n // > 'Sun Mar 12 2017 03:00:00 GMT-0400 (Eastern Daylight Time)'\n //\n // The time is \"correctly\" adjusted via DST, but we _really_\n // wanted 2AM. The problem is that time simply doesn't exist.\n //\n // Why is this a problem? Well, consider a case where the DST\n // shift happens *at midnight* and it goes back an hour. You think\n // you have a date object for the next day, but when formatted it\n // actually shows the previous day. A more likely scenario: buggy\n // timezone data makes JS dates do this shift when it shouldn't,\n // so using midnight at the time for date logic gives back the\n // last day. See the time range of Sep 30 15:00 - Oct 1 1:00 for\n // the AEST timezone when nodejs-mobile incorrectly gives you back\n // a time an hour *before* you specified. Since this happens on\n // Oct 1, doing `addMonths(September, 1)` still gives you back\n // September. Issue here:\n // https://github.com/JaneaSystems/nodejs-mobile/issues/251\n //\n // The fix is simple once you understand this. Always use the 12th\n // hour of the day. That's it. There is no DST that shifts more\n // than 12 hours (god let's hope not) so no matter how far DST has\n // shifted backwards or forwards, doing date logic will stay\n // within the day we want.\n\n let [year, month, day] = value.split('-');\n if (day != null) {\n return new Date(parseInt(year), parseInt(month) - 1, parseInt(day), 12);\n } else if (month != null) {\n return new Date(parseInt(year), parseInt(month) - 1, 1, 12);\n } else {\n return new Date(parseInt(year), 0, 1, 12);\n }\n }\n return value;\n}\n\nexport const parseDate = _parse;\n\nexport function yearFromDate(date) {\n return d.format(_parse(date), 'yyyy');\n}\n\nexport function monthFromDate(date) {\n return d.format(_parse(date), 'yyyy-MM');\n}\n\nexport function dayFromDate(date) {\n return d.format(_parse(date), 'yyyy-MM-dd');\n}\n\nexport function currentMonth() {\n if (global.IS_TESTING) {\n return '2017-01';\n } else {\n return d.format(new Date(), 'yyyy-MM');\n }\n}\n\nexport function currentDay() {\n if (global.IS_TESTING) {\n return '2017-01-01';\n } else {\n return d.format(new Date(), 'yyyy-MM-dd');\n }\n}\n\nexport function nextMonth(month) {\n return d.format(d.addMonths(_parse(month), 1), 'yyyy-MM');\n}\n\nexport function prevMonth(month) {\n return d.format(d.subMonths(_parse(month), 1), 'yyyy-MM');\n}\n\nexport function addMonths(month, n) {\n return d.format(d.addMonths(_parse(month), n), 'yyyy-MM');\n}\n\nexport function subMonths(month, n) {\n return d.format(d.subMonths(_parse(month), n), 'yyyy-MM');\n}\n\nexport function addDays(day, n) {\n return d.format(d.addDays(_parse(day), n), 'yyyy-MM-dd');\n}\n\nexport function subDays(day, n) {\n return d.format(d.subDays(_parse(day), n), 'yyyy-MM-dd');\n}\n\nexport function isBefore(month1, month2) {\n return d.isBefore(_parse(month1), _parse(month2));\n}\n\nexport function isAfter(month1, month2) {\n return d.isAfter(_parse(month1), _parse(month2));\n}\n\n// TODO: This doesn't really fit in this module anymore, should\n// probably live elsewhere\nexport function bounds(month) {\n return {\n start: parseInt(d.format(d.startOfMonth(_parse(month)), 'yyyyMMdd')),\n end: parseInt(d.format(d.endOfMonth(_parse(month)), 'yyyyMMdd'))\n };\n}\n\nexport function _range(start, end, inclusive) {\n const months = [];\n let month = monthFromDate(start);\n while (d.isBefore(_parse(month), _parse(end))) {\n months.push(month);\n month = addMonths(month, 1);\n }\n\n if (inclusive) {\n months.push(month);\n }\n\n return months;\n}\n\nexport function range(start, end) {\n return _range(start, end);\n}\n\nexport function rangeInclusive(start, end) {\n return _range(start, end, true);\n}\n\nexport function _dayRange(start, end, inclusive) {\n const days = [];\n let day = start;\n while (d.isBefore(_parse(day), _parse(end))) {\n days.push(day);\n day = addDays(day, 1);\n }\n\n if (inclusive) {\n days.push(day);\n }\n\n return days;\n}\n\nexport function dayRange(start, end) {\n return _dayRange(start, end);\n}\n\nexport function dayRangeInclusive(start, end) {\n return _dayRange(start, end, true);\n}\n\nexport function getMonthIndex(month) {\n return parseInt(month.slice(5, 7)) - 1;\n}\n\nexport function getYear(month) {\n return month.slice(0, 4);\n}\n\nexport function getMonth(day) {\n return day.slice(0, 7);\n}\n\nexport function getYearStart(month) {\n return getYear(month) + '-01';\n}\n\nexport function getYearEnd(month) {\n return getYear(month) + '-12';\n}\n\nexport function sheetForMonth(month) {\n return 'budget' + month.replace('-', '');\n}\n\nexport function nameForMonth(month) {\n return d.format(_parse(month), \"MMMM 'yy\");\n}\n\nexport function format(month, str) {\n return d.format(_parse(month), str);\n}\n\nexport const getDateFormatRegex = memoizeOne(format => {\n return new RegExp(\n format\n .replace(/d+/g, '\\\\d{1,2}')\n .replace(/M+/g, '\\\\d{1,2}')\n .replace(/y+/g, '\\\\d{4}')\n );\n});\n\nexport const getDayMonthFormat = memoizeOne(format => {\n return format\n .replace(/y+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '');\n});\n\nexport const getDayMonthRegex = memoizeOne(format => {\n let regex = format\n .replace(/y+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/d+/g, '\\\\d{1,2}')\n .replace(/M+/g, '\\\\d{1,2}');\n return new RegExp('^' + regex + '$');\n});\n\nexport const getMonthYearFormat = memoizeOne(format => {\n return format\n .replace(/d+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/\\/\\//, '/')\n .replace(/\\.\\./, '.')\n .replace(/--/, '-');\n});\n\nexport const getMonthYearRegex = memoizeOne(format => {\n let regex = format\n .replace(/d+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/\\/\\//, '/')\n .replace(/M+/g, '\\\\d{1,2}')\n .replace(/y+/g, '\\\\d{2,4}');\n return new RegExp('^' + regex + '$');\n});\n\nexport const getShortYearFormat = memoizeOne(format => {\n return format.replace(/y+/g, 'yy');\n});\n\nexport const getShortYearRegex = memoizeOne(format => {\n let regex = format\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/d+/g, '\\\\d{1,2}')\n .replace(/M+/g, '\\\\d{1,2}')\n .replace(/y+/g, '\\\\d{2}');\n return new RegExp('^' + regex + '$');\n});\n","let currencyFormatter = require('currency-formatter');\n\nexport function cleanUUID(uuid) {\n return uuid.replace(/-/g, '');\n}\n\nexport function last(arr) {\n return arr[arr.length - 1];\n}\n\nexport function mergeObjects(objects) {\n return Object.assign.apply(null, [{}, ...objects]);\n}\n\nexport function composeCellChanges(objects) {\n const merged = {};\n Object.keys(objects).forEach(key => {\n if (merged[key]) {\n merged[key] = { ...merged[key], ...objects[key] };\n } else {\n merged[key] = objects[key];\n }\n });\n}\n\nexport function flattenArray(arrays) {\n return Array.prototype.concat.apply([], arrays);\n}\n\nexport function shallowEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n var numKeysA = 0,\n numKeysB = 0,\n key;\n for (key in b) {\n numKeysB++;\n if (!a.hasOwnProperty(key) || a[key] !== b[key]) {\n return false;\n }\n }\n for (key in a) {\n numKeysA++;\n }\n return numKeysA === numKeysB;\n}\n\nexport function getChangedValues(obj1, obj2) {\n // Keep the id field because this is mostly used to diff database\n // objects\n const diff = obj1.id ? { id: obj1.id } : {};\n const keys = Object.keys(obj2);\n let hasChanged = false;\n\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n\n if (obj1[key] !== obj2[key]) {\n diff[key] = obj2[key];\n hasChanged = true;\n }\n }\n\n return hasChanged ? diff : null;\n}\n\nexport function hasFieldsChanged(obj1, obj2, fields) {\n let changed = false;\n for (var i = 0; i < fields.length; i++) {\n let field = fields[i];\n if (obj1[field] !== obj2[field]) {\n changed = true;\n break;\n }\n }\n return changed;\n}\n\nexport function applyChanges(changes, items) {\n items = [...items];\n\n if (changes.added) {\n changes.added.forEach(add => {\n items.push(add);\n });\n }\n\n if (changes.updated) {\n changes.updated.forEach(({ id, ...fields }) => {\n const idx = items.findIndex(t => t.id === id);\n items[idx] = {\n ...items[idx],\n ...fields\n };\n });\n }\n\n if (changes.deleted) {\n changes.deleted.forEach(t => {\n const idx = items.findIndex(t2 => t.id === t2.id);\n if (idx !== -1) {\n items.splice(idx, 1);\n }\n });\n }\n\n return items;\n}\n\nexport function partitionByField(data, field) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n let key = item[field];\n\n let items = res.get(key) || [];\n items.push(item);\n\n res.set(key, items);\n }\n return res;\n}\n\nexport function groupBy(data, field, mapper) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n let key = item[field];\n let existing = res.get(key) || [];\n res.set(key, existing.concat([mapper ? mapper(item) : data[i]]));\n }\n return res;\n}\n\nexport function groupBySingle(data, field, mapper) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n let key = item[field];\n if (res.has(key)) {\n throw new Error('groupBySingle found conflicting key: ' + key);\n }\n res.set(key, mapper ? mapper(item) : data[i]);\n }\n return res;\n}\n\n// This should replace the existing `groupById` function, since a\n// `Map` is better, but we can't swap it out because `Map` has a\n// different API and we need to go through and update everywhere that\n// uses it.\nfunction _groupById(data) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n res.set(item.id, item);\n }\n return res;\n}\n\nexport function diffItems(items, newItems) {\n let grouped = _groupById(items);\n let newGrouped = _groupById(newItems);\n let added = [];\n let updated = [];\n\n let deleted = items\n .filter(item => !newGrouped.has(item.id))\n .map(item => ({ id: item.id }));\n\n newItems.forEach(newItem => {\n let item = grouped.get(newItem.id);\n if (!item) {\n added.push(newItem);\n } else {\n const changes = getChangedValues(item, newItem);\n if (changes) {\n updated.push(changes);\n }\n }\n });\n\n return { added, updated, deleted };\n}\n\nexport function groupById(data) {\n let res = {};\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n res[item.id] = item;\n }\n return res;\n}\n\nexport function debugMemoFailure(prevProps, nextProps) {\n let changed = getChangedValues(prevProps, nextProps);\n if (changed !== null) {\n console.log(changed);\n }\n return changed === null;\n}\n\nexport function setIn(map, keys, item) {\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n\n if (i === keys.length - 1) {\n map.set(key, item);\n } else {\n if (!map.has(key)) {\n map.set(key, new Map());\n }\n\n map = map.get(key);\n }\n }\n}\n\nexport function getIn(map, keys) {\n let item = map;\n for (let i = 0; i < keys.length; i++) {\n item = item.get(keys[i]);\n\n if (item == null) {\n return item;\n }\n }\n return item;\n}\n\n// Useful for throwing exception from expressions\nexport function throwError(err) {\n throw err;\n}\n\nexport function fastSetMerge(set1, set2) {\n let finalSet = new Set(set1);\n let iter = set2.values();\n let value = iter.next();\n while (!value.done) {\n finalSet.add(value.value);\n value = iter.next();\n }\n return finalSet;\n}\n\nexport function titleFirst(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\n\nexport let numberFormats = [\n { value: 'comma-dot', label: '1,000.33' },\n { value: 'dot-comma', label: '1.000,33' },\n { value: 'space-comma', label: '1 000,33' }\n];\n\nlet numberFormat = {\n value: null,\n formatter: null,\n regex: null\n};\n\nexport function setNumberFormat(format) {\n let locale, regex, separator;\n\n switch (format) {\n case 'space-comma':\n locale = 'za-ZA';\n regex = /[^-0-9,]/g;\n separator = ',';\n break;\n case 'dot-comma':\n locale = 'de-DE';\n regex = /[^-0-9,]/g;\n separator = ',';\n break;\n case 'comma-dot':\n default:\n locale = 'en-US';\n regex = /[^-0-9.]/g;\n separator = '.';\n }\n\n numberFormat = {\n value: format,\n separator,\n // This is the keep in line with the Intl API which we might\n // switch to when it's available on all mobile platforms\n formatter: {\n format: number =>\n currencyFormatter.format(number, { locale, format: '%v' })\n },\n regex\n };\n}\n\nexport function getNumberFormat() {\n return numberFormat;\n}\n\nsetNumberFormat('1,000.33');\n\nexport function toRelaxedNumber(value) {\n return integerToAmount(currencyToInteger(value) || 0);\n}\n\nexport function toRelaxedInteger(value) {\n return stringToInteger(value) || 0;\n}\n\nexport function integerToCurrency(n) {\n // Awesome\n return numberFormat.formatter.format(n / 100);\n}\n\nexport function amountToCurrency(n) {\n return numberFormat.formatter.format(n);\n}\n\nexport function amountToPrettyCurrency(n, code) {\n return currencyFormatter.format(n, { code });\n}\n\nexport function currencyToAmount(str) {\n let amount = parseFloat(\n str.replace(numberFormat.regex, '').replace(numberFormat.separator, '.')\n );\n return isNaN(amount) ? null : amount;\n}\n\nexport function currencyToInteger(str) {\n let amount = currencyToAmount(str);\n return amount ? amountToInteger(amount) : null;\n}\n\nexport function stringToInteger(str) {\n let amount = parseInt(str.replace(/[^-0-9.,]/g, ''));\n if (!isNaN(amount)) {\n return amount;\n }\n return null;\n}\n\nexport function amountToInteger(n) {\n return Math.round(n * 100);\n}\n\nexport function integerToAmount(n) {\n return parseFloat((n / 100).toFixed(2));\n}\n\n// This is used when the input format could be anything (from\n// financial files and we don't want to parse based on the user's\n// number format, because the user could be importing from many\n// currencies. We extract out the numbers and just ignore separators.\nexport function looselyParseAmount(amount) {\n function safeNumber(v) {\n return isNaN(v) ? null : v;\n }\n\n let m = amount.match(/[.,][^.,]*$/);\n if (!m || m.index === 0) {\n return safeNumber(parseFloat(amount));\n }\n\n let left = amount.slice(0, m.index);\n let right = amount.slice(m.index + 1);\n\n return safeNumber(parseFloat(left.replace(/[^0-9-]/g, '') + '.' + right));\n}\n\nexport function semverToNumber(str) {\n return parseInt(\n '1' +\n str\n .split('.')\n .map(x => {\n return ('000' + x.replace(/[^0-9]/g, '')).slice(-3);\n })\n .join('')\n );\n}\n","import { useContext, useState, useRef, useLayoutEffect } from 'react';\nimport NamespaceContext from './NamespaceContext.js';\nimport SpreadsheetContext from './SpreadsheetContext';\n\n// !! Do not use this!! This is deprecated. Use the `useSheetValue`\n// hook instead. The reason this hasn't been refactored on top of it\n// is because the hook only exposes the value, not the node. It also\n// doesn't provide a setter function. In the future there will be\n// separate hooks for those things.\nexport default function SheetValue({\n binding,\n initialValue,\n children,\n onChange\n}) {\n if (!binding) {\n throw new Error('SheetValue binding is required');\n }\n\n if (global.IS_TESTING && typeof binding !== 'string' && !binding.name) {\n binding = { ...binding, name: binding.value.toString() };\n }\n\n binding =\n typeof binding === 'string' ? { name: binding, value: null } : binding;\n\n if (binding.name == null) {\n throw new Error('Binding name is now required');\n }\n\n let spreadsheet = useContext(SpreadsheetContext);\n let sheetName = useContext(NamespaceContext) || '__global';\n let [result, setResult] = useState({\n name: sheetName + '!' + binding.name,\n value: initialValue != null ? initialValue : binding.value,\n query: binding.query\n });\n let latestOnChange = useRef(onChange);\n let latestValue = useRef(result.value);\n\n function setCell() {\n throw new Error('setCell is not implemented anymore');\n }\n\n useLayoutEffect(() => {\n latestOnChange.current = onChange;\n latestValue.current = result.value;\n });\n\n useLayoutEffect(\n () => {\n if (binding.query) {\n spreadsheet.createQuery(sheetName, binding.name, binding.query);\n }\n\n return spreadsheet.bind(sheetName, binding, null, newResult => {\n if (latestOnChange.current) {\n latestOnChange.current(newResult);\n }\n\n if (newResult.value !== latestValue.current) {\n setResult(newResult);\n }\n });\n },\n [sheetName, binding.name]\n );\n\n return result.value != null ? children(result, setCell) : null;\n}\n","const uuid = require('uuid');\n\nmodule.exports = {\n v4: function() {\n return Promise.resolve(uuid.v4());\n },\n\n v4Sync: function() {\n return uuid.v4();\n }\n};\n"],"sourceRoot":""}