@tight-embedded/react 6.9.1 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{create as e}from"zustand";import{devtools as t,persist as n}from"zustand/middleware";import*as r from"react";import{useRef as a,useMemo as o,useContext as i,createContext as l,useEffect as s,Component as c,useState as d,useCallback as u,createElement as h,forwardRef as p,useLayoutEffect as m,useImperativeHandle as g,useReducer as v,Fragment as f}from"react";import"zustand/react/shallow";import{cloneDeep as b,entries as y,mapValues as w,isEqual as C,differenceBy as x,debounce as T,isEmpty as k}from"lodash-es";import{v4 as E}from"uuid";import*as A from"zod";import{z as S}from"zod";import{jsx as I,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as P,useIsRestoring as D,useQuery as M,keepPreviousData as L,useMutationState as F,useMutation as O,useQueries as V,useInfiniteQuery as U}from"@tanstack/react-query";import B from"yocto-queue";import H from"big.js";import{ResponsiveContainer as W,BarChart as z,Legend as _,CartesianGrid as j,XAxis as q,YAxis as K,Tooltip as Y,Bar as Z,ReferenceLine as G,Line as Q}from"recharts";import{flexRender as X,createColumnHelper as J,useReactTable as $,getCoreRowModel as ee,getExpandedRowModel as te}from"@tanstack/react-table";import{useFloatingNodeId as ne,useFloating as re,offset as ae,flip as oe,shift as ie,size as le,autoUpdate as se,useClick as ce,useDismiss as de,useRole as ue,useInteractions as he,useFloatingParentNodeId as pe,FloatingTree as me,FloatingNode as ge,useMergeRefs as ve,FloatingPortal as fe,FloatingOverlay as be,FloatingFocusManager as ye}from"@floating-ui/react";import{ContextAwareConfirmation as we,confirmable as Ce}from"react-confirm";import{createFormHookContexts as xe,useStore as Te,createFormHook as ke}from"@tanstack/react-form";import{NumericFormat as Ee}from"react-number-format";import Ae from"fuse.js";import Se from"react-inlinesvg";import{AnimatePresence as Ie,motion as Ne}from"motion/react";import{useDropzone as Re}from"react-dropzone";import{openDB as Pe}from"idb";import{PersistQueryClientProvider as De}from"@tanstack/react-query-persist-client";import{fetchEventSource as Me}from"@microsoft/fetch-event-source";import{Toast as Le,createToaster as Fe,Toaster as Oe}from"@ark-ui/react/toast";import{Portal as Ve}from"@ark-ui/react/portal";function Ue(e,t){return`${e.trim()}:${t.trim()}`}const Be=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,FEATUREFLAG_CATEGORY_SETTINGS:!1,FEATUREFLAG_GENERAL_LEDGER:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,Ue("featureFlags","updateFlags"))});function He(){return dn(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function We(){return dn(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}function ze(){return dn(e=>e.FEATUREFLAG_GENERAL_LEDGER)}let _e=null,je=!1;function qe(){const e=document.querySelector("meta[name='viewport']");if(!e)return null;const t=Object.fromEntries((e.getAttribute("content")??"").split(",").map(e=>{const[t,n=""]=e.trim().split("=");return[t.trim(),n.trim()]}));return{meta:e,params:t}}function Ke(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Ye(){const e=qe();if(!e)return;const{meta:t,params:n}=e;if(je)return t.remove(),je=!1,void(_e=null);_e?n["interactive-widget"]=_e:delete n["interactive-widget"],_e=null,Ke(t,n)}const Ze="drawerNavigation",Ge=(e,t)=>({drawerHistory:[],closingQueue:[],openDrawer:(t,n={})=>e(e=>{const{replaceHistory:r,routeProps:a}=n,o={[t]:{routeProps:a}};if(r||0===e.drawerHistory.length)return 0===e.drawerHistory.length&&function(){let e=qe();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),je=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;_e=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Ke(t,n)}(),{drawerHistory:[o]};{const t=b(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,Ue(Ze,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,Ue(Ze,"closeDrawer")),0===t().drawerHistory.length&&Ye()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,Ue(Ze,"closeAllDrawers")),Ye()},requestCloseDrawer:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t.length-1,r=t[n];return{drawerHistory:t.slice(0,n),closingQueue:[...e.closingQueue,r]}},void 0,Ue(Ze,"requestCloseDrawer")),requestCloseAllDrawers:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t[t.length-1];return{drawerHistory:[],closingQueue:[...e.closingQueue,n]}},void 0,Ue(Ze,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,Ue(Ze,"confirmCloseDrawer")),0===t().drawerHistory.length&&Ye()}}),Qe=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,Ue("externalOptions","setOptions"))});function Xe(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function Je(e){return Array.isArray(e)&&e.length>0}function $e(e){const t={...e,selectedValues:e=>e.filter(e=>e.modelKey===t.key),createFilter:e=>({...e,modelKey:t.key,id:E()}),searchFunc:e.searchFunc?e.searchFunc:e=>{return n=e,t.name.toLowerCase().includes(n.toLowerCase());var n}};return t}const et="search",tt=$e({key:et,name:"Search"});function nt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function rt(e,t,n){return new Date(e,t,n)}function at(e){const[t,n,r]=e.split("-");return rt(Number(t),Number(n),Number(r))}function ot(){return nt(rt(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function it(e,t){return nt(rt(t,e,1))}function lt(){const e=/* @__PURE__ */new Date;return nt(rt(e.getFullYear(),e.getMonth()+1,0))}function st(e){const t=/* @__PURE__ */new Date;return nt(rt(t.getFullYear(),t.getMonth()-e,1))}function ct(e){const t=e.getMonth(),n=t-t%3;return nt(rt(e.getFullYear(),n,1))}function dt(e){const t=e.getMonth(),n=t-t%3+3;return nt(rt(e.getFullYear(),n,0))}const ut={ALL_TIME:"ALL_TIME",THIS_MONTH:"THIS_MONTH",LAST_MONTH:"LAST_MONTH",LAST_3_MONTHS:"LAST_3_MONTHS",LAST_6_MONTHS:"LAST_6_MONTHS",LAST_12_MONTHS:"LAST_12_MONTHS",THIS_QUARTER:"THIS_QUARTER",LAST_QUARTER:"LAST_QUARTER",THIS_YEAR:"THIS_YEAR",LAST_YEAR:"LAST_YEAR"},ht={ALL_TIME:"All Time",THIS_MONTH:"This Month",LAST_MONTH:"Last Month",LAST_3_MONTHS:"Last 3 Months",LAST_6_MONTHS:"Last 6 Months",LAST_12_MONTHS:"Last 12 Months",THIS_QUARTER:"This Quarter",LAST_QUARTER:"Last Quarter",THIS_YEAR:"This Year",LAST_YEAR:"Last Year"},pt=e=>Object.values(ut).includes(e),mt={[ut.ALL_TIME]:()=>"",[ut.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return it(e.getMonth(),e.getFullYear())}(),[ut.LAST_YEAR]:()=>nt(rt(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[ut.LAST_MONTH]:()=>st(1),[ut.LAST_6_MONTHS]:()=>st(5),[ut.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return nt(rt(e.getFullYear(),e.getMonth()-11,1))}(),[ut.THIS_YEAR]:()=>nt(rt(/* @__PURE__ */(new Date).getFullYear(),0,1)),[ut.LAST_3_MONTHS]:()=>st(2),[ut.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ct(rt(e.getFullYear(),e.getMonth()-3,1))}(),[ut.THIS_QUARTER]:()=>ct(/* @__PURE__ */new Date)};function gt(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&void 0===t.endDate||void 0===t.beginDate&&"string"==typeof t.endDate||"string"==typeof t.beginDate&&"string"==typeof t.endDate}const vt=e=>mt[e](),ft={[ut.ALL_TIME]:()=>"",[ut.THIS_MONTH]:()=>lt(),[ut.LAST_YEAR]:()=>nt(rt(/* @__PURE__ */(new Date).getFullYear(),0,0)),[ut.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return nt(rt(e.getFullYear(),e.getMonth(),0))}(),[ut.LAST_6_MONTHS]:()=>lt(),[ut.LAST_12_MONTHS]:()=>lt(),[ut.THIS_YEAR]:()=>ot(),[ut.LAST_3_MONTHS]:()=>lt(),[ut.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return dt(rt(e.getFullYear(),e.getMonth()-3,1))}(),[ut.THIS_QUARTER]:()=>dt(/* @__PURE__ */new Date)},bt=e=>ft[e](),yt=e=>{return pt(e)?{beginDate:vt(e),endDate:bt(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:nt((t=e).beginDate),endDate:nt(t.endDate)};var t},wt=["SUN","MON","TUE","WED","THU","FRI","SAT"],Ct=["January","February","March","April","May","June","July","August","September","October","November","December"];function xt({yearsBack:e=10,startYear:t}){const n=t??/* @__PURE__ */(new Date).getFullYear(),r=[n];for(let a=n-1;a>=n-e;a--)r.push(a);return r}function Tt(e,t){return e.toDateString()===t.toDateString()}function kt(e){return Tt(e,/* @__PURE__ */new Date)}function Et(e,t){const n=rt(e.getFullYear(),e.getMonth(),e.getDate()),r=rt(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function At(e){return e&&e instanceof Date&&!isNaN(e.getTime())?`${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getDate()).padStart(2,"0")}/${e.getFullYear()}`:""}function St(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=rt(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function It(e){if(!e.trim())return null;const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return St(o,i,l)?rt(l,o-1,i):null}function Nt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,4})-(\d{1,2})-(\d{1,2})/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return St(i,l,o)?rt(o,i-1,l):null}function Rt(e){if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getDate()).padStart(2,"0");return`${t}-${String(e.getMonth()+1).padStart(2,"0")}-${n}`}function Pt(e,t){return Et(e,t)?t:e}function Dt(e,t){return Et(t,e)?t:e}const Mt=(e,t)=>{const n={month:t.abbreviateMonth?"short":"long",year:t.abbreviateYear?"2-digit":"numeric"},r=e.toLocaleString("default",n);let a=r;if(t.abbreviateYear){const e=r.length-2;a=r.slice(0,e)+"'"+r.slice(e)}return a},Lt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return kt(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Mt(t,{abbreviateMonth:!0,abbreviateYear:!1})},Ft=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Ot(e,t){return rt(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Vt(e){const{month:t,year:n}=e;return{beginDate:rt(n,t-1,1),endDate:rt(n,t+1,0)}}const Ut="date",Bt=Object.values(ut).map(e=>{return{name:ht[t=e],value:{date:{name:ht[t],value:t}}};var t}),Ht=$e({key:Ut,name:"Date",possibleValues:()=>({values:Bt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function Wt(e){return"OWNER"===e||"READ_ONLY"===e}function zt(e){if(0===e.length)return e;const t=function(e,t){if(0===e.length)return-1;let n=e.length-1;for(;n>-1;){if(t(e[n]))return n;n--}return-1}(e,e=>e.modelKey===et);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==et)}const _t=Ht.createFilter({name:ht[ut.LAST_12_MONTHS],value:{date:{name:ht[ut.LAST_12_MONTHS],value:ut.LAST_12_MONTHS}}});function jt(e,t){return zt([...t.some(e=>e.modelKey===Ut)?function(e){const t=e.findIndex(e=>e.modelKey===Ut);return-1!==t?Xe(e,t):e}(e.filters):e.filters,...t])}function qt(e,t){const n=e.filters[t];return n&&n.modelKey===Ut?function(e,t){const n=[...e];return n[t]=_t,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Kt(e){return zt(e.some(e=>e.modelKey===Ut)?e:[...e,_t])}function Yt(e,t){if(e.hasInitialized)return e;const n=[];return Wt(t.userRole)&&t.hasNonReconciledTransactions&&t.needsReviewStatuses.length>0&&n.push({modelKey:"reviewStatus",id:E(),name:"Needs Review",value:{reviewStatus:{name:"Needs Review",value:{in:t.needsReviewStatuses}}}}),n.push(_t),{filters:n,hasInitialized:!0}}const Zt="transactionsDashboardFilters",Gt=e=>({transactionsDashboardFilters:[_t],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:jt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ue(Zt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:qt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ue(Zt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Kt(t)}),void 0,Ue(Zt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Yt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,Ue(Zt,"initialize"))}),Qt="expenseDashboardFilters",Xt=e=>({expenseDashboardFilters:[_t],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:jt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ue(Qt,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:qt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ue(Qt,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Kt(t)}),void 0,Ue(Qt,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Yt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,Ue(Qt,"initialize"))}),Jt="incomeDashboardFilters",$t=e=>({incomeDashboardFilters:[_t],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:jt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ue(Jt,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:qt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ue(Jt,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Kt(t)}),void 0,Ue(Jt,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Yt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,Ue(Jt,"initialize"))}),en="generalLedgerFilters",tn="ACCRUAL",nn={generalLedgerGlAccountId:void 0,generalLedgerDateRange:void 0,generalLedgerAccountingMethod:tn},rn=e=>({...nn,setGeneralLedgerGlAccountId:t=>e(e=>({...e,generalLedgerGlAccountId:t}),void 0,Ue(en,"setGlAccountId")),setGeneralLedgerDateRange:t=>e(e=>({...e,generalLedgerDateRange:t}),void 0,Ue(en,"setDateRange")),setGeneralLedgerAccountingMethod:t=>e(e=>({...e,generalLedgerAccountingMethod:t}),void 0,Ue(en,"setAccountingMethod")),setGeneralLedgerFilters:t=>e(e=>({...e,generalLedgerGlAccountId:t.glAccountId,generalLedgerDateRange:t.dateRange,generalLedgerAccountingMethod:t.accountingMethod}),void 0,Ue(en,"setFilters")),resetGeneralLedgerFilters:()=>e(e=>({...e,...nn}),void 0,Ue(en,"reset"))}),an={label:"Connected Accounts",value:"connected"},on="banksAndIntegrationsState",ln=e=>({banksAndIntegrationsSelectedTab:an,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,Ue(on,"setBanksAndIntegrationsSelectedTab")),toggleExpandedIntegration:(t,n)=>e(e=>({expandedPlaidItems:e.expandedPlaidItems.includes(t)||n&&!e.hasExpandedUpdated?e.expandedPlaidItems.filter(e=>e!==t):[...e.expandedPlaidItems,t],hasExpandedUpdated:!0}),void 0,Ue(on,"toggleExpandedIntegration"))}),sn={plaidLink:null,plaidLinkEvent:null,plaidLinkError:null,gusto:null,payroll:null,bITile:null,conversations:null,bill:null,transactionForm:null,customer:null},cn=e=>({events:sn,setEvents:t=>e(e=>({events:{...e.events,...t}}),void 0,Ue("events","setEvents"))}),dn=e()(t(n((...e)=>({...Be(...e),...Ge(...e),...Qe(...e),...Gt(...e),...Xt(...e),...$t(...e),...rn(...e),...ln(...e),...cn(...e)}),{name:"tight-featureflag-storage",partialize:e=>{const t=Object.entries(e).filter(([e])=>e.startsWith("FEATUREFLAG"));return Object.fromEntries(t)}}),{name:"globalStore",store:"globalStore",enabled:!1})),un={SELECT:"select",EXPAND:"expand"},hn={...un,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},pn=[hn.COMMENTS,hn.DATE,hn.DESCRIPTION,hn.AMOUNT,hn.CATEGORY,hn.DIMENSION_VALUE,hn.REVIEW_STATUS],mn=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(pn)))}),gn=e=>{const t=mn.safeParse(e);return t.success?t.data:void 0},vn=A.optional(A.string().trim()),fn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,bn=A.optional(A.array(A.string().trim())),yn=A.object({integrations:A.optional(A.array(A.enum(["UNIT","STRIPE","GUSTO","SHOPIFY","SQUARE","RUTTER","UBER","MOOV","QUALPAY","MANUAL_ENTRY","PARTNER_IMPLEMENTATION","QBO","XERO","FRESHBOOKS"]))),useOnPlaidLink:A.optional(A.boolean()),hideManualBanks:A.optional(A.boolean())}),wn={transactionsDashboard:gn,incomeDashboard:gn,expenseDashboard:gn,accessToken:e=>{const t=vn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=bn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>fn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=yn.safeParse(e);return t.success?t.data:void 0}},Cn=(e,t)=>{if(void 0!==wn[e])return(0,wn[e])(t)};function xn(e){const t=a(!1),n=dn(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=Cn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=dn(e=>e.externalOptions);return{options:o(()=>b(r),[r]),setOptions:n}}const Tn=l(null);function kn(){return i(Tn)}function En(e){const t=a(!1),n=dn(e=>e.setEvents);return s(()=>{e&&!t.current&&(n(e),t.current=!0)},[e,n]),[dn(e=>e.events),n]}function An(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Sn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function In(e){return String.fromCharCode(e+(e>25?39:97))}function Nn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=In(t%52)+n;return In(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var Rn=/\s*!(important)?/i;function Pn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var Dn=e=>{const t=/* @__PURE__ */new Map;return(...n)=>{const r=JSON.stringify(n);if(t.has(r))return t.get(r);const a=e(...n);return t.set(r,a),a}},Mn=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Ln(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(Mn.has(n))return;const r=e[n],a=t[n];An(r)&&An(a)?e[n]=Ln(r,a):e[n]=a}),e):e,{})}var Fn=e=>null!=e;function On(e,t,n={}){const{stop:r,getKey:a}=n;return function e(n,o=[]){if("object"==typeof(i=n)&&null!==i){const i={};for(const[l,s]of Object.entries(n)){const c=a?.(l,s)??l,d=[...o,c];if(r?.(n,d))return t(n,o);const u=e(s,d);Fn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Vn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return On(e,e=>{return Array.isArray(e)?(t=e,n=a.breakpoints.keys,t.reduce((e,t,r)=>{const a=n[r];return null!=t&&(e[a]=t),e},{})):e;var t,n},{stop:e=>Array.isArray(e),getKey:n?e=>o?i(e):e:void 0})}var Un={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Bn=/([A-Z])/g,Hn=/^ms-/,Wn=Dn(e=>e.startsWith("--")?e:e.replace(Bn,"-$1").replace(Hn,"-ms-").toLowerCase()),zn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),_n=`(?:${"cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%".split(",").join("|")})`,jn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${_n}$`),qn={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):An(e)?On(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&zn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&jn.test(e)},Kn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Sn(t))};const Yn=new Set("_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,_supportHover,_notDisabled,_scrolledX,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,1_5xl,1_5xlOnly,1_5xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo1_5xl,smTo2xl,mdToLg,mdToXl,mdTo1_5xl,mdTo2xl,lgToXl,lgTo1_5xl,lgTo2xl,xlTo1_5xl,xlTo2xl,1_5xlTo2xl,@/md,@/lg,@/xl,@tight-component/md,@tight-component/lg,@tight-component/xl,@page/md,@page/lg,@page/xl,@report-table-container/md,@report-table-container/lg,@report-table-container/xl,_themeBizhub,base".split(",")),Zn=/^@|&|&$/;function Gn(e){return Yn.has(e)||Zn.test(e)}const Qn=/^_/,Xn=/&|@/,Jn=/* @__PURE__ */new Map;"aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos,top:top,left:left,inset:inset,insetInline:inset-x,insetBlock:inset-y,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e,insetInlineStart:inset-s,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p,paddingLeft:pl,paddingRight:pr,paddingTop:pt,paddingBottom:pb,paddingBlock:py,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px,paddingInlineEnd:pe,paddingInlineStart:ps,marginLeft:ml,marginRight:mr,marginTop:mt,marginBottom:mb,margin:m,marginBlock:my,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx,marginInlineEnd:me,marginInlineStart:ms,spaceX:sx,spaceY:sy,outlineWidth:ring-w,outlineColor:ring-c,outline:ring,outlineOffset:ring-o,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w,inlineSize:w-is,minWidth:min-w,minInlineSize:min-w-is,maxWidth:max-w,maxInlineSize:max-w-is,height:h,blockSize:h-bs,minHeight:min-h,minBlockSize:min-h-bs,maxHeight:max-h,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p,backgroundPositionX:bg-p-x,backgroundPositionY:bg-p-y,backgroundAttachment:bg-a,backgroundClip:bg-cp,background:bg,backgroundColor:bg-c,backgroundOrigin:bg-o,backgroundImage:bg-i,backgroundRepeat:bg-r,backgroundBlendMode:bg-bm,backgroundSize:bg-s,backgroundGradient:bg-grad,backgroundLinear:bg-linear,backgroundRadial:bg-radial,backgroundConic:bg-conic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr,borderTopLeftRadius:bdr-tl,borderTopRightRadius:bdr-tr,borderBottomRightRadius:bdr-br,borderBottomLeftRadius:bdr-bl,borderTopRadius:bdr-t,borderRightRadius:bdr-r,borderBottomRadius:bdr-b,borderLeftRadius:bdr-l,borderStartStartRadius:bdr-ss,borderStartEndRadius:bdr-se,borderStartRadius:bdr-s,borderEndStartRadius:bdr-es,borderEndEndRadius:bdr-ee,borderEndRadius:bdr-e,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x,borderInlineWidth:bd-x-w,borderInlineColor:bd-x-c,borderBlock:bd-y,borderBlockWidth:bd-y-w,borderBlockColor:bd-y-c,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s,borderInlineStartWidth:bd-s-w,borderInlineStartColor:bd-s-c,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e,borderInlineEndWidth:bd-e-w,borderInlineEndColor:bd-e-c,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh,boxShadowColor:bx-sh-c,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x,translateY:translate-y,translateZ:translate-z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor".split(",").forEach(e=>{const[t,n]=e.split(":");Jn.set(t,n)});const $n={conditions:{shift:function(e){return e.sort((e,t)=>{const n=Gn(e),r=Gn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Yn.has(e)?e.replace(Qn,""):Xn.test(e)?`[${Pn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${Jn.get(e)||Wn(e)}_${Pn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},er=function(e){const{utility:t,hash:n,conditions:r=Un}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return Dn(({base:o,...i}={})=>{const l=Vn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return On(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&Rn.test(u),[l,...c]=r.shift(o),d=c.slice().filter(e=>!/* @__PURE__ */(e=>"base"===e)(e));var u;const h=t.transform(l,function(e){return"string"==typeof e?e.replace(Rn,"").trim():e}((e=>"string"==typeof e?e.replaceAll(/[\n\s]+/g," "):e)(e)));let p=((e,o)=>{let i;if(n){const n=[...r.finalize(e),o];i=a(t.toHash(n,Nn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}($n),tr=(...e)=>er(nr(...e));tr.raw=(...e)=>nr(...e);const{mergeCss:nr}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>An(e)&&Object.keys(Sn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Vn(t,e))}return{mergeCss:Dn(function(...e){return Ln(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}($n);function rr(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const ar=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function or(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=ar(e),o=e=>({...r,...Sn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=nr(i,n[t][a]));const l=function(e,t){let n={};return e.forEach(e=>{Object.entries(e).every(([e,n])=>"css"===e||(Array.isArray(n)?n:[n]).some(n=>t[e]===n))&&(n=nr(n,e.css))}),n}(a,r);return nr(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(Dn(function(e){return tr(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=ar(e.config),i=((...e)=>{const t=e.reduce((e,t)=>(t&&t.forEach(t=>e.add(t)),e),/* @__PURE__ */new Set([]));return Array.from(t)})(e.variantKeys,Object.keys(n));return or({base:nr(t,o.base),variants:Object.fromEntries(i.map(e=>[e,nr(n[e],o.variants[e])])),defaultVariants:Ln(r,o.defaultVariants),compoundVariants:[...a,...o.compoundVariants]})},splitVariantProps:function(e){return function(e,...t){const n=Object.getOwnPropertyDescriptors(e),r=Object.keys(n),a=e=>{const t={};for(let r=0;r<e.length;r++){const a=e[r];n[a]&&(Object.defineProperty(t,a,n[a]),delete n[a])}return t};return t.map(e=>a(Array.isArray(e)?e:r.filter(e))).concat(a(r))}(e,l)},getVariantProps:o})}var ir,lr=((ir=lr||{}).component="component",ir["dashboard-placeholder-table"]="dashboard-placeholder-table",ir["dashboard-header"]="dashboard-header",ir["dashboard-table"]="dashboard-table",ir["dashboard-table-body"]="dashboard-table-body",ir["dashboard-table-cell"]="dashboard-table-cell",ir["dashboard-table-column-header"]="dashboard-table-column-header",ir["dashboard-table-header"]="dashboard-table-header",ir.label="label",ir.popup="popup",ir["popup-sort-row"]="popup-sort-row",ir["progress-bar"]="progress-bar",ir["progress-bar-fill"]="progress-bar-fill",ir.drawer="drawer",ir.summation="summation",ir["table-parent-row"]="table-parent-row",ir["table-row"]="table-row",ir["table-sub-row"]="table-sub-row",ir.tile="tile",ir["tile-bar-label"]="tile-bar-label",ir["tile-bar-label-outer"]="tile-bar-label-outer",ir["tile-body"]="tile-body",ir["tile-filter-button"]="tile-filter-button",ir["tile-filter-list"]="tile-filter-list",ir["tile-filter-row"]="tile-filter-row",ir["tile-header"]="tile-header",ir["business-owner-dashboard"]="business-owner-dashboard",ir["business-owner-dashboard-header"]="business-owner-dashboard-header",ir["transaction-type-label"]="transaction-type-label",ir["transaction-date-cell-container"]="transaction-date-cell-container",ir["selector-row"]="selector-row",ir["popup-list"]="popup-list",ir.badge="badge",ir["badge-chip"]="badge-chip",ir["date-cell"]="date-cell",ir["vertical-divider"]="vertical-divider",ir["horizontal-divider"]="horizontal-divider",ir["checkbox-input"]="checkbox-input",ir["bulk-select"]="bulk-select",ir["button-base"]="button-base",ir["button-discreet-small"]="button-discreet-small",ir["button-primary"]="button-primary",ir["button-secondary"]="button-secondary",ir["button-success"]="button-success",ir["button-danger"]="button-danger",ir["button-warning"]="button-warning",ir["button-action"]="button-action",ir["button-table-header"]="button-table-header",ir["button-inline"]="button-inline",ir["small-square-button"]="small-square-button",ir.card="card",ir["card-button"]="card-button",ir["card-button-icon-container"]="card-button-icon-container",ir["pagination-button"]="pagination-button",ir.text="text",ir["cell-button"]="cell-button",ir["selector-button"]="selector-button",ir["review-status-selector-button"]="review-status-selector-button",ir["review-status-dropdown-arrow"]="review-status-dropdown-arrow",ir["financial-summary-layout"]="financial-summary-layout",ir["financial-summary-chatbox"]="financial-summary-chatbox",ir["financial-summary-chatbox-header"]="financial-summary-chatbox-header",ir["month-picker"]="month-picker",ir["month-picker-left-button"]="month-picker-left-button",ir["month-picker-right-button"]="month-picker-right-button",ir["month-picker-label"]="month-picker-label",ir["filter-bar"]="filter-bar",ir["filter-search-bar"]="filter-search-bar",ir.pill="pill",ir["filter-pill"]="filter-pill",ir["email-pill"]="email-pill",ir["discreet-form-input"]="discreet-form-input",ir["editable-form-input"]="editable-form-input",ir["amount-input"]="amount-input",ir["modal-popup"]="modal-popup",ir["drawer-header"]="drawer-header",ir["form-body"]="form-body",ir.body="body",ir.heading="heading",ir["sub-label"]="sub-label",ir["strong-label"]="strong-label",ir["strong-sub-label"]="strong-sub-label",ir["weak-label"]="weak-label",ir["metric-xl"]="metric-xl",ir["metric-md"]="metric-md",ir["large-icon"]="large-icon",ir["medium-icon"]="medium-icon",ir["small-icon"]="small-icon",ir["tiny-icon"]="tiny-icon",ir["x-large-icon"]="x-large-icon",ir["xx-large-icon"]="xx-large-icon",ir["category-icon"]="category-icon",ir["card-header"]="card-header",ir.icon="icon",ir["neutral-badge"]="neutral-badge",ir["highlight-badge"]="highlight-badge",ir["success-badge"]="success-badge",ir["warning-badge"]="warning-badge",ir["danger-badge"]="danger-badge",ir["critical-badge"]="critical-badge",ir["button-group"]="button-group",ir["alert-dialog"]="alert-dialog",ir["alert-header"]="alert-header",ir["emphasis-label"]="emphasis-label",ir["profit-loss-graph"]="profit-loss-graph",ir.banner="banner",ir["banner-high"]="banner-high",ir["banner-medium"]="banner-medium",ir["banner-low"]="banner-low",ir["banner-urgent"]="banner-urgent",ir["banner-default"]="banner-default",ir["banner-button"]="banner-button",ir["banner-button-text"]="banner-button-text",ir["banner-button-icon"]="banner-button-icon",ir["banner-icon"]="banner-icon",ir["banner-title"]="banner-title",ir["empty-dashboard-layout"]="empty-dashboard-layout",ir["emphasis-sub-label"]="emphasis-sub-label",ir["bar-transactions-positive"]="bar-transactions-positive",ir["bar-transactions-negative"]="bar-transactions-negative",ir["message-sent"]="message-sent",ir["message-received"]="message-received",ir["date-amount-header"]="date-amount-header",ir["close-button"]="close-button",ir["start-date-form-section"]="start-date-form-section",ir["beginning-balance-form-section"]="beginning-balance-form-section",ir["date-picker-nav-button"]="date-picker-nav-button",ir["date-picker-day-button"]="date-picker-day-button",ir["dropdown-selector-button"]="dropdown-selector-button",ir.chip="chip",ir["attachment-dropzone"]="attachment-dropzone",ir["list-body"]="list-body",ir["loading-skeleton"]="loading-skeleton",ir["line-item-card"]="line-item-card",ir["linked-entity-row"]="linked-entity-row",ir["drawer-search-bar"]="drawer-search-bar",ir["value-comparison-summary"]="value-comparison-summary",ir["category-selector-table-cell"]="category-selector-table-cell",ir["zero-state-button"]="zero-state-button",ir.toast="toast",ir["toast-dismiss"]="toast-dismiss",ir);const sr=e=>null==e,cr=e=>!sr(e),dr="Tight-",ur=e=>`${dr}${e}`;function hr(e){return e in lr}function pr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===dr&&r in lr}function mr(e){return!hr(e)&&!pr(e)}const gr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(ur(e)),t.forEach(e=>{sr(e)||(mr(e)?r.push(e):hr(e)?n.push(ur(e)):pr(e)&&n.push(e))}),{className:rr(...n,...r)}},vr=tr.raw({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}),fr=gr(lr["business-owner-dashboard-header"],tr(vr));function br({children:e}){return I("div",{...fr,children:e})}function yr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(pr(t)&&e.push(t),e),[])],[])}function wr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(mr(t)&&e.push(t),e),[])],[])}function Cr(e){const t=Array.isArray(e)?e:[e];return{className:rr(...yr(t),...wr(t))}}const xr=or({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:"template"}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:"template"},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:"template"},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"template",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"template"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:"template"},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:"template"},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:"template"}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"template"}},metric:{sm:{fontWeight:"metric.sm",fontSize:"metric.sm",fontFamily:"metric",color:"typography.metric.sm"},md:{fontWeight:"metric.md",fontSize:"metric.md",fontFamily:"metric",color:"typography.metric.md"},lg:{fontWeight:"metric.lg",fontSize:"metric.lg",fontFamily:"metric",color:"typography.metric.lg"},xl:{fontWeight:"metric.xl",fontSize:"metric.xl",fontFamily:"metric",color:"typography.metric.xl"}}}}),Tr=gr(lr.heading,xr({heading:"default"}));function kr({children:e,stylists:t=[]}){const n=Cr([Tr,...t]);return I("div",{...n,children:e})}function Er(e,t,n){return[...e,{accessToken:t,environment:n}]}function Ar(e,t){return[...e,t]}function Sr(e){return""===e.trim()}function Ir(e){return sr(e)||Sr(e)}function Nr(e){return!Ir(e)}const Rr=l({activeToken:void 0,accountantToken:void 0});function Pr(){const{activeToken:e}=i(Rr);return e}const Dr=()=>{throw new Error("No access token provided")},Mr=72e5,Lr=new P({defaultOptions:{queries:{gcTime:Mr,staleTime:3e4,refetchInterval:6e4}}}),Fr=l("SANDBOX");function Or(){return i(Fr)}function Vr({queryKey:e,queryFn:t,...n}){const r=Pr(),a=Or(),o=Nr(r),i=Er(e,r??"",a),l=D(),s=M({...n,queryKey:i,queryFn:o?t:Dr,...o?{}:{retry:!1,staleTime:1/0}},Lr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Ur{constructor(e){this.client=e}async sendEvent({apiKey:e,events:t,notifier:n,payloadVersion:r}){const a=/* @__PURE__ */(new Date).toISOString(),o=JSON.stringify({apiKey:e,payloadVersion:r,notifier:n,events:t});await fetch(this.client.endpoints.notify,{method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":r,"Bugsnag-Sent-At":a},referrerPolicy:"no-referrer",body:o})}}const Br=Symbol("Circular"),Hr=Symbol("AccessError");function Wr(e,t,n){return zr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function zr({key:e,value:t,replacer:n,seen:r,depthLimit:a=1/0,depth:o,edgeIndex:i,edgesLimit:l=1/0}){let s=t;if(r.includes(s)&&(s=Br),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=_r(()=>s.toJSON(String(e)))),null===s||"object"!=typeof s)return s;var c;if(o>a||i+1>l)return"[...]";if(r.push(t),Array.isArray(s)){const e=[],t=Math.min(s.length,l);for(let i=0;i<t;i++){const t=_r(()=>s[i]);e.push(zr({key:i,value:t,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l}))}t<s.length&&e.push("[...]"),s=e}else{const e={},t=Object.keys(s);for(let i=0;i<t.length;i++){const c=t[i],d=_r(()=>s[c]);e[c]=zr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function _r(e){try{return e()}catch{return Hr}}const jr=Object.prototype.toString,qr=Object.getPrototypeOf;function Kr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Yr=/^\s*at .*(\S+:\d+|\(native\))/m,Zr=/^(eval@)?(\[native code])?$/;function Gr(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)return[e];const n=t[2]?parseInt(t[2],10):void 0,r=t[3]?parseInt(t[3],10):void 0;return[t[1],n,r]}function Qr(e,t){const n=Xr(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Kr(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[Jr(n)];return a.push(...ta(n).map(e=>Jr(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function Xr(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===jr.call(t))return!0;t=qr(t)}return!1}(e))return e;let n=function(e){if(!Kr(e))return null;const t=t=>{const n=e[t];if("string"==typeof n&&e[t.length])return n},n=t("name")||t("errorClass"),r=t("message")||t("errorMessage");if(!n||!r)return null;const a=new Error(r);return a.name=n,a}(e);if(n)return n;switch(typeof n){case"string":case"number":case"boolean":return new Error(String(e));default:return n=new Error(`${t} received a non-error. See "${t}" tab for more detail.`),n.name="InvalidError",n}}function Jr(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:$r(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function $r(e,{backtrace:t}){const n=function(e){let t=e.stack;return void 0===t&&(t=e.stacktrace),"string"==typeof t&&t.length&&t!==`${e.name}: ${e.message}`?t:void 0}(e);return n?function(e){return(e.match(Yr)?e.split("\n").filter(e=>!!e.match(Yr)).map(e=>{e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),a=Gr(n?n[1]:r.pop()||"(no location)"),o=r.join(" ")||void 0;return{file:["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0],lineNumber:a[1],columnNumber:a[2],method:o}}):(t=e,t.split("\n").filter(e=>!e.match(Zr)).map(e=>{if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return{method:e};{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=Gr(e.replace(t,""));return{file:a[0],lineNumber:a[1],columnNumber:a[2],method:r}}}))).reduce((e,t)=>{if("{}"===JSON.stringify(t))return e;let n=t.file||t.method||"number"!=typeof t.lineNumber?t.file||"(unknown file)":"global code";n=n.replace(/\?.*$/,"").replace(/#.*$/,"");let r=t.method||"(unknown function)";return r=/^global code$/i.test(r)?"global code":r,e.concat([{file:n,lineNumber:t.lineNumber,columnNumber:t.columnNumber,method:r}])},[]);var t}(n):t?function(){const e=[];let t;try{t=arguments.callee}catch{return[]}for(;t&&e.length<ea;){t.name?e.push({method:t.name,file:"(unknown file)"}):/function(?:\s+([\w$]+))+\s*\(/.test(t.toString())&&e.push({method:RegExp.$1,file:"(unknown file)"});try{t=t.caller}catch{break}}return e}():[]}const ea=20;function ta(e){const t=e;if(t.cause){const e=Xr(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(ta(e))}return[]}function na(...e){console.error}const ra={name:"errorBreadcrumbs",load(e){e.addOnPostError(t=>{e.leaveBreadcrumb(t.exceptions[0].errorClass,{errorClass:t.exceptions[0].errorClass,errorMessage:t.exceptions[0].message,severity:t.severity},"error")})}};let aa=Date.now();const oa=()=>{aa=Date.now()},ia={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-aa,!0}),{reset:oa})},la=[["Edge (EdgeHTML)",/Edge\/([0-9._]+)/],["Edge (iOS)",/EdgiOS\/([0-9._]+)/],["Yandex",/YaBrowser\/([0-9._]+)/],["KakaoTalk",/KAKAOTALK\s([0-9.]+)/],["Samsung",/SamsungBrowser\/([0-9.]+)/],["Silk",/\bSilk\/([0-9._-]+)\b/],["MIUI",/MiuiBrowser\/([0-9.]+)$/],["Beaker",/BeakerBrowser\/([0-9.]+)/],["Edge (Chromium)",/EdgA?\/([0-9.]+)/],["Chromium WebView",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome (iOS)",/CriOS\/([0-9.]+)(:?\s|$)/],["Firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["Firefox (iOS)",/FxiOS\/([0-9.]+)/],["Opera Mini",/Opera Mini.*Version\/([0-9.]+)/],["Opera",/Opera\/([0-9.]+)(?:\s|$)/],["Opera",/OPR\/([0-9.]+)(:?\s|$)/],["Internet Explorer",/Trident\/7\.0.*rv:([0-9.]+).*\).*Gecko$/],["Internet Explorer",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["Internet Explorer",/MSIE\s(7\.0)/],["Blackberry",/BB10;\sTouch.*Version\/([0-9.]+)/],["Android",/Android\s([0-9.]+)/],["Safari (iOS)",/Version\/([0-9._]+).*Mobile.*Safari.*/],["Safari",/Version\/([0-9._]+).*Safari/],["Facebook",/FB[AS]V\/([0-9.]+)/],["Instagram",/Instagram\s([0-9.]+)/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Mobile/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Gecko\)$/]],sa=[["iOS",void 0,/iP(hone|od|ad)/],["Android",void 0,/Android/],["BlackBerry",void 0,/BlackBerry|BB10/],["Windows Mobile",void 0,/IEMobile/],["Kindle",void 0,/Kindle/],["Windows","3.11",/Win16/],["Windows","95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows","98",/(Windows 98)|(Win98)/],["Windows","2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows","XP",/(Windows NT 5.1)|(Windows XP)/],["Windows","Server 2003",/(Windows NT 5.2)/],["Windows","Vista",/(Windows NT 6.0)/],["Windows","7",/(Windows NT 6.1)/],["Windows","8",/(Windows NT 6.2)/],["Windows","8.1",/(Windows NT 6.3)/],["Windows","10+",/(Windows NT 10.0)/],["Windows","ME",/Windows ME/],["Open BSD",void 0,/OpenBSD/],["Sun OS",void 0,/SunOS/],["Chrome OS",void 0,/CrOS/],["Linux",void 0,/(Linux)|(X11)/],["Mac OS",void 0,/(Mac_PowerPC)|(Macintosh)/],["QNX",void 0,/QNX/],["BeOS",void 0,/BeOS/],["OS/2",void 0,/OS\/2/]],ca=(da=function(e){const t=""!==(n=e)&&la.reduce((e,[t,r])=>{if(e)return e;const a=r.exec(n);return!!a&&[t,a]},!1);var n;if(!t)return{};const[r,a]=t,o=function(e){for(const[t,n,r]of sa)if(r.exec(e))return{osName:t,osVersion:n};return null}(e),i="iOS"===o?.osName?function(e){const t=/iPad|iPhone|iPod/.exec(e);return t?{manufacturer:"Apple",model:t[0]}:/MacIntel/.test(e)&&self.navigator&&self.navigator.maxTouchPoints&&self.navigator.maxTouchPoints>2?{manufacturer:"Apple",model:"iPad"}:null}(e):{};return{browserName:r,browserVersion:a[1],osName:o?.osName,osVersion:o?.osVersion,manufacturer:i?.manufacturer,model:i?.model}},{name:"browserContext",load(e){e.addOnError(e=>{e.request={...e.request,url:self.location.href},e.context=e.context||self.location.pathname,e.device={...e.device,...da(self.navigator.userAgent),locale:self.navigator.language,userAgent:self.navigator.userAgent};let t=["n/a"];try{t=self.navigator.languages}catch{}return e.metaData={...e.metaData,language:{language:self.navigator.language,languages:t}},!0})}});var da;class ua{limit;period;events;constructor(e,t){this.limit=e,this.period=t,this.events=new B}reset(){this.events.clear()}increment(){const e=/* @__PURE__ */(new Date).getTime();if(void 0!==this.period){let t=this.events.peek();for(;void 0!==t&&e-this.period>t;)this.events.dequeue(),t=this.events.peek()}const t=this.events.size+1<=this.limit;return t&&this.events.enqueue(e),t}get size(){return this.events.size}}class ha extends c{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}handleClearError(){this.setState({error:void 0,errorInfo:void 0})}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){const{exceptions:n,metadata:r}=Qr(e,"notify");t&&t.componentStack&&(t.componentStack=function(e){const t=e.split(/\s*\n\s*/g);let n="";for(let r=0,a=t.length;r<a;r++)t[r].length&&(n+=`${n.length?"\n":""}${t[r]}`);return n}(t.componentStack));const{onError:a,client:o}=this.props;o.notifyEvent({exceptions:n,unhandled:!0,severity:"error",severityReason:{type:"unhandledException"},metadata:{...r,react:t},onError:a},e),this.setState({errorInfo:t})}render(){const{error:e}=this.state;if(e){const{FallbackComponent:e}=this.props;if(e)return I(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return I(N,{children:this.props.children})}}const pa={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(ha,{client:e,onError:t,FallbackComponent:n,children:r})})},ma=new class{breadcrumbs=[];config;delivery=new Ur(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return na(),this;let t;this.config=e,this.config.onError&&(t=Array.isArray(this.config.onError)?this.config.onError:[this.config.onError]),this.errorCallbacks=new Set(t);for(const n of this.config.plugins||[])this.plugins.push({name:n.name||"unknown",plugin:n.load(this)});return this}get endpoints(){return{notify:this.config?.endpoints?.notify||"https://notify.bugsnag.com/"}}notify(e,t={}){const{exceptions:n,metadata:r}=Qr(e,"notify");let a,o,i=r;return"function"==typeof t?a=t:(o=t.severity,t.metadata&&(i={...r,...t.metadata})),this.notifyEvent({exceptions:n,metadata:i,severity:o,onError:a},e)}leaveBreadcrumb(e,t,n){if(!this.config)return;if("string"!=typeof e)try{e=String(e)}catch{e="Unable to stringify breadcrumb message"}if(!e.length)return;this.breadcrumbs.push({name:e,metaData:t,type:n||"manual",timestamp:/* @__PURE__ */(new Date).toISOString()});const{maxBreadcrumbs:r=25}=this.config;this.breadcrumbs.length>r&&this.breadcrumbs.splice(0,this.breadcrumbs.length-r)}async notifyEvent({exceptions:e,unhandled:t,severity:n,severityReason:r,metadata:a,onError:o},i){if(!this.config)return;const l=this.config.releaseStage||"production";if(this.config.enabledReleaseStages&&!this.config.enabledReleaseStages.includes(l))return;const s={exceptions:e,breadcrumbs:this.breadcrumbs.length?this.breadcrumbs:void 0,originalError:i,unhandled:"boolean"==typeof t&&t,severity:n||"warning",severityReason:r,user:this.config.user||void 0,app:{releaseStage:l,version:this.config.appVersion,type:this.config.appType||("object"==typeof window?"browser":"node")},device:{time:/* @__PURE__ */(new Date).toISOString()},metaData:a||{}},c=[...this.errorCallbacks];o&&c.push(o);const d=["stringifyValues","redact"];c.sort((e,t)=>d.includes(e.name)&&d.includes(t.name)?0:d.includes(e.name)?1:d.includes(t.name)?-1:0);for(const g of c){const e=await g(s);if("boolean"==typeof e&&!e)return}const u=Wr(s,(e,t)=>{if("originalError"!==e)return t},{depthLimit:20,edgesLimit:500});let h;const p={apiKey:this.config.apiKey,payloadVersion:"5",notifier:{name:"Tight Components",version:"1",url:"https://github.com/tight-embedded/TraxComponents/tree/dev/packages/react/src/bugsnag/README.md"},events:[u]};try{h=JSON.stringify(p)}catch{u.metaData={notifier:"Unable to serialize metadata"},h=JSON.stringify(p)}if(h.length>1e6&&(u.metaData={notifier:`Payload was ${h.length/1e6}Mb. Metadata removed.`},h=JSON.stringify(p),h.length>1e6))throw new Error("Payload exceeded 1Mb limit");for(const g of this.postErrorCallbacks)g(s);try{await this.delivery.sendEvent(p)}catch(m){na()}}getUser(){return this.config?.user||{}}setUser(e,t,n){this.config&&(this.config.user={id:e,email:t,name:n})}setProperties(e){this.config&&(this.config.releaseStage=e)}addOnError(e){this.errorCallbacks.add(e)}removeOnError(e){this.errorCallbacks.delete(e)}addOnPostError(e){this.postErrorCallbacks.add(e)}removeOnPostError(e){this.postErrorCallbacks.delete(e)}getPlugin(e){return this.plugins.find(t=>t.name===e)?.plugin}setDelivery(e){this.delivery=e}};let ga="",va="";const fa="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",ba=ma.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.9.1",appType:"browser",releaseStage:fa,enabledReleaseStages:["prod"],plugins:[ia,ca,ra,(()=>{const e=new ua(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),pa]}),ya=(e,t)=>{try{ma.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?wa({error:n,severity:"error"}):wa({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},wa=async e=>{try{await ma.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:ga,environment:va}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await wa({error:t,severity:"error"}):await wa({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},Ca=ba.getPlugin("react"),xa=Ca?.BugsnagErrorBoundary,Ta=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,ka=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},Ea=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},Aa={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function Sa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...w(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?Aa:{}}});return{url:(n=e.endpointManager.getUrl(e.path),r=e.pathParams,void 0!==r&&Object.entries(r).forEach(([e,t])=>{n=n.replace(`{${e}}`,t)}),n),headers:t};var n,r}async function Ia({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=ka({extraHeaders:t,authorization:e});ya("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return ya("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),Ea(e)}catch(l){return Promise.reject(l)}}async function Na(e){const{url:t,headers:n}=Sa(e);return Ia({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function Ra(e){return Na(e)}async function Pa(e){return Na(e)}const Da=(e,t)=>({getUrl:t=>((e,t)=>{let n=t;for(;n.length>0&&"/"===n.charAt(0);)n=n.slice(1);return`${e}/${n}`})(e,t),baseUrl:e,apiVersion:t}),Ma={DEVELOPMENT:"https://dev.hurdlr.com/rest",PRODUCTION:"https://prod.hurdlr.com/rest",SANDBOX:"https://sandbox.hurdlr.com/rest",LOCAL:"http://localhost:8081/TraxAngular/rest",DEVELOPMENT_RC:"https://dev.hurdlr.com/rest",SANDBOX_RC:"https://sandbox.hurdlr.com/rest",PRODUCTION_RC:"https://prod.hurdlr.com/rest"},La={DEVELOPMENT:"https://dev.tight.com",PRODUCTION:"https://prod.tight.com",SANDBOX:"https://sandbox.tight.com",LOCAL:"http://localhost:8080",DEVELOPMENT_RC:"https://qa.dev.tight.com",SANDBOX_RC:"https://qa.sandbox.tight.com",PRODUCTION_RC:"https://qa.prod.tight.com"},Fa={...La,LOCAL:"http://localhost:8082"};function Oa(e){return Da(`${t=e,Ma[t]}/v5`,"v5");var t}const Va=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Ua=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...yt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Oa(a)};return await Pa(o)};function Ba({filter:e,grouping:t,select:n,accountingMethod:r}){return Vr({queryKey:Va({filter:e,grouping:t,accountingMethod:r}),queryFn:Ua,select:n})}const Ha="noDataHeight";function Wa(e){const t=Nt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function za(e){const t=Wa(e.period?.beginDate),n=e.netIncome??0,{profit:r,remainingIncome:a,loss:o,remainingExpenses:i}=function(e,t,n){const r=e>0?e:0,a=e<0?e:0;return{profit:r,remainingIncome:void 0!==t?H(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?H(n).plus(a).toNumber():0}}(n,e.income?.total,e.expenses?.total);return{month:{month:t,income:a,expenses:-i,profit:r,loss:o,netIncome:n,hasNoData:/* @__PURE__ */function(e,t,n){return 0===e&&0===t&&0===n}(n,a,i)},netIncome:n}}function _a(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(sr(n))return t;for(const i of n){const{month:e,netIncome:n}=za(i);t.total=H(n).plus(t.total).toNumber(),t.months.push(e)}const{domainMin:r,domainMax:a}=n.reduce((e,t)=>({domainMin:Math.min(e.domainMin,-(t.expenses?.total??0)),domainMax:Math.max(e.domainMax,t.income?.total??0)}),{domainMin:0,domainMax:0});t.domain=[r,a],t.hasAnyData=t.months.some(e=>!e.hasNoData);const o=function(e,t){const n=t-e;return n>0?.03*n:3}(r,a);return t.months=t.months.map(e=>e.hasNoData?{...e,noDataHeight:o}:e),t}const ja="MONTHLY",qa=gr(lr["tile-header"],tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Ka({title:e}){return I("div",{...qa,children:I(kr,{children:e})})}const Ya=gr(lr["tile-body"],tr({display:"flex",justifyContent:"start",alignItems:"start",flexDirection:"column",gap:"20px",height:"100%",padding:"20px 15px",backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderBottomRadius:"lg",borderTop:"hidden"}));function Za({children:e}){return I("div",{...Ya,children:e})}const Ga=or({base:{display:"flex",flexDirection:"column",transition:"height 0.5s, width 0.5s",position:"relative",borderRadius:"lg",overflow:"hidden"},variants:{type:{default:{minWidth:"295px",maxWidth:"426px",width:"100%",height:"295px"},chart:{minWidth:"900px",maxWidth:"1440px",height:"481px"}},isSample:{true:{pointerEvents:"none"},false:{}}},defaultVariants:{type:"default"}});function Qa({children:e,type:t,isSample:n=!1}){const r=gr(lr.tile,Ga({type:t,isSample:n}));return I("div",{...r,children:e})}const Xa=tr({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Ja=tr.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),$a=tr.raw({whiteSpace:"normal",overflowWrap:"break-word"}),eo=tr.raw({overflow:"visible",whiteSpace:"nowrap"}),to=tr({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),no=tr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),ro=tr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"template"});tr.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"});const ao=gr(lr.text,tr({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa);function oo({children:e}){return I("div",{...ao,children:e})}const io=gr(lr["metric-xl"],xr({metric:"xl"}));function lo(e){return I("div",{...io,children:e.children})}const so=gr(lr.summation,tr({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function co({title:e,label:t}){return R("div",{...so,children:[I(lo,{children:e}),I(oo,{children:t})]})}const uo=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function ho({children:e}){return I("div",{...uo,children:e})}const po=(e,t=0)=>{const n=Math.abs(e);let r;if(t<=0)r=Math.round(n);else{const e=n.toFixed(t);r=parseFloat(e)}return Math.sign(e)*r},mo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),go=1e9;function vo(e,t={}){const{cents:n="default",condense:r=!1,dollarSign:a=!1,decorator:o,signage:i="default"}=t,l="string"==typeof e?parseFloat(e):e;if(Number.isNaN(l))return"";let s;const c=Math.abs(l);let d;if(r&&c>99999)d=Math.sign(l)<0,s=function(e){const t=Math.floor((n=e,Math.log(n)/Math.log(1e3)))-1;var n;const r=Math.pow(1e3,t),a=Math.round(e/r),o=a*r;let i,l=a/1e3;return e<go&&l>=1e3&&(l/=1e3),o>=go?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${mo(l,0,1)}${i}`}(c);else{const{minPrecision:e,precision:t,roundedValue:r}=function(e,t){if("floor"===t)return{precision:0,minPrecision:0,roundedValue:(n=e,Math.sign(n)*Math.floor(Math.abs(n)))};if("round"===t){const t=0;return{precision:t,minPrecision:0,roundedValue:po(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:po(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:po(e,t)}}{const t=2,n=po(e,t);return{precision:t,roundedValue:n,minPrecision:n%1==0?0:2}}var n}(l,n);d=Math.sign(r)<0;const a=Math.abs(r);s=mo(a,e,t)}if(a)return function(e,t,n,r){let a=e;const o=n?"$":"";return void 0===r||"off"===r?a=`${o}${e}`:"parens"===r?a=`${o}${t?`(${e})`:e}`:"always"===r?a=`${t?"-":"+"}${o}${e}`:"default"===r&&(a=`${t?"-":""}${o}${e}`),a}(s,d,a,i);const u=(h=s,"$"===(p=o)?`${p}${h}`:"%"===p?`${h}${p}`:h);var h,p;return"off"===i?u:"parens"===i?d?`(${u})`:u:"always"===i?`${d?"-":"+"}${u}`:"default"===i?`${d?"-":""}${u}`:u}function fo(e){return vo(e,{condense:!0,dollarSign:!0})}function bo(e){return vo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function yo(e){return vo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function wo(e){return vo(e,{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function Co(e,t){return vo(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const xo=or({variants:{wrap:{ellipsis:Ja,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function To({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Ir(n))return null;const a=Cr([gr(lr["strong-label"],lr.text,xr({label:"strongLabel"}),xo({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const ko=or({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"label.sub"}},variants:{intent:{weak:{color:"typography.base.weak"},normal:{color:"typography.label.sub"},action:{color:"typography.intent.action"},primary:{color:"typography.intent.primary"},danger:{color:"typography.accent.danger"}},accent:{action:{_supportHover:{color:"typography.accent.action",transition:"color 100ms ease-out"},transition:"color 300ms ease-out"},active:{color:"typography.accent.action"},strongest:{color:"brand.action.strongest"}},wrap:{ellipsis:Ja,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:Ja,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function Eo({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=gr(lr["sub-label"],lr.text,ko({intent:e,wrap:t,accent:r}),Xa);return Ir(n)?null:I("div",{...a,children:n})}const Ao=gr(null,tr({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"10px",width:"fit-content",height:"fit-content"}));function So({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ha)return null;let n=t[0].value??0;return"expenses"===t[0].dataKey?n+=t[0].payload.loss:"income"===t[0].dataKey&&(n+=t[0].payload.profit),R("div",{...Ao,children:[I(To,{children:t[0].name??""}),I(Eo,{children:fo(Number(n))})]})}const Io={"colors.white100":{value:"#FFFFFF",variable:"var(--Tight-colors-white100)"},"colors.white200":{value:"#F9F9F9",variable:"var(--Tight-colors-white200)"},"colors.white300":{value:"#EDEDED",variable:"var(--Tight-colors-white300)"},"colors.white600":{value:"#E7E8E9",variable:"var(--Tight-colors-white600)"},"colors.white700":{value:"#E0E2E3",variable:"var(--Tight-colors-white700)"},"colors.black100":{value:"#CED1D2",variable:"var(--Tight-colors-black100)"},"colors.black200":{value:"#A7ACAD",variable:"var(--Tight-colors-black200)"},"colors.black300":{value:"#A4A9AB",variable:"var(--Tight-colors-black300)"},"colors.black400":{value:"#6F7576",variable:"var(--Tight-colors-black400)"},"colors.black600":{value:"#50595C",variable:"var(--Tight-colors-black600)"},"colors.black700":{value:"#182428",variable:"var(--Tight-colors-black700)"},"colors.black800":{value:"#030506",variable:"var(--Tight-colors-black800)"},"colors.blue200":{value:"#EDFAFC",variable:"var(--Tight-colors-blue200)"},"colors.blue300":{value:"#DAF4FA",variable:"var(--Tight-colors-blue300)"},"colors.blue400":{value:"#CAECF3",variable:"var(--Tight-colors-blue400)"},"colors.blue500":{value:"#94D8E8",variable:"var(--Tight-colors-blue500)"},"colors.blue700":{value:"#2AB2D1",variable:"var(--Tight-colors-blue700)"},"colors.blue900":{value:"#177F96",variable:"var(--Tight-colors-blue900)"},"colors.green100":{value:"#EDFAF4",variable:"var(--Tight-colors-green100)"},"colors.green200":{value:"#DBF9EA",variable:"var(--Tight-colors-green200)"},"colors.green300":{value:"#B8F3D5",variable:"var(--Tight-colors-green300)"},"colors.green400":{value:"#94E8BD",variable:"var(--Tight-colors-green400)"},"colors.green500":{value:"#5FDD9C",variable:"var(--Tight-colors-green500)"},"colors.green700":{value:"#009C75",variable:"var(--Tight-colors-green700)"},"colors.green900":{value:"#067559",variable:"var(--Tight-colors-green900)"},"colors.yellow200":{value:"#FFF3C3",variable:"var(--Tight-colors-yellow200)"},"colors.yellow300":{value:"#FFE787",variable:"var(--Tight-colors-yellow300)"},"colors.yellow400":{value:"#FCD34D",variable:"var(--Tight-colors-yellow400)"},"colors.yellow500":{value:"#FBBF24",variable:"var(--Tight-colors-yellow500)"},"colors.yellow700":{value:"#F59E0B",variable:"var(--Tight-colors-yellow700)"},"colors.yellow800":{value:"#B35F00",variable:"var(--Tight-colors-yellow800)"},"colors.red200":{value:"#FFCBCB",variable:"var(--Tight-colors-red200)"},"colors.red300":{value:"#FF9797",variable:"var(--Tight-colors-red300)"},"colors.red400":{value:"#F45C5C",variable:"var(--Tight-colors-red400)"},"colors.red500":{value:"#E84747",variable:"var(--Tight-colors-red500)"},"colors.red700":{value:"#E42525",variable:"var(--Tight-colors-red700)"},"colors.template.background":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-template-background)"},"colors.template.background.weak":{value:"hsl(from var(--Tight-colors-surface-background) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-background-weak)"},"colors.template.appBackground":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-template-appBackground)"},"colors.template.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-template-foreground)"},"colors.template.foreground.weak":{value:"hsl(from var(--Tight-colors-template-foreground) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-foreground-weak)"},"colors.template.typography":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-template-typography)"},"colors.template.typography.weak":{value:"hsl(from var(--Tight-colors-template-typography) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-typography-weak)"},"colors.template.brand":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-template-brand)"},"colors.template.brand.weak":{value:"hsl(from var(--Tight-colors-template-brand) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weak)"},"colors.template.brand.strong":{value:"hsl(from var(--Tight-colors-template-brand) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strong)"},"colors.template.brand.weaker":{value:"hsl(from var(--Tight-colors-template-brand-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weaker)"},"colors.template.brand.stronger":{value:"hsl(from var(--Tight-colors-template-brand-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-stronger)"},"colors.template.brand.weakest":{value:"hsl(from var(--Tight-colors-template-brand-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weakest)"},"colors.template.brand.strongest":{value:"hsl(from var(--Tight-colors-template-brand-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strongest)"},"colors.template.neutral":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-template-neutral)"},"colors.template.neutral.weak":{value:"hsl(from var(--Tight-colors-template-neutral) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weak)"},"colors.template.neutral.strong":{value:"hsl(from var(--Tight-colors-template-neutral) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strong)"},"colors.template.neutral.weaker":{value:"hsl(from var(--Tight-colors-template-neutral-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weaker)"},"colors.template.neutral.stronger":{value:"hsl(from var(--Tight-colors-template-neutral-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-stronger)"},"colors.template.neutral.weakest":{value:"hsl(from var(--Tight-colors-template-neutral-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weakest)"},"colors.template.neutral.strongest":{value:"hsl(from var(--Tight-colors-template-neutral-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strongest)"},"colors.template.accent":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-template-accent)"},"colors.template.accent.weak":{value:"hsl(from var(--Tight-colors-template-accent) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weak)"},"colors.template.accent.strong":{value:"hsl(from var(--Tight-colors-template-accent) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strong)"},"colors.template.accent.weaker":{value:"hsl(from var(--Tight-colors-template-accent-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weaker)"},"colors.template.accent.stronger":{value:"hsl(from var(--Tight-colors-template-accent-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-stronger)"},"colors.template.accent.weakest":{value:"hsl(from var(--Tight-colors-template-accent-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weakest)"},"colors.template.accent.strongest":{value:"hsl(from var(--Tight-colors-template-accent-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strongest)"},"colors.template.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-template-success)"},"colors.template.success.weak":{value:"hsl(from var(--Tight-colors-template-success) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weak)"},"colors.template.success.strong":{value:"hsl(from var(--Tight-colors-template-success) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strong)"},"colors.template.success.weaker":{value:"hsl(from var(--Tight-colors-template-success-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weaker)"},"colors.template.success.stronger":{value:"hsl(from var(--Tight-colors-template-success-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-stronger)"},"colors.template.success.weakest":{value:"hsl(from var(--Tight-colors-template-success-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weakest)"},"colors.template.success.strongest":{value:"hsl(from var(--Tight-colors-template-success-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strongest)"},"colors.template.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-template-warning)"},"colors.template.warning.weak":{value:"hsl(from var(--Tight-colors-template-warning) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weak)"},"colors.template.warning.strong":{value:"hsl(from var(--Tight-colors-template-warning) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strong)"},"colors.template.warning.weaker":{value:"hsl(from var(--Tight-colors-template-warning-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weaker)"},"colors.template.warning.stronger":{value:"hsl(from var(--Tight-colors-template-warning-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-stronger)"},"colors.template.warning.weakest":{value:"hsl(from var(--Tight-colors-template-warning-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weakest)"},"colors.template.warning.strongest":{value:"hsl(from var(--Tight-colors-template-warning-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strongest)"},"colors.template.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-template-danger)"},"colors.template.danger.weak":{value:"hsl(from var(--Tight-colors-template-danger) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weak)"},"colors.template.danger.strong":{value:"hsl(from var(--Tight-colors-template-danger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strong)"},"colors.template.danger.weaker":{value:"hsl(from var(--Tight-colors-template-danger-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weaker)"},"colors.template.danger.stronger":{value:"hsl(from var(--Tight-colors-template-danger-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-stronger)"},"colors.template.danger.weakest":{value:"hsl(from var(--Tight-colors-template-danger-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weakest)"},"colors.template.danger.strongest":{value:"hsl(from var(--Tight-colors-template-danger-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strongest)"},"lineHeights.template":{value:"normal",variable:"var(--Tight-lineHeights-template)"},"letterSpacings.template":{value:"normal",variable:"var(--Tight-letterSpacings-template)"},"fonts.template":{value:"Duplet Regular, sans-serif",variable:"var(--Tight-fonts-template)"},"fonts.base":{value:"var(--Tight-fonts-template)",variable:"var(--Tight-fonts-base)"},"fontSizes.template":{value:"16px",variable:"var(--Tight-fontSizes-template)"},"fontSizes.template.xs":{value:"calc(calc(var(--Tight-fontSizes-template) - 2px) - 2px)",variable:"var(--Tight-fontSizes-template-xs)"},"fontSizes.template.sm":{value:"calc(var(--Tight-fontSizes-template) - 2px)",variable:"var(--Tight-fontSizes-template-sm)"},"fontSizes.template.lg":{value:"calc(var(--Tight-fontSizes-template) + 4px)",variable:"var(--Tight-fontSizes-template-lg)"},"fontSizes.template.xl":{value:"calc(var(--Tight-fontSizes-template-lg) + 4px)",variable:"var(--Tight-fontSizes-template-xl)"},"fontSizes.sm":{value:"var(--Tight-fontSizes-template-xs)",variable:"var(--Tight-fontSizes-sm)"},"fontSizes.md":{value:"var(--Tight-fontSizes-template-sm)",variable:"var(--Tight-fontSizes-md)"},"fontSizes.lg":{value:"var(--Tight-fontSizes-template)",variable:"var(--Tight-fontSizes-lg)"},"fontSizes.xl":{value:"var(--Tight-fontSizes-template-lg)",variable:"var(--Tight-fontSizes-xl)"},"fontSizes.2xl":{value:"var(--Tight-fontSizes-template-xl)",variable:"var(--Tight-fontSizes-2xl)"},"fontWeights.template.sm":{value:"400",variable:"var(--Tight-fontWeights-template-sm)"},"fontWeights.template.md":{value:"600",variable:"var(--Tight-fontWeights-template-md)"},"fontWeights.template.lg":{value:"900",variable:"var(--Tight-fontWeights-template-lg)"},"fontWeights.sm":{value:"var(--Tight-fontWeights-template-sm)",variable:"var(--Tight-fontWeights-sm)"},"fontWeights.md":{value:"var(--Tight-fontWeights-template-md)",variable:"var(--Tight-fontWeights-md)"},"fontWeights.lg":{value:"var(--Tight-fontWeights-template-lg)",variable:"var(--Tight-fontWeights-lg)"},"radii.zero":{value:"0",variable:"var(--Tight-radii-zero)"},"radii.full":{value:"9999px",variable:"var(--Tight-radii-full)"},"radii.template":{value:"4px",variable:"var(--Tight-radii-template)"},"radii.template.sm":{value:"var(--Tight-radii-template-sm)",variable:"var(--Tight-radii-template-sm)"},"radii.template.md":{value:"var(--Tight-radii-template-md)",variable:"var(--Tight-radii-template-md)"},"radii.template.lg":{value:"var(--Tight-radii-template-lg)",variable:"var(--Tight-radii-template-lg)"},"radii.sm":{value:"var(--Tight-radii-template-sm)",variable:"var(--Tight-radii-sm)"},"radii.md":{value:"var(--Tight-radii-template-md)",variable:"var(--Tight-radii-md)"},"radii.lg":{value:"var(--Tight-radii-template-lg)",variable:"var(--Tight-radii-lg)"},"borderWidths.template":{value:"1px",variable:"var(--Tight-borderWidths-template)"},"borderWidths.template.sm":{value:"var(--Tight-borderWidths-template-sm)",variable:"var(--Tight-borderWidths-template-sm)"},"borderWidths.template.md":{value:"var(--Tight-borderWidths-template-md)",variable:"var(--Tight-borderWidths-template-md)"},"borderWidths.template.lg":{value:"var(--Tight-borderWidths-template-lg)",variable:"var(--Tight-borderWidths-template-lg)"},"borderWidths.template.xl":{value:"var(--Tight-borderWidths-template-xl)",variable:"var(--Tight-borderWidths-template-xl)"},"borderWidths.sm":{value:"var(--Tight-borderWidths-template-sm)",variable:"var(--Tight-borderWidths-sm)"},"borderWidths.md":{value:"var(--Tight-borderWidths-template-md)",variable:"var(--Tight-borderWidths-md)"},"borderWidths.lg":{value:"var(--Tight-borderWidths-template-lg)",variable:"var(--Tight-borderWidths-lg)"},"borderWidths.xl":{value:"var(--Tight-borderWidths-template-xl)",variable:"var(--Tight-borderWidths-xl)"},"animations.appear.instant":{value:"0.25s linear fade-in",variable:"var(--Tight-animations-appear-instant)"},"animations.appear.delay":{value:"0.25s linear both 1.5s fade-in",variable:"var(--Tight-animations-appear-delay)"},"animations.shimmer":{value:"2s ease-in-out infinite shimmer",variable:"var(--Tight-animations-shimmer)"},"animations.spin":{value:"1.5s ease-in-out 0.1s spin infinite",variable:"var(--Tight-animations-spin)"},"shadows.box-shadow":{value:"0px 10px 30px 0px rgba(0, 0, 0, 0.05), 0px 4px 12px 0px rgba(0, 0, 0, 0.15) ",variable:"var(--Tight-shadows-box-shadow)"},"durations.toast.enter":{value:"250ms",variable:"var(--Tight-durations-toast-enter)"},"durations.toast.exit":{value:"200ms",variable:"var(--Tight-durations-toast-exit)"},"easings.toast.enter":{value:"ease-out",variable:"var(--Tight-easings-toast-enter)"},"easings.toast.exit":{value:"ease-in",variable:"var(--Tight-easings-toast-exit)"},"breakpoints.sm":{value:"640px",variable:"var(--Tight-breakpoints-sm)"},"breakpoints.md":{value:"850px",variable:"var(--Tight-breakpoints-md)"},"breakpoints.lg":{value:"1024px",variable:"var(--Tight-breakpoints-lg)"},"breakpoints.xl":{value:"1280px",variable:"var(--Tight-breakpoints-xl)"},"breakpoints.1_5xl":{value:"1400px",variable:"var(--Tight-breakpoints-1_5xl)"},"breakpoints.2xl":{value:"1536px",variable:"var(--Tight-breakpoints-2xl)"},"sizes.breakpoint-sm":{value:"640px",variable:"var(--Tight-sizes-breakpoint-sm)"},"sizes.breakpoint-md":{value:"850px",variable:"var(--Tight-sizes-breakpoint-md)"},"sizes.breakpoint-lg":{value:"1024px",variable:"var(--Tight-sizes-breakpoint-lg)"},"sizes.breakpoint-xl":{value:"1280px",variable:"var(--Tight-sizes-breakpoint-xl)"},"sizes.breakpoint-1_5xl":{value:"1400px",variable:"var(--Tight-sizes-breakpoint-1_5xl)"},"sizes.breakpoint-2xl":{value:"1536px",variable:"var(--Tight-sizes-breakpoint-2xl)"},"colors.brand.primary.weaker":{value:"var(--Tight-colors-brand-primary-weaker)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-brand-primary-weak)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-brand-primary)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-brand-secondary-weaker)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-brand-secondary)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-brand-action-stronger)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-brand-success-stronger)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-brand-success-strongest)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-brand-warning-stronger)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-brand-warning-strongest)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-brand-danger-stronger)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-surface-background-hover)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-surface-foreground-hover)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-surface-elevated)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-surface-elevated-hover)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-surface-intent-primary)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-surface-intent-primary-hover)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-surface-intent-primary-active)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-intent-primary-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-surface-intent-secondary)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-surface-intent-secondary-hover)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-surface-intent-secondary-active)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-intent-secondary-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-surface-intent-action)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-surface-intent-action-hover)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-surface-intent-action-active)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-intent-action-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"var(--Tight-colors-surface-intent-action-discreet)",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-surface-intent-action-discreet-hover)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-surface-intent-action-discreet-active)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-surface-intent-action-highlight)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-surface-intent-success)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-surface-intent-success-hover)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-surface-intent-success-active)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-intent-success-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-surface-intent-success-highlight)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-surface-intent-warning)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-surface-intent-warning-hover)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-surface-intent-warning-active)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-intent-warning-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-surface-intent-warning-highlight)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-surface-intent-danger)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-surface-intent-danger-hover)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-surface-intent-danger-active)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-intent-danger-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-surface-intent-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-surface-intent-danger-highlight)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.intent.notification":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-intent-notification)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-surface-reports-alternateRows)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.intent.notification":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-notification)"},"colors.typography.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-typography-accent-action)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-body)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-label)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-label-sub)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-label-strong)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-label-strongSub)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-label-emphasisSub)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-heading)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-metric-sm)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-metric-md)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-metric-lg)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-metric-xl)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-icon-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-icon-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-icon-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-icon-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-icon-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-icon-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-icon-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-icon-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-icon-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-icon-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-icon-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-icon-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-icon-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-icon-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-icon-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-icon-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-icon-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-icon-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-icon-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-icon-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-icon-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-icon-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-icon-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-icon-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-icon-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-border-layout-weak)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-border-layout-strong)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-border-intent-primary-hover)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-border-intent-primary)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-border-intent-primary-active)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-intent-primary-disabled)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-border-intent-secondary-hover)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-border-intent-secondary)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-border-intent-secondary-active)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-intent-secondary-disabled)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-border-intent-danger-hover)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-border-intent-danger)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-border-intent-danger-active)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-intent-danger-disabled)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-border-intent-warning-hover)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-border-intent-warning)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-border-intent-warning-active)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-intent-warning-disabled)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-border-intent-success-hover)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-border-intent-success)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-border-intent-success-active)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-intent-success-disabled)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-border-intent-action-hover)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-border-intent-action)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-border-intent-action-active)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-intent-action-disabled)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-money)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-money-positive)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-money-positive-weak)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-money-positive-strong)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-money-negative)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-money-negative-weak)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-money-negative-strong)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"var(--Tight-colors-overlay)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"var(--Tight-colors-transparent)",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"var(--Tight-colors-none)",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"var(--Tight-colors-currentColor)",variable:"var(--Tight-colors-currentColor)"},"fonts.body":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-body)"},"fonts.label":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-label)"},"fonts.heading":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-heading)"},"fonts.metric":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-metric)"},"fontWeights.global":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-global)"},"fontWeights.body":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-body)"},"fontWeights.label":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label)"},"fontWeights.label.strong":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strong)"},"fontWeights.label.sub":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label-sub)"},"fontWeights.label.strongSub":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strongSub)"},"fontWeights.label.emphasisSub":{value:"var(--Tight-fontWeights-lg)",variable:"var(--Tight-fontWeights-label-emphasisSub)"},"fontWeights.heading":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-heading)"},"fontWeights.title":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-title)"},"fontWeights.metric.sm":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-sm)"},"fontWeights.metric.md":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-md)"},"fontWeights.metric.lg":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-lg)"},"fontWeights.metric.xl":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-xl)"},"fontSizes.title":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-title)"},"fontSizes.body":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-body)"},"fontSizes.label":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label)"},"fontSizes.label.strong":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label-strong)"},"fontSizes.label.sub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-sub)"},"fontSizes.label.strongSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-strongSub)"},"fontSizes.label.emphasisSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-emphasisSub)"},"fontSizes.heading":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-heading)"},"fontSizes.metric.sm":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-metric-sm)"},"fontSizes.metric.md":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-metric-md)"},"fontSizes.metric.lg":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-metric-lg)"},"fontSizes.metric.xl":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-metric-xl)"},"colors.colorPalette":{value:"var(--Tight-colors-colorPalette)",variable:"var(--Tight-colors-colorPalette)"},"colors.colorPalette.background":{value:"var(--Tight-colors-colorPalette-background)",variable:"var(--Tight-colors-colorPalette-background)"},"colors.colorPalette.background.weak":{value:"var(--Tight-colors-colorPalette-background-weak)",variable:"var(--Tight-colors-colorPalette-background-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-weak)"},"colors.colorPalette.appBackground":{value:"var(--Tight-colors-colorPalette-appBackground)",variable:"var(--Tight-colors-colorPalette-appBackground)"},"colors.colorPalette.foreground":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"colors.colorPalette.foreground.weak":{value:"var(--Tight-colors-colorPalette-foreground-weak)",variable:"var(--Tight-colors-colorPalette-foreground-weak)"},"colors.colorPalette.typography":{value:"var(--Tight-colors-colorPalette-typography)",variable:"var(--Tight-colors-colorPalette-typography)"},"colors.colorPalette.typography.weak":{value:"var(--Tight-colors-colorPalette-typography-weak)",variable:"var(--Tight-colors-colorPalette-typography-weak)"},"colors.colorPalette.brand":{value:"var(--Tight-colors-colorPalette-brand)",variable:"var(--Tight-colors-colorPalette-brand)"},"colors.colorPalette.brand.weak":{value:"var(--Tight-colors-colorPalette-brand-weak)",variable:"var(--Tight-colors-colorPalette-brand-weak)"},"colors.colorPalette.brand.strong":{value:"var(--Tight-colors-colorPalette-brand-strong)",variable:"var(--Tight-colors-colorPalette-brand-strong)"},"colors.colorPalette.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.brand.weaker":{value:"var(--Tight-colors-colorPalette-brand-weaker)",variable:"var(--Tight-colors-colorPalette-brand-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.brand.stronger":{value:"var(--Tight-colors-colorPalette-brand-stronger)",variable:"var(--Tight-colors-colorPalette-brand-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-stronger)"},"colors.colorPalette.brand.weakest":{value:"var(--Tight-colors-colorPalette-brand-weakest)",variable:"var(--Tight-colors-colorPalette-brand-weakest)"},"colors.colorPalette.weakest":{value:"var(--Tight-colors-colorPalette-weakest)",variable:"var(--Tight-colors-colorPalette-weakest)"},"colors.colorPalette.brand.strongest":{value:"var(--Tight-colors-colorPalette-brand-strongest)",variable:"var(--Tight-colors-colorPalette-brand-strongest)"},"colors.colorPalette.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.neutral":{value:"var(--Tight-colors-colorPalette-neutral)",variable:"var(--Tight-colors-colorPalette-neutral)"},"colors.colorPalette.neutral.weak":{value:"var(--Tight-colors-colorPalette-neutral-weak)",variable:"var(--Tight-colors-colorPalette-neutral-weak)"},"colors.colorPalette.neutral.strong":{value:"var(--Tight-colors-colorPalette-neutral-strong)",variable:"var(--Tight-colors-colorPalette-neutral-strong)"},"colors.colorPalette.neutral.weaker":{value:"var(--Tight-colors-colorPalette-neutral-weaker)",variable:"var(--Tight-colors-colorPalette-neutral-weaker)"},"colors.colorPalette.neutral.stronger":{value:"var(--Tight-colors-colorPalette-neutral-stronger)",variable:"var(--Tight-colors-colorPalette-neutral-stronger)"},"colors.colorPalette.neutral.weakest":{value:"var(--Tight-colors-colorPalette-neutral-weakest)",variable:"var(--Tight-colors-colorPalette-neutral-weakest)"},"colors.colorPalette.neutral.strongest":{value:"var(--Tight-colors-colorPalette-neutral-strongest)",variable:"var(--Tight-colors-colorPalette-neutral-strongest)"},"colors.colorPalette.accent":{value:"var(--Tight-colors-colorPalette-accent)",variable:"var(--Tight-colors-colorPalette-accent)"},"colors.colorPalette.accent.weak":{value:"var(--Tight-colors-colorPalette-accent-weak)",variable:"var(--Tight-colors-colorPalette-accent-weak)"},"colors.colorPalette.accent.strong":{value:"var(--Tight-colors-colorPalette-accent-strong)",variable:"var(--Tight-colors-colorPalette-accent-strong)"},"colors.colorPalette.accent.weaker":{value:"var(--Tight-colors-colorPalette-accent-weaker)",variable:"var(--Tight-colors-colorPalette-accent-weaker)"},"colors.colorPalette.accent.stronger":{value:"var(--Tight-colors-colorPalette-accent-stronger)",variable:"var(--Tight-colors-colorPalette-accent-stronger)"},"colors.colorPalette.accent.weakest":{value:"var(--Tight-colors-colorPalette-accent-weakest)",variable:"var(--Tight-colors-colorPalette-accent-weakest)"},"colors.colorPalette.accent.strongest":{value:"var(--Tight-colors-colorPalette-accent-strongest)",variable:"var(--Tight-colors-colorPalette-accent-strongest)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.weakest":{value:"var(--Tight-colors-colorPalette-success-weakest)",variable:"var(--Tight-colors-colorPalette-success-weakest)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.weakest":{value:"var(--Tight-colors-colorPalette-warning-weakest)",variable:"var(--Tight-colors-colorPalette-warning-weakest)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.danger.weakest":{value:"var(--Tight-colors-colorPalette-danger-weakest)",variable:"var(--Tight-colors-colorPalette-danger-weakest)"},"colors.colorPalette.danger.strongest":{value:"var(--Tight-colors-colorPalette-danger-strongest)",variable:"var(--Tight-colors-colorPalette-danger-strongest)"},"colors.colorPalette.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-weak)"},"colors.colorPalette.primary":{value:"var(--Tight-colors-colorPalette-primary)",variable:"var(--Tight-colors-colorPalette-primary)"},"colors.colorPalette.primary.strong":{value:"var(--Tight-colors-colorPalette-primary-strong)",variable:"var(--Tight-colors-colorPalette-primary-strong)"},"colors.colorPalette.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-stronger)"},"colors.colorPalette.secondary.weaker":{value:"var(--Tight-colors-colorPalette-secondary-weaker)",variable:"var(--Tight-colors-colorPalette-secondary-weaker)"},"colors.colorPalette.secondary.weak":{value:"var(--Tight-colors-colorPalette-secondary-weak)",variable:"var(--Tight-colors-colorPalette-secondary-weak)"},"colors.colorPalette.secondary":{value:"var(--Tight-colors-colorPalette-secondary)",variable:"var(--Tight-colors-colorPalette-secondary)"},"colors.colorPalette.secondary.strong":{value:"var(--Tight-colors-colorPalette-secondary-strong)",variable:"var(--Tight-colors-colorPalette-secondary-strong)"},"colors.colorPalette.action.opaque":{value:"var(--Tight-colors-colorPalette-action-opaque)",variable:"var(--Tight-colors-colorPalette-action-opaque)"},"colors.colorPalette.opaque":{value:"var(--Tight-colors-colorPalette-opaque)",variable:"var(--Tight-colors-colorPalette-opaque)"},"colors.colorPalette.action.weaker":{value:"var(--Tight-colors-colorPalette-action-weaker)",variable:"var(--Tight-colors-colorPalette-action-weaker)"},"colors.colorPalette.action.weak":{value:"var(--Tight-colors-colorPalette-action-weak)",variable:"var(--Tight-colors-colorPalette-action-weak)"},"colors.colorPalette.action":{value:"var(--Tight-colors-colorPalette-action)",variable:"var(--Tight-colors-colorPalette-action)"},"colors.colorPalette.action.strong":{value:"var(--Tight-colors-colorPalette-action-strong)",variable:"var(--Tight-colors-colorPalette-action-strong)"},"colors.colorPalette.action.stronger":{value:"var(--Tight-colors-colorPalette-action-stronger)",variable:"var(--Tight-colors-colorPalette-action-stronger)"},"colors.colorPalette.action.strongest":{value:"var(--Tight-colors-colorPalette-action-strongest)",variable:"var(--Tight-colors-colorPalette-action-strongest)"},"colors.colorPalette.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"colors.colorPalette.background.hover":{value:"var(--Tight-colors-colorPalette-background-hover)",variable:"var(--Tight-colors-colorPalette-background-hover)"},"colors.colorPalette.hover":{value:"var(--Tight-colors-colorPalette-hover)",variable:"var(--Tight-colors-colorPalette-hover)"},"colors.colorPalette.foreground.hover":{value:"var(--Tight-colors-colorPalette-foreground-hover)",variable:"var(--Tight-colors-colorPalette-foreground-hover)"},"colors.colorPalette.foreground.disabled":{value:"var(--Tight-colors-colorPalette-foreground-disabled)",variable:"var(--Tight-colors-colorPalette-foreground-disabled)"},"colors.colorPalette.disabled":{value:"var(--Tight-colors-colorPalette-disabled)",variable:"var(--Tight-colors-colorPalette-disabled)"},"colors.colorPalette.elevated":{value:"var(--Tight-colors-colorPalette-elevated)",variable:"var(--Tight-colors-colorPalette-elevated)"},"colors.colorPalette.elevated.hover":{value:"var(--Tight-colors-colorPalette-elevated-hover)",variable:"var(--Tight-colors-colorPalette-elevated-hover)"},"colors.colorPalette.intent.primary":{value:"var(--Tight-colors-colorPalette-intent-primary)",variable:"var(--Tight-colors-colorPalette-intent-primary)"},"colors.colorPalette.intent.primary.hover":{value:"var(--Tight-colors-colorPalette-intent-primary-hover)",variable:"var(--Tight-colors-colorPalette-intent-primary-hover)"},"colors.colorPalette.primary.hover":{value:"var(--Tight-colors-colorPalette-primary-hover)",variable:"var(--Tight-colors-colorPalette-primary-hover)"},"colors.colorPalette.intent.primary.active":{value:"var(--Tight-colors-colorPalette-intent-primary-active)",variable:"var(--Tight-colors-colorPalette-intent-primary-active)"},"colors.colorPalette.primary.active":{value:"var(--Tight-colors-colorPalette-primary-active)",variable:"var(--Tight-colors-colorPalette-primary-active)"},"colors.colorPalette.active":{value:"var(--Tight-colors-colorPalette-active)",variable:"var(--Tight-colors-colorPalette-active)"},"colors.colorPalette.intent.primary.disabled":{value:"var(--Tight-colors-colorPalette-intent-primary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-primary-disabled)"},"colors.colorPalette.primary.disabled":{value:"var(--Tight-colors-colorPalette-primary-disabled)",variable:"var(--Tight-colors-colorPalette-primary-disabled)"},"colors.colorPalette.intent.secondary":{value:"var(--Tight-colors-colorPalette-intent-secondary)",variable:"var(--Tight-colors-colorPalette-intent-secondary)"},"colors.colorPalette.intent.secondary.hover":{value:"var(--Tight-colors-colorPalette-intent-secondary-hover)",variable:"var(--Tight-colors-colorPalette-intent-secondary-hover)"},"colors.colorPalette.secondary.hover":{value:"var(--Tight-colors-colorPalette-secondary-hover)",variable:"var(--Tight-colors-colorPalette-secondary-hover)"},"colors.colorPalette.intent.secondary.active":{value:"var(--Tight-colors-colorPalette-intent-secondary-active)",variable:"var(--Tight-colors-colorPalette-intent-secondary-active)"},"colors.colorPalette.secondary.active":{value:"var(--Tight-colors-colorPalette-secondary-active)",variable:"var(--Tight-colors-colorPalette-secondary-active)"},"colors.colorPalette.intent.secondary.disabled":{value:"var(--Tight-colors-colorPalette-intent-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-secondary-disabled)"},"colors.colorPalette.secondary.disabled":{value:"var(--Tight-colors-colorPalette-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-secondary-disabled)"},"colors.colorPalette.intent.action":{value:"var(--Tight-colors-colorPalette-intent-action)",variable:"var(--Tight-colors-colorPalette-intent-action)"},"colors.colorPalette.intent.action.hover":{value:"var(--Tight-colors-colorPalette-intent-action-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-hover)"},"colors.colorPalette.action.hover":{value:"var(--Tight-colors-colorPalette-action-hover)",variable:"var(--Tight-colors-colorPalette-action-hover)"},"colors.colorPalette.intent.action.active":{value:"var(--Tight-colors-colorPalette-intent-action-active)",variable:"var(--Tight-colors-colorPalette-intent-action-active)"},"colors.colorPalette.action.active":{value:"var(--Tight-colors-colorPalette-action-active)",variable:"var(--Tight-colors-colorPalette-action-active)"},"colors.colorPalette.intent.action.disabled":{value:"var(--Tight-colors-colorPalette-intent-action-disabled)",variable:"var(--Tight-colors-colorPalette-intent-action-disabled)"},"colors.colorPalette.action.disabled":{value:"var(--Tight-colors-colorPalette-action-disabled)",variable:"var(--Tight-colors-colorPalette-action-disabled)"},"colors.colorPalette.intent.action.discreet":{value:"var(--Tight-colors-colorPalette-intent-action-discreet)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet)"},"colors.colorPalette.action.discreet":{value:"var(--Tight-colors-colorPalette-action-discreet)",variable:"var(--Tight-colors-colorPalette-action-discreet)"},"colors.colorPalette.discreet":{value:"var(--Tight-colors-colorPalette-discreet)",variable:"var(--Tight-colors-colorPalette-discreet)"},"colors.colorPalette.intent.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)"},"colors.colorPalette.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-action-discreet-hover)"},"colors.colorPalette.discreet.hover":{value:"var(--Tight-colors-colorPalette-discreet-hover)",variable:"var(--Tight-colors-colorPalette-discreet-hover)"},"colors.colorPalette.intent.action.discreet.active":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-active)"},"colors.colorPalette.action.discreet.active":{value:"var(--Tight-colors-colorPalette-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-action-discreet-active)"},"colors.colorPalette.discreet.active":{value:"var(--Tight-colors-colorPalette-discreet-active)",variable:"var(--Tight-colors-colorPalette-discreet-active)"},"colors.colorPalette.intent.action.highlight":{value:"var(--Tight-colors-colorPalette-intent-action-highlight)",variable:"var(--Tight-colors-colorPalette-intent-action-highlight)"},"colors.colorPalette.action.highlight":{value:"var(--Tight-colors-colorPalette-action-highlight)",variable:"var(--Tight-colors-colorPalette-action-highlight)"},"colors.colorPalette.highlight":{value:"var(--Tight-colors-colorPalette-highlight)",variable:"var(--Tight-colors-colorPalette-highlight)"},"colors.colorPalette.intent.success":{value:"var(--Tight-colors-colorPalette-intent-success)",variable:"var(--Tight-colors-colorPalette-intent-success)"},"colors.colorPalette.intent.success.hover":{value:"var(--Tight-colors-colorPalette-intent-success-hover)",variable:"var(--Tight-colors-colorPalette-intent-success-hover)"},"colors.colorPalette.success.hover":{value:"var(--Tight-colors-colorPalette-success-hover)",variable:"var(--Tight-colors-colorPalette-success-hover)"},"colors.colorPalette.intent.success.active":{value:"var(--Tight-colors-colorPalette-intent-success-active)",variable:"var(--Tight-colors-colorPalette-intent-success-active)"},"colors.colorPalette.success.active":{value:"var(--Tight-colors-colorPalette-success-active)",variable:"var(--Tight-colors-colorPalette-success-active)"},"colors.colorPalette.intent.success.disabled":{value:"var(--Tight-colors-colorPalette-intent-success-disabled)",variable:"var(--Tight-colors-colorPalette-intent-success-disabled)"},"colors.colorPalette.success.disabled":{value:"var(--Tight-colors-colorPalette-success-disabled)",variable:"var(--Tight-colors-colorPalette-success-disabled)"},"colors.colorPalette.intent.success.highlight":{value:"var(--Tight-colors-colorPalette-intent-success-highlight)",variable:"var(--Tight-colors-colorPalette-intent-success-highlight)"},"colors.colorPalette.success.highlight":{value:"var(--Tight-colors-colorPalette-success-highlight)",variable:"var(--Tight-colors-colorPalette-success-highlight)"},"colors.colorPalette.intent.warning":{value:"var(--Tight-colors-colorPalette-intent-warning)",variable:"var(--Tight-colors-colorPalette-intent-warning)"},"colors.colorPalette.intent.warning.hover":{value:"var(--Tight-colors-colorPalette-intent-warning-hover)",variable:"var(--Tight-colors-colorPalette-intent-warning-hover)"},"colors.colorPalette.warning.hover":{value:"var(--Tight-colors-colorPalette-warning-hover)",variable:"var(--Tight-colors-colorPalette-warning-hover)"},"colors.colorPalette.intent.warning.active":{value:"var(--Tight-colors-colorPalette-intent-warning-active)",variable:"var(--Tight-colors-colorPalette-intent-warning-active)"},"colors.colorPalette.warning.active":{value:"var(--Tight-colors-colorPalette-warning-active)",variable:"var(--Tight-colors-colorPalette-warning-active)"},"colors.colorPalette.intent.warning.disabled":{value:"var(--Tight-colors-colorPalette-intent-warning-disabled)",variable:"var(--Tight-colors-colorPalette-intent-warning-disabled)"},"colors.colorPalette.warning.disabled":{value:"var(--Tight-colors-colorPalette-warning-disabled)",variable:"var(--Tight-colors-colorPalette-warning-disabled)"},"colors.colorPalette.intent.warning.highlight":{value:"var(--Tight-colors-colorPalette-intent-warning-highlight)",variable:"var(--Tight-colors-colorPalette-intent-warning-highlight)"},"colors.colorPalette.warning.highlight":{value:"var(--Tight-colors-colorPalette-warning-highlight)",variable:"var(--Tight-colors-colorPalette-warning-highlight)"},"colors.colorPalette.intent.danger":{value:"var(--Tight-colors-colorPalette-intent-danger)",variable:"var(--Tight-colors-colorPalette-intent-danger)"},"colors.colorPalette.intent.danger.hover":{value:"var(--Tight-colors-colorPalette-intent-danger-hover)",variable:"var(--Tight-colors-colorPalette-intent-danger-hover)"},"colors.colorPalette.danger.hover":{value:"var(--Tight-colors-colorPalette-danger-hover)",variable:"var(--Tight-colors-colorPalette-danger-hover)"},"colors.colorPalette.intent.danger.active":{value:"var(--Tight-colors-colorPalette-intent-danger-active)",variable:"var(--Tight-colors-colorPalette-intent-danger-active)"},"colors.colorPalette.danger.active":{value:"var(--Tight-colors-colorPalette-danger-active)",variable:"var(--Tight-colors-colorPalette-danger-active)"},"colors.colorPalette.intent.danger.disabled":{value:"var(--Tight-colors-colorPalette-intent-danger-disabled)",variable:"var(--Tight-colors-colorPalette-intent-danger-disabled)"},"colors.colorPalette.danger.disabled":{value:"var(--Tight-colors-colorPalette-danger-disabled)",variable:"var(--Tight-colors-colorPalette-danger-disabled)"},"colors.colorPalette.intent.danger.weak":{value:"var(--Tight-colors-colorPalette-intent-danger-weak)",variable:"var(--Tight-colors-colorPalette-intent-danger-weak)"},"colors.colorPalette.intent.danger.highlight":{value:"var(--Tight-colors-colorPalette-intent-danger-highlight)",variable:"var(--Tight-colors-colorPalette-intent-danger-highlight)"},"colors.colorPalette.danger.highlight":{value:"var(--Tight-colors-colorPalette-danger-highlight)",variable:"var(--Tight-colors-colorPalette-danger-highlight)"},"colors.colorPalette.intent.notification":{value:"var(--Tight-colors-colorPalette-intent-notification)",variable:"var(--Tight-colors-colorPalette-intent-notification)"},"colors.colorPalette.notification":{value:"var(--Tight-colors-colorPalette-notification)",variable:"var(--Tight-colors-colorPalette-notification)"},"colors.colorPalette.reports.alternateRows":{value:"var(--Tight-colors-colorPalette-reports-alternateRows)",variable:"var(--Tight-colors-colorPalette-reports-alternateRows)"},"colors.colorPalette.alternateRows":{value:"var(--Tight-colors-colorPalette-alternateRows)",variable:"var(--Tight-colors-colorPalette-alternateRows)"},"colors.colorPalette.base":{value:"var(--Tight-colors-colorPalette-base)",variable:"var(--Tight-colors-colorPalette-base)"},"colors.colorPalette.base.weak":{value:"var(--Tight-colors-colorPalette-base-weak)",variable:"var(--Tight-colors-colorPalette-base-weak)"},"colors.colorPalette.contrast":{value:"var(--Tight-colors-colorPalette-contrast)",variable:"var(--Tight-colors-colorPalette-contrast)"},"colors.colorPalette.contrast.weak":{value:"var(--Tight-colors-colorPalette-contrast-weak)",variable:"var(--Tight-colors-colorPalette-contrast-weak)"},"colors.colorPalette.accent.success":{value:"var(--Tight-colors-colorPalette-accent-success)",variable:"var(--Tight-colors-colorPalette-accent-success)"},"colors.colorPalette.accent.warning":{value:"var(--Tight-colors-colorPalette-accent-warning)",variable:"var(--Tight-colors-colorPalette-accent-warning)"},"colors.colorPalette.accent.danger":{value:"var(--Tight-colors-colorPalette-accent-danger)",variable:"var(--Tight-colors-colorPalette-accent-danger)"},"colors.colorPalette.accent.action":{value:"var(--Tight-colors-colorPalette-accent-action)",variable:"var(--Tight-colors-colorPalette-accent-action)"},"colors.colorPalette.body":{value:"var(--Tight-colors-colorPalette-body)",variable:"var(--Tight-colors-colorPalette-body)"},"colors.colorPalette.label":{value:"var(--Tight-colors-colorPalette-label)",variable:"var(--Tight-colors-colorPalette-label)"},"colors.colorPalette.label.sub":{value:"var(--Tight-colors-colorPalette-label-sub)",variable:"var(--Tight-colors-colorPalette-label-sub)"},"colors.colorPalette.sub":{value:"var(--Tight-colors-colorPalette-sub)",variable:"var(--Tight-colors-colorPalette-sub)"},"colors.colorPalette.label.strong":{value:"var(--Tight-colors-colorPalette-label-strong)",variable:"var(--Tight-colors-colorPalette-label-strong)"},"colors.colorPalette.label.strongSub":{value:"var(--Tight-colors-colorPalette-label-strongSub)",variable:"var(--Tight-colors-colorPalette-label-strongSub)"},"colors.colorPalette.strongSub":{value:"var(--Tight-colors-colorPalette-strongSub)",variable:"var(--Tight-colors-colorPalette-strongSub)"},"colors.colorPalette.label.emphasisSub":{value:"var(--Tight-colors-colorPalette-label-emphasisSub)",variable:"var(--Tight-colors-colorPalette-label-emphasisSub)"},"colors.colorPalette.emphasisSub":{value:"var(--Tight-colors-colorPalette-emphasisSub)",variable:"var(--Tight-colors-colorPalette-emphasisSub)"},"colors.colorPalette.heading":{value:"var(--Tight-colors-colorPalette-heading)",variable:"var(--Tight-colors-colorPalette-heading)"},"colors.colorPalette.metric.sm":{value:"var(--Tight-colors-colorPalette-metric-sm)",variable:"var(--Tight-colors-colorPalette-metric-sm)"},"colors.colorPalette.sm":{value:"var(--Tight-colors-colorPalette-sm)",variable:"var(--Tight-colors-colorPalette-sm)"},"colors.colorPalette.metric.md":{value:"var(--Tight-colors-colorPalette-metric-md)",variable:"var(--Tight-colors-colorPalette-metric-md)"},"colors.colorPalette.md":{value:"var(--Tight-colors-colorPalette-md)",variable:"var(--Tight-colors-colorPalette-md)"},"colors.colorPalette.metric.lg":{value:"var(--Tight-colors-colorPalette-metric-lg)",variable:"var(--Tight-colors-colorPalette-metric-lg)"},"colors.colorPalette.lg":{value:"var(--Tight-colors-colorPalette-lg)",variable:"var(--Tight-colors-colorPalette-lg)"},"colors.colorPalette.metric.xl":{value:"var(--Tight-colors-colorPalette-metric-xl)",variable:"var(--Tight-colors-colorPalette-metric-xl)"},"colors.colorPalette.xl":{value:"var(--Tight-colors-colorPalette-xl)",variable:"var(--Tight-colors-colorPalette-xl)"},"colors.colorPalette.layout.weak":{value:"var(--Tight-colors-colorPalette-layout-weak)",variable:"var(--Tight-colors-colorPalette-layout-weak)"},"colors.colorPalette.layout":{value:"var(--Tight-colors-colorPalette-layout)",variable:"var(--Tight-colors-colorPalette-layout)"},"colors.colorPalette.layout.strong":{value:"var(--Tight-colors-colorPalette-layout-strong)",variable:"var(--Tight-colors-colorPalette-layout-strong)"},"colors.colorPalette.positive":{value:"var(--Tight-colors-colorPalette-positive)",variable:"var(--Tight-colors-colorPalette-positive)"},"colors.colorPalette.positive.weak":{value:"var(--Tight-colors-colorPalette-positive-weak)",variable:"var(--Tight-colors-colorPalette-positive-weak)"},"colors.colorPalette.positive.strong":{value:"var(--Tight-colors-colorPalette-positive-strong)",variable:"var(--Tight-colors-colorPalette-positive-strong)"},"colors.colorPalette.negative":{value:"var(--Tight-colors-colorPalette-negative)",variable:"var(--Tight-colors-colorPalette-negative)"},"colors.colorPalette.negative.weak":{value:"var(--Tight-colors-colorPalette-negative-weak)",variable:"var(--Tight-colors-colorPalette-negative-weak)"},"colors.colorPalette.negative.strong":{value:"var(--Tight-colors-colorPalette-negative-strong)",variable:"var(--Tight-colors-colorPalette-negative-strong)"}};function No(e,t){return Io[e]?.value||t}No.var=function(e,t){return Io[e]?.variable||t};const Ro=gr(null,tr({borderRadius:"50%",flexShrink:0})),Po=gr(null,tr({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Do=No.var("colors.surface.foreground.disabled");function Mo({color:e=Do,diameter:t=17,label:n}){return R("div",{...Po,"data-testid":"bullet-row",children:[I("div",{...Ro,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(Eo,{children:n})]})}const Lo=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function Fo({payload:e}){return void 0===e?null:I("div",{...Lo,children:e.map((e,t)=>"none"!==e.type&&I(Mo,{color:e.color,label:e.value,diameter:17},t))})}const Oo={right:20,left:20},Vo=["income","profit","expenses","loss"],Uo=e=>Vo.findIndex(t=>t===e.dataKey),Bo={paddingBottom:"20px",marginLeft:"-20px"},Ho={stackId:"stack",isAnimationActive:!1},Wo=gr(lr["profit-loss-graph"],tr({"& .recharts-surface":{outline:"none"}})),zo=No.var("colors.money"),_o=No.var("colors.border.layout"),jo=No.var("colors.border.layout.strong"),qo={fill:No.var("colors.typography.base"),fontSize:No.var("fontSizes.metric.sm")},Ko={profit:No.var("colors.money.positive.strong"),income:No.var("colors.money.positive.weak"),loss:No.var("colors.money.negative.strong"),expenses:No.var("colors.money.negative.weak")},Yo=[0,100],Zo=["auto","auto"];function Go({data:e}){const[t,n]=d(!0);if(void 0===e)return null;const r=e.hasAnyData?Zo:Yo;return I(W,{width:"100%",height:"100%",...Wo,children:R(z,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:Oo,children:[I(_,{verticalAlign:"top",itemSorter:Uo,wrapperStyle:Bo,content:({payload:e})=>I(Fo,{payload:e})}),I(j,{strokeDasharray:"0",vertical:!1,stroke:_o}),I(q,{dataKey:"month",interval:0,tickLine:!1,stroke:_o,tick:qo}),I(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:_o,tick:qo,tickFormatter:e=>fo(e)}),I(Y,{content:({active:e,payload:t})=>I(So,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(Z,{name:"Profit",dataKey:"profit",fill:Ko.profit,...Ho}),I(Z,{name:"Income",dataKey:"income",fill:Ko.income,...Ho}),I(Z,{name:"Loss",dataKey:"loss",fill:Ko.loss,...Ho}),I(Z,{name:"Expenses",dataKey:"expenses",fill:Ko.expenses,...Ho}),I(Z,{dataKey:Ha,fill:_o,legendType:"none",...Ho}),I(G,{y:0,stroke:jo}),I(Q,{dataKey:"netIncome",fill:zo,stroke:zo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const Qo=tr({backgroundColor:"surface.elevated",borderRadius:"sm",backgroundImage:"linear-gradient(90deg, {colors.surface.elevated} 30%, {colors.surface.foreground} 50%, {colors.surface.elevated} 70%)",backgroundSize:"400%",backgroundPosition:"100% 0",animation:"shimmer"});function Xo({styles:e}){const t=rr(ur(lr["loading-skeleton"]),Qo,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const Jo=tr({width:"40%",minHeight:65});function $o({children:e}){return R(N,{children:[I(Xo,{styles:Jo}),I(ho,{children:e})]})}const ei=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),ti=tr({width:"80px",height:"17px",marginBottom:"10px"}),ni=tr({width:"100%",height:"100%"});function ri(){return R(N,{children:[R("div",{...ei,children:[I(Xo,{styles:ti}),I(Xo,{styles:ti}),I(Xo,{styles:ti}),I(Xo,{styles:ti})]}),I(Xo,{styles:ni})]})}const ai=or({base:{color:"typography.base.weak",boxSizing:"border-box",position:"absolute",bottom:"0",left:"0",right:"0",top:"0",display:"flex",justifyContent:"center",alignItems:"center",pointerEvents:"none",margin:"0 auto",transform:"rotate(-20deg)",opacity:"80%"},variants:{size:{sm:{fontSize:"4em"},lg:{fontSize:"7em"},xl:{fontSize:"10em"}}}});function oi({size:e}){const t=ai({size:e});return I("div",{className:t,children:"Sample"})}const ii=20200,li=5043,si=Object.freeze({income:ii,expenses:li,netIncome:15157,absoluteSum:Math.abs(ii)+Math.abs(li)}),ci=Object.freeze({total:li,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),di=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),ui=[{income:1247,expenses:7434},{income:2103,expenses:8672},{income:1876,expenses:7656},{income:3291,expenses:6623},{income:5647,expenses:7034},{income:8923,expenses:6456},{income:11547,expenses:5892},{income:9834,expenses:6721},{income:15283,expenses:5347},{income:18467,expenses:4923},{income:17924,expenses:4534},{income:20200,expenses:5043}];function hi({filter:e=ut.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Ba({filter:e,grouping:t,select:_a})}({filter:e,grouping:ja}),a=t?function(){const e=[],t=/* @__PURE__ */new Date;let n=0,r=0,a=0;for(let o=11;o>=0;o--){const i=new Date(t.getFullYear(),t.getMonth()-o,1),l=Mt(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=ui[11-o],c=s.income-s.expenses,d=c>0?c:0,u=c<0?c:0,h=s.income-d,p=s.expenses+u;e.push({month:l,income:h,expenses:-p,profit:d,loss:u,netIncome:c,hasNoData:!1}),n+=c,r=Math.max(r,s.income),a=Math.max(a,s.expenses)}return{total:n,domain:[-a,r],months:e,hasAnyData:!0}}():n;return R(Qa,{type:"chart",children:[I(Ka,{title:"Profit + Loss"}),I(Za,{children:r?I($o,{children:I(ri,{})}):R(N,{children:[I(co,{title:fo(a?.total??0),label:"Profit"}),I(ho,{children:I(Go,{data:a})})]})}),t&&I(oi,{size:"xl"})]})}const pi={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},mi=l({}),gi=or({base:{stroke:"currentColor"},variants:{primary:{DEFAULT:{stroke:"icon.intent.primary"},hover:{stroke:"icon.intent.primary.hover"},active:{stroke:"icon.intent.primary.active"}},secondary:{DEFAULT:{stroke:"icon.intent.secondary"},hover:{stroke:"icon.intent.secondary.hover"},active:{stroke:"icon.intent.secondary.active"}},success:{DEFAULT:{stroke:"icon.intent.success"},hover:{stroke:"icon.intent.success.hover"},active:{stroke:"icon.intent.success.active"}},warning:{DEFAULT:{stroke:"icon.intent.warning"},hover:{stroke:"icon.intent.warning.hover"},active:{stroke:"icon.intent.warning.active"}},danger:{DEFAULT:{stroke:"icon.intent.danger"},hover:{stroke:"icon.intent.danger.hover"},active:{stroke:"icon.intent.danger.active"}},action:{DEFAULT:{stroke:"icon.intent.action"},hover:{stroke:"icon.intent.action.hover"},active:{stroke:"icon.intent.action.active"}}}});function vi(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:l}=i(mi),s=n?.styleIconKey?l?.[n.styleIconKey]:void 0,c=Cr([gr(null,gi()),...o]);return s?I("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:tr({objectFit:"contain"})}):I(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const fi=vi(e=>r.createElement("svg",{width:13,height:15,stroke:"currentColor",viewBox:"0 0 13 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.743464 14.9687V0.96875H11.6465L9.22218 4.59886L11.6465 8.24166H0.743464",strokeMiterlimit:10})),"Flag",{styleIconKey:"flag"}),bi=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.08708 2.34833H7.91602C7.75004 2.34808 7.58676 2.39026 7.44167 2.47087C7.29657 2.55147 7.1745 2.66783 7.08702 2.80888L1.24458 12.1581C1.14602 12.3136 1.09355 12.4938 1.09325 12.6779C1.09324 12.8069 1.11886 12.9346 1.16861 13.0536C1.21837 13.1726 1.29127 13.2805 1.38309 13.3711C1.47491 13.4617 1.58381 13.5332 1.70348 13.5813C1.82314 13.6295 1.95118 13.6534 2.08015 13.6516H13.9229C14.1812 13.6516 14.4289 13.549 14.6115 13.3664C14.7941 13.1838 14.8967 12.9361 14.8967 12.6779C14.8964 12.4938 14.8439 12.3136 14.7454 12.1581L8.91608 2.80888C8.8286 2.66783 8.70652 2.55147 8.56143 2.47087C8.41634 2.39026 8.25306 2.34808 8.08708 2.34833Z",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 5.48663V9.25659",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",strokeMiterlimit:10})),"Attention"),yi=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.81985 0.464722V3.49919",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M7.81985 12.0008V15.0353",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M15.1051 7.75H12.0706",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M3.56907 7.75H0.534607",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 2.59967L10.8227 4.74724",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 10.7528L2.66949 12.9004",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 12.9004L10.8227 10.7528",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 4.74724L2.66949 2.59967",stroke:"black",strokeMiterlimit:10})),"Processing"),wi=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"CircleCheck",{styleIconKey:"checkmark"}),Ci=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.21065 9.68766C6.15485 9.47136 6.04211 9.27397 5.88416 9.11602C5.72621 8.95807 5.52882 8.84533 5.31252 8.78953L1.47815 7.80078C1.41273 7.78221 1.35515 7.74281 1.31416 7.68856C1.27316 7.6343 1.25098 7.56816 1.25098 7.50016C1.25098 7.43215 1.27316 7.36601 1.31416 7.31175C1.35515 7.2575 1.41273 7.2181 1.47815 7.19953L5.31252 6.21016C5.52874 6.15441 5.72608 6.04176 5.88402 5.88393C6.04197 5.7261 6.15475 5.52884 6.21065 5.31266L7.1994 1.47828C7.21778 1.4126 7.25714 1.35474 7.31147 1.31353C7.36581 1.27231 7.43214 1.25 7.50034 1.25C7.56854 1.25 7.63486 1.27231 7.6892 1.31353C7.74353 1.35474 7.78289 1.4126 7.80127 1.47828L8.7894 5.31266C8.8452 5.52895 8.95794 5.72634 9.11589 5.88429C9.27384 6.04224 9.47123 6.15498 9.68752 6.21078L13.5219 7.19891C13.5878 7.21709 13.646 7.25641 13.6874 7.31083C13.7289 7.36525 13.7513 7.43176 13.7513 7.50016C13.7513 7.56855 13.7289 7.63507 13.6874 7.68948C13.646 7.7439 13.5878 7.78322 13.5219 7.80141L9.68752 8.78953C9.47123 8.84533 9.27384 8.95807 9.11589 9.11602C8.95794 9.27397 8.8452 9.47136 8.7894 9.68766L7.80065 13.522C7.78227 13.5877 7.74291 13.6456 7.68857 13.6868C7.63424 13.728 7.56791 13.7503 7.49971 13.7503C7.43151 13.7503 7.36518 13.728 7.31085 13.6868C7.25651 13.6456 7.21715 13.5877 7.19877 13.522L6.21065 9.68766Z",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M12.5 1.875V4.375",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M13.75 3.125H11.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M2.5 10.625V11.875",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M3.125 11.25H1.875",strokeLinecap:"round",strokeLinejoin:"round"})),"AiStar");function xi(e){return Da(`${t=e,La[t]}`,"v6");var t}async function Ti({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=ka({extraHeaders:t,authorization:e}),l=(({url:e,params:t})=>{let n=e;const r=null==(a=t)?"":Object.entries(a).map(([e,t])=>{let n;return n=Array.isArray(t)?t.map(t=>Ta(e,t)).join("&"):Ta(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});ya("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return ya("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),Ea(e)}catch(s){return Promise.reject(s)}}async function ki(e){const{url:t,headers:n}=Sa(e);return Ti({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function Ei(e){return ki({...e,endpointManager:xi(e.environment)})}async function Ai(e){return ki({...e,endpointManager:Oa(e.environment)})}const Si=l(void 0);function Ii(){return i(Si)}const Ni=e=>["introspect",e];function Ri(e){return async t=>{const n=t.queryKey;return async function(e,t,n){const r={path:"/sdk/introspect",accessToken:e,environment:t,params:n?{theme:n}:void 0};return await Ai(r)}(n[2].accessToken,n[2].environment,e)}}function Pi(){const e=Ii();return Vr({queryKey:Ni(e),queryFn:Ri(e)})}const Di={RECONCILIATION_DISCREPANCY:"RECONCILIATION_DISCREPANCY",USER_REVIEW_REQUIRED:"USER_REVIEW_REQUIRED",AWAITING_MATCH:"AWAITING_MATCH",ACCOUNTANT_REVIEW_REQUIRED:"ACCOUNTANT_REVIEW_REQUIRED",STAGED:"STAGED",RECONCILED:"RECONCILED",PARTNER_REVIEW_REQUIRED:"PARTNER_REVIEW_REQUIRED"},Mi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Li={DISCREPANCY:{text:"Discrepancy",Icon:bi,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:yi,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:fi,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:yi,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:yi,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:fi,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:Ci,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:wi,variant:"success"}},Fi={DISCREPANCY:["RECONCILIATION_DISCREPANCY"],CLIENT_REVIEW:["USER_REVIEW_REQUIRED"],NEEDS_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:[],ADDITIONAL_REVIEW:["PARTNER_REVIEW_REQUIRED"],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Oi={DISCREPANCY:[],CLIENT_REVIEW:[],NEEDS_REVIEW:["RECONCILIATION_DISCREPANCY","USER_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED","PARTNER_REVIEW_REQUIRED"],ADDITIONAL_REVIEW:[],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Vi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Ui=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Bi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],Hi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],Wi=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],zi=[{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"RECONCILIATION_DISCREPANCY",displayName:"Discrepancy"},{status:"USER_REVIEW_REQUIRED",displayName:"Flag to User"},{status:"RECONCILED",displayName:"Reconciled"}];function _i(){return Ki()?zi:Wi}function ji(e,t){return{...Li[e],key:e,value:(t?Fi:Oi)[e]}}function qi(e){const t=Ki()?Fi:Oi,n=Mi.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Li[n]}function Ki(){const{query:{data:e}}=Pi();return"ACCOUNTANT"===e?.userRole}function Yi(){return ji("NEEDS_REVIEW",Ki())}function Zi(e){return e in Di}const{CONVERSATIONS:Gi,TRANSACTIONS:Qi}=pi.FinancialOverview,Xi={MESSAGE_REVIEW:Gi,TRANSACTION_REVIEW:Qi,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},Ji={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},$i={resolutionStatus:{in:["OPEN"]}},el=[],tl=[],nl=vi(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10,transform:"scale(-1, 1) translate(-13, 0)"})),"ArrowLeft"),rl=vi(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10})),"ArrowRight"),al=tr.raw({transition:"background 300ms ease-out, background-color 300ms ease-out, border-color 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, background-color 100ms ease-out, border-color 100ms ease-out, box-shadow 0ms"}}),ol=tr(al),il=tr.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),ll=tr(il);tr({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}),tr({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),tr({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const sl=l({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function cl({Component:e,stylists:t}){return I(e,{stylists:[gr(lr["small-icon"],lr.icon),...t??[]],size:12})}const dl=gr(lr["pagination-button"],tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderRadius:"md",borderColor:"border.layout",color:"typography.base",display:"inline-flex",alignItems:"center",justifyContent:"center",height:{xl:"35px",base:"44px"},overflow:"hidden",gap:0})),ul=gr(null,tr({border:"none",borderRadius:"sm",backgroundColor:"surface.intent.action.discreet",padding:{xl:"4px",base:"12px"},margin:0,overflow:"hidden",color:"icon.base",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",outline:"none",boxShadow:"0 0 0 0 transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{opacity:.6,pointerEvents:"none"},_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}}),ll),hl=gr(null,tr({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),pl=gr(null,tr({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function ml(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=i(sl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...dl,children:[I("div",{...hl,children:I("button",{...ul,onClick:r,disabled:!t,children:I(cl,{Component:nl,stylists:[pl]})})}),I("div",{...hl,children:I("button",{...ul,onClick:n,disabled:!e,children:I(cl,{Component:rl,stylists:[pl]})})})]})}const gl=tr({width:"100%",height:"50px"});function vl(){return I(Xo,{styles:gl})}const fl=gr(lr["dashboard-placeholder-table"],tr({display:"flex",flexDirection:"column",gap:"4px"})),bl=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),yl=tr({width:"100px",height:"20px"});function wl({numColumns:e=6}){return R("div",{...fl,children:[I("div",{...bl,children:Array.from({length:e},(e,t)=>I(Xo,{styles:yl},t))}),I(vl,{}),I(vl,{}),I(vl,{}),I(vl,{}),I(vl,{}),I(vl,{})]})}function Cl(e,t){const n=Pr(),r=Or();return u(a=>{const o=Nr(n),i=o?{}:{retry:!1,staleTime:1/0};return Lr.prefetchQuery({queryKey:Er(e(a),n??"",r),queryFn:o?t:Dr,...i})},[e,t,n,r])}const xl=Object.freeze({}),Tl=Object.freeze({cursor:"FINAL_PAGE"});function kl({queryKey:e,queryFn:t,...n}){const[r,i]=d(xl),l=a(e);C(l.current,e)||(l.current=e,i(xl));const c=n.select,h=cr(c)?e=>({...c(e),cursor:e.cursor}):void 0,p=Ar(e,r),m=Vr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),g=o(()=>{return e=m.query.data?.cursor,t=i,{getFirstPage:()=>t(xl),getLastPage:()=>t(Tl),hasNextPage:cr(e?.after),hasPreviousPage:cr(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[m.query.data?.cursor]),v=Cl(u(t=>Ar(e,t),[e]),t),f=Cl(u(t=>Ar(e,t),[e]),t);return s(()=>{const e=m.query.data?.cursor;!m.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{wa({error:e,severity:"error"})}),e.before&&f({cursor:e.before}).catch(e=>{wa({error:e,severity:"error"})}))},[m.query.data?.cursor,m.query.isFetching,v,f]),{...m,paginationControls:g}}function El({delay:e,callback:t}){const n=o(()=>function({delay:e,callback:t}){let n;const r=()=>{n&&(clearTimeout(n),n=void 0)};return{startCallback:a=>{r(),n=setTimeout(()=>{t(a)},e)},cancelCallback:()=>r()}}({delay:e,callback:t}),[e,t]);return s(()=>()=>{n.cancelCallback()},[n]),{startCallback:u(e=>{n.startCallback(e)},[n]),cancelCallback:u(()=>{n.cancelCallback()},[n])}}function Al({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=El({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Sl={CREATED_DATE_TIME:"CREATED_DATE_TIME",SUBJECT:"SUBJECT",EMAIL:"EMAIL",LAST_MESSAGE_CREATED_DATE_TIME:"LAST_MESSAGE_CREATED_DATE_TIME",LAST_MESSAGE_TEXT:"LAST_MESSAGE_TEXT"},Il={ASC:"ASC",DESC:"DESC"},Nl=e=>["conversations",e??{}],Rl=e=>["conversations","conversation",e],Pl=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Dl(e){return kl({queryKey:e?Nl(e):["conversations",{}],queryFn:Pl})}const Ml=async e=>{const t=e.queryKey,{id:n}=t[2],r={path:"/v6/conversations/{id}",pathParams:{id:n},accessToken:t[3].accessToken,environment:t[3].environment},a=await Ei(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Ll(e){const t=cr(e);return Vr({queryKey:Rl({id:e??""}),queryFn:Ml,enabled:t})}const Fl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:xi(n)};return await Ra(r)};function Ol(){return Al({prefetchFn:Cl(Rl,Ml)})}function Vl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Ul({header:e}){const t=Vl(e.column);return I("div",{...gr(lr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:X(e.column.columnDef.header,e.getContext())})}const Bl=gr(lr["dashboard-table-header"],tr({display:"flex",flexDirection:"row",alignItems:"center",minHeight:"32px"}));function Hl({headerGroups:e}){return I("div",{children:e.map(e=>h("div",{...Bl,key:e.id},e.headers.map(e=>I(Ul,{header:e},e.id))))})}const Wl=gr(lr["dashboard-table-body"],tr({display:"flex",flexDirection:"column"}));function zl({children:e}){return I("div",{...Wl,children:e})}function _l(e){if("object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id)return e.id}const jl=/* @__PURE__ */new Set;const ql=l(void 0);function Kl({editMutationKey:e,children:t}){const n=function(e){const t=F({filters:{mutationKey:e,status:"pending"},select:e=>e.state.variables},Lr);return o(()=>0===t.length?jl:function(e){const t=/* @__PURE__ */new Set;for(const n of e){const e=Array.isArray(n)?n:[n];for(const n of e){const e=_l(n);void 0!==e&&t.add(e)}}return t}(t),[t])}(e);return I(ql.Provider,{value:n,children:t})}const Yl=gr(lr["dashboard-table-cell"],tr({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),Zl=tr({display:"flex",flexDirection:"row",height:"100%"});function Gl({cell:e,onCellClick:t,isMutating:n}){const r=Vl(e.column);return I("div",{className:Zl,style:r,onClick:()=>{!n&&t&&t(e)},children:I("div",{style:r,...Yl,children:X(e.column.columnDef.cell,{...e.getContext(),isMutating:n})})})}const Ql=gr(lr["table-sub-row"],tr({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function Xl({rowData:e,onCellClick:t,isMutating:n}){const r=e.getVisibleCells();return I("div",{...Ql,children:r.map(e=>I(Gl,{cell:e,onCellClick:t,isMutating:n,isChild:!0},e.id))})}const Jl=tr({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden",position:"relative",isolation:"isolate"}),$l=tr({position:"absolute",inset:"0",backgroundColor:"surface.foreground",opacity:"80%",pointerEvents:"all",cursor:"default"}),es=tr({background:"surface.background"}),ts=gr(lr["table-row"],tr({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.weaker"},"&:focus-visible":{outlineColor:"brand.action.strong",outlineStyle:"solid",outlineWidth:"borderWidths.md",outlineOffset:"calc(-1 * {borderWidths.md})",zIndex:1,backgroundColor:"brand.action.weaker"}}));function ns({rowData:e,onMouseEnter:t,onMouseLeave:n,onRowClick:r,onCellClick:o,shouldDisplayDivider:l}){const c=function(e){const t=i(ql);return t?.has(e)??!1}(e.id),d=e.getIsExpanded(),u=gr(lr["table-parent-row"],Jl,e.index%2==0?es:void 0),h=e.getVisibleCells(),p=function(e){const t=a(null);return s(()=>{const n=t.current;n&&(n.inert=e)},[e]),t}(c),{onKeyDownCapture:m,ref:g,role:v,tabIndex:f}=function(e){const t=a(null);return{role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDownCapture:n=>{"Enter"!==n.key&&"Space"!==n.code||n.target!==t.current||(n.preventDefault(),n.stopPropagation(),e?.())},ref:t}}(r);return R("div",{...u,onMouseEnter:t,onMouseLeave:n,ref:p,children:[I("div",{...ts,onKeyDownCapture:m,ref:g,role:v,tabIndex:f,children:h.map(e=>I(Gl,{cell:e,onCellClick:o,isMutating:c},e.id))}),c&&I("div",{className:$l}),d&&I("div",{children:e.subRows.map(e=>I(Xl,{rowData:e,onCellClick:o,shouldDisplayDivider:l,isMutating:c},e.id))})]})}const rs=(e,t={})=>{dn.getState().openDrawer(e,t)},as=()=>{dn.getState().requestCloseDrawer()},os=()=>dn(e=>e.drawerHistory),is={COMPANY:"co",EMPLOYEE:"emp",DIMENSION_VALUE:"cls",DIMENSION:"tcll",CUSTOMER:"cus",BANK_ACCOUNT:"bka",GL_ACCOUNT:"gla",TRANSACTION_CATEGORY:"ctg",BANK_TRANSACTION:"btxn",PROCESSOR_TRANSACTION:"ptxn",TRANSACTION_LINE_ITEM:"tli",VENDOR:"vnd",TRANSACTION_RULE:"trl",INVOICE:"inv",INVOICE_LINE_ITEM:"ili",BILL:"bll",BILL_LINE_ITEM:"bli",PAYROLL:"prl",PAYROLL_LINE_ITEM:"pli",FINANCIAL_SUMMARY:"fsm",TASK:"tsk",CONVERSATION:"cnv",MESSAGE:"msg",REACTION:"rct",BUSINESS_TYPE:"bzt",TEMPLATE_CLASS_LABEL:"tcll",TEMPLATE_COA:"tcoa",TEMPLATE_GL_ACCOUNT:"tgla",TEMPLATE_TRANSACTION_RULES:"ttrl",MANUAL_JOURNAL_ENTRY:"mje",ASSET:"ast",ASSET_DEPRECIATION:"asd",EXPENSE_AMORTIZATION:"exa",REVENUE_RECOGNITION:"rvr",GL_TRANSACTION:"glt",ATTACHMENT:"att",CAR:"car",MILEAGE:"mlg",INTEGRATION:"int",TIME:"tme",TIME_TYPE:"tmt",TAX_RETURN:"txr"};function ls(e,t){return!Ir(e)&&e.startsWith(t)}function ss({id:e,prefix:t}){return void 0!==e?`${is[t]}_${e}`:""}function cs(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}function ds(e,t,n){cr(e)&&(e.listener(t),e.preventDefault)||n?.()}function us(e,t){const{events:n}=dn.getState();null!==e?ls(e.id,is.BANK_TRANSACTION)?ds(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>rs("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ds(n.transactionForm,{type:"OPEN_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>rs("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ds(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:null,error:null},()=>rs("BankTransactionForm",{routeProps:{transactionId:t?.transactionId,initialTab:t?.initialTab,initialType:t?.initialType}}))}function hs({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Er(e,n,r);return Lr.fetchQuery({queryKey:a,queryFn:t})}function ps({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Er(e,n,r);return Lr.prefetchQuery({queryKey:a,queryFn:t})}const ms=[{name:"One-Time Expense",value:"ONE_TIME"},{name:"Weekly Recurring Expense",value:"WEEKLY"},{name:"Monthly Recurring Expense",value:"MONTHLY"},{name:"Yearly Recurring Expense",value:"YEARLY"}],gs={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},vs={ASC:"ASC",DESC:"DESC"},fs=e=>["banks/transactions",e??{}],bs=e=>["banks/transactions",e.id],ys=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ws(e,t){return kl({queryKey:fs(e),queryFn:ys,...t})}const Cs=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await Ei(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function xs({id:e,enabled:t=!0}){return Vr({queryKey:bs({id:e??""}),queryFn:Cs,enabled:t})}function Ts(){return Al({prefetchFn:Cl(bs,Cs)})}function ks(){const{query:{data:e}}=ws({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!sr(t)&&t.length>0}const Es=e=>["conversations/messages",e];function As(e){if(sr(e)||0===e.length)return null;const t=[[e[0]]];for(let n=1;n<e.length;n++){const r=e[n],a=t[t.length-1],o=a[0].author.userId;r.author.userId===o?a.push(r):t.push([r])}return t}const Ss=async e=>{const t=e.queryKey,{id:n}=t[1],r={path:"/v6/conversations/{id}/messages",pathParams:{id:n},accessToken:t[2].accessToken,environment:t[2].environment},a=await Ei(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},Is=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:xi(n),accessToken:t};return await Ra(r)};function Ns(){return Al({prefetchFn:Cl(Es,Ss)})}const Rs=e=>["summaries",e??{}],Ps=e=>["summaries",e.id],Ds=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:xi(t[2].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const Ms=async e=>{const t=e.queryKey,n={path:"/v6/summaries/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await Ei(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Ls(){return dn(e=>e.events.conversations)}function Fs({rowData:e,isMobile:t}){const n=Ls(),{startPrefetch:r,cancelPrefetch:a}=Ol(),{startPrefetch:o,cancelPrefetch:i}=Ns(),{startPrefetch:l,cancelPrefetch:s}=Ts(),{startPrefetch:c,cancelPrefetch:d}=Al({prefetchFn:Cl(Ps,Ms)}),h=u(()=>{cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?l({id:e.original.attachedEntityId}):cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&c({id:e.original.attachedEntityId}),o({id:e.original.id}),r({id:e.original.id})},[e.original.attachedEntityId,e.original.id,o,r,l,c]),p=u(()=>{cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?s():cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&d(),i(),a()},[s,d,a,i,e.original.attachedEntityId]);return I(ns,{rowData:e,onMouseEnter:h,onMouseLeave:p,shouldDisplayDivider:e=>0!==e,onCellClick:()=>{ds(n,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:e.original,error:null},()=>((e,t,n)=>{n?rs("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):cr(t)?ls(t,is.BANK_TRANSACTION)?us(null,{transactionId:t,initialTab:"conversation"}):ls(t,is.FINANCIAL_SUMMARY)&&(r=e,a=t,rs("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){rs("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t))}})}const Os=vi(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M0.328064 7.5H14.6719",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.328064V14.6719",strokeMiterlimit:10})),"Plus"),Vs=tr.raw({display:"flex",alignItems:"center",justifyContent:"center",outline:"none",cursor:"pointer",borderRadius:"md","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout",outlineOffset:"-1px"},"&:disabled":{cursor:"not-allowed",opacity:.6}}),Us=tr(Vs),Bs=tr.raw({color:"typography.intent.primary",border:"{borderWidths.md} solid",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.primary.active",borderColor:"border.intent.primary.active","& .Tight-text":{color:"typography.intent.primary.active"}},"& .Tight-text":{color:"typography.intent.primary"}});tr(Bs);const Hs=tr.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Ws=tr(Hs),zs=tr.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});tr(zs);const _s=tr.raw({display:"flex",alignItems:"center",gap:"5px",backgroundColor:"surface.intent.action.discreet",borderRadius:"md",border:"{borderWidths.md} solid transparent",outline:"none",boxShadow:"0 0 0 0 transparent",position:"relative",cursor:"pointer",color:"icon.base","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"default"},_supportHover:{_enabled:{borderColor:"border.intent.action.hover",backgroundColor:"surface.intent.action.discreet.hover",color:"icon.intent.action.hover",fill:"icon.intent.action.hover"}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"transparent",color:"icon.intent.action.active",fill:"icon.intent.action.active"}}),js=tr.raw({color:"typography.intent.danger",border:"{borderWidths.md} solid",borderColor:"border.intent.danger",backgroundColor:"surface.intent.danger",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-text":{color:"typography.intent.danger.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.danger.active",borderColor:"border.intent.danger.active","& .Tight-text":{color:"typography.intent.danger.active"}},"& .Tight-text":{color:"typography.intent.danger"}}),qs=tr.raw({color:"typography.intent.success",border:"{borderWidths.md} solid",borderColor:"border.intent.success",backgroundColor:"surface.intent.success","& .Tight-text":{color:"typography.intent.success"},"& path":{stroke:"icon.intent.success"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-text":{color:"typography.intent.success.hover"},"& path":{stroke:"icon.intent.success.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.success.active",borderColor:"border.intent.success.active","& .Tight-text":{color:"typography.intent.success.active"},"& path":{stroke:"icon.intent.success.active"}}}),Ks=tr.raw({color:"typography.intent.warning",border:"1px solid {colors.border.intent.warning}",backgroundColor:"surface.intent.warning",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-text":{color:"typography.intent.warning.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.warning.active",borderColor:"border.intent.warning.active","& .Tight-text":{color:"typography.intent.warning.active"}},"& .Tight-text":{color:"typography.intent.warning"}}),Ys=tr.raw({color:"typography.intent.secondary",border:"{borderWidths.md} solid",borderColor:"border.layout",backgroundColor:"surface.intent.secondary","& .Tight-text":{color:"typography.intent.secondary"},"& path":{stroke:"icon.intent.secondary"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-text":{color:"typography.intent.secondary.hover"},"& path":{stroke:"icon.intent.secondary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.secondary.active","& .Tight-text":{color:"typography.intent.secondary.active"},"& path":{stroke:"icon.intent.secondary.active"}}}),Zs=tr.raw({color:"typography.intent.action",border:"1px solid {colors.border.intent.action}",backgroundColor:"surface.intent.action",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-text":{color:"typography.intent.action.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.active",borderColor:"border.intent.action.active","& .Tight-text":{color:"typography.intent.action.active"}},"& .Tight-text":{color:"typography.intent.action"}}),Gs=or({base:tr.raw(Vs,Hs,al),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:Hs,small:zs},intent:{default:{},danger:js,primary:Bs,secondary:Ys,success:qs,warning:Ks,action:Zs}}}),Qs=p(function({children:e,stylists:t=[],styles:n,className:r,type:a="button",onClick:o,disabled:i,size:l="default",width:s="default",intent:c="default",active:d=!1,onMouseEnter:u,onMouseLeave:h,popupTriggerProps:p,eventSource:m},g){const v=function(e){switch(e){case"danger":return lr["button-danger"];case"primary":return lr["button-primary"];case"secondary":return lr["button-secondary"];case"success":return lr["button-success"];case"warning":return lr["button-warning"];case"action":return lr["button-action"];case"default":return null}}(c),f=Cr([gr(lr["button-base"],v,r,tr(Gs.raw({width:s,size:l,intent:c}),n)),...t]);return I("button",{ref:g,...f,type:a,onClick:o,disabled:i,"data-active":d,"data-event-name":m,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function Xs({children:e,stylists:t=[],...n}){return I(Qs,{intent:"secondary",stylists:t,...n,children:e})}const Js=gr(lr["small-square-button"],void 0),$s=tr({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function ec(){const e=Ls();return I("div",{className:$s,children:I(Xs,{stylists:[Js],onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation",{routeProps:{conversationId:null}}))},width:"fill-parent",children:I(cl,{Component:Os})})})}const tc=or({base:{display:"flex",flexDirection:"column",flexGrow:1,animation:"appear.instant",overflow:"hidden"},variants:{dashboard:{transactionDashboard:{border:"none"},financialOverviewDashboard:{marginTop:"16px",borderWidth:"lg",borderStyle:"solid",borderColor:"border.layout",borderRadius:"lg",background:"surface.foreground"},generalLedger:{borderWidth:"lg",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"md",background:"surface.foreground"}}}});function nc({children:e,dashboard:t}){const n=gr(lr["dashboard-table"],tc({dashboard:t}));return I("div",{...n,children:e})}const rc=l(null),ac="mobile",oc=or({base:{padding:"0 25px",height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",width:"100%"},variants:{alignVariant:{flexStart:{alignItems:"flex-start"},center:{alignItems:"center"},flexEnd:{alignItems:"flex-end"}}},defaultVariants:{alignVariant:"flexStart"}});function ic({children:e,alignVariant:t="flexStart"}){const n=gr(null,oc({alignVariant:t}));return I("div",{...n,children:e})}const lc=or({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"template",maxWidth:"100%",xl:{lineHeight:"template",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"},notification:{color:"typography.intent.notification"}},wrap:{ellipsis:Ja,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:eo},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function sc({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=gr(lr.label,lr.text,tr(lc.raw({intent:t,wrap:n,alignment:r}),a));return Ir(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const cc={"sm-sm":gr(lr.text,tr({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"sm-med":gr(lr.text,tr({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"sm-lg":gr(lr.text,tr({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"med-sm":gr(lr.text,tr({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"med-med":gr(lr.text,tr({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"med-lg":gr(lr.text,tr({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa)};function dc({children:e,size:t,weight:n,stylists:r=[]}){const a=Cr([cc[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const uc=gr(lr["emphasis-label"],tr({lineHeight:"template"}));function hc({children:e}){return I(dc,{size:"med",weight:"lg",stylists:[uc],children:e})}function pc({text:e,isRead:t}){return I(t?sc:hc,{children:e})}function mc({date:e,isRead:t=!1}){const n=Lt(e);return I(pc,{text:n,isRead:t})}const gc=gr(lr["strong-sub-label"],xr({label:"strongSubLabel"}));function vc({children:e,stylists:t=[]}){return Ir(e)?null:I(dc,{size:"sm",weight:"med",stylists:[gc,...t],children:e})}const fc=l(null),bc=tr({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),yc=tr.raw({display:"flex",alignItems:"center",gap:"9px",cursor:"pointer",borderRadius:"zero",width:"100%",padding:{sm:"10px",base:"16px"},border:"none",backgroundColor:"surface.foreground",color:"icon.base",minWidth:{base:"100%"},boxShadow:{sm:"none"},minHeight:{sm:"35px"},height:{sm:"fit-content"},flexShrink:{sm:0},textAlign:{sm:"start"},"&[data-focused='true']":{boxShadow:"none",outline:"none",backgroundColor:"surface.intent.action.discreet.hover"}}),wc=gr(lr["selector-row"],tr(yc));function Cc(e,t,n){const[r,a]=d(e);return[t??r,n??a]}function xc({children:e}){return null===pe()?I(me,{children:e}):e}function Tc({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const c=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=d(),[c,h]=d(),[p,m]=Cc(e,r,a),g=ne(),v=re({placement:t,open:p,nodeId:g,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||m(e)},whileElementsMounted:se,middleware:[ae(n),oe({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),ie({padding:8}),le({apply({availableHeight:e,elements:t}){let n=e;if(e<314){const t=37*Math.floor(e/37)-18.5;n=Math.max(t,55.5)}Object.assign(t.floating.style,{maxHeight:`${n}px`,overflowY:"auto"})},padding:8})]}),f=v.context,b=ce(f,{enabled:i}),y=de(f,{bubbles:{escapeKey:!0}}),w=ue(f),C=he([b,y,w]),x=u(()=>m(!1),[m]);return o(()=>({open:p,setOpen:m,close:x,...C,...v,modal:!0,labelId:l,descriptionId:c,setLabelId:s,setDescriptionId:h,nodeId:g}),[p,m,x,C,v,l,c,g])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=pe(),p=l&&null===h,m=c.nodeId;return I(xc,{children:I(ge,{id:m,children:I(fc.Provider,{value:{...c,popupParentNodeId:h,blockInteraction:p},children:e})})})}function kc(){const e=i(fc);if(sr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function Ec({children:e}){const t=kc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const Ac=vi(e=>r.createElement("svg",{stroke:"currentColor",width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.23712 1.23718L8.76283 8.76289",strokeWidth:.8,strokeMiterlimit:10}),r.createElement("path",{d:"M8.76288 1.23718L1.23717 8.76289",strokeWidth:.8,strokeMiterlimit:10})),"Cross");function Sc({Component:e,stylists:t}){return I(e,{stylists:[gr(lr["tiny-icon"],lr.icon),...t??[]],size:9})}const Ic=vi(e=>r.createElement("svg",{stroke:"currentColor",width:11,height:10,viewBox:"0 0 11 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.03625 2.20312H9.96378"}),r.createElement("path",{d:"M1.03625 5H9.96378"}),r.createElement("path",{d:"M1.03625 7.79688H7.24223"})),"Sort"),Nc=gr(lr["button-discreet-small"],tr(_s,{maxWidth:"fit-content",justifyContent:"center","&[data-active='true']":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"border.intent.action.active"},"&:has(button:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),ol),Rc=gr(null,tr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),Pc=gr(null,tr({display:"flex",color:"icon.base",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",padding:"0 6px 0 0",border:"none",outline:"none",position:"relative",cursor:"pointer","&::before":{content:"''",position:"absolute",top:"-9px",right:"-7px",bottom:"-9px",left:"-5px"},_focusVisible:{borderRadius:"sm",outline:"4px solid",outlineColor:"border.layout"}})),Dc=gr(null,tr({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function Mc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...Nc,"data-active":a,children:[R("button",{...Rc,...r,children:[I(vc,{children:t}),!a&&I("div",{...Dc,children:I(Sc,{Component:Ic})})]}),a&&I("button",{...Pc,onClick:e,children:I(Sc,{Component:Ac})})]})}const Lc=or({base:{borderColor:"border.layout",background:"surface.foreground",borderRadius:"zero",boxShadow:"box-shadow",animation:"appear.instant",display:"flex",flexShrink:1,width:"max-content",position:"absolute",top:0,left:0,"& *":{boxSizing:"border-box"}},variants:{type:{reaction:{borderRadius:"sm"}}}});function Fc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=kc(),d=ve([c.refs.setFloating,n]),u=gr(lr.popup,Lc({type:r}));return a||l.open?R(fe,{children:[s&&I(be,{lockScroll:!0}),I(ye,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:I("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Oc=gr(lr["popup-sort-row"],tr({border:"none",background:"none",paddingLeft:"10px",paddingRight:"10px",paddingTop:"4px",paddingBottom:"4px",margin:0,cursor:"pointer",display:"flex",alignItems:"center",width:"100%",outline:"none",_focusVisible:{outline:"4px solid",outlineOffset:"-2px",outlineColor:"border.layout"}}));function Vc({onClick:e,children:t,active:n}){return I("button",{onClick:e,...Oc,children:I(Eo,{accent:n?"active":"action",children:t})})}const Uc=gr(null,tr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),Bc=gr(null,tr({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Hc({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=kc(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return R("div",{...Uc,children:[I(vc,{stylists:[Bc],children:"Sort by:"}),I(Vc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Vc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Wc=tr.raw(_s,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function zc({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=d(!1),u=gr(lr["button-discreet-small"],tr(Wc,e),ol),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return I("button",{type:"button",...u,onClick:e=>{void 0===h&&c(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const _c={minWidth:"140px"};function jc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=i(rc);if(!a)return null;const{sortInstance:o,setSortInstance:l}=a,s=o?.orderBy===t,c=()=>{l(void 0)};return t&&n&&r?R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(Mc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),I(Fc,{style:_c,children:I(Hc,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{l(e)},sortInstance:o})})]}):I(zc,{disabled:!0,children:I(vc,{children:e})})}const qc=or({base:{display:"flex",width:"100%"},variants:{align:{left:{justifyContent:"flex-start"},center:{justifyContent:"center"},right:{justifyContent:"flex-end"}},padding:{none:{},default:{},large:{}}},compoundVariants:[{align:"left",padding:"none",css:{paddingLeft:"0"}},{align:"left",padding:"default",css:{paddingLeft:"19px"}},{align:"left",padding:"large",css:{paddingLeft:"33px"}},{align:"right",padding:"none",css:{paddingRight:"0"}},{align:"right",padding:"default",css:{paddingRight:"19px"}},{align:"right",padding:"large",css:{paddingRight:"33px"}}],defaultVariants:{align:"left",padding:"default"}});function Kc({children:e,align:t="left",padding:n="default"}){return I("div",{className:qc({align:t,padding:n}),children:e})}function Yc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I(Kc,{align:a,padding:o,children:I(jc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Zc="Oldest to Newest",Gc="Newest to Oldest";const Qc=l({userId:void 0,userRole:void 0,userEmail:void 0,companyId:void 0,customerPartnerId:void 0,apiPartnerName:void 0,clientId:void 0,unitIntegrationBankName:null,supportedIntegrations:[],isDfy:!1,hasBookkeeper:!1});function Xc({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=i(Qc);let a="";return e===r?a="Me":Wt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),I(pc,{text:a,isRead:t})}const Jc=vi(e=>r.createElement("svg",{width:15,height:15,stroke:"currentColor",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.77996 13.5774L13.2416 7.78614C13.9666 6.84449 14.288 5.65345 14.1351 4.47491C13.9821 3.29638 13.3674 2.22682 12.4261 1.5014C11.969 1.12033 11.4381 0.83785 10.8667 0.671702C10.2952 0.505554 9.69563 0.459321 9.10548 0.535904C8.51534 0.612488 7.9474 0.810234 7.43731 1.11673C6.92722 1.42323 6.48599 1.83186 6.14132 2.31698L1.10393 8.82104C-0.191398 10.3699 0.829788 12.2478 1.98119 13.1525C2.59811 13.6529 3.38756 13.8897 4.17805 13.8114C4.96854 13.7331 5.69621 13.3461 6.20301 12.7344L11.213 6.23038C11.3671 6.03065 11.4803 5.8025 11.5461 5.55898C11.612 5.31546 11.6291 5.06134 11.5967 4.81118C11.5642 4.56101 11.4827 4.3197 11.3569 4.10105C11.2311 3.88239 11.0634 3.6907 10.8635 3.53692C10.4594 3.22747 9.94931 3.09053 9.44461 3.15603C8.93992 3.22152 8.48166 3.48412 8.16999 3.88645L3.94132 9.36933",strokeMiterlimit:10})),"Attachment"),$c=gr(lr.text,tr({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"template",maxWidth:"100%",fontFamily:"label"}),Xa);function ed({children:e,stylists:t=[]}){const n=Cr([$c,...t]);return I("div",{...n,children:e})}const td=or({base:{display:"flex",gap:8,border:"none",borderBottom:"1px solid",borderBottomColor:"border.layout.weak",borderRadius:0,padding:0,width:"100%",height:"100%",cursor:"pointer",alignItems:"stretch"},variants:{isRead:{true:{backgroundColor:"transparent"},false:{backgroundColor:"surface.background"}}}}),nd=rr(tr({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),Xa),rd=tr({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),ad=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),od=tr({display:"flex",alignItems:"center",gap:8}),id=tr({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),ld=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),sd=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),cd=tr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function dd({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:td({isRead:a}),onTouchEnd:o,children:R("div",{className:nd,children:[R("div",{className:ld,children:[!a&&I("div",{className:cd}),I(pc,{text:t,isRead:a})]}),R("div",{className:rd,children:[I("div",{className:sd,children:I(Xc,{authorUserId:e,isRead:a})}),R("div",{className:od,children:[I("div",{className:ad,children:I(mc,{date:n,isRead:a})}),a?I(cl,{Component:rl}):I(ed,{children:I(cl,{Component:rl})})]})]}),I("div",{className:id,children:Ir(r)?R(N,{children:[I(cl,{Component:Jc}),I(sc,{children:"Shared a file"})]}):I(sc,{children:r})})]})})}const ud=tr({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),hd=tr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function pd({text:e,isRead:t}){return t?I(sc,{children:e}):R("div",{className:ud,children:[I("div",{className:hd}),I(hc,{children:e})]})}const md=J(),gd=gr(null,tr({paddingLeft:"25px"})),vd=[md.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(ic,{children:I(Xc,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(vc,{stylists:[gd],children:"From"}),size:160,maxSize:160}),md.accessor("subject",{id:"subject",cell:({row:e})=>R(ic,{children:[I(pd,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(sc,{children:e.original.latestMessage.text})]}),header:()=>I(vc,{stylists:[gd],children:"Subject"}),size:200}),md.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(ic,{children:I(mc,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(Yc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Gc,sortAscDisplay:Zc}),size:150,maxSize:150}),md.display({id:ac,cell:({row:e})=>I(dd,{sender:e.original.latestMessage.author.userId,subject:e.original.subject,date:e.original.lastUpdatedDateTime,message:e.original.latestMessage.text,isRead:"READ"===e.original.readStatus,handleFormOpen:()=>{}})})];function fd(e){return e?vd.filter(e=>e.id===ac):vd.filter(e=>e.id!==ac)}const bd=[],yd=tr({display:"flex",flexDirection:"column",height:"250px",paddingBottom:"20px",alignItems:"center",justifyContent:"center",boxSizing:"border-box",textAlign:"center",backgroundColor:"surface.background",gap:"10px",color:"icon.base"}),wd=gr(lr["empty-dashboard-layout"],yd);function Cd({children:e}){return I("div",{...wd,"data-testid":"empty-dashboard-layout",children:e})}const xd=tr({width:"25px",height:"25px",borderRadius:"sm"});function Td({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:xd}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["large-icon"],lr.icon),...n??[]],size:25})}const kd=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I(Qs,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),Ed=vi(e=>r.createElement("svg",{stroke:"currentColor",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M12 1.47998C6.2 1.47998 1.5 5.74998 1.5 11C1.52866 13.0153 2.23294 14.9626 3.5 16.53L2.5 21.53L9.16 20.2C10.1031 20.4499 11.0744 20.5776 12.05 20.58C17.85 20.58 22.55 16.3 22.55 11.03C22.55 5.75998 17.8 1.47998 12 1.47998Z",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M11.05 11.02H12.95",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M15.82 11.02H17.73",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M6.27 11.02H8.18",strokeWidth:1.5,strokeMiterlimit:10})),"Comment",{styleIconKey:"comment"}),Ad=tr({width:"15px",height:"15px",borderRadius:"sm"});function Sd({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:Ad}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["medium-icon"],lr.icon),...n??[]],size:15})}function Id(){const e=Ls();return R(N,{children:[I(Td,{Component:Ed}),I(To,{wrap:"wrap",children:"Need help with your financials?"}),R(kd,{...gr(lr["zero-state-button"]),onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation",{routeProps:{conversationId:null}}))},children:[I(To,{children:"Message Bookkeeper"}),I(Sd,{Component:rl})]})]})}const Nd=vi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.0625 2.14374L1.5625 6.90624L11.6813 12.8562L14.0625 2.14374Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M8.25624 10.8375L5.73124 12.8562L5.33749 9.12499L13.4687 2.73749",strokeWidth:.9375,strokeMiterlimit:10})),"Paperplane",{styleIconKey:"send"});function Rd(){return R(N,{children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",children:"All caught up"}),I(Eo,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const Pd=l({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function Dd(e){const{registerAnchor:t}=i(Pd);m(()=>{t(e)},[e,t])}const Md=gr(null,tr({display:"flex",flexDirection:"row",gap:"5px"}));function Ld({children:e}){return I("div",{...Md,children:e})}const Fd=or({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Od(e){return I(e?Rd:Id,{})}function Vd({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){Dd(Gi);const i=function({conversations:e,isMobile:t}){return $({data:e??bd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??bd.length,columns:fd(t),getCoreRowModel:ee(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Dl({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!sr(l?.data?.[0])&&!s;return R("div",{className:Fd({isMobile:o}),children:[I("div",{id:Gi}),R(sl.Provider,{value:r,children:[R(br,{children:[I(kr,{children:"Conversations"}),R(Ld,{children:[I(ml,{}),I(ec,{})]})]}),I(nc,{dashboard:"financialOverviewDashboard",children:a?I(wl,{numColumns:4}):R(N,{children:[!o&&I(rc.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(Hl,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(Kl,{editMutationKey:i.options.meta?.editMutationKey,children:I(zl,{children:i.getRowModel().rows.map(e=>I(Fs,{rowData:e,isMobile:o},e.id))})}):I(Cd,{children:Od(c)})]})})]})]})}const Ud=gr(lr.body,xr({body:"default"}));function Bd({children:e,stylists:t=[]}){if(Ir(e))return null;const n=Cr([Ud,...t]);return I("div",{...n,children:e})}const Hd=gr(null,tr({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Wd=or({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),zd=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function _d(){return I("div",{...Hd,children:zd.map((e,t)=>I(Xo,{styles:Wd({width:e?.width})},t))})}const jd=tr({position:"absolute",top:"-1",right:"-1",width:"10",height:"10",borderRadius:"999px",backgroundColor:"surface.intent.warning",boxShadow:"0 0 0 1px {colors.border.intent.warning}"}),qd=tr({position:"relative",width:"25px",height:"25px"});function Kd({hasUnread:e}){return R("div",{className:qd,children:[I(Td,{Component:Ed}),e&&I("div",{"data-testid":"unread-comment-badge",className:jd,"aria-hidden":"true"})]})}const Yd=gr(lr["financial-summary-chatbox-header"],tr({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Zd({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Yd,children:[I(To,{children:"Message Bookkeeper"}),t&&I(Kd,{hasUnread:e})]})}const Gd=tr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function Qd(){const e=Ls();return R("div",{className:Gd,children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(Eo,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(kd,{...gr(lr["zero-state-button"]),onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation"))},children:[I(To,{children:"Send a Message"}),I(Sd,{Component:rl})]})]})}const Xd=tr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Jd({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Ol(),{startPrefetch:a,cancelPrefetch:o}=Ns(),i=u(()=>{a({id:t}),n({id:t})},[t,a,n]),l=u(()=>{o(),r()},[o,r]);return R("div",{className:Xd,children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(Eo,{wrap:"wrap",children:"Pick up where you left off."}),I(Xs,{onClick:()=>rs("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(To,{children:"Continue conversation"})})]})}const $d=tr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function eu({summaryId:e}){return R("div",{className:$d,children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(Eo,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(Xs,{...gr(lr["zero-state-button"]),onClick:()=>rs("FinancialSummary",{routeProps:{summaryId:e}}),children:I(To,{children:"Talk to a bookkeeper"})})]})}function tu({summaryId:e,conversationId:t}){const n=cr(t);return sr(e)?I(Qd,{}):n?I(Jd,{conversationId:t,summaryId:e}):I(eu,{summaryId:e})}const nu=tr({display:"flex",flexDirection:"column",flex:{base:"1 1 100%",xl:"0 0 342px"},maxHeight:"247px",minHeight:"247px",width:{base:"100%",xl:"342px"},maxWidth:{base:"100%",xl:"342px"},background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",alignItems:"center",overflow:"hidden",boxSizing:"border-box"}),ru=gr(lr["financial-summary-chatbox"],tr({display:"flex",flexDirection:"column",flex:"1 1 0",minHeight:0,width:"100%",backgroundColor:"surface.background",padding:"10px",gap:"10px",alignItems:"flex-start",boxSizing:"border-box"}));function au({summaryData:e}){const t=cr(e?.summary),n=cr(e?.conversation);return R("div",{className:nu,children:[I(Zd,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...ru,children:I(tu,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const ou=vi(e=>r.createElement("svg",{stroke:"currentColor",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("circle",{cx:12,cy:12,r:10,strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M12 6V12L15.5 15.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),"Clock"),iu=tr({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function lu(){return R("div",{className:iu,children:[I(Td,{Component:ou}),I(To,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const su=tr({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),cu=or({base:{display:"flex",flex:{base:"1 1 100%",xl:"1 1 0"},minWidth:{base:"100%",xl:"450px"},maxHeight:"247px",minHeight:"247px",background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",gap:"10px",alignItems:"flex-start",boxSizing:"border-box",position:"relative",marginBottom:10,overflow:"auto"},variants:{isSample:{true:{pointerEvents:"none",overflow:"hidden"},false:{}},isZeroState:{true:{alignItems:"center",justifyContent:"center",padding:"16px"},false:{}}}}),du=gr(null,tr({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),uu=tr({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function hu({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Vr({queryKey:(t={limit:1,filter:{date:{equal:it(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Rs(t):["summaries",{}],queryFn:Ds,...n});var t,n}(t),a=e?function(){const e=/* @__PURE__ */new Date;return`In ${e.toLocaleString("en-US",{month:"long"})} ${e.getFullYear()}, your total income increased significantly to $${ii.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${li.toLocaleString()}, compared to $${4534..toLocaleString()} last month, which slightly narrowed your net profit margin despite a healthy $${15157..toLocaleString()} net profit. \n\nA key area for improvement is transaction categorization; with one transaction remaining uncategorized and only two user-categorized, enhancing categorization accuracy will improve financial tracking and insights. To maintain positive momentum, consider reviewing variable expenses to identify any controllable cost increases.\n\nGoing forward, continue focusing on revenue growth while keeping a close eye on expense management, and aim to fully categorize all transactions to gain more precise financial visibility.`}():n?.summary,o=!e&&!r&&!a,i=gr(lr["financial-summary-layout"],cu({isSample:e,isZeroState:o}));return R("div",{className:uu,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(_d,{}):o?I(lu,{}):R("div",{className:su,children:[I(Bd,{stylists:[du],children:a}),e&&I(oi,{size:"lg"})]})}),I(au,{summaryData:n})]})}const pu=gr(lr["month-picker"],tr({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),mu=gr(lr["month-picker-left-button"],tr({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),gu=gr(lr["month-picker-right-button"],tr({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),vu=gr(lr["month-picker-label"],tr({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function fu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=rt(e.year,e.month,1),o=Mt(a,{abbreviateMonth:!0});return R("div",{...pu,children:[I(Xs,{stylists:[mu],onClick:()=>{return t(0===(n=e).month?{month:11,year:n.year-1}:{month:n.month-1,year:n.year});var n},disabled:r,children:I(cl,{Component:nl})}),I("div",{...vu,children:I(To,{children:o})}),I(Xs,{stylists:[gu],onClick:()=>{return t(11===(n=e).month?{month:0,year:n.year+1}:{month:n.month+1,year:n.year});var n},disabled:n,children:I(cl,{Component:rl})})]})}const bu=tr({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function yu({children:e}){return I("div",{className:bu,children:e})}function wu(){return dn(e=>e.events.bITile)}const Cu=or({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),xu=gr(lr["progress-bar"],tr({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),Tu=gr(lr["progress-bar-fill"],tr({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),ku=gr(lr["tile-bar-label"],tr({paddingLeft:"10px"})),Eu=gr(lr["tile-bar-label-outer"],tr({paddingLeft:"10px"}));function Au({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?lr["bar-transactions-positive"]:lr["bar-transactions-negative"],l=gr(i,Cu({color:n})),s=Cr([Tu,l]);return R("div",{...xu,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...ku,children:I(sc,{children:e})})}),!o&&I("div",{...Eu,children:I(sc,{children:e})})]})}const Su=gr(lr["metric-md"],tr(xr.raw({metric:"md"}),eo));function Iu(e){return I("div",{...Su,children:e.children})}const Nu=tr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),Ru=tr({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function Pu({label:e,amount:t,total:n,color:r}){const a=n>0?function(e,t,n,r=0,a=100){return r+(e-t)*(a-r)/(n-t)}(t,0,n):0;return R("div",{className:Nu,children:[I(Au,{label:e,percentage:a,color:r}),I("div",{className:Ru,children:I(Iu,{children:fo(t)})})]})}const Du=vi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.3131 0.489685V4.15097H9.65182",strokeMiterlimit:10}),r.createElement("path",{d:"M2.32925 15.1348V11.4735H5.99054",strokeMiterlimit:10}),r.createElement("path",{d:"M1.34228 9.57602C1.18256 9.00181 1.10327 8.40823 1.10669 7.81223C1.1074 6.38654 1.56211 4.99811 2.4049 3.8482C3.2477 2.69828 4.4348 1.84664 5.79412 1.41671C7.15345 0.986775 8.61437 1.00089 9.96513 1.45702C11.3159 1.91314 12.4863 2.78757 13.3067 3.95356",strokeMiterlimit:10}),r.createElement("path",{d:"M14.2937 6.04849C14.4534 6.6227 14.5327 7.21628 14.5293 7.81228C14.5286 9.23797 14.0739 10.6264 13.2311 11.7763C12.3883 12.9262 11.2012 13.7779 9.84185 14.2078C8.48253 14.6377 7.02161 14.6236 5.67085 14.1675C4.32008 13.7114 3.14967 12.8369 2.32925 11.671",strokeMiterlimit:10})),"Sync"),Mu={},Lu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return Mu[e]={loading:!1,error:null,scriptEl:t}},Fu="undefined"!=typeof window&&void 0!==window.document;function Ou({src:e,checkForExisting:t=!1,...n}){let r=Mu[e];!r&&t&&e&&Fu&&(r=Lu(e));const[a,o]=d(r?r.loading:Boolean(e)),[i,l]=d(r?r.error:null),[c,u]=d(!1);return s(()=>{if(!Fu||!e||c||i)return;let a;r=Mu[e],!r&&t&&(r=Lu(e)),r?a=r.scriptEl:(a=document.createElement("script"),a.src=e,Object.keys(n).forEach(e=>{void 0===a[e]?a.setAttribute(e,n[e]):a[e]=n[e]}),r=Mu[e]={loading:!0,error:null,scriptEl:a});const s=()=>{r&&(r.loading=!1),o(!1),u(!0)},d=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",s),a.addEventListener("error",d),document.body.appendChild(a),()=>{a.removeEventListener("load",s),a.removeEventListener("error",d),r&&r.loading&&(a.remove(),delete Mu[e])}},[e]),[a,i]}const Vu=e=>["integrations",e??{}],Uu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Bu(e,t){return kl({...t,queryKey:Vu(e),queryFn:Uu})}function Hu(e){return Bu({filter:{apiName:{equal:"PLAID"}}},e)}function Wu(e){return Da(`${t=e,Ma[t]}/v1`,"v1");var t}async function zu({institutionId:e,accessToken:t,environment:n}){if(!t)throw new Error("Access token is required to get Plaid item institution");const r={path:"/banks2/bankUrl",accessToken:t,endpointManager:Wu(n)},{url:a,headers:o}=Sa(r);return await Ti({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const _u="cancel",ju="danger",qu="success",Ku=tr({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Yu=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Zu=or({base:{background:"surface.background",borderRadius:"md",display:"flex",flexDirection:"column",gap:"16px"},variants:{size:{sm:{maxWidth:"360px",minWidth:"0",margin:"32px"},md:{maxWidth:"600px",minWidth:"400px",margin:"32px"},lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"},margin:{sm:"32px",base:"0"},height:{sm:"auto",base:"100dvh"}}},padding:{none:{padding:"0"},sm:{padding:"8px"},md:{padding:"16px"},lg:{padding:"24px"}}},defaultVariants:{size:"sm",padding:"md"}}),Gu={transform:"none",willChange:"auto"};function Qu({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=re({open:e,strategy:"fixed"}),s=de(l,{outsidePress:o,escapeKey:i}),c=ue(l,{role:t}),{getFloatingProps:d}=he([s,c]),u="alertdialog"===t?lr["alert-dialog"]:null,{className:h}=gr(u,Zu({size:r,padding:a}));return e?I(fe,{children:I(be,{lockScroll:!0,className:Ku,children:I(ye,{context:l,modal:!0,returnFocus:!0,children:I("div",{...d(),className:h,style:Gu,children:n})})})}):null}const Xu=gr(lr["close-button"],tr({display:"flex",backgroundColor:"surface.intent.action.discreet",border:"none",padding:"6px",color:"icon.base",margin:0,borderRadius:"sm",outline:"none",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),ll),Ju=()=>as();function $u({Icon:e=Ac,handleClose:t=Ju}={}){return I("button",{...Xu,onClick:t,type:"button",children:I(Sd,{Component:e,...Xu})})}const eh=gr(lr["alert-header"],tr({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"template"},$a));function th({children:e}){return I("div",{...eh,children:e})}const nh=tr({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),rh=tr.raw({width:"100%"}),ah=e=>{switch(e){case oh.DANGER:return"danger";case oh.SUCCESS:return"success";case oh.ACTION:return"primary";default:return"secondary"}},oh={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ih=we.createConfirmation(Ce(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(Qu,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[R("div",{className:Yu,children:[I(th,{children:r}),o&&I($u,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(sc,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:nh,children:i.map(e=>I(Qs,{intent:ah(e.type),styles:rh,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(To,{children:e.label})},e.key))})]})}));function lh(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function sh(e){return new H(e).div(100).toNumber()}function ch(e){return new H(e).times(100).toNumber()}function dh(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function uh(e,t){return t?e?`${e} ${dh(t)}`:dh(t):e??""}const hh=e=>{ds(dn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:{defaultValues:e},error:null},()=>rs("Conversation",{routeProps:{conversationId:null,defaultValues:e}}))},ph=tr({display:"flex",flexDirection:"column",gap:"12px"});async function mh(e){await ih({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Chat",type:oh.SUCCESS}]})===qu&&hh({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const gh=e=>["banks/accounts",e??{}],vh={integration:{expand:!0},status:{notIn:["REMOVED"]}},fh=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment,i={path:"/v6/banks/accounts/query",bodyParams:{...n,filter:{...n.filter},cursor:r},accessToken:a,endpointManager:xi(o)},l=await Ra(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function bh(e){return kl({queryKey:gh({...e?.params,filter:{...vh,...e?.params?.filter}}),queryFn:fh,enabled:e?.enabled,select:e?.select})}function yh(e,t){return hs({queryKey:Ar(gh({filter:vh}),{}),queryFn:fh,accessToken:e,environment:t})}const wh={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},Ch={short:{credentialsChanged:e=>`${e} Credentials Changed`,accountLocked:e=>`${e} Account Locked`,supportChanged:e=>`${e} Support Changed`,updateNeeded:e=>`${e} Update Needed`,noAccountsAvailable:e=>`No ${e} Accounts Available`,connectionError:e=>`${e} Connection Error`,serverError:e=>`${e} Server Error`,temporarilyDown:e=>`${e} Temporarily Down`,serverDown:e=>`${e} Server Down`,requestError:e=>`${e} Request Error`,inputError:e=>`${e} Input Error`,volumeDown:e=>`${e} Down Due to Volume`,credentialsExpiring:e=>`${e} Credentials Expiring`,relinkNeeded:e=>`${e} Relink Needed`,generic:()=>"Bank Connection Error"},long:{relinkCredentials:()=>"Please relink your account using your latest credentials.",invalidUpdatedUsername:({isMobile:e})=>`Your bank account has an updated username and needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,accountLocked:({isMobile:e})=>`Your bank account has been locked. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" and ask your financial institution to unlock your account. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,supportChanged:({apiPartnerName:e})=>`Unfortunately, your bank has added restrictions that block services like ${e||"ours"} from linking with it. Please chat with support to resolve this issue.`,updateNeeded:({isMobile:e})=>`Your bank requires you to take some action. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to log in and perform the requested action. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,mfaUpdateNeeded:({isMobile:e})=>`You have an unsupported "Multi-Factor Authentication" enabled. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to disable it on your banking site. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,noAccountsUnlink:()=>"It seems that you have no active accounts with this bank. Please unlink this bank.",connectionError:()=>"Your bank connection encountered an error. Please chat with support to resolve the issue.",productNotReady:()=>"Your institution was not ready for transactions to be pulled. Please chat with support to resolve the issue.",permissionRevoked:({apiInstitutionName:e})=>`Access to your accounts with ${e} has been revoked. Please unlink and relink your account using your latest credentials.`,bankMaintenance:()=>"Your bank's server is down for maintenance, so it may take a little longer than normal to receive new transactions.",serverDown:()=>"Your bank's server is unexpectedly down. Please chat with support to resolve the issue.",bankConnectionMaintenance:()=>"Your bank connection is down for maintenance, so it may take a little longer than normal to receive new transactions.",partnerCredsChange:({isMobile:e})=>`Your bank account needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,credentialsExpiring:({apiInstitutionName:e})=>`Your authorization for ${e} will expire soon. Please relink your bank with your latest credentials.`,relinkForStatements:()=>"Please relink your account using your latest credentials to enable automatic retrieval of bank statements.",generic:()=>"There was an error with your bank connection. Please chat with our team so they can resolve it."}},xh={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.RELINK},INVALID_MFA:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.invalidUpdatedUsername,buttonType:wh.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:Ch.short.accountLocked,longMessage:Ch.long.accountLocked,buttonType:wh.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:Ch.short.supportChanged,longMessage:Ch.long.supportChanged,buttonType:wh.CHAT},USER_SETUP_REQUIRED:{shortMessage:Ch.short.updateNeeded,longMessage:Ch.long.updateNeeded,buttonType:wh.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:Ch.short.supportChanged,longMessage:Ch.long.mfaUpdateNeeded,buttonType:wh.OPEN_BANK},NO_ACCOUNTS:{shortMessage:Ch.short.noAccountsAvailable,longMessage:Ch.long.noAccountsUnlink,buttonType:wh.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:Ch.short.noAccountsAvailable,longMessage:Ch.long.noAccountsUnlink,buttonType:wh.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},ITEM_NOT_FOUND:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},PRODUCT_NOT_READY:{shortMessage:Ch.short.serverError,longMessage:Ch.long.productNotReady,buttonType:wh.CHAT},USER_PERMISSION_REVOKED:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.permissionRevoked,buttonType:wh.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:Ch.short.temporarilyDown,longMessage:Ch.long.bankMaintenance,buttonType:wh.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:Ch.short.serverDown,longMessage:Ch.long.serverDown,buttonType:wh.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:Ch.short.temporarilyDown,longMessage:Ch.long.bankMaintenance,buttonType:wh.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:Ch.short.supportChanged,longMessage:Ch.long.supportChanged,buttonType:wh.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},PLANNED_MAINTENANCE:{shortMessage:Ch.short.temporarilyDown,longMessage:Ch.long.bankConnectionMaintenance,buttonType:wh.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:Ch.short.requestError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:Ch.short.inputError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:Ch.short.volumeDown,longMessage:Ch.long.bankMaintenance,buttonType:wh.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:Ch.short.updateNeeded,longMessage:Ch.long.partnerCredsChange,buttonType:wh.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:Ch.short.credentialsExpiring,longMessage:Ch.long.credentialsExpiring,buttonType:wh.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:Ch.short.relinkNeeded,longMessage:Ch.long.relinkForStatements,buttonType:wh.RELINK}},DEFAULT:{DEFAULT:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:Ch.short.generic,longMessage:Ch.long.generic,buttonType:wh.CHAT}}};function Th({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=xh[e];if(!n)return wa({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),xh.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(wa({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),xh.DEFAULT.DEFAULT)}function kh(e){return!0===e?.additionalConsentRequired}const Eh=e=>{const t=e?.status?"DELETED"===e.status?"REMOVED":e.status:"ACTIVE",n="MORTGAGE"!==e?.apiType&&"BROKERAGE"!==e?.apiType&&e?.apiType?e.apiType:"OTHER";return{iconUrl:"",...e,id:e.id??"",status:"DELETED"===e.status?"REMOVED":t,name:e.apiName??"",apiName:"PLAID",glAccountId:ss({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:ss({id:e.plaidItemId||e.oauthAccountId,prefix:"INTEGRATION"}),apiInstitutionId:e.apiInstitutionId??null},mask:e.apiMask??"",beginningBalanceData:{},isSupported:e.isSupported||!1,tranStartDate:e.tranStartDate||null,tranMinStartDate:e.tranMinStartDate||null,latestTransactionDate:e.latestTransactionDate||null,accountBalance:e.apiCurrentBalance||null,subType:e.apiSubType||null}};function Ah({mutationFn:e,onMutateFn:t,onSuccess:n,onError:r,...a}){const o=Pr(),i=Or(),l=!Ir(o);return O({...a,mutationFn:l?t=>e({data:t,accessToken:o,environment:i}):Dr,onMutate:l&&cr(t)?e=>t({data:e,accessToken:o,environment:i}):void 0,onSuccess:n,onError:r},Lr)}const Sh=l({createToast:()=>null,dismiss:()=>{}});function Ih(){const{createToast:e,dismiss:t}=i(Sh);return o(()=>({success:(t,n)=>e("success",t,n),error:(t,n)=>e("error",t,n),dismiss:t}),[e,t])}function Nh({toast:e,responseErrorParser:t,toastOptions:n,onSuccess:r,onError:a}){return{onSuccess:r||n?(a,o,i)=>(n&&function(e,t,n,r,a){const o=n.defaultPartialMessage;if(cr(o)&&t.isPartialFailure(r)){const n=t.getErrorMessages(r),i="function"==typeof o?o(a):o;(n.length>0?n:[i]).forEach(t=>e.error(t))}else{const t=(i=n.defaultSuccessMessage,l=r,s=a,"function"==typeof i?i(l,s):i);cr(t)&&e.success(t)}var i,l,s}(e,t,n,a,o),r?.(a,o,i)):void 0,onError:a||n?.defaultErrorMessage?(r,o,i)=>(n&&function(e,t,n,r,a){(function(e,t,n,r){const a=t.defaultErrorMessage,o="function"==typeof a?a(r):a;if(sr(o))return[];const i=n.getErrorMessages(e);return i.length>0?i:[o]})(r,n,t,a).forEach(t=>e.error(t))}(e,t,n,r,o),a?.(r,o,i)):void 0}}function Rh(e){return"object"==typeof e&&null!==e}const Ph={isFailureResult:function(e){return Rh(e)&&"FAILURE"===e.result},isPartialFailure:function(){return!1},getErrorMessages:function(e){if(!Rh(e)||!cr(e.errors))return[];const t=[],{fieldErrors:n,globalErrors:r}=e.errors;if(cr(n))for(const a of Object.values(n))cr(a)&&Nr(a.errorMessage)&&t.push(a.errorMessage);if(Array.isArray(r))for(const a of r)cr(a)&&Nr(a.errorMessage)&&t.push(a.errorMessage);return t}};function Dh({mutationFn:e,onSuccess:t,onError:n,meta:r,...a}){const o=Ih(),{onSuccess:i,onError:l}=Nh({toast:o,responseErrorParser:Ph,toastOptions:r?.toastOptions,onSuccess:t,onError:n});return Ah({...a,mutationFn:async({data:t,accessToken:n,environment:r})=>{const a=await e({data:t,accessToken:n,environment:r});return Ph.isFailureResult(a)?Promise.reject(a):a},onSuccess:i,onError:l})}const Mh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Oa(n)};return await Pa(r)},Lh=async({data:e,accessToken:t,environment:n})=>Mh({data:e,accessToken:t,environment:n}),Fh=async({data:e,accessToken:t,environment:n})=>Mh({data:e,accessToken:t,environment:n}),Oh=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/accounts",bodyParams:{accounts:e.accounts},accessToken:t,endpointManager:Oa(n)};return await Pa(r)})({data:{accounts:e},accessToken:t,environment:n});function Vh(e){return Dh({onSuccess:async()=>{ya("mutation successful, invalidating bank account queries");try{return Lr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}},...e})}function Uh(){return Vh({mutationFn:Fh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update account"}}})}function Bh(){return Dh({onSuccess:async()=>{ya("mutation successful, invalidating bank account queries");try{return Lr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}},mutationFn:Oh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update accounts"}}})}const Hh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,Wh=e=>"PLAID"===e,zh=e=>({id:cs(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),_h=tr({display:"flex",flexDirection:"column",gap:"16px"}),jh=async()=>ih({title:"Merge Accounts",body:R("div",{className:_h,children:[I(sc,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(sc,{wrap:"wrap",children:"This action can't be undone."}),I(sc,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Continue",type:oh.DANGER}]}),qh=()=>ih({title:"Merge Failed",body:I(sc,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:_u,label:"OK"}]}),{formContext:Kh,fieldContext:Yh,useFieldContext:Zh,useFormContext:Gh}=xe(),Qh=vi(e=>r.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{id:"icon/check"},r.createElement("path",{id:"Vector",d:"M0.986511 5L3.66217 7.67566L9.01349 2.32434",stroke:"currentColor",strokeWidth:1.25,strokeMiterlimit:10}))),"Check");function Xh({children:e,stylists:t=[],...n}){return I(Qs,{intent:"success",stylists:t,...n,children:e})}function Jh({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(Xh,{type:"submit",disabled:n,children:[e&&I(cl,{Component:Qh}),I(To,{children:t})]})}const $h=tr({animation:"linear 1s spin infinite"}),ep=tr({background:"conic-gradient(from 90deg, transparent 0deg, {colors.icon.base.weak} 360deg)",height:"100%",width:"100%",opacity:1}),tp=tr({position:"relative"});function np({size:e}){const t=e??15;return I("div",{className:tp,children:R("svg",{className:$h,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[I("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:I("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:I("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:I("div",{className:ep})})})}),I("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z","data-figma-gradient-fill":'{"type":"GRADIENT_ANGULAR","stops":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"stopsVar":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"transform":{"m00":-9.1848822316819949e-16,"m01":-14.999998092651367,"m02":15.999998092651367,"m10":14.999998092651367,"m11":-9.1848822316819949e-16,"m12":1.0},"opacity":1.0,"blendMode":"NORMAL","visible":true}'}),I("defs",{children:I("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:I("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z"})})})]})})}const rp=gr(null,tr({display:"flex",width:"100%"}));function ap({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r,isSubmitting:a}){let o;return o=a&&e?R(N,{children:[I(np,{size:12}),I(To,{children:t})]}):a&&!e?I(np,{size:12}):!a&&e?R(N,{children:[I(cl,{Component:Qh}),I(To,{children:t})]}):I(To,{children:t}),I(kd,{type:"submit",disabled:n||a,stylists:[rp],onClick:r,children:o})}const op=or({base:{},variants:{alignment:{vertical:{width:"{borderWidths.md}",minWidth:"{borderWidths.md}",alignItems:"stretch"},horizontal:{width:"100%",height:"{borderWidths.md}",minHeight:"{borderWidths.md}"}},color:{weak:{backgroundColor:"border.layout.weak"},normal:{backgroundColor:"border.layout"},strong:{backgroundColor:"border.layout.strong"},active:{backgroundColor:"border.intent.secondary"}}}});function ip({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=gr("vertical"===e?lr["vertical-divider"]:lr["horizontal-divider"],n,op({alignment:e,color:t}));return I("div",{...r})}const lp=tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),sp=[gr(null,tr({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],cp=gr(null,tr({display:"flex",alignItems:"center",gap:"4px"}));function dp({errorMessage:e}){return R("div",{...cp,children:[I(Sd,{Component:bi,stylists:sp}),I(Eo,{intent:"danger",wrap:"wrap",children:e})]})}const up=tr({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function hp({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o,isSubmitting:i}){return R(N,{children:[I(ip,{alignment:"horizontal",color:"normal"}),R("div",{className:lp,children:[e,o&&I("div",{className:up,children:I(dp,{errorMessage:o})}),I(ap,{showIcon:t,disabled:r,onClick:a,textContent:n,isSubmitting:i})]})]})}const pp=tr.raw({_notDisabled:{"&[data-state='closed'][data-disablehover='false']":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:not([data-state])[data-disablehover='false']:not(:focus-within)":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&[data-state='open']":{backgroundColor:"surface.intent.action.discreet.active"},"&[data-active='false']:has(:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}},_disabled:{backgroundColor:"surface.foreground.disabled",color:"typography.base.weak",pointerEvents:"none",borderColor:"border.layout"}}),mp=tr.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function gp({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1,disabled:l=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i,"data-disabled":l||void 0}}}const vp=tr({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},pp),fp=tr(mp),bp=tr({display:"flex",flexDirection:"column",gap:"8px"}),yp=tr({display:"flex",justifyContent:"space-between",alignItems:"center"});function wp({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:c,errorMessage:u,disableHover:h=!1,type:p,remainingChars:m,hasErrorStyles:g,disabled:v=!1}){const f=gr(i||null,vp,l,fp,ll),[b,y]=d(!0),{dataAttributes:w}=gp({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:g,disableHover:h,disabled:v});return R("div",{className:bp,children:[R("div",{className:yp,children:[void 0!==r&&I(sc,{children:r}),cr(m)&&I(sc,{children:`${m}`})]}),I("div",{...f,onClick:s,...n,onMouseDown:e=>{y(!0),t&&t.current&&e.target!==t.current&&(e.preventDefault(),t.current.focus())},onFocus:()=>{t&&t.current&&function(e,t){if("setSelectionRange"in e&&"number"!==t){const t=e.value.length;e.setSelectionRange(t,t)}}(t.current,p)},onBlur:()=>{y(!1),c?.()},...w,children:e}),o&&"open"!==n?.["data-state"]&&u&&I(dp,{errorMessage:u})]})}function Cp({disabled:e=!1,...t}){const n=Zh(),r=Te(n.form.store,e=>e.isSubmitting);return I(wp,{...t,disabled:r||e})}const xp=tr({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled",_notDisabled:{"&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}}});function Tp({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a,disabled:o}){const i=Zh(),l=Te(i.store,e=>e.meta.errors[0]?.message),s=Te(i.store,e=>e.meta.isDefaultValue),c=Te(i.store,e=>e.meta.isTouched);return I(Cp,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:s,isTouched:c,className:lr["discreet-form-input"],additionalStyles:xp,errorMessage:l,onClick:a,onBlur:i.handleBlur,disabled:o,children:e})}function kp(e){((navigator.userAgent?navigator.userAgent.toLowerCase().includes("mac"):navigator.platform.toLowerCase().includes("mac"))?e.metaKey:e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),e.currentTarget.requestSubmit())}function Ep(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Ap(e){"Enter"===e.key&&e.currentTarget.blur()}const Sp=gr(lr["amount-input"],xr({metric:"md"}),tr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),Ip=gr(null,tr({display:"flex",alignItems:"center",gap:"2px"}));function Np({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=d(!1);return R("div",{...Ip,children:[sr(e)&&I(Iu,{children:"$"}),I(Ee,{...Sp,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:sr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Ap,autoFocus:o})]})}const Rp=or({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",_disabled:{backgroundColor:"surface.foreground.disabled"}},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function Pp({kind:e,label:t,children:n,inputRef:r,disabled:a,popupTriggerProps:o,onClick:i,disableHover:l=!1,type:s,maxLength:c,hasErrorStyles:d}){const u=Zh(),h=Te(u.store,e=>e.meta.errors[0]?.message),p=Te(u.store,e=>e.meta.isTouched),m="string"==typeof u.state.value?u.state.value.length:0,g=cr(c)?c-m:void 0;return I(Cp,{label:t,inputRef:r,popupTriggerProps:o,className:lr["editable-form-input"],additionalStyles:Rp({kind:e}),errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:g,hasErrorStyles:d,disabled:a,children:n})}const Dp=gr(null,tr({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function Mp({options:e,onSelect:t,selectedLabel:n}){const r=kc();return I("div",{...Dp,children:e.map(e=>I(Vc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const Lp=vi(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2922)"},r.createElement("path",{d:"M0.714706 3.99996L6.31472 9.59998L11.9147 3.99996",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2922"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowDown"),Fp=gr(lr["dropdown-selector-button"],tr({cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderRadius:"sm",gap:"7px",backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}}),ol);function Op({selectedLabel:e,options:t,onSelect:n}){return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>R("button",{...Fp,...t,children:[I(To,{children:e}),I(Sc,{Component:Lp})]})}),I(Fc,{children:I(Mp,{options:t,onSelect:n,selectedLabel:e})})]})}const Vp=gr(null,tr({display:"flex",alignItems:"center",gap:"15px"})),Up=Ct.map((e,t)=>({value:t,label:e})),Bp=xt({}).map(e=>({value:e,label:String(e)}));function Hp({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return R("div",{...Vp,children:[I(Op,{selectedLabel:Ct[r],options:Up,onSelect:e=>a(n,e)}),I(Op,{selectedLabel:String(n),options:Bp,onSelect:e=>a(e,r)})]})}const Wp=gr(null,tr({background:"surface.foreground",padding:"25px",gap:"15px"})),zp=gr(null,tr({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),_p=gr(lr["date-picker-nav-button"],tr({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"8px",borderRadius:"sm",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"},"&:disabled":{opacity:.6,pointerEvents:"none"}}),ol),jp=gr(null,tr({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),qp=gr(null,tr({padding:"8px",textAlign:"center"})),Kp=gr(lr["date-picker-day-button"],tr({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"6px",width:"36px",height:"36px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"sm",cursor:"pointer",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}},"&[data-selected='true']":{backgroundColor:"surface.intent.action.discreet.active",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.active"},"&[data-today='true']::after":{content:"''",position:"absolute",bottom:"3px",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:"brand.primary"},"&:disabled":{cursor:"default"}}),ol),Yp=gr(null,tr({color:"typography.base"}));function Zp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&Tt(e,t),l=kt(e),s=e.getMonth()!==n,c=!!a&&Et(e,a),d=!!o&&Et(o,e);return I("button",{...Kp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(To,{stylists:s||c||d?[Yp]:[],children:e.getDate().toString()})})}function Gp({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=kc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=rt(e,t,1),r=new Date(n);return r.setDate(r.getDate()-n.getDay()),Array.from({length:42},(e,t)=>{const n=new Date(r);return n.setDate(r.getDate()+t),n})}(s,c),u=(h=d)[h.length-1];var h;const p=void 0===a||u&&Et(a,u),m=sr(o)||d.length>0&&Et(d[0],o),g=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return R("div",{...Wp,children:[R("div",{...zp,children:[I("button",{..._p,onClick:()=>v(-1),disabled:!m,"aria-label":"Previous month",children:I(cl,{Component:nl})}),I(Hp,{currentMonthYear:l,onMonthYearChange:r}),I("button",{..._p,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:I(cl,{Component:rl})})]}),R("div",{...jp,children:[wt.map(e=>I("div",{...qp,children:I(Eo,{children:e})},e)),d.map(t=>I(Zp,{date:t,selectedDate:e,currentMonth:c,onClick:g,maxDate:a,minDate:o},t.toISOString()))]})]})}const Qp=gr(null,xr({label:"default"}),tr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),Xp=gr(null,xr({label:"default"}),tr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",cursor:"text",overflowWrap:"break-word",minWidth:"100%",maxWidth:"100%","&::placeholder":{color:"typography.base.weak"},"&:focus":{outline:"none"}}));function Jp(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant",block:"end"}),e.current.setAttribute("data-hasscrolled","true"))}async function $p(e){const t=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}const em=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),tm=[...em].map(e=>`.${e}`).join(","),nm=/* @__PURE__ */new Set(["xls","xlsx","csv"]),rm={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...em].map(e=>e.toUpperCase()).join(", ")} file.`,fileTooLarge:"File exceeds the 50MB size limit.",fileTooLargeSpreadsheet:"File exceeds the 50MB size limit. Try splitting it into smaller parts.",duplicate:"File has already been attached. To replace it, delete the existing file first.",maxAttachmentsReached:"Maximum of 3 attachments allowed per transaction. Remove an existing attachment to add more."},am={"image/jpeg":[".jpg",".jpeg",".jfif"],"image/png":[".png"],"image/gif":[".gif"],"image/heic":[".heic"],"image/tiff":[".tif",".tiff"],"image/svg+xml":[".svg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"application/vnd.ms-excel":[".xls"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"text/csv":[".csv"],"text/plain":[".txt"]};function om(e,t,n,r,a,o,i=crypto.randomUUID(),l=null,s=null,c=null){return{localId:i,id:t,file:e,displayText:r,displayFileName:n,isPending:a,hasError:o,fileSize:l,iconUrl:s,publicFileUrl:c}}function im(e,t,n){return om(e,null,e.name,t,!1,!0,n)}async function lm(e,t){const n=await async function(e,t){const n=e.name.split("."),r=n.length>=2?n[n.length-1].toLowerCase():void 0;if(!r||!em.has(r))return rm.unsupportedFileType;if(e.size>52428800)return nm.has(r)?rm.fileTooLargeSpreadsheet:rm.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await $p(e);for(const e of a)if(await $p(e.file)===t)return rm.duplicate}return null}(e,t);return n?im(e,n):om(e,null,e.name,rm.pendingUpload,!0,!1)}const sm=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Oa(n).getUrl(`/files/upload/${a}`),s=Ir(o)?"att_"+i:o,c=new FormData;return c.append("file",r),c.append("caption",s),c.append("entityId",String(i)),(await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`},credentials:"include",body:c})).json()};function cm(){return Ah({mutationFn:sm,onSuccess:async()=>Lr.invalidateQueries({queryKey:["files/attachments"]})})}const dm=async({data:e,accessToken:t,environment:n})=>{const r=Oa(n).getUrl("/files/attachment");return(await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:e.id})})).json()};const um=tr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),hm=tr({display:"none"}),pm=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=cm();return{mutateAsync:u(async t=>{const n=t.map(({file:t})=>e({file:t,entity:"message",caption:t.name,entityId:null})),r=await Promise.allSettled(n);return t.map((e,t)=>function(e,t){if("fulfilled"===t.status&&"SUCCESS"===t.value.result){const n=t.value?.attachment?.id??null,r=t.value?.attachment?.caption??e.file.name,a=t.value?.attachment?.fileSize??null,o=t.value?.attachment?.iconUrl??null,i=t.value?.attachment?.publicFileUrl??null;return om(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return im(e.file,rm.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=u(()=>{r.current?.click()},[]),l=u(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>lm(e,n))),s=l.filter(e=>!e.hasError);e?.(l);try{const e=await o(s);t?.(e)}finally{r.current&&(r.current.value="")}},[n,e,t,o]);return R("div",{children:[I("input",{className:hm,type:"file",multiple:!0,accept:tm,ref:r,onChange:l}),I(Xs,{type:"button",onClick:i,children:I("span",{className:um,children:I(Sd,{Component:Jc})})})]})},mm=S.custom(),gm=S.object({message:S.object({text:S.string(),attachments:S.array(mm)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),vm=tr.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),fm=tr.raw({visibility:"hidden",fontSizeAdjust:"none",fontSize:"100%",fontStyle:"normal",letterSpacing:"normal",fontStretch:"normal",fontVariant:"normal",fontWeight:"normal",textAlign:"left",textAlignLast:"initial",textDecoration:"none",textEmphasis:"none",textIndent:"0px",textJustify:"auto",textShadow:"none",textTransform:"none"}),bm=tr(fm,vm),ym=tr.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),wm=tr(ym,vm,xr.raw({body:"default"})),Cm=tr({display:"block",width:"100%"}),xm=tr({position:"relative"}),Tm=tr({display:"flex",justifyContent:"flex-end",gap:"15px"}),km=tr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Em=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Zh(),c=a(null),{startCallback:d}=El({delay:50,callback:e=>n(e)});g(l,()=>c.current);const u=!e&&gm.safeParse(s.form.state.values).success;return I(Pp,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(Jp(t),void d(!0)),children:R("div",{className:Cm,children:[R("div",{className:xm,children:[R("pre",{className:bm,children:[s.state.value.text,I("br",{})]}),I("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:wm,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),R("div",{className:Tm,children:[!i&&I(pm,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),I(Xs,{disabled:!u,type:"submit",children:I("span",{className:km,children:I(Sd,{Component:Nd})})})]})]})})}),Am=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,Sm=l(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function Im(e,t){switch(t.type){case"increment":return((e,t)=>{let n;if(null===e.focusedIndex)n=0;else{const r=e.focusedIndex+1;n=!t.repeat&&r>e.maxIndex?0:Math.min(r,e.maxIndex)}return{...e,focusedIndex:n}})(e,t);case"decrement":return((e,t)=>{let n;if(null===e.focusedIndex)n=e.maxIndex;else{const r=e.focusedIndex-1;n=!t.repeat&&r<0?e.maxIndex:Math.max(r,0)}return{...e,focusedIndex:n}})(e,t);case"set":return{...e,focusedIndex:Math.min(t.focusedIndex,e.maxIndex)};case"max":return{...e,maxIndex:t.max}}}function Nm(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function Rm(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return r.top>=n.top&&r.bottom<=n.bottom&&r.left>=n.left&&r.right<=n.right}function Pm(e,t,n){if(null===e)return{node:void 0,metadata:void 0};const r=t[e];return{node:r,metadata:n.get(r)}}function Dm(e){const[t,n]=d(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:l,isMousing:c,isScrolling:h}=function(e,t){const n=a(null),[r,o]=d(!0),[l,c]=d(!1),u=i(Sm),[h,p]=v(Im,{focusedIndex:null,maxIndex:e});s(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&sr(h.focusedIndex)&&void 0!==u?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,u?.popupNodeId,t.forceRootCascade]);const m=a(null);return s(()=>{p({type:"max",max:e})},[e]),s(()=>{const e=n.current;if(null!==e){const n=e=>{c(!1);const n=e.target instanceof HTMLElement&&e.target.getAttribute("data-listitem");if(!n)return;const r=Number(e.target.getAttribute("data-index"));h.focusedIndex===r&&m.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(o(!0),m.current=e.target,p({type:"set",focusedIndex:r}),t.setCascadeState(!0,r))},r=e=>{const t="ArrowDown"===e.key||"Tab"===e.key&&!e.shiftKey,n="ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey;o(!1),c(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>c(!0);return e.addEventListener("mousemove",n),e.addEventListener("keydown",r),e.addEventListener("scroll",a),()=>{e.removeEventListener("mousemove",n),e.removeEventListener("keydown",r),e.removeEventListener("scroll",a)}}},[t,h.focusedIndex]),{listRef:n,focusedState:h,isMousing:r,isScrolling:l}}(t.size-1,e),p=kc(),m=u((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),g=u(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:f,sortedMap:b}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(Nm)),n},[e,t]),r=o(()=>{const t=/* @__PURE__ */new Map;return n.forEach((n,r)=>{const a=e.get(n)??{};t.set(n,{...a,index:r})}),t},[n,e]);return{sortedNodes:n,sortedMap:r}}(t,r);!function(e,t,n,r,a,o){s(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=Pm(r,t,n),{shouldOpenCascade:c,shouldCloseCascade:d}=function(e,t,n,r){const a=e.placement.includes("left"),o=e?.popupParentNodeId&&!r.forceRootCascade,i=o&&n?.hasCascading&&a?"ArrowLeft":"ArrowRight",l=a?"ArrowRight":"ArrowLeft";return{shouldOpenCascade:n?.hasCascading&&t.key===i,shouldCloseCascade:o&&t.key===l}}(a,e,s,o),u=!(e.target instanceof HTMLInputElement&&""!==e.target.value)&&" "===e.key;var h,p,m,g,v;c||"Enter"===e.key||u?(p=r,m=l,g=i,v=o,!(!(h=s)||!h.hasCascading||null===p||m&&g&&Rm(m,g)&&(v.setCascadeState(!0,p),v.setFocus(!0),0))||function(e){const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});e?.dispatchEvent(t)}(l),e.preventDefault()):d&&(e.preventDefault(),a.close())};return i.addEventListener("keydown",l),()=>{i.removeEventListener("keydown",l)}},[e,t,r,n,a,o])}(r,f,b,l.focusedIndex,p,e);const{startCallback:y,cancelCallback:w}=El({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&Rm(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return C=l.focusedIndex,s(()=>{const e=E.current;if(null===C||x)return;const{node:t,metadata:n}=Pm(C,T,k);return A.lastOpenedIndex!==C&&n?.hasCascading&&(A.closeCurrentCascade(),S({focusedIndex:C,node:t,listElement:e})),()=>I()},[C,x=c,E=r,A=e,I=w,T=f,k=b,S=y]),function(e,t,n,r){s(()=>{const{metadata:a}=Pm(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(l.focusedIndex,f,b,e),o(()=>({register:m,unregister:g,map:b,focusedIndex:l.focusedIndex,listRef:r,isMousing:c,isScrolling:h,popupNodeId:p?.nodeId}),[m,g,b,l.focusedIndex,r,c,h,p?.nodeId]);var C,x,T,k,E,A,S,I}const Mm=l(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function Lm({style:e,children:t,forceNewCascade:n}){const r=gr(lr["popup-list"],bc,e),a=function(e){const[t,n]=d(null),[r,a]=d(!1),[o,i]=d(null),l=u((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=u(()=>{n(null),i(null),a(!1)},[n,i,a]),c=u(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:c,forceRootCascade:e}}(n),o=Dm(a);return I("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:I(Sm.Provider,{value:o,children:I(Mm.Provider,{value:a,children:t})})})}function Fm({searchTerm:e,setSearchTerm:t,onClick:n,placeholder:r,SearchInput:a,SearchList:o,DefaultList:i,extraProps:l,listLength:s,forceSearchVisible:c}){const d=c||s>=5,u=Nr(e),h=e=>{n?.(e)};return R(N,{children:[d&&I(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?I(o,{...l??{},onClick:h,searchTerm:e}):I(i,{...l??{},onClick:h})]})}const Om=rr(xr({body:"default"}),tr({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function Vm({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return s(()=>{r.current?.focus({preventScroll:!0});const e=e=>{const t=document.activeElement,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement;!r.current||document.activeElement===r.current||n||(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)&&"Backspace"!==e.key||r.current.focus()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[]),I("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Om})}function Um({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=kc(),[c,u]=d(""),h=Nr(c),p=l?.(h);return I(Fc,{children:I(Lm,{style:p,children:I(Fm,{searchTerm:c,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:Vm,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function Bm({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:l,focusedIndex:s,isMousing:c,listRef:d}=i(Sm);m(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const h=o(()=>void 0!==l&&null!==t.current?l.get(t.current)?.index??-1:-1,[l]),p=h===s;m(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const g=u(()=>{d?.current?.focus()},[d]),v=o(()=>({onFocus:g,"data-focused":p}),[g,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const Hm=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...wc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),Wm=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=Bm(),l=ve([i,r]);return I(Hm,{...wc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),zm=tr({display:"flex",gap:"8px",alignItems:"center"});function _m({promptText:e}){return R("div",{className:zm,children:[I(cl,{Component:Os}),I(sc,{children:e})]})}function jm({text:e}){return I("div",{...wc,children:e?I(To,{children:e}):I(Xo,{styles:tr({width:"100%",height:"16px"})})})}const qm=gr(lr["popup-list"],bc),Km=()=>R("div",{...qm,children:[I(jm,{}),I(jm,{}),I(jm,{}),I(jm,{}),I(jm,{})]});function Ym({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(Km,{}):R(N,{children:[r&&I(Wm,{onClick:()=>rs("BankAccountForm"),children:I(_m,{promptText:"Add bank account"})}),e?.map(e=>I(Wm,{onClick:()=>t(e),children:I(To,{wrap:"wrap",children:uh(e?.name,e?.mask)})},e?.id))]})}const Zm={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Gm={...Zm,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function Qm({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ae(e??[],Gm),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(Km,{}):R(N,{children:[a&&I(Wm,{onClick:()=>rs("BanksAndIntegrations"),children:I(_m,{promptText:"Add bank account"})}),0===l.length?I(jm,{text:"No results found"}):l.map(e=>I(Wm,{onClick:()=>n(e),children:I(To,{wrap:"wrap",children:uh(e?.name,e?.mask)})},e?.id))]})}function Xm({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(Um,{onClick:e,placeholder:"Search bank accounts...",SearchList:Qm,DefaultList:Ym,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Jm=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function $m({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=uh(n?.name??"",n?.mask??"");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:r=>I(Pp,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:Jm,type:"button",disabled:t,children:cr(n)?I(sc,{children:i}):I(sc,{intent:"weak",children:"Select bank account"})})})}),I(Xm,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const eg=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),tg=e=>{if(sr(e))return!1;const t=e.filter(e=>Wh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||cr(e.lastSyncedDate))},ng=()=>{const e=bh({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function rg(){return bh({select:e=>{return{...e,plaidItemAccountsReadyToSync:tg(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>Wh(e.apiName)))};var t}})}function ag(e){return e?.filter(e=>Hh(e.apiName)&&"ACTIVE"===e.status)}function og(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function ig(e){return bh({select:t=>({...t,data:og(t?.data,e)})})}const lg=e=>{const{query:t}=bh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data};function sg({options:e,onClick:t}){const n=kc();return I(Fc,{children:I(Lm,{children:e.map((e,r)=>I(Wm,{onClick:()=>(t(e),void n.close()),children:I(sc,{children:e.label})},`${e.label}_${r}`))})})}const cg=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),dg=tr.raw({color:"typography.base.weak"}),ug=(e,t)=>e===t;function hg({options:e,label:t,isEqual:n=ug,isEmpty:r,disabled:a}){const o=Zh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!sr(o.state.value)&&!r?.(o.state.value);return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:n=>I(Pp,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...cg,type:"button",children:I(sc,l?{children:i(e,o.state.value)}:{extraClassNames:[dg],children:`Select ${t.toLowerCase()}...`})})})}),I(sg,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const pg=tr({border:"none",outline:"none",backgroundColor:"transparent"},xr.raw({label:"default"})),mg=e=>r.createElement("svg",{width:16,height:16,stroke:"currentColor",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.9092 4.60259V6.39635H1.78418V4.60259L8.34669 1.62134L14.9092 4.60259Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M14.9092 12.3589H1.78418V14.7464H14.9092V12.3589Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.97803 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.55908 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.1343 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M13.7153 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"})),gg=vi(mg,"Bank",{styleIconKey:"bank"}),vg=or({base:{display:"flex",flexDirection:{base:"row",sm:"column"},alignItems:{base:"center",sm:"start"},justifyContent:"flex-start",textAlign:"start",gap:"4px",maxWidth:"100%",flexWrap:"wrap",minWidth:0},variants:{active:{true:{flexDirection:"column-reverse",alignItems:"start"},false:{flexDirection:{base:"column"},alignItems:{base:"start"}}}}});function fg({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?uh(e,t):e;return R("div",{className:vg({active:r}),children:[n&&I(Eo,{intent:r?"normal":"weak",children:n}),I(sc,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const bg=e=>["plaidInstitutionLogo",e??{}],yg=gr(lr["category-icon"],tr({objectFit:"contain"})),wg=gr(lr["category-icon"],tr({objectFit:"contain",color:"icon.base"}));function Cg(e,t,n){const r=({size:n=24})=>{const{icons:r}=i(mi),a=e;return Nr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?I(Se,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...wg}):I("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...yg});var o};return r.displayName=t,r}const xg=tr({display:"flex",gap:"10px",maxWidth:"100%"});function Tg({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=Pr(),n=Or();return M({queryKey:bg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await zu({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?Cg(i,"Logo"):void 0;return R("div",{className:xg,children:[I(Td,{Component:l&&o?l:gg}),I(fg,{accountName:e,accountNo:t,active:a,syncText:r})]})}const kg=gr(lr.text,xr({label:"strongLabel"}),tr({maxWidth:"100%"}),Xa);function Eg({children:e,stylists:t=[]}){const n=Cr([kg,...t]);return I("div",{...n,children:e})}const Ag=tr({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Sg({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(Xs,{popupTriggerProps:r,disabled:n,width:"fill-parent",children:I(Eg,{children:e?uh(e.name,e.mask):R("div",{className:Ag,children:[I(sc,{children:t}),I(cl,{Component:Os})]})})})}const Ig="TRIGGER_ACCOUNT",Ng="FORM_SELECTABLE_ACCOUNT",Rg=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Pg({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Rg,children:[R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(Sg,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Ig?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(Xm,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I(dp,{errorMessage:o})]})}const Dg=(e,t,n)=>{if(!n)return;const r=e===Ng?t:n,a=e===Ng?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,Wh(c)&&Hh(d));var c,d;const u=(h=r?.status,p=a?.status,"ACTIVE"===h&&"INACTIVE"===p);var h,p;return o?"Selected account number does not match destination account number":s?"Merging a linked account into a manually tracked account may result in duplicate transactions":u?"You selected an active account to be merged into an archived account":void 0},Mg=tr({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Lg=tr({display:{base:"block",sm:"none"}}),Fg=tr({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Og=tr({display:"flex",justifyContent:"center",alignItems:"center"}),Vg=tr({display:{base:"none",sm:"block"}}),Ug=tr({display:{base:"block",sm:"none"}});function Bg({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return R("div",{className:Mg,children:[R("div",{className:Fg,children:[o?I(Pg,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Ig,bankAccounts:n,isFilling:r,warningMessage:Dg(Ig,e,t??null)}):I(Sg,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Og,children:[I("div",{className:Vg,children:I(Sd,{Component:rl})}),I("div",{className:Ug,children:I(Sd,{Component:Lp})})]}),I(Tg,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:Lg,children:I(ip,{alignment:"horizontal"})})]})}function Hg({queryKey:e,queryFn:t,...n}){const r=Pr(),a=Or(),o=Nr(r),i=Er(e,r??"",a),l=D(),s=U({...n,queryKey:i,queryFn:o?t:Dr,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Lr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const Wg=e=>["vendors",e??{}],zg=e=>["vendors","infinite",e??{}],_g=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:xi(r)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},jg=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return _g({queryParams:n,cursor:r,accessToken:a,environment:o})};function qg(e={},t){return kl({queryKey:Wg(e),queryFn:jg,...t})}const Kg=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return _g({queryParams:n,cursor:o,accessToken:r,environment:a})},Yg="FAILURE";function Zg(e){return"object"==typeof e&&null!==e}function Gg(e){return!!Zg(e)&&(e.result===Yg||Array.isArray(e.data)&&e.data.some(Gg))}const Qg={isFailureResult:function(e){return Zg(e)&&e.result===Yg},isPartialFailure:function(e){return!(!Zg(e)||e.result===Yg)&&Array.isArray(e.data)&&e.data.some(Gg)},getErrorMessages:function e(t){if(!Zg(t))return[];const n=[];if(Array.isArray(t.error))for(const r of t.error)cr(r)&&Nr(r.message)&&n.push(r.message);if(Array.isArray(t.data))for(const r of t.data)n.push(...e(r));return n}};function Xg({onSuccess:e,onError:t,meta:n,...r}){const a=Ih(),{onSuccess:o,onError:i}=Nh({toast:a,responseErrorParser:Qg,toastOptions:n?.toastOptions,onSuccess:e,onError:t});return Ah({...r,onSuccess:o,onError:i})}async function Jg(e){const{url:t,headers:n}=Sa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=ka({extraHeaders:n,authorization:t});ya("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return ya("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),Ea(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function $g(e){return Jg(e)}const ev=async({data:e,accessToken:t,environment:n})=>Ra({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:xi(n)}),tv=async({data:e,accessToken:t,environment:n})=>$g({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:xi(n)}),nv=async({data:e,accessToken:t,environment:n})=>Ra({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:xi(n)}),rv=async()=>await Lr.invalidateQueries({queryKey:["vendors"]});function av(){return Xg({mutationFn:ev,onSuccess:rv,meta:{toastOptions:{defaultSuccessMessage:"Vendor saved",defaultErrorMessage:"Couldn't save vendor"}}})}const ov=rr(xr({body:"default"}),tr({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),iv=tr({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),lv=gr(lr["button-inline"],tr({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function sv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:iv,children:[I("input",{ref:o,type:"text",placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r()):"Escape"===e.key&&(e.preventDefault(),a())},onFocus:e=>{e.stopPropagation()},className:ov}),I("button",{type:"button",onClick:r,...lv,children:I(Eo,{children:"Add"})})]})}function cv({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=d(!1),[i,l]=d(""),c=a(null);return s(()=>{r&&c.current&&c.current.focus({preventScroll:!0})},[r]),I(Wm,{onClick:r?void 0:()=>{o(!0)},children:r?I(sv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:c}):I(_m,{promptText:e})})}function dv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ae(e??[],Zm),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(Km,{}):R(N,{children:[I(cv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?I(jm,{text:"No results found"}):l.map(e=>I(Wm,{onClick:()=>n(e),children:I(sc,{children:e.name})},e.id))]})}function uv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(Km,{}):R(N,{children:[I(cv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(Wm,{onClick:()=>t(e),children:I(sc,{children:e.name})},e.id))]})}function hv({onClick:e}){const{query:{data:t,isLoading:n}}=qg({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=av(),a=t?.data??[];return I(Um,{onClick:e,placeholder:"Search vendors...",SearchList:dv,DefaultList:uv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}const pv=tr({all:"unset"});function mv({children:e}){return I("div",{tabIndex:0,role:"button",className:pv,children:e})}function gv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const vv=e=>["customers",e??{}],fv=e=>["customers","infinite",e??{}],bv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:xi(r)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},yv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return bv({queryParams:n,cursor:r,accessToken:a,environment:o})};function wv(e={},t){return kl({queryKey:vv(e),queryFn:yv,...t})}const Cv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return bv({queryParams:n,cursor:o,accessToken:r,environment:a})},xv=async({data:e,accessToken:t,environment:n})=>Ra({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:xi(n)}),Tv=async({data:e,accessToken:t,environment:n})=>$g({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:xi(n)}),kv=async()=>await Lr.invalidateQueries({queryKey:["customers"]});function Ev(){return Xg({mutationFn:xv,onSuccess:kv,meta:{toastOptions:{defaultSuccessMessage:"Customer saved",defaultErrorMessage:"Couldn't save customer"}}})}const Av={left:"-100%",right:"100%"},Sv={type:"tween",duration:.3},Iv={x:0},Nv=e=>({x:Av[e]}),Rv=e=>({x:Av[e]});function Pv({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(Fc,{style:r,modal:!0,forceMount:t,children:e})}const Dv=tr({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Mv=gr(null,Dv);function Lv({children:e,clickHandler:t}){const n=kc();return t||(t=()=>{n.close()}),I(be,{lockScroll:!0,...Mv,onClick:t,children:e})}const Fv=tr({display:"flex",flexDirection:"column",position:"fixed",right:0,top:0,left:{base:0,sm:"auto"},bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},backgroundColor:"surface.background"});function Ov({children:e,overlay:t=!1}){const n=kc(),r=u(e=>{e.stopPropagation()},[]);return I(Ie,{children:n.context.open&&R(Pv,{fadeIn:!1,forceMount:!0,children:[t&&I(Lv,{}),I(Ne.div,{transition:Sv,initial:Nv("right"),animate:Iv,exit:Rv("right"),className:Fv,onAnimationEnd:r,children:e})]})})}const Vv=tr.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Uv=tr.raw({display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",flex:"1 1 0",alignSelf:"stretch",overflowY:"auto",width:"100%",maxWidth:{base:"none",sm:"512px"},scrollbar:"hidden"}),Bv=gr(lr["drawer-header"],tr(Vv));function Hv({hideDivider:e=!1,children:t}){return R(N,{children:[I("header",{...Bv,children:t}),!e&&I(ip,{alignment:"horizontal",color:"normal"})]})}const Wv=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function zv({children:e}){return I("div",{className:Wv,children:e})}const _v=tr({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),jv=or({base:Uv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function qv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=kc();return R(N,{children:[I(Hv,{children:R(zv,{children:[I($u,{Icon:nl,handleClose:()=>{r?.(),i.close()}}),I(To,{children:o}),!sr(t)&&I("div",{className:_v,children:t})]})}),I("div",{className:jv({padChildren:a}),children:n}),e]})}function Kv({overlay:e=!1,...t}){return I(Ov,{overlay:e,children:I(qv,{...t})})}const Yv=vi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.19899 11.5105C8.9944 11.5105 11.2605 9.2444 11.2605 6.44899C11.2605 3.65358 8.9944 1.38745 6.19899 1.38745C3.40358 1.38745 1.13745 3.65358 1.13745 6.44899C1.13745 9.2444 3.40358 11.5105 6.19899 11.5105Z",strokeMiterlimit:10}),r.createElement("path",{d:"M15.05 15.3L9.67714 9.92712",strokeMiterlimit:10})),"Search",{styleIconKey:"search"}),Zv=tr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),Gv=gr(lr["drawer-search-bar"],tr({display:"flex",padding:"16px",flexDirection:"row",alignItems:"center",gap:"8px",flex:"1 0 0",borderRadius:"sm",border:"1px solid {colors.border.layout}",backgroundColor:"surface.foreground",maxHeight:"49px",minWidth:"fit-content"})),Qv=rr(tr({display:"flex",flexDirection:"column",alignItems:"flex-start",backgroundColor:"surface.foreground",gap:"8px",flex:"1 0 0",border:"none",outline:"none",_placeholder:{color:"typography.label.sub"}}),xr({label:"strongLabel"})),Xv=gr(null,tr({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Jv({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:Zv,children:[I(To,{children:"Search"}),R("div",{...Gv,children:[I(Sd,{Component:Yv}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Qv}),Nr(e)&&I(Xs,{stylists:[Xv],onClick:()=>t(""),children:I(Sd,{Component:Ac})})]})]})}function $v({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=d("");return I(Fm,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Jv,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function ef({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:d}){const[h,p]=Cc({},a?.selected,i),[m,g]=Cc({},a?.expanded,l),v=u((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),f=u((e,t)=>{const n=t??!m[e],r={[e]:n};g({...m,...r})},[m,g]),b=o(()=>e.map((e,a)=>({key:r({rows:e,groupIndex:a,originalGroup:t?.[a]}),index:a,original:t?.[a]??void 0,getRows:()=>e.map((e,t)=>{const r=n(e,t);return{key:r,value:e,expanded:m[r]??!1,getCanSelect:()=>c?.(e)??!0,getIsSelected:()=>h[r]??!1,toggleSelected:e=>v(r,e),getCanExpand:()=>d?.(e)??!0,getIsExpanded:()=>m[r]??!1,toggleExpanded:()=>f(r,!m[r])}})})),[e,r,t,n,h,v,m,f,c,d]);return o(()=>{const e={selected:h,expanded:m};return{groups:b,toggleSelected:v,toggleExpanded:f,getState:()=>e}},[b,v,f,m,h])}const tf=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2768)"},r.createElement("path",{d:"M2.70654 9.12132C3.60197 9.12132 4.32787 8.39543 4.32787 7.49999C4.32787 6.60456 3.60197 5.87866 2.70654 5.87866C1.8111 5.87866 1.08521 6.60456 1.08521 7.49999C1.08521 8.39543 1.8111 9.12132 2.70654 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M8.32496 9.12132C9.22039 9.12132 9.94629 8.39543 9.94629 7.49999C9.94629 6.60456 9.22039 5.87866 8.32496 5.87866C7.42952 5.87866 6.70363 6.60456 6.70363 7.49999C6.70363 8.39543 7.42952 9.12132 8.32496 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M13.9434 9.12132C14.8388 9.12132 15.5647 8.39543 15.5647 7.49999C15.5647 6.60456 14.8388 5.87866 13.9434 5.87866C13.048 5.87866 12.3221 6.60456 12.3221 7.49999C12.3221 8.39543 13.048 9.12132 13.9434 9.12132Z",fill:"currentColor"}))),"Dots"),nf=tr({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function rf({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:nf,children:[I(Sd,{Component:tf}),I(To,{wrap:"wrap",children:`No ${t} found`}),n&&I(Eo,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const af=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function of({children:e}){return I("div",{className:af,children:e})}const lf=gr(lr["list-body"],null);function sf({title:e,children:t}){return R(of,{children:[e,I("div",{...lf,children:t})]})}const cf=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10})),"Circle"),df=gr(null,tr({fill:"surface.intent.action.active"}));function uf({selected:e,showEmptyIndicator:t}){return e?I(Sd,{Component:wi,stylists:[df]}):t?I(Sd,{Component:cf}):null}const hf=or({base:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"9px",cursor:"pointer",padding:"16px",color:"typography.intent.secondary",minHeight:"52px",width:"100%",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}}}});function pf({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=gr(lr["selector-row"],hf({selected:r}),ll);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function mf({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(pf,{handleClick:t,selected:n,children:[e,I(uf,{selected:n,showEmptyIndicator:r})]})}const gf=tr.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function vf(){return I(Xo,{styles:tr(yc,gf)})}const ff=tr({width:"70px",height:"24px"}),bf=tr({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function yf(){return R("div",{className:bf,children:[I(Xo,{styles:ff}),R(of,{children:[I(vf,{}),I(vf,{}),I(vf,{})]}),I(Xo,{styles:ff}),R(of,{children:[I(vf,{}),I(vf,{}),I(vf,{})]})]})}function wf({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ae(e,Zm),[e]),s=ef({data:o(()=>l.search(t).map(e=>e.item),[l,t]).map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return n?I(yf,{}):0===s.groups.length?I(rf,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):I(sf,{title:I(sc,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return I(mf,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:I(sc,{children:t.value.name})},t.key)})})}const Cf=tr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),xf=tr({width:"100%"});function Tf({promptText:e,placeholderText:t,onSubmit:n,onPromptClick:r,keepInlineCreateOnPromptClick:o=!1}){const[i,l]=d(!1),[c,u]=d(""),h=a(null);s(()=>{i&&h.current&&h.current.focus({preventScroll:!0})},[i]);const p=()=>{u(""),l(!1)};return R("div",{className:xf,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||p()},children:[I(ip,{alignment:"horizontal"}),I(pf,{handleClick:i?void 0:()=>{r&&(r(),!o)||l(!0)},children:i?I(sv,{placeholder:t,value:c,onChange:u,onSubmit:()=>{c.trim()&&(n(c.trim()),u(""),l(!1))},onCancel:p,inputRef:h}):I(_m,{promptText:e})})]})}function kf(){return dn(e=>e.events.customer)}function Ef({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=kf(),l=ef({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(yf,{}):R(of,{children:[I(Tf,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n,onPromptClick:i?()=>i.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}):void 0,keepInlineCreateOnPromptClick:cr(i)&&!i.preventDefault}),R("div",{className:Cf,children:[I(sc,{children:"Customers"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I(mf,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(sc,{children:t.value.name})},t.key)})})]})]})}function Af({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=wv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(gv)})}),{mutateAsync:a}=Ev(),o=kc(),i=n?.data??[],[l,s]=d(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(Kv,{title:"Back",Footer:I(hp,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!c}),onClose:()=>s(t?{[t.id]:!0}:{}),children:I($v,{placeholder:"Search customers...",onClick:e=>{sr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:wf,DefaultList:Ef,listLength:i.length,extraProps:{customers:i,isLoading:r,onCreateCustomer:async e=>{const t=await a({data:[{name:e}]}),n=t.data?.[0]?.data?.id;n&&s({[ss({id:n,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function Sf({frequencies:e,onClick:t}){const n=kc();return I(Fc,{children:I(Lm,{children:e.map(e=>I(Wm,{onClick:()=>(t(e),void n.close()),children:I(To,{children:e.name})},e.value))})})}const If=or({base:{minWidth:0,borderRadius:"zero",border:"1px solid",borderColor:"border.layout",_first:{borderRight:"none"},_last:{borderLeft:"none"},"&:not(:first-child):not(:last-child)":{borderLeft:"none",borderRight:"none"},_focus:{zIndex:2}},variants:{width:{full:{width:"100%"},fit:{width:"fit-content%",minWidth:"100px"}},backgroundColor:{foreground:{backgroundColor:"surface.foreground"}},active:{true:{borderColor:"border.intent.secondary",zIndex:1}},corners:{rounded:{_first:{borderTopLeftRadius:"sm",borderBottomLeftRadius:"sm"},_last:{borderTopRightRadius:"sm",borderBottomRightRadius:"sm"}}}}});function Nf({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=gr(lr["button-group"],rr(If({width:a,backgroundColor:o,active:t,corners:i}),Ws,Us,tr(Ys),ol));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(To,{wrap:"wrap",textAlign:"center",children:e.label}):I(sc,{wrap:"wrap",alignment:"center",children:e.label})})}const Rf=or({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"},fit:{width:"fit-content"}}}});function Pf({width:e,children:t}){return I("div",{className:Rf({width:e}),children:t})}function Df({width:e="full",options:t,handleClick:n,selectedIndex:r}){const[a,o]=d(null);return I(Pf,{width:e,children:t.map((t,i)=>R(f,{children:[0!==i&&I(ip,{color:i!==r&&i!==r+1||a===r?"normal":"active"}),I(Nf,{option:t,isActive:i===r,handleClick:()=>n(i),onHoverChange:e=>o(e?i:null),width:e,backgroundColor:"foreground",corners:"rounded"})]},t.value))})}const Mf=vi(e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.668689 4.04687L0.668689 0.650082L11.3313 0.650083L11.3313 4.04688",strokeMiterlimit:10}),r.createElement("path",{d:"M6.00008 3.55915L6.00008 11.7998",strokeMiterlimit:10}),r.createElement("path",{d:"M2.60834 6.46875L6.00005 3.07703L9.39177 6.46875",strokeMiterlimit:10})),"Upload"),Lf=tr({display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",alignSelf:"stretch",padding:"16px",gap:"8px",outline:"none",color:"icon.base",borderRadius:"2px",border:"{borderWidths.md} dashed {colors.border.layout}"},pp,mp,il),Ff=gr(null,tr({color:"icon.base"})),Of=gr(lr["attachment-dropzone"],Lf);function Vf({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return R("div",{...a,...e({className:Of.className,onMouseDown:r,onBlur:n}),children:[I("input",{...t()}),I(Sd,{stylists:[Ff],Component:Mf}),I(sc,{children:"Add Files"})]})}const Uf=tr({display:"flex",flexDirection:"column",gap:"8px"}),Bf=tr({display:"flex",justifyContent:"space-between",alignItems:"center"});function Hf({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return R("div",{className:Uf,children:[o&&I("div",{className:Bf,children:I(sc,{children:o})}),I(Vf,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&I(dp,{errorMessage:i})]})}const Wf=tr({display:"flex",justifyContent:"start",width:"100%"}),zf=tr({display:"flex",alignItems:"center",gap:"9px"}),_f=tr({width:"100%"}),jf=or({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function qf(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Kf({flatDimensionValues:e,dimensions:t,dimensionValueOptions:n,selectedRow:r,searchTerm:a,onClick:i}){const l=o(()=>e.filter(e=>{const n=t.find(t=>t.id===e.dimension?.id);return!n||!qf(n)}),[e,t]),s=o(()=>new Ae(l,Zm),[l]),c=o(()=>new Set(s.search(a).map(e=>e.item.id)),[s,a]),d=o(()=>n.map(e=>e.filter(e=>c.has(e.id))).filter(e=>e.length>0),[c,n]);if(0===d.length)return I(rf,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return R(N,{children:[I("div",{className:Wf,children:I(sc,{children:"Search Results"})}),I("div",{className:jf({nested:u}),children:d.map(e=>I("div",{className:_f,children:e.map(e=>I(pf,{handleClick:()=>i(e),selected:r[e.id],children:R("div",{className:zf,children:[I(uf,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(sc,{children:e.name})]})},e.id))},e[0].id))})]})}const Yf=vi(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2940)"},r.createElement("path",{d:"M11.9147 7.99997L6.31472 2.39996L0.714716 7.99997",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2940"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowUp"),Zf=or({base:{display:"flex",alignItems:"stretch",width:"100%",minHeight:"52px",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},variants:{active:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}},expanded:{true:{borderBottom:"none"}}}}),Gf=tr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",padding:"16px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent",color:"typography.intent.secondary","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),Qf=tr({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"16px",minWidth:"58px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}});function Xf({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=gr(lr["selector-row"],Zf({active:r,expanded:a}),ll);return R("div",{...i,children:[o?R("button",{type:"button",className:Gf,onClick:t,children:[I(uf,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:Gf,children:e}),!sr(n)&&I("button",{type:"button",className:Qf,onClick:n,children:I(Sd,{Component:a?Yf:Lp})})]})}function Jf({dimensionValueRows:e,onClick:t}){return e.map(e=>I(pf,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:zf,children:[I(uf,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(sc,{children:e.value.name})]})},e.key))}function $f({fieldDimension:e,dimensionValueOptions:t,dimensions:n,selectedRow:r,setSelectedRow:a,allowMultiselect:o,onClick:i}){const l=t.map(e=>({id:e[0].id,displayName:e[0].name??""})),s=ef({data:t,groups:l,getRowKey:e=>e.id,getGroupKey:({originalGroup:e,groupIndex:t})=>e?.id??t.toString(),state:{selected:r},onSelectedChange:e=>a(e),hasMultiSelect:o??!1,getCanSelect:e=>{const t=n.find(t=>t.id===e.dimension?.id);return!t||!qf(t)}}),c=s.groups.some(e=>e.getRows().length>1);return R(N,{children:[I("div",{className:Wf,children:I(sc,{children:e})}),I("div",{className:jf({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return R("div",{className:_f,children:[(c||0===t)&&I(ip,{alignment:"horizontal"}),I(Xf,{onClick:n.getCanSelect()?()=>i(n.value):void 0,onExpandToggle:r.length>0?n.toggleExpanded:void 0,active:n.getIsSelected(),expanded:n.expanded,canSelect:n.getCanSelect(),children:I(sc,{children:n.value.name})}),n.expanded&&R(N,{children:[I(ip,{alignment:"horizontal"}),I(Jf,{dimensionValueRows:r,onClick:i})]})]},e.key)}return I(Jf,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function eb({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=u(t=>{if(n){const e=!a[t.id],n={...a,[t.id]:e};if(e){const e=r.find(e=>e.some(e=>e.id===t.id));e&&e.length>1&&(e[0].id===t.id?e.slice(1).forEach(e=>{n[e.id]=!1}):n[e[0].id]=!1)}o(n)}e?.(t)},[n,r,a,o,e]);return I($v,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Kf,DefaultList:$f,listLength:t.flatDimensionValues.length,extraProps:t})}function tb({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){const i=o(()=>n.filter(([e,...t])=>{if(t.length>0)return!0;const n=r.find(t=>t.id===e.dimension?.id);return!n||!qf(n)}),[n,r]),[l,s]=d(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),c=o(()=>i.flat(),[i]),u=kc(),h=Object.values(l).some(Boolean);return I(qv,{title:"Back",Footer:I(hp,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=c.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:I(eb,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:c,selectedRow:l,setSelectedRow:s})})}function nb(e){const t=kc();return I(Ov,{children:t.open&&I(tb,{...e})})}const rb=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),ab=tr.raw({color:"typography.base.weak"});function ob(e){const t=e.slice(0,10);return 0===t.length?"":t.length<=3?`(${t}`:t.length<=6?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`}const ib=/\D/g,lb=tr({border:"none",outline:"none",backgroundColor:"transparent"},xr.raw({label:"default"})),sb=tr({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),cb=or({base:{display:"inline-flex",height:"25px",padding:"5px 10px",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"md",border:"{borderWidths.lg} solid",borderColor:"border.intent.secondary",background:"surface.intent.secondary",fontSize:"sm",fontWeight:"sm",lineHeight:"template",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),db=tr({border:"none",background:"none",padding:0,cursor:"pointer"}),ub=tr({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function hb({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return R("div",{...gr(lr.pill,n,cb({disabled:r})),children:[I("div",{className:ub,children:e}),I("button",{className:db,onClick:t,disabled:r,children:I(Sc,{Component:Ac,stylists:[gr(null,sb)]})})]})}const pb=S.email(),mb=tr({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),gb=tr({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},xr.raw({label:"default"})),{useAppForm:vb,withForm:fb,withFieldGroup:bb}=ke({formContext:Kh,fieldContext:Yh,formComponents:{SaveButton:Jh,FormSaveButton:ap,FormFooter:hp},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Zh();return I(Tp,{inputRef:t,label:e,children:I(Np,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Zh();return I(Pp,{inputRef:r,label:e,hasErrorStyles:t,children:I(Np,{value:o.state.value,onChange:o.handleChange,inputRef:r,autofocus:n})})},DateInput:function({label:e,maxDate:t,minDate:n,autofocus:r=!1,editable:o=!1,hasErrorStyles:i}){const l=Zh(),s=Te(l.store,e=>e.meta.isDefaultValue),c=a(null),[u,h]=d(()=>l.state.value?Nt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Nt(l.state.value):null,[m,g]=d(""),v=e=>{const r=function(e){const t=e.replace(/\D/g,"");return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4,8)}`}(e.target.value);g(r);const a=It(r);if(a){let e=a;t&&n?e=Dt(Pt(a,t),n):t?e=Pt(a,t):n&&(e=Dt(a,n)),l.handleChange(Rt(e)),h(e)}else l.handleChange("")},f=m||(p?At(p):""),[b,y]=d(!1),w=e=>{b&&(()=>{if(p&&!s){const e=It(m);(t&&e&&Et(e,t)||n&&e&&Et(n,e))&&g(At(p))}})(),y(e)},C=e=>{"Enter"===e.key&&(e.preventDefault(),w(!b))},x=o?Pp:Tp;return R(Tc,{placement:"bottom-start",onOpenChange:w,open:b,children:[I(Ec,{children:t=>I(x,{label:e,inputRef:c,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:I("input",{...Qp,ref:c,type:"text",id:l.name,value:f,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:C,autoComplete:"off"})})}),I(Fc,{initialFocus:!1,children:I(Gp,{selectedDate:p,onDateSelect:e=>{l.handleChange(Rt(e)),g(At(e)),h(e)},viewDate:u,onViewDateChange:h,maxDate:t,minDate:n})})]})},TextAreaInput:function({label:e,placeholder:t,autofocus:n=!1,resizeable:r=!0}){const o=Zh(),i=a(null);return I(Pp,{label:e,inputRef:i,children:I("textarea",{...Xp,ref:i,value:o.state.value||"",onChange:e=>o.handleChange(e.target.value),placeholder:t??"Add note...",rows:4,style:{resize:r?"both":"none"},autoFocus:n})})},MessageAreaInput:Em,ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Zh(),a=lg(t?.id??""),{query:{data:o},isFilling:i}=bh({select:e=>({...e,data:ag(e?.data)})}),l=o?.data,s=cr(e)&&!Am(e);return I($m,{label:"Bank Account",disabled:s,onClick:e=>{var t;n({id:(t=e).id,name:t.name}),r()},bankAccount:a,bankAccountOptions:l,isFilling:i})},ButtonGroupField:function({label:e,options:t}){const n=Zh(),r=t.findIndex(e=>e.value===n.state.value);return I(Pp,{label:e,disableHover:!0,children:I(Df,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:hg,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Zh(),l=a(null);return I(Pp,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:I("input",{className:pg,value:i.state.value,onChange:e=>i.handleChange(e.target.value),type:t,maxLength:n,ref:l,placeholder:o})})},BulkMergeAccountRowField:Bg,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const o=a(null),i=r?Pp:Tp,{handleBlur:l}=Zh();return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(mv,{children:I(sc,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})})}),I(hv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?Pp:Tp;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(mv,{children:I(sc,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})})}),I(Af,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??ms[0].name}`;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(Pp,{inputRef:r,label:e,popupTriggerProps:t,children:I(To,{children:o})})}),I(Sf,{frequencies:ms,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=am,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Zh(),c=Te(s.form.store,e=>e.isSubmitting),{mutateAsync:u}=cm(),[h,p]=d(!0),{dataAttributes:m}=gp({isActive:h,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l,disabled:n||c}),{getRootProps:g,getInputProps:v}=Re({maxFiles:e,accept:t,disabled:n||c,onDrop:async t=>{const n=s.state.value??[],r=n.filter(e=>!e.hasError).length,a=e-r,o=t.slice(0,a),i=t.slice(a),l=[...await Promise.all(o.map(e=>lm(e,n))),...i.map(e=>im(e,rm.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const d=c.map(async e=>{try{const t=await u({file:e.file,entity:"glSource",caption:e.file.name,entityId:null}),n=t?.attachment;return{localId:e.localId,success:!0,id:n?.id??null,iconUrl:n?.iconUrl??null,publicFileUrl:n?.publicFileUrl??null,fileSize:n?.fileSize??null}}catch{return{localId:e.localId,success:!1,id:null,iconUrl:null,publicFileUrl:null,fileSize:null}}}),h=await Promise.allSettled(d);s.setValue(e=>(e??[]).map(e=>{if(e.hasError)return e;const t=c.findIndex(t=>t.localId===e.localId);if(-1===t)return e;const n=h[t];return"fulfilled"===n?.status&&n.value.success?{...e,isPending:!1,hasError:!1,displayText:"",id:n.value.id,iconUrl:n.value.iconUrl,publicFileUrl:n.value.publicFileUrl,fileSize:n.value.fileSize}:{...e,isPending:!1,hasError:!0,displayText:"Upload failed. Please try again."}}))}});return I(Hf,{getRootProps:g,getInputProps:v,dataAttrs:m,onMouseDown:()=>p(!0),onBlur:()=>p(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return R(Tc,{children:[I(Ec,{children:n=>I(Pp,{label:e,popupTriggerProps:n,children:I("button",{className:rb,type:"button",children:I(sc,t?{children:t.name}:{extraClassNames:[ab],children:`Select ${e.toLowerCase()}...`})})})}),I(nb,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Zh(),o=a(null),i=a(null);return m(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),I(Pp,{label:e,disabled:t,inputRef:o,kind:"text",children:I("input",{className:lb,value:ob(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace(ib,"").length,o=t.value.replace(ib,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=ob(o);i.current=function(e,t){let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e[r])){if(n===t)return r;n++}return e.length}(l,a)},onBlur:function(){const e=r.state.value;e.length>0&&e.length<10&&r.setErrorMap({onBlur:{message:"Phone number is incomplete"}})},type:"text",inputMode:"numeric",ref:o,placeholder:n})})},MultiEmailField:function({label:e,disabled:t,placeholder:n="Add email address"}){const r=Zh(),[o,i]=d(""),l=a(null),s=r.state.value,c=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=pb.safeParse(e);return t.success?!s.some(t=>t.toLowerCase()===e.toLowerCase())||(r.handleBlur(),r.setErrorMap({onChange:{message:"Email already added"}}),!1):(r.handleBlur(),r.setErrorMap({onChange:{message:t.error.issues[0].message}}),!1)})(e)&&(r.handleChange([...s,e]),r.setErrorMap({onChange:void 0}),i(""))};return I(Pp,{label:e,disabled:t,inputRef:l,kind:"container",children:R("div",{className:mb,children:[s.map(e=>I(hb,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:lr["email-pill"],disabled:t},e)),I("input",{ref:l,className:gb,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:c,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),c()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const yb=[gr(null,tr({"& path":{stroke:"icon.base"}}))];function wb({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(Xs,{type:"button",onClick:n,children:[e&&I(cl,{Component:Ac,stylists:yb}),I(To,{children:t})]})}const Cb=tr({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),xb=tr({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),Tb=tr({maxWidth:"600px"}),kb=tr({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),Eb=tr({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Ab=tr({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Sb=tr({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Ib=tr({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),Nb=tr({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),Rb=e=>{kp(e),Ep(e)};function Pb({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=bh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=Bh(),a=Pr(),o=Or(),i=cr(n),l=i?{selectedAccounts:n}:e;return i&&a&&n.forEach(({duplicateAccount:e})=>{var t,n,r;e&&(t=e.id,n=a,r=o,ps({queryKey:Ar(fs({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:ys,accessToken:n,environment:r}))}),vb({defaultValues:l,onSubmit:async e=>{if(await jh()===ju){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await qh());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=Ar(fs({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await hs({queryKey:r,queryFn:ys,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Nt(e.tranStartDate||""),l=Nt(n||""),s=Nt(e.tranMinStartDate||""),sr(l)?i:cr(s)?Dt(l,s):(cr(i)&&Dt(l,i),i));var i,l,s;return sr(r)?null:Rt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...zh(t),duplicateBankAccountIds:[cs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await qh()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:Cb,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:Rb,children:[R("div",{className:xb,children:[I(To,{children:"Merge Accounts"}),I("div",{className:Tb,children:I(sc,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:kb,children:[R("div",{className:Eb,children:[I("div",{className:Ab,children:I(To,{children:"Duplicate Account"})}),I("div",{className:Sb,children:I(To,{children:"Into"})}),I("div",{className:Ib,children:I(To,{children:"Destination Account"})})]}),I(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>I(i.AppField,{name:`selectedAccounts[${n}]`,children:t=>{const n=t.state.value.duplicateAccount?.id,o=function(e,t,n,r){const a=function(e,t,n){const r=new Set(e.map(e=>e.id));return t.forEach(({duplicateAccount:e})=>{e&&e.id!==n&&r.add(e.id)}),Array.from(r)}(e,t,n);return r?.filter(e=>!a.includes(e.id)&&Hh(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return I(Bg,{destinationAccount:t.state.value.destinationAccount,selectedDuplicate:t.state.value.duplicateAccount,availableAccounts:o,isFilling:a,onSelectionChange:e=>{const n={duplicateAccount:e,destinationAccount:t.state.value.destinationAccount};t.handleChange(n)}},t.state.value.destinationAccount.id)}},n))})]}),I("div",{className:Nb,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[I(wb,{showIcon:!1,onClick:()=>n()}),I(kd,{onClick:()=>i.reset(o),disabled:!t,children:I(To,{children:"Clear Selections"})}),I(Jh,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Db=tr({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",width:"100%",maxWidth:"100%",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative",overflow:"hidden",boxSizing:"border-box"}),Mb=we.createConfirmation(Ce(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I(Qu,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:Db,children:I(Pb,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Lb({plaidItemAccounts:e,matchingAccountPairs:t}){await Mb({matchingAccountPairs:t,plaidItemAccounts:e})}const Fb=tr({display:"flex",flexDirection:"column",gap:"12px"}),Ob=async(e,t,n)=>{try{const r=await async function({accessToken:e,plaidItemId:t,environment:n}){if(!e)throw new Error("Access token is required to create Plaid link token");const r={path:"/banks2/createPlaidLinkToken",accessToken:e,endpointManager:Wu(n)},{url:a,headers:o}=Sa(r);return Ti({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(ya("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(wa({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),mh("NO_LINK_TOKEN"))}catch(r){return wa({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),mh("LINK_TOKEN_FAILED")}};async function Vb(e,t,n){const r=await async function(e,t){const n=Ar(Vu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await hs({queryKey:n,queryFn:Uu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Ub(e,t,n,r){ya("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||ya("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,ps({queryKey:Ar(gh({filter:vh}),{}),queryFn:fh,accessToken:r,environment:a});const o=await Vb(e,t,n);if(o){const e=await yh(t,n);return e?.data?.filter(e=>e.integration?.id===o.id)||[]}}var r,a;return[]}(t?.institution?.institution_id,n,r),{plaidItem:i}=await async function({publicToken:e,metadata:t,accessToken:n,environment:r}){if(!n)throw new Error("Access token is required to create Plaid link token");const a={path:"/banks2/webPlaidPublicToken",accessToken:n,endpointManager:Wu(r)},{url:o,headers:i}=Sa(a);return await Ia({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(ya("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Lr.invalidateQueries({queryKey:["integrations"]}),Lr.invalidateQueries({queryKey:["banks/accounts",{}]}),Lr.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===Th({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return wa({error:new Error("Plaid Item requires relink, plaid reopened automatically"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),{relinkPlaidItemId:i.id};const l=await yh(n,r),s=l?.data?.filter(e=>Hh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=x(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(wa({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ih({title:"Uh Oh!",body:"It appears something went wrong fetching the accounts from your bank. Please chat with the support or try again later.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Chat",type:oh.SUCCESS}]})===qu&&hh({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void wa({error:new Error("No new accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}});if(!i.some(e=>"ACTIVE"===e.status))return wa({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ih({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:_u,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return wa({error:new Error("Accounts saved successfully with unsupported accounts"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),function(e,t,n){const r=e.length;return ih({title:"All set! Ready to track your transactions?",body:R("div",{className:ph,children:[I(sc,{wrap:"wrap",children:`Your ${n} ${t} ${lh("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(sc,{wrap:"wrap",children:`The following linked ${r>1?"accounts are":"account is"} not supported at this time, so ${r>1?"they":"it"} will remain unsynced.`}),I("ul",{children:e.map(e=>I("li",{children:I(sc,{wrap:"wrap",children:uh(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:qu,label:"Get Started",type:oh.SUCCESS}]})}(l,o,e.plaidItemAccounts.length);const s=function(e,t){const n=[];for(const r of e){if(!r.apiMask)continue;const e=t.find(e=>e.mask===r.apiMask&&r.isSupported);e&&n.push({destinationAccount:Eh(r),duplicateAccount:e})}return n}(i,a);return s.length>0?async function({institutionName:e,matchingAccountPairs:t,plaidItemAccounts:n}){const r=t.slice(0,3),a=t.length>3;await ih({title:"Your transactions are being categorized",body:R("div",{className:Fb,children:[I(sc,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(sc,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),R("ul",{children:[r.map(({duplicateAccount:e})=>I("li",{children:I(sc,{wrap:"wrap",children:uh(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(sc,{wrap:"wrap",children:"and more..."})})]}),I(sc,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:_u,label:"No thanks"},{key:qu,label:"Review",type:oh.SUCCESS}]})===qu&&await Lb({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(wa({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ih({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${lh("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:qu,label:"Get started",type:oh.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return wa({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ih({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Chat",type:oh.SUCCESS}]})===qu&&hh({message:{text:`I tried to link with ${e} and it failed (CODE: BANK_POST_FAILURE).`,attachments:[]}})}(t.institution?.name||"my bank"),{}}var a}async function Bb(e,t,n){return sr(e)?(ya("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(ya("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(wa({error:new Error("Plaid Item sync failed, refreshing Plaid Items"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),!0):("INVALID_UPDATED_USERNAME"===e.error_code&&(wa({error:new Error("Plaid Item sync failed due to invalid updated username"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),await async function(e){const t=await ih({title:e,body:'Your bank account has an updated username. To fix it, tap "Banks & Integrations", and unlink your old account, so you can relink it with your new username. If you need any assistance, tap "Chat" to chat with a member of our team.',buttons:[{key:_u,label:"Cancel"},{key:"chat",label:"Chat"},{key:qu,label:"Banks & Integrations",type:oh.SUCCESS}]});"chat"===t?hh({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==qu||(e=>{const t=dn.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||rs("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Hb=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Lt(t.lastSyncedDate)}`},Wb=e=>{let t;return e.isSupported?"ACTIVE"!==e.status?t="Archived":!e.lastSyncedDate&&e.syncTransactions?t="Processing":e.syncTransactions||(t="Not Synced"):t="Not Supported",t},zb="PLAID_LINK_NEW",_b="PLAID_LINK_UNLINK_RELINK",jb="PLAID_LINK_UPDATE",qb="PLAID_LINK_UNLINK";function Kb({plaidEvent:e,apiAccessToken:t,apiErrorCode:n}){const r=t?{plaidAccessToken:t}:null,a=null!=n;switch(e){case zb:return{type:"PLAID_LINK_NEW",result:"SUCCESS",data:null,error:null};case jb:return a?{type:"PLAID_LINK_RESET",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RESET",result:"SUCCESS",data:r,error:null};case _b:return a?{type:"PLAID_LINK_RELINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RELINK",result:"SUCCESS",data:r,error:null};case qb:return a?{type:"PLAID_LINK_UNLINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_UNLINK",result:"SUCCESS",data:r,error:null};default:return null}}function Yb({plaidEvent:e,plaidItemId:t,apiAccessToken:n,apiErrorCode:r,message:a}){return{eventType:"onPlaidLink",message:a,defaultPrevented:!0,data:{plaidEvent:e,integrationId:t,apiAccessToken:n,apiErrorCode:r}}}function Zb(){return dn(e=>e.events.plaidLink)}function Gb(){return dn(e=>e.events.plaidLinkEvent)}function Qb(){return dn(e=>e.events.plaidLinkError)}const Xb=l({});function Jb({onPlaidLink:e,children:t}){return I(Xb.Provider,{value:{onPlaidLink:e},children:t})}function $b(){return i(Xb)}const ey=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Oa(n)};return await Pa(r)};function ty(){return Ah({mutationFn:ey,onSuccess:()=>{const e=["integrations"];return Lr.invalidateQueries({queryKey:e})}})}const ny=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Oa(t)};return await Pa(n)};function ry(){return Ah({mutationFn:ny,onSuccess:()=>{const e=["integrations"];return Lr.invalidateQueries({queryKey:e})}})}const ay=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(cs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Oa(n)};return await async function(e){return Jg(e)}(r)};function oy(){const{mutate:e}=ry();return Ah({mutationFn:ay,onSuccess:()=>{const e=["integrations"];return Lr.invalidateQueries({queryKey:e})},onError:async t=>{wa({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ih({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Try Again",type:oh.SUCCESS}]})===qu&&e()}})}function iy(e,t){return new Promise(n=>{window.Plaid.create({token:e,onSuccess:(e,t)=>n({status:"success",public_token:e,metadata:t}),onExit:(e,t)=>n({status:"exit",metadata:t,error:e}),onEvent:(e,n)=>{ya(`Plaid event: ${e}`,{metadata:n,eventName:e}),t?.listener({type:"PLAID_LINK_EVENT",result:"SUCCESS",data:{eventName:e,metadata:n},error:null})}}).open()})}async function ly(e,t,n,r,a,o){const i=await Ob(e,t,n);if(!i)return;const l=await iy(i,a);if("success"===l?.status){const{public_token:e,metadata:i}=l;ya("Plaid link successful",{public_token:e,metadata:i});const s=await Ub(e,i,t,n);if(s.relinkPlaidItemId)return ly(s.relinkPlaidItemId,t,n,r,a,o)}else if("exit"===l?.status){const{metadata:e,error:t}=l;ya("Plaid link exited",{metadata:e,error:t}),t&&o?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await Bb(t,e,i)&&r()}else wa({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:l,token:i}})}function sy(){const[e,t]=Ou({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Pr(),r=Or(),{mutate:a}=ry(),{onPlaidLink:o}=$b(),i=Zb(),l=Gb(),s=Qb();return{linkPlaid:e=>{if(cr(i)){const t=Kb(e);if(cr(t)&&i.listener(t),i.preventDefault)return}if(cr(o)){const t=Yb(e);o(t)}else ly(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,a,l,s)},loading:e||cr(t),hasOnPlaidLinkOverride:cr(i)||cr(o)}}function cy(){const[e,t]=Ou({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Pr(),r=Or(),{mutate:a}=ry(),{apiPartnerName:o}=i(Qc),{onPlaidLink:l}=$b(),s=Zb(),c=Gb(),d=Qb();return{linkPlaid:e=>{if(cr(s)){const t=Kb(e);if(cr(t)&&s.listener(t),s.preventDefault)return}if(cr(l)){const t=Yb(e);l(t)}else!async function(e,t,n,r,a,o,i){const l=await Ob(e,t,n);if(!l)return;const s=await iy(l,o);if("success"===s?.status){const{public_token:e,metadata:l}=s;ya("Plaid link from search successful",{public_token:e,metadata:l});const c=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Vb(t.institution.institution_id,n,r);if(i)return wa({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ih({title:"Already Linked",body:`It seems that this bank is already linked${o?` with ${o}`:""}. Please tap "Relink" to update the existing linked institution.`,buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Relink",type:oh.SUCCESS}]}))===qu?{relinkPlaidItemId:cs(i.id)}:{}}var o;return ya("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Ub(e,t,n,r)}(e,l,t,n,r);c.relinkPlaidItemId&&ly(c.relinkPlaidItemId,t,n,a,o,i)}else if("exit"===s?.status){const{metadata:e,error:t}=s;ya("Plaid link from search exited",{metadata:e,error:t}),t&&i?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await Bb(t,e,l)&&a()}}(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,o,a,c,d)},loading:e||cr(t),hasOnPlaidLinkOverride:cr(s)||cr(l)}}const dy=gr(null,Us,tr({position:"absolute",left:1,right:1,bottom:1,width:"calc(100% - 2)",height:"44px",background:"surface.intent.primary",border:"none",borderRadius:0,gap:9,color:"icon.intent.primary",pointerEvents:"all",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}}}),ol);function uy({onPress:e,preventDefault:t,eventSource:n}){const{linkPlaid:r,loading:a}=sy();return R("button",{onClick:()=>{e?.(),t||r({plaidEvent:zb,message:"Tile Plaid Link button pressed"})},...dy,disabled:a,"data-event-name":n,children:[I(Sd,{Component:Du}),I(sc,{intent:"primary",children:"Link Account"})]})}const hy=tr({width:266,minHeight:32});function py(){return I(Xo,{styles:hy})}const my=gr(lr.text,tr({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa);function gy({children:e}){return I("div",{...my,children:e})}const vy={SUCCESS:tr({backgroundColor:"surface.intent.success.highlight"}),DANGER:tr({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:tr({backgroundColor:"surface.intent.secondary"})},fy=gr(lr.chip,tr({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function by({variant:e,children:t}){return I("div",{className:rr(fy.className,vy[e]),children:I(gy,{children:t})})}const yy=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function wy({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${vo(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return I(by,{variant:yy(r,n,t),children:a})}const Cy=tr({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function xy({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:Cy,children:[I(co,{title:e,label:t}),cr(n)&&I(wy,{difference:n,invertDirection:r})]})}const Ty={netIncome:0,income:0,expenses:0,absoluteSum:0},ky=e=>{if(sr(e))return Ty;const t=e.income?.total??0,n=e.expenses?.total??0,r=H(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},Ey=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(ky):[]},Ay=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function Sy({defaultRange:e=ut.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=wu(),i=u(()=>{a?.listener?.({type:"PROFIT_AND_LOSS_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Vt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return Ba({filter:e,grouping:t,select:Ey})}({filter:l,grouping:t?ja:void 0}),{profitLossData:d,profitDifference:h}=o(()=>{if(n)return{profitLossData:si,profitDifference:null};if(!s||0===s.length)return{profitLossData:Ay,profitDifference:null};if(2===s.length){const[e,t]=s;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:s[0],profitDifference:null}},[s,n]);return R(Qa,{isSample:n,children:[I(Ka,{title:"Profit + Loss"}),I(Za,{children:c?R($o,{children:[I(py,{}),I(py,{})]}):R(N,{children:[I(xy,{title:fo(d.netIncome),label:"Profit",comparison:h}),R(ho,{children:[I(Pu,{amount:d.income,total:d.absoluteSum,color:"positive",label:"Income"}),I(Pu,{amount:d.expenses,total:d.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(oi,{size:"sm"}),r&&I(uy,{onPress:i,preventDefault:a?.preventDefault})]})}const Iy=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],Ny=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...yt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Oa(a)};return await Pa(o)},Ry={moneyIn:0,moneyOut:0,netMoneyIn:0},Py=e=>{if(sr(e)||sr(e.operatingActivities)||!e.operatingActivities.children)return Ry;let t=new H(0),n=new H(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(H(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Dy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Py):[]};const My=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function Ly({defaultRange:e=ut.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=wu(),i=u(()=>{a?.listener?.({type:"CASH_FLOW_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Vt(t):e,{query:{data:s,isFetched:c},isFilling:d}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Vr({queryKey:Iy({filter:e,grouping:t}),queryFn:Ny,select:n})}({filter:e,grouping:t,select:Dy})}({filter:l,grouping:t?ja:void 0}),{cashFlowData:h,difference:p}=o(()=>{if(n)return{cashFlowData:di,difference:null};if(!s||0===s.length)return{cashFlowData:My,difference:null};if(2===s.length){const[e,t]=s;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:s[0],difference:null}},[s,n]),m=n||c?Math.abs(h.moneyIn)+Math.abs(h.moneyOut):0;return R(Qa,{isSample:n,children:[I(Ka,{title:"Cash Flow"}),I(Za,{children:d?R($o,{children:[I(py,{}),I(py,{})]}):R(N,{children:[I(xy,{title:fo(h.netMoneyIn),label:"Change in Cash",comparison:p}),R(ho,{children:[I(Pu,{amount:h.moneyIn,total:m,color:"positive",label:"Money In"}),I(Pu,{amount:h.moneyOut,total:m,color:"negative",label:"Money Out"})]})]})}),n&&I(oi,{size:"sm"}),r&&I(uy,{onPress:i,preventDefault:a?.preventDefault})]})}const Fy=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Oy=tr({display:"flex",justifyContent:"end"});function Vy({color:e,bulletLabel:t,moneySummary:n}){return R("div",{className:Fy,children:[I(Mo,{color:e,label:t}),I("div",{className:Oy,children:I(sc,{children:n})})]})}const Uy=gr(null,tr({display:"flex",gap:"10px",alignItems:"center"})),By=tr({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Hy=gr(null,By);function Wy({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>R("div",{...Uy,children:[I(Mo,{color:No.var("colors.brand.secondary")}),t?I(Xo,{styles:By}):I("div",{...Hy})]},n))})}const zy={total:0,children:[]},_y=e=>{return sr(e)||sr(e.expenses)||!e.expenses.children?zy:{total:e.expenses.total??0,children:(t=e.expenses.children,t.sort((e,t)=>(t.total??0)-(e.total??0)).slice(0,3).map(e=>({name:e.name??"",total:e.total??0})))};var t},jy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(_y):[]},qy=[No.var("colors.brand.primary"),No.var("colors.brand.success"),No.var("colors.brand.action")],Ky=Object.freeze({total:0,children:[]});function Yy({defaultRange:e=ut.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=dn(e=>e.externalOptions),l=wu(),s=u(()=>{l?.listener?.({type:"EXPENSE_TILE",result:"SUCCESS",data:null,error:null})},[l]),c=i.dataVisualizationColors??qy,d=t?Vt(t):e,{query:{data:h},isFilling:p}=function({filter:e,grouping:t}){return Ba({filter:e,grouping:t,select:jy})}({filter:d,grouping:t?ja:void 0}),{expenseData:m,expensesDifference:g}=o(()=>{if(r)return{expenseData:ci,expensesDifference:null};if(!h||0===h.length)return{expenseData:Ky,expensesDifference:null};if(2===h.length){const[e,t]=h;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:h[0],expensesDifference:null}},[h,r]),v=void 0===n?"Total Expenses":`${Ct[n]} Total`,f=m.children.length>0;return R(Qa,{isSample:r,children:[I(Ka,{title:"Expenses"}),I(Za,{children:p?I($o,{children:I(Wy,{shimmer:!0})}):R(N,{children:[I(xy,{title:fo(m.total),label:v,comparison:g,invertDirection:!0}),I(ho,{children:f?m.children.map((e,t)=>I(Vy,{color:c[t],bulletLabel:e.name,moneySummary:fo(e.total)},t)):I(Wy,{})})]})}),r&&I(oi,{size:"sm"}),a&&I(uy,{onPress:s,preventDefault:l?.preventDefault})]})}const Zy=gr(null,tr({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function Gy({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:rt(l=e.year,i,1),endDate:rt(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Zy,children:[R(br,{children:[I(kr,{children:"Monthly Review"}),I(fu,{period:e,setPeriod:t,disableNext:r||(s=e,c=n,h=s.month,p=c.month,h===p&&(d=s.year,u=c.year,d===u)),disablePrev:r})]}),R(yu,{children:[I(Sy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(Ly,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(Yy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const Qy="Oldest to Newest",Xy="Newest to Oldest",Jy="A-Z",$y="Z-A",ew="Lowest to Highest",tw="Highest to Lowest",nw="A-Z",rw="Z-A";function aw(){const[e,t]=d(void 0),n=o(()=>{if(e&&(e.orderBy||e.direction))return e},[e]);return{sortInstance:e,setSortInstance:e=>{(function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in gs)??!1,n=(e.direction&&e.direction in vs)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const ow=tr({width:"15px",height:"15px",borderRadius:"sm",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,position:"relative","&::before":{content:"''",position:"absolute",top:"-10px",left:"-10px",right:"-10px",bottom:"-10px"},_supportHover:{"&[data-is-checked='false']":{backgroundColor:"surface.background.hover"}}}),iw=tr({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),lw=tr({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function sw({checked:e,onClick:t,Icon:n=Qh}){const[r,a]=d(e??!1),o=void 0===e?r:e;return I("button",{...gr(lr["checkbox-input"],ow,o?lw:iw,ll),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&I(Sc,{Component:n})})}const cw=gr(null,tr({paddingLeft:"20px",paddingRight:"5px"}));function dw({checked:e,onClick:t,Icon:n=Qh}){return I("div",{...cw,children:I(sw,{checked:e,onClick:t,Icon:n})})}const uw=gr(lr["date-cell"],tr({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function hw({date:e,annotation:t}){const n=At(Nt(e));return R("div",{...uw,children:[t&&I(gy,{children:t}),I(sc,{children:n})]})}const pw="Income",mw={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},gw={EXPENSE:"Expense",REVENUE:pw,TRANSFER_IN:"Bank Transfer In",TRANSFER_OUT:"Bank Transfer Out"},vw={Expense:[{name:gw.EXPENSE,value:mw.EXPENSE}],Income:[{name:gw.REVENUE,value:mw.REVENUE}],Transfer:[{name:gw.TRANSFER_IN,value:mw.TRANSFER_IN},{name:gw.TRANSFER_OUT,value:mw.TRANSFER_OUT}]},fw={EXPENSE:"Expense",REVENUE:pw,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},bw=Object.fromEntries(Object.entries(fw).map(([e,t])=>[e,`Add ${t}`])),yw=Object.fromEntries(Object.entries(fw).map(([e,t])=>[e,`Edit ${t}`])),ww=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},Cw=e=>e===mw.TRANSFER_IN||e===mw.TRANSFER_OUT,xw=tr({color:"money.negative"}),Tw=tr({color:"money.positive"}),kw=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>Sr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),Ew=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!sr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:xw};const t=e.amount>0;let n;return n=t?"Expense Refund":e.children?.length>0?"Split Expense":"Expense",{type:"EXPENSE",displayName:n,css:t?Tw:xw}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":pw,css:t?xw:Tw}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?xw:Tw};break;default:t=(e=>({type:e.type,displayName:kw(e.type),css:e.amount<0?xw:Tw}))(e)}var n;return t},Aw=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 10.625H7.5C5.8424 10.625 4.25269 9.96652 3.08058 8.79442C1.90848 7.62231 1.25 6.0326 1.25 4.375V0.625",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M10 14.375L13.75 10.625L10 6.875",stroke:"currentColor",strokeMiterlimit:10})),"ChildRow"),Sw=gr(lr["transaction-date-cell-container"],tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function Iw({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=Ew(e),a=gr(lr["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?R("div",{...Sw,children:[I(Sd,{Component:Aw}),I(hw,{date:e.date,annotation:o})]}):I(hw,{date:e.date,annotation:o})}const Nw=tr({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),Rw=tr({display:"flex",flexDirection:"column",width:"100%"}),Pw=tr({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function Dw({iconUrl:e,iconSpacing:t}){return void 0!==e?I("img",{src:e,className:Pw,alt:void 0,width:24,height:24}):t?I("span",{className:Pw}):null}function Mw({label:e,subLabel:t,iconUrl:n,iconSpacing:r=!0}){return R("div",{className:Nw,children:[I(Dw,{iconUrl:n,iconSpacing:r}),R("div",{className:Rw,children:[I(sc,{children:e}),I(Eo,{children:t})]})]})}function Lw({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:tr({paddingLeft:"25px"}),children:I(Mw,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I(Mw,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}const Fw=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.10632H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.69366H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.28131H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8687H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.71875 10.4749L3.33125 12.8686L0.9375 10.4749",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 1.50635V12.8688",stroke:"currentColor",strokeMiterlimit:10})),"NestedRows"),Ow=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.13135H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.71851H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.30682H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8934H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M0.9375 4.5251L3.33125 2.13135L5.71875 4.5251",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 13.4938V2.13135",stroke:"currentColor",strokeMiterlimit:10})),"NestedRowsExpanded"),Vw=tr({display:"flex",alignItems:"center",gap:"8px"}),Uw=tr({padding:"6px"});function Bw({amount:e,canExpand:t=!1,isExpanded:n=!1}){return t?I(zc,{ariaLabel:n?"Collapse children":"Expand children",ariaExpanded:n,children:R("div",{className:Vw,children:[I(Sd,{Component:n?Ow:Fw}),I(Iu,{children:e})]})}):I("div",{className:Uw,children:I(Iu,{children:e})})}const Hw=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 1.25L1.25 13.75",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M13.75 9.84375V1.25H5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Withdraw"),Ww=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 13.75L1.25 1.25",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.15625 13.75H13.75V5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Deposit"),zw=tr({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),_w=tr({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function jw({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return Hw;case"Deposited to":return Ww;default:return null}})(e);return R("div",{className:zw,children:[n&&I(Sd,{Component:n}),R("div",{className:_w,children:[e&&I(Eo,{children:e}),t&&I(sc,{children:t})]})]})}const qw={id:"mock_task_link_bank",priority:"HIGH",name:"Link your bank account",description:"Effortlessly track every dollar by linking your bank account",shortDescription:"Link your bank to track every dollar",type:"LINK_BANK",dismissable:"DISMISSABLE",status:"ACTIVE"};function Kw(e,t=!0){const n=Th({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return{id:`${e.apiInstitutionName??"unknown"}_${e.id}_${e.apiErrorCode}_bank_error_task`,priority:"URGENT",name:n?.shortMessage(e.apiInstitutionName??"your bank")||"",description:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!1,apiPartnerName:""})||"",shortDescription:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!0,apiPartnerName:""})||"",type:n?.buttonType||"CHAT",dismissable:"DISMISSABLE",status:"ACTIVE",meta:{plaidItem:e}}}function Yw(){return Bu({filter:{status:{equal:"ACTIVE"}}},{select:e=>({multiAccountIntegrations:e.data?.filter(e=>["PLAID","UNIT"].includes(e.apiName))||[],integrations:e.data?.filter(e=>!["PLAID","UNIT"].includes(e.apiName))||[],cursor:e.cursor})})}const Zw={LINK_BANK:"LINK_BANK",RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT",MESSAGE_REVIEW:"MESSAGE_REVIEW",TRANSACTION_REVIEW:"TRANSACTION_REVIEW",BANK_ERROR:"BANK_ERROR",RULE_REVIEW:"RULE_REVIEW",CSV_IMPORT_REVIEW:"CSV_IMPORT_REVIEW"},Gw=e=>["tasks",e??{}],Qw={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},Xw={filter:{status:{in:["ACTIVE"]}}},Jw=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:xi(t[2].environment)},a=await Ra(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function $w(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=sr(r=e)||sr(r.data)?[]:[...r.data].sort((e,t)=>Qw[e.priority]-Qw[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=Xw,Vr({...r,queryKey:a?Gw(a):["tasks",{}],queryFn:Jw}));var r,a;const{query:{data:i},isFilling:l}=rg(),{query:{data:s},isFilling:c}=Hu({select:e=>({...e,data:e?.data?.filter(({status:e,apiErrorType:t,apiErrorCode:n})=>"ACTIVE"===e&&t&&n)})});return{taskBanners:o(()=>{let e=[];const n=s?.data;n&&(e=n.map(e=>Kw(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[qw]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const eC=e=>{const t=Xi[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},tC=e=>["banks/transactions/summary",e],nC=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:xi(t[2].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},rC=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>iC({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),aC=async({data:e,accessToken:t,environment:n})=>iC({data:{data:e},accessToken:t,environment:n}),oC=async({data:e,accessToken:t,environment:n})=>aC({data:[e],accessToken:t,environment:n}),iC=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:xi(n)};return await Ra(r)};function lC(){return ya("mutation successful, invalidating BT queries"),Promise.all([Lr.invalidateQueries({queryKey:["banks/transactions"]}),Lr.invalidateQueries({queryKey:["banks/transactions/summary"]}),Lr.invalidateQueries({queryKey:["tasks"]}),Lr.invalidateQueries({queryKey:["reports"]})]).catch(e=>wa({error:e,severity:"error"}))}function sC(){return dC({mutationFn:oC,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}})}function cC({mutationKey:e=["banks/transactions"],...t}){return Xg({onSuccess:()=>lC(),mutationKey:e,...t})}function dC({mutationKey:e=["banks/transactions"],...t}){return Xg({onSuccess:()=>lC(),mutationKey:e,...t})}function uC(){return cC({mutationFn:aC,meta:{toastOptions:{defaultErrorMessage:"Couldn't update categories"}}})}const hC=()=>["accounting/glAccounts"],pC=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await Ai(n);return fC(r)};function mC(e){return Vr({...e,queryKey:["accounting/glAccounts"],queryFn:pC})}function gC(e){return e.filter(e=>"ACTIVE"===e.status)}function vC(e){return mC({select:t=>CC(e?gC(t):t).flatMap(e=>[e,...e.children])})}const fC=e=>e.map(e=>({...e,id:ss({id:e.id,prefix:"GL_ACCOUNT"})}));function bC(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentAccountNo){const e=t.get(n.parentAccountNo)??[];e.push(n),t.set(n.parentAccountNo,e)}return t}function yC(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>yC(e,t))}const wC=e=>!e.parentAccountNo;function CC(e){const t=bC(e);return e.filter(wC).map(e=>({...e,children:yC(e,t)}))}function xC(e,t){return(t.get(e)??[]).map(e=>{const n=xC(e.accountNo,t);return{...e,children:n}})}function TC(e){const t=bC(e);return e.filter(wC).map(e=>({...e,children:xC(e.accountNo,t)}))}function kC(){return mC({select:TC})}const EC=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function AC(e,t){return o(()=>void 0===t?e??[]:e?.filter(e=>t.includes(e.type))??[],[e,t])}const SC=tr({maxWidth:"100%",width:"fit-content",display:"inline-flex",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.layout",background:"surface.background","& .Tight-sub-label":{color:"typography.base"},"& .Tight-icon > path":{stroke:"icon.base"}}),IC=rr(SC,tr({padding:"2.5px"})),NC=rr(SC,tr({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),RC=tr({background:"surface.intent.secondary",border:"{borderWidths.sm} solid",borderColor:"border.intent.secondary","& .Tight-sub-label":{color:"typography.intent.secondary"},"& .Tight-label":{color:"typography.intent.secondary"},"& .Tight-icon > path":{stroke:"icon.intent.secondary"}}),PC=rr(RC,tr({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),DC=tr({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.action",background:"surface.intent.action","& .Tight-sub-label":{color:"typography.intent.action"},"& .Tight-label":{color:"typography.intent.action"},"& .Tight-icon > path":{stroke:"icon.intent.action"},_supportHover:{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}}}),MC=rr(DC,tr({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),LC=tr({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.success",background:"surface.intent.success","& .Tight-sub-label":{color:"typography.intent.success"},"& .Tight-label":{color:"typography.intent.success"},"& .Tight-icon > path":{stroke:"icon.intent.success"}}),FC=rr(LC,tr({_supportHover:{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}}})),OC=tr({background:"surface.intent.warning",border:"{borderWidths.sm} solid",borderColor:"border.intent.warning","& .Tight-sub-label":{color:"typography.intent.warning"},"& .Tight-label":{color:"typography.intent.warning"},"& .Tight-icon > path":{stroke:"icon.intent.warning"}}),VC=rr(OC,tr({_supportHover:{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}}})),UC=tr({background:"surface.intent.danger",border:"{borderWidths.sm} solid",borderColor:"border.intent.danger","& .Tight-sub-label":{color:"typography.intent.danger"},"& .Tight-label":{color:"typography.intent.danger"},"& .Tight-icon > path":{stroke:"icon.intent.danger"}}),BC=rr(UC,tr({_supportHover:{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}}})),HC=tr({display:"flex",alignItems:"center",gap:"8px",height:"37px",margin:"0 8px",padding:"10px",borderRadius:"sm",cursor:"pointer",minWidth:0,outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}}),WC={default:PC,neutral:PC,warning:VC,success:FC,danger:BC,highlight:MC},zC=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=Cr([gr(lr["selector-button"],rr(HC,WC[e]),ll),...n]);return I("button",{ref:a,...o,...r,children:t})}),_C={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function jC(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function qC(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.accountNo===l.accountNo))),o=!a&&r.children?.length>0,i=!(a||r.children&&0!==r.children.length);var l;o?function(e,t){e.children.forEach(n=>{jC(e,n,t)})}(r,n):a?jC(a,r,n):i&&jC(r,r,n)}),n}const KC=[gr(null,tr({marginLeft:"6px",marginRight:"6px"}))],YC=gr(null,tr({whiteSpace:"normal"}));function ZC({types:e,activeOnly:t,onClick:n,searchTerm:r}){const{query:{data:a},isFilling:i}=vC(t),l=AC(a,e),s=o(()=>new Ae(l,_C),[l]),c=o(()=>qC(s.search(r),l),[l,r,s]);return i?I(Km,{}):c.map(({parent:e,child:t})=>I(Wm,{onClick:()=>n(t),children:R(Eg,{stylists:[YC],children:[e.name,I(cl,{Component:rl,stylists:KC}),t.name]})},`${t.accountNo}`))}const GC=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=ve([a,t?.ref]);return I(Hm,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function QC({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=i(Mm),{itemRef:o,index:l,itemProps:s}=Bm({hasCascading:!0}),{isScrolling:c}=i(Sm);return R(Tc,{open:n===l,onOpenChange:e=>{c||r(e,l)},placement:"right-start",children:[I(Ec,{children:t=>I(GC,{itemProps:s,index:l,ref:o,popupTriggerProps:t,children:e})}),I(Fc,{initialFocus:a,children:t})]})}const XC=tr({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),JC=tr({display:"flex",gap:"8px",color:"icon.base"});function $C({Icon:e,iconUrl:t,displayLabel:n}){const r=t?Cg(t,"Icon"):void 0;return R("div",{className:XC,children:[R("div",{className:JC,children:[!sr(e)&&e,sr(e)&&r&&I(Sd,{Component:r}),I(To,{wrap:"wrap",children:n})]}),I(cl,{Component:rl})]})}function ex({types:e,activeOnly:t,onClick:n}){const{query:{data:r,isFetching:a},isFilling:o}=(l=t,mC({select:e=>CC(l?gC(e):e)})),i=AC(r,e);var l;return o?I(Km,{}):o||a||void 0!==r?i.map(e=>I(QC,{triggerChildren:I($C,{displayLabel:e.name}),popupChildren:I(tx,{glAccount:e,onClick:n})},e.accountNo)):I(jm,{text:"No data"})}function tx({glAccount:e,onClick:t}){return I(Lm,{children:e.children.map(e=>I(Wm,{onClick:()=>t(e),children:I(To,{children:e.name})},e.accountNo))})}const nx=tr({maxWidth:"420px",width:"fit-content"});function rx({onClick:e,types:t,activeOnly:n,placeholder:r="Search accounts..."}){return I(Um,{onClick:e,placeholder:r,getSearchActiveStyles:e=>e?nx:void 0,SearchList:ZC,DefaultList:ex,extraProps:{types:t,activeOnly:n},listLength:0,forceSearchVisible:!0})}const ax=gr(lr["category-selector-table-cell"]);function ox({accountName:e,iconUrl:t,onChange:n,types:r,activeOnly:a,placeholder:o}){const{startPrefetch:i,cancelPrefetch:l}=Al({prefetchFn:Cl(hC,pC)}),s=sr(t)?void 0:Cg(t,"");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>R(zC,{...t,stylists:[ax],onMouseEnter:i,onMouseLeave:l,children:[s&&I(Sd,{Component:s}),I(sc,{children:e})]})}),I(rx,{onClick:n,types:r,activeOnly:a,placeholder:o})]})}function ix({transaction:e,parentTransaction:t,accountName:n}){const{mutate:r}=sC(),a=void 0!==t;return I(ox,{accountName:n,iconUrl:e.glAccount?.iconUrl,onChange:a?n=>{if(n?.id&&a){const{id:a,children:o}=t,{id:i}=e,l=o.map(e=>e.id===i?{...e,glAccountId:n.id.toString()}:e);r({id:a,children:l})}}:t=>{r({id:e.id,glAccountId:t.id})},types:EC,placeholder:"Search revenue accounts..."})}const lx=e=>e>0?"Deposited to":"Withdrawn from",sx=vi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31676 1.37476L1.67926 4.01226L4.31676 6.64976",strokeMiterlimit:10}),r.createElement("path",{d:"M12.2292 6.64976L14.8667 4.01226L12.2292 1.37476",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 7.85619 5.91297 7.11425 5.17103C6.37231 4.42909 5.36602 4.01227 4.31676 4.01227H1.67926",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 8.68983 5.91297 9.43177 5.17103C10.1737 4.42909 11.18 4.01227 12.2293 4.01227H14.8668",strokeMiterlimit:10})),"Split"),cx=e=>({id:e.id,name:e.name});function dx(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:lh("Category","Categories",n.size,!0),list:[...n].join(", ")}}const ux=gr(null,tr({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),hx=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function px({transaction:e}){const{label:t,list:n}=dx(e.children);return I(ic,{children:R("div",{...hx,children:[I(Sd,{Component:sx}),R("div",{...ux,children:[I(To,{children:t}),I(Eo,{children:n})]})]})})}const mx=()=>["expenses/categories"],gx=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await Ai(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:ss({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?ss({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function vx(e){return Vr({...e,queryKey:["expenses/categories"],queryFn:gx})}function fx(){return vx({select:e=>({...e,data:e.data?Tx(e.data):void 0})})}function bx(e,t){return(t.get(e)??[]).map(e=>{const n=bx(e.id,t);return{...e,children:n.length>0?n:void 0}})}function yx(e){if(0===e.length)return[];const t=Cx(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=bx(e.id,t);return{...e,children:n.length>0?n:void 0}})}function wx(){return vx({select:e=>({...e,data:e.data?yx(e.data):void 0})})}function Cx(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentCategoryId){const e=t.get(n.parentCategoryId)??[];e.push(n),t.set(n.parentCategoryId,e)}return t}function xx(e){if(0===e.length)return[];const t=Cx(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function Tx(e){if(0===e.length)return[];const t=Cx(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function kx(){return Al({prefetchFn:Cl(mx,gx)})}const Ex={keys:[{name:"name"}],threshold:.1};function Ax(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Sx(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.id===l.id))),o=!(a||0!==r?.children?.length&&r.children),i=!a&&r.children&&r.children.length>0;var l;a?Ax(a,r,n):o?Ax(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Ax(e,n,t)})}(r,n)}),n}const Ix=gr(null,tr({whiteSpace:"normal"})),Nx=[gr(null,tr({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function Rx({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=vx({select:e=>({...e,data:e.data?xx(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ae(i??[],Ex),[i]),c=o(()=>i?Sx(s.search(e),i):[],[i,e,s]);return a?I(Km,{}):l?I(jm,{text:"No data"}):0===c.length?I(jm,{text:"No results found"}):I(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=Cg(n.iconUrl,"Expense Icon");return R(Wm,{onClick:()=>t(cx(n)),children:[I(Sd,{Component:a}),I(Eg,{stylists:[Ix],children:r?n.name:R(N,{children:[e.name,I(cl,{Component:rl,stylists:Nx}),n.name]})})]},`${e.id}_${n.id}`)})})}function Px({category:e,handleCategoryChange:t}){return I(Lm,{children:e.children?.map(e=>{const n=Cg(e.iconUrl,"Expense Icon");return R(Wm,{onClick:()=>t(cx(e)),children:[I(Sd,{Component:n}),I(To,{wrap:"wrap",children:e.name})]},e.id)})})}function Dx({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=fx(),a=t?.data,o=!r&&n&&void 0===a;return r?I(Km,{}):o?I(jm,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(QC,{triggerChildren:I($C,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(Px,{category:t,handleCategoryChange:e})},t.id);const n=Cg(t.iconUrl,"Expense Category Icon");return R(Wm,{onClick:()=>e(cx(t)),children:[I(Sd,{Component:n}),I(To,{wrap:"wrap",children:t.name})]},t.id)})})}const Mx=({onClick:e})=>{const{query:{data:t}}=fx();return I(Um,{onClick:e,placeholder:"Search expense categories...",SearchList:Rx,DefaultList:Dx,listLength:(t?.data??[]).length})},Lx=gr(lr["category-selector-table-cell"]);function Fx({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=kx(),a=e.category?.name??"",{mutate:o}=sC(),i=void 0!==t,l=sr(e.category?.iconUrl)?void 0:Cg(e.category.iconUrl,"Expense Icon");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(zC,{...e,stylists:[Lx],onMouseEnter:n,onMouseLeave:r,children:[l&&I(Sd,{Component:l}),I(sc,{children:a})]})}),I(Mx,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,categoryId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{t?.id&&o({id:e.id,categoryId:t.id.toString()})}})]})}function Ox({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(px,{transaction:e});switch(ww(e.type)){case"EXPENSE_CATEGORY":return I(Fx,{transaction:e,parentTransaction:t});case"TRANSFER":return I(jw,{annotation:lx(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return wa({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(ix,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function Vx({name:e}){return I(N,{children:e&&I(sc,{children:e})})}function Ux({onClick:e}){const t=kc(),n=_i();return I(Fc,{children:I(Lm,{children:n.map(({status:n,displayName:r})=>I(Wm,{onClick:()=>(e(n),void t.close()),children:I(To,{children:r})},n))})})}const Bx=gr(lr["review-status-selector-button"],tr({width:"151px",justifyContent:"center"})),Hx=gr(lr["review-status-dropdown-arrow"],tr({display:"none"}));function Wx({status:e,transactionId:t}){const[n,r]=d(!1),{mutate:a}=sC(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:c}=qi(e);return t&&((u=t).startsWith(is.TRANSACTION_LINE_ITEM)||u.startsWith(is.PROCESSOR_TRANSACTION))?null:R(Tc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(Ec,{children:e=>R(zC,{variant:s,...e,stylists:[Bx],onClick:i,children:[I(Sd,{Component:c}),I(sc,{children:l}),I("div",{...Hx,children:I(cl,{Component:Lp})})]})}),I(Ux,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function zx({status:e,transactionId:t}){return I(Wx,{status:e,transactionId:t},t)}function _x({isMutating:e}){return e?I(np,{}):I(Sd,{Component:rl})}function jx({isMutating:e}){return I(_x,{isMutating:e})}const qx=e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.495239 8.15601H14.7767",strokeMiterlimit:10})),Kx=vi(qx,"Dash"),Yx=gr(null,tr({stroke:"icon.base.weak"}));function Zx({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(Kd,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(Sc,{Component:Kx,stylists:[Yx]})})})}function Gx({conversationId:e}){const{query:{data:t}}=Ll(e??null),{startPrefetch:n,cancelPrefetch:r}=Ol(),{startPrefetch:a,cancelPrefetch:o}=Ns(),i=cr(t),l=i&&"READ"===t?.readStatus,s=u(()=>{cr(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=u(()=>{cr(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I(Zx,{hasConversation:i,hasUnread:!l})})}function Qx(e){return bo(sh(e.amount))}const Xx=gr(lr["badge-chip"],IC),Jx=gr(null,to),$x=gr(null,ll),eT=gr(lr["neutral-badge"],RC),tT=gr(lr["highlight-badge"],DC),nT=gr(lr["success-badge"],LC),rT=gr(lr["warning-badge"],OC),aT=gr(lr["danger-badge"],lr["critical-badge"],UC);function oT({type:e,children:t}){let n;switch(e){case"danger":n=aT;break;case"warning":n=rT;break;case"neutral":n=eT;break;case"success":n=nT;break;case"highlight":n=tT}const r=Cr([Xx,Jx,n,$x]);return I("div",{...r,children:t})}function iT({reviewStatus:e}){const{variant:t,Icon:n}=qi(e);return I(oT,{type:t,children:I(Sd,{Component:n})})}const lT=tr({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),sT=tr({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),cT=tr({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),dT=tr({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),uT=tr({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),hT=tr({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function pT({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=dx(e.children);return`${t}: ${n}`}switch(ww(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${lx(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void wa({error:new Error("Should not get here. Payout without line items."),severity:"error"});default:return e.glAccount?.name}}(t),r=void 0!==e.getParentRow();return R("div",{className:lT,children:[r&&I(Sd,{Component:Aw}),R("div",{className:uT,children:[R("div",{className:cT,children:[t.iconUrl?I("img",{src:t.iconUrl,className:hT,alt:void 0,width:24,height:24}):I("span",{className:hT}),I(To,{children:t.description})]}),R("div",{className:dT,children:[I(iT,{reviewStatus:t.reviewStatus}),I(Eo,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:sT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(Bw,{amount:Qx(e.original),canExpand:e.getCanExpand(),isExpanded:e.getIsExpanded()}),I(cl,{Component:rl})]})]})}const mT=vi(qx,"Minus");function gT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(dw,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?mT:Qh})}const vT=J(),fT=[vT.display({id:hn.SELECT,header:({table:e})=>I(gT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(dw,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),vT.accessor("date",{id:hn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(ic,{children:I(Iw,{transaction:e.row.original,isChild:t})})},header:()=>I(Yc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:Qy,sortDescDisplay:Xy}),size:130,maxSize:144}),vT.accessor("description",{id:hn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(ic,{children:I(Lw,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(Yc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:Jy,sortDescDisplay:$y}),size:180}),vT.accessor("amount",{id:hn.AMOUNT,cell:e=>I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:Qx(e.row.original),canExpand:e.row.getCanExpand(),isExpanded:e.row.getIsExpanded()})}),header:()=>I(Yc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:ew,sortDescDisplay:tw,align:"right"}),size:130,maxSize:130}),vT.accessor("category.id",{id:hn.CATEGORY,cell:({row:e})=>I(Ox,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(Yc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),vT.accessor(e=>e.dimensionValues[0]?.id,{id:hn.DIMENSION_VALUE,cell:e=>I(ic,{children:I(Vx,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>I(Yc,{columnName:"Business"}),size:130}),vT.accessor("reviewStatus",{id:hn.REVIEW_STATUS,cell:e=>I(ic,{children:I(zx,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(Yc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:nw,sortDescDisplay:rw,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),vT.display({id:hn.COMMENTS,cell:e=>{const t=e.row.original;return I(ic,{alignVariant:"center",children:I(Gx,{conversationId:t.conversation?.id})})},header:()=>I(Yc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),vT.display({id:hn.EXPAND,cell:e=>I("div",{className:tr({paddingRight:"20px"}),children:I(jx,{isMutating:e.isMutating})}),size:40,maxSize:60})],bT=vT.display({id:"MOBILE",cell:e=>I(pT,{row:e.row})}),yT=l(!0);function wT(){return i(yT)}const CT=[];function xT({transactions:e,columns:t}){const n=wT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(hn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[bT]:(i=t)?fT.filter(e=>i.includes(e.id)):fT;var i;return $({data:e??CT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??CT.length,columns:o,getCoreRowModel:ee(),getRowCanExpand:e=>e.original.children.length>0,getSubRows:e=>e.children.map(e=>{return t=e,{...t,iconUrl:t.iconUrl??"",reconciliationMatch:null,tax:{paymentInfo:null},customData:null,children:[],attachments:[],suggestedCategories:[],conversation:null,status:"ACTIVE"};var t}),getExpandedRowModel:te(),paginateExpandedRows:!1,getRowId:e=>e.id,meta:{editMutationKey:["banks/transactions"]},state:{columnOrder:r,columnVisibility:a}})}const TT=[hn.COMMENTS,hn.DATE,hn.DESCRIPTION,hn.AMOUNT,hn.CATEGORY,hn.REVIEW_STATUS];function kT({Component:e,stylists:t}){return I(e,{stylists:[gr(lr["xx-large-icon"],lr.icon),...t??[]],size:50})}function ET(){return R(N,{children:[I(kT,{Component:wi}),I(To,{wrap:"wrap",children:"All caught up"}),I(Eo,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function AT({children:e,stylists:t=[],...n}){return I(Qs,{intent:"warning",stylists:t,...n,children:e})}function ST({eventSource:e}){const{linkPlaid:t,loading:n}=sy();return I(AT,{...gr(lr["zero-state-button"]),onClick:()=>t({plaidEvent:zb,message:"Plaid Link button pressed"}),disabled:n,eventSource:e,children:I(To,{children:"Link your bank"})})}function IT({eventSource:e}){return R(N,{children:[I(kT,{Component:gg}),I(kr,{children:"Link Bank Account"}),I(Eo,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(ST,{eventSource:e})]})}const NT=tr({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function RT(){return R(N,{children:[I("div",{className:NT,children:I(kT,{Component:yi})}),I(kr,{children:"Transactions are being processed"}),I(Eo,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}function PT(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,s(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const i=o(()=>{const a=T(e,t,n),o=(...e)=>a(...e);return o.cancel=()=>{a.cancel()},o.isPending=()=>!!r.current,o.flush=()=>a.flush(),o},[e,t,n]);return s(()=>{r.current=T(e,t,n)},[e,t,n]),i}function DT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=d(e),[a,o]=d(!1);s(()=>{r(e)},[e]);const i=PT(u(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const MT=gr(lr["filter-bar"],tr({display:"flex",padding:"16px",flexDirection:"column",alignItems:"flex-start",gap:"8px",flex:"1 0 0",borderRadius:"2px",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:0,xl:{display:"flex",flex:"1 0 0",flexDirection:"column",height:"35px",padding:"0 10px",justifyContent:"center",alignItems:"flex-start",gap:"10px",borderRadius:"sm",background:"surface.background"}})),LT=gr(lr["filter-search-bar"],tr({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),FT=gr(null,tr({color:"icon.base",flexShrink:0,marginRight:"15px"})),OT=gr(null,tr({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"template",display:"flex",flex:"1 0 0",flexDirection:"column",justifyContent:"center",height:"100%",minWidth:0,padding:0,fontFamily:"label",_placeholder:{color:"typography.base.weak"},xl:{fontSize:"14px",lineHeight:"template"}})),VT=tr({width:25});function UT({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=DT({debouncedValue:t,onChangeDebouncedValue:e});return I("div",{...MT,children:R("div",{...LT,children:[I("div",{className:VT,children:n||i?I(np,{}):I(Sd,{stylists:[FT],Component:Yv})}),I("input",{...OT,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Ep})]})})}const BT=gr(lr["date-amount-header"],tr({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function HT({formattedDate:e,formattedSum:t}){return R("div",{...BT,children:[I(To,{wrap:"wrap",children:e}),I(Iu,{children:t})]})}function WT(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=Cw(e.row.original.type),o="category"===e.column.id&&(r||a),i="comments"===e.column.id,l="amount"===e.column.id;if(i){const e=t.getParentRow();us(e?.original??t.original,{initialTab:"conversation"})}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();us(e?.original??t.original)}}function zT({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=Ts(),a=u(()=>n({id:e.original.id}),[n,e.original]),o=u(()=>{us(e.original)},[e.original]);return I(ns,{rowData:e,onMouseEnter:a,onMouseLeave:r,onRowClick:o,onCellClick:WT,shouldDisplayDivider:n=>{return r=n,a=t,o=e.getVisibleCells().length,!(0===r||a&&1===r||r===o-1||a||1===r);var r,a,o}})}function _T({rows:e}){const t=o(()=>function(e){return Array.from(function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=n.original.date;if(t.has(e)){const r=t.get(e);r&&(r.netSumCents+=n.original.amount,r.formattedSumDollars=bo(sh(r.netSumCents)),r.rows.push(n))}else{const r=Nt(e);t.set(e,{date:e,formattedDate:r?At(r):e,netSumCents:n.original.amount,formattedSumDollars:bo(sh(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>R(f,{children:[I(HT,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(zT,{rowData:e},e.id))]},e.date))})}function jT({table:e,hasSelect:t}){const n=wT();return I(Kl,{editMutationKey:e.options.meta?.editMutationKey,children:I(zl,{children:n?I(_T,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(zT,{rowData:e,hasSelect:t},e.id))})})}function qT(e){return e?"Search":"Search transactions..."}function KT(e,t){const n=/* @__PURE__ */new Map;return t.forEach(t=>{const r=t.selectedValues(e);r.length>0&&n.set(t.key,[...r])}),n}function YT(e,t){return e.get(t)??[]}function ZT(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function GT(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function QT(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function XT({buttonText:e,onButtonClick:t}){return R(N,{children:[I(Td,{Component:tf}),I(To,{children:"No results"}),I(Eo,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(zc,{onClick:t,children:e})]})}const JT=tr({xl:{minWidth:"900px"}}),$T=tr({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function ek({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){Dd(Qi);const c=function({transactions:e}){return function({transactions:e,columns:t}){return xT({transactions:e,columns:t?[...t,hn.EXPAND]:void 0})}({transactions:e,columns:TT})}({transactions:i}),{query:{data:d},isFilling:u}=ws({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=wT(),p=!sr(d?.data?.[0])&&!u,m=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(XT,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(ET,{})):a=I(RT,{}):a=I(IT,{eventSource:"FinancialOverviewTransactionsTableZeroState"}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:JT,children:[I("div",{id:Qi}),R(sl.Provider,{value:o,children:[R(br,{children:[I(kr,{children:"Transactions for review"}),I(Ld,{children:I(ml,{})})]}),I(nc,{dashboard:"financialOverviewDashboard",children:r?I(wl,{}):R(N,{children:[!h&&I("div",{className:$T,children:I(UT,{placeholder:qT(h),searchTerm:l,onChange:s,isFetching:a})}),I(rc.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(Hl,{headerGroups:c.getHeaderGroups()})}),sr(m)?I(jT,{table:c,hasSelect:!1}):I(Cd,{children:m})]})})]})]})}function tk(){const[e,t]=d(""),{sortInstance:n,setSortInstance:r,apiSort:a}=aw(),o={...(()=>{const e=Yi();return{...Ji,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=ws({filter:o,sort:a,limit:10}),u=i?.data??el,{hasPlaidLinkedBankAccount:h,isFilling:p}=ng();return I(ek,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:c,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const nk=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function rk({children:e}){return I("div",{...nk,children:e})}const ak=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:Ed,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:fi,buttonText:"Review"};case"LINK_BANK":return{Icon:gg,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:gg,buttonText:"Fix"};case"RELINK":return{Icon:gg,buttonText:"Relink"};case"CHAT":return{Icon:bi,buttonText:"Learn more"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:wi,buttonText:""};default:return{Icon:bi,buttonText:""}}},ok=gr(lr["banner-title"],tr({display:"flex",alignItems:"center",gap:"8px"})),ik=gr(lr["banner-icon"],tr({width:"20px",height:"20px"}));function lk({title:e,type:t}){const{Icon:n}=ak(t);return R("div",{...ok,children:[I(Sd,{Component:n,stylists:[ik]}),I(To,{wrap:"wrap",children:e})]})}const sk=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",color:"icon.base",gap:{base:"4px",xl:"5px"},flex:{xl:"1 1 0"},minWidth:{xl:"200px"},width:"100%"}));function ck({title:e,description:t,type:n}){return R("div",{...sk,children:[I(lk,{title:e,type:n}),I(Eo,{wrap:"wrap",children:t})]})}const dk=lr["banner-button"],uk=tr.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),hk=gr(lr["banner-button-text"]),pk=gr(lr["banner-button-icon"]);function mk({priority:e,type:t,handleClick:n,eventSource:r}){const{buttonText:a}=ak(t),o=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return R(Qs,{onClick:n,intent:o,styles:uk,className:dk,eventSource:r,children:[I(To,{stylists:[hk],children:a}),I(cl,{stylists:[pk],Component:rl})]})}const gk=or({base:{display:"flex",flexDirection:{base:"column",xl:"row"},padding:{base:"16px",xl:"15px"},gap:{base:"16px",xl:"0"},justifyContent:{xl:"space-between"},alignItems:{base:"flex-start",xl:"center"},alignSelf:"stretch",width:{base:"100%",xl:"auto"},minWidth:{xl:"350px"},borderRadius:{base:"sm",xl:"lg"},border:"1px solid",backgroundColor:"surface.foreground"},variants:{priority:{HIGH:{borderColor:"border.intent.warning"},MEDIUM:{borderColor:"border.intent.action"},LOW:{borderColor:"border.intent.success"},URGENT:{borderColor:"border.intent.danger"},DEFAULT:{borderColor:"border.intent.secondary"}}}}),vk={HIGH:lr["banner-high"],MEDIUM:lr["banner-medium"],LOW:lr["banner-low"],URGENT:lr["banner-urgent"]};function fk({task:e,handleClick:t,eventSource:n}){const{name:r,description:a,shortDescription:o,type:i,priority:l}=e,s=wT()?o:a,c=gr(lr.banner,vk[l],gk({priority:l}));return R("div",{...c,children:[I(ck,{title:r,description:s,type:i}),I(mk,{priority:l,type:i,handleClick:t,eventSource:n})]})}function bk(e,t){ds(dn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation",{routeProps:{conversationId:null,defaultValues:{message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}}}}))}function yk(e,t,n,r,a){return()=>ih({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function wk(e){const{mutateAsync:t}=oy(),n=Pr(),r=Or(),{apiPartnerName:a}=i(Qc),o=wT(),{linkPlaid:l,loading:s,hasOnPlaidLinkOverride:c}=sy(),{linkPlaid:d,loading:u}=sy(),h=Zb(),p=cr(e)?function(e){const t=Th({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return cr(t)?t:kh(e)?xh.ADDITIONAL_CONSENT_REQUIRED.DEFAULT:null}(e):null;if(sr(p)||sr(e))return null;const m="ITEM_LOCKED"===e.apiErrorCode;switch(p.buttonType){case wh.DELETE_OR_RELINK:case wh.RELINK:return s?null:(v=l,f=a,b=o,{alert:yk(p,(g=e).apiInstitutionName,f,b,[{key:_u,label:"Cancel"},{key:qu,label:"Relink",type:oh.SUCCESS}]),actions:{success:()=>{v({plaidEvent:jb,plaidItemId:g.id,apiAccessToken:g.apiAccessToken,apiErrorCode:g.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case wh.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:yk(e,t.apiInstitutionName,a,o,[{key:_u,label:"Cancel"},{key:wh.CHAT,label:"Chat"},{key:qu,label:"Unlink and Relink",type:oh.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:_b,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[wh.CHAT]:()=>bk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,t,d,a,o,c);case wh.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l,s){return{alert:yk(e,t.apiInstitutionName,i,l,[{key:_u,label:"Cancel"},{key:wh.CHAT,label:"Chat"},{key:wh.RELINK,label:"Relink"},{key:qu,label:"Go To Bank",type:oh.SUCCESS}]),actions:{success:async()=>{const e=await zu({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;cr(o)?ds(s,{type:"PLAID_LINK_ROUTE_TO_BANK",result:"SUCCESS",data:{bankUrl:o},error:null},()=>window.open(o,"_blank")):window.open(o,"_blank")},[wh.RELINK]:()=>{o({plaidEvent:jb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[wh.CHAT]:()=>bk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,m,n,r,l,a,o,h);case wh.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:yk(e,t.apiInstitutionName,a,o,[{key:_u,label:"Cancel"},{key:qu,label:"Unlink",type:oh.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:qb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(p,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:yk(e,t,a,o,[{key:_u,label:"Cancel"},{key:wh.CHAT,label:"Chat",type:oh.SUCCESS}]),actions:{[wh.CHAT]:()=>bk(t,r)}}}(p,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var g,v,f,b}const Ck=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){wa({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function xk({task:e}){const{linkPlaid:t,loading:n}=sy(),{linkPlaid:r,loading:a}=cy(),o=wk(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&sr(o);if(i||l||s)return null;const c="LINK_BANK"===e.type?"FinancialOverviewLinkAccountBanner":"RELINK"===e.type?"FinancialOverviewRelinkAccountBanner":void 0;return I(fk,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:jb,plaidItemId:e?.meta?.plaidItem?.id,apiAccessToken:e?.meta?.plaidItem?.apiAccessToken,apiErrorCode:e?.meta?.plaidItem?.apiErrorCode,message:"Fix Relink Bank Error button pressed"}):"LINK_BANK"===e.type?(ya("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:zb,message:"Plaid Banner Link Bank pressed"})):cr(o)&&(ya("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Ck(o))},eventSource:c})}const Tk=gr(lr.banner,lr["banner-default"],gk({priority:"DEFAULT"}));function kk(){const e=wT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...Tk,children:I(ck,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const Ek=gr(lr.banner,lr["banner-default"],gk({priority:"DEFAULT"}));function Ak(){const e=wT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...Ek,children:I(ck,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Sk=tr({width:"100%",height:72,minWidth:"300px"});function Ik(){return R(N,{children:[I(Xo,{styles:Sk}),I(Xo,{styles:Sk}),I(Xo,{styles:Sk})]})}function Nk({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(Ik,{}):a?e.map(e=>void 0===Zw[e.type]?null:"LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(wh).includes(e.type)?I(xk,{task:e},e.id):I(fk,{task:e,handleClick:()=>t(e.type)},e.id)):I(n?Ak:kk,{})}const Rk=gr(lr["button-table-header"]),Pk=tr({height:{xl:"auto",base:"44px"}});function Dk(){const e=bh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:Pk,children:R(Xs,{onClick:()=>{rs(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[Rk],eventSource:"FinancialOverviewActionItemHeader",children:[I(cl,{Component:Du}),I(vc,{children:"Banks & Integrations"})]})})}const Mk=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1 3.5H14"}),r.createElement("path",{d:"M1 7.5H14"}),r.createElement("path",{d:"M1 11.5H14"})),"HamburgerNavMenu"),Lk=tr.raw({width:"44px",height:"44px"});function Fk(){return I(Xs,{onClick:()=>rs("NavMenu"),styles:Lk,children:I(Sd,{Component:Mk})})}const Ok=gr(lr["business-owner-dashboard-header"],tr(vr,{flexDirection:{base:"column",xl:"row"},alignItems:{base:"stretch",xl:"center"},justifyContent:{base:"center",xl:"space-between"},height:{base:"auto",xl:"80px"},minHeight:"80px",gap:{base:"16px",xl:0}})),Vk=tr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"});function Uk(){return R("div",{...Ok,children:[R("div",{className:Vk,children:[I(Fk,{}),I(Dk,{})]}),I(kr,{children:"Action Items"})]})}const Bk=()=>{const e=wT(),{isApp:t}=i(Pd);return e&&t};function Hk({shouldFilterTasks:e=!1}){const t=Bk(),{taskBanners:n,isFilling:r}=$w(e),a=ks(),{query:{data:o}}=rg();return R(N,{children:[t?I(Uk,{}):R(br,{children:[I(kr,{children:"Action Items"}),I(Dk,{})]}),I(rk,{children:I(Nk,{taskBanners:n,handleScrollAction:eC,isWaitingForPlaidItemAccountsSync:!a&&!0===o?.plaidItemAccountsReadyToSync,isFilling:r})})]})}const Wk=gr(lr["business-owner-dashboard"],tr({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),zk=tr({display:"flex",width:"100%",justifyContent:"center"}),_k={status:{in:["ACTIVE","INACTIVE"]}};function jk({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=d(void 0);return{sortInstance:e,setSortInstance:u(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Sl)??!1,n=(e.direction&&e.direction in Il)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:l,paginationControls:s}=Dl({limit:10,sort:a,filter:$i}),c=o?.data??tl,h=wT(),{hasBookkeeper:p}=i(Qc),{initialPageProps:m}=i(Pd),{query:{data:g}}=rg(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=ws({filter:_k,limit:1});return(e?.data?.length??0)>0}(),g),f=/* @__PURE__ */new Date,b={month:f.getMonth(),year:f.getFullYear()};const[y,w]=Cc(m?.period??b,e,t),C=(x=y.month,{beginDate:rt((T=y.year)-1,x+1,1),endDate:rt(T,x+1,0)});var x,T;return I("div",{className:zk,children:R("div",{...Wk,children:[I(Hk,{shouldFilterTasks:h}),!h&&R(N,{children:[I(Gy,{period:y,handleDateChange:e=>{var t,n;(t=b).year===(n=e).year&&n.month>t.month||n.year>t.year||w(e)},todayPeriod:b,showSamples:v,showLinkAccountButton:v&&!g?.plaidItemAccountsReadyToSync}),p&&R(N,{children:[I(br,{children:I(kr,{children:"Financial Summary"})}),I(hu,{isSample:v,period:y})]})]}),!h&&I(N,{children:I(hi,{filter:C,isSample:v})}),p&&I(Vd,{sortInstance:n,setSortInstance:r,conversations:c,paginationControls:s,isFilling:l,isMobile:h}),I(tk,{})]})})}function qk(e){return I(xa||N,{children:e.children})}function Kk({children:e}){return I(qk,{children:I("div",{className:ur(lr.component),children:e})})}function Yk({source:e,children:t}){return I(Tn.Provider,{value:e,children:t})}function Zk(e){return I(Kk,{children:I(Yk,{source:"FinancialOverview",children:I(jk,{...e})})})}const Gk=tr({display:"flex",flexDirection:"column"});function Qk({task:e}){return I("div",{className:Gk,children:I(xk,{task:e})})}const Xk=tr({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),Jk=tr({width:"80px",height:"12px"}),$k=tr({width:"150px",height:"16px"}),eE=tr({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),tE=tr({userSelect:"none",cursor:"pointer"});function nE(){return R("div",{className:eE,children:[R("div",{className:tE,children:[R("div",{className:Xk,children:[I(Xo,{styles:$k}),I(Xo,{styles:Jk})]}),R("div",{className:Xk,children:[I(Xo,{styles:$k}),I(Xo,{styles:Jk})]})]}),I("div",{className:tE,children:R("div",{className:Xk,children:[I(Xo,{styles:$k}),I(Xo,{styles:Jk})]})})]})}const rE=tr.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function aE({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=wT(),a=n||r?zc:Xs;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(a,{extraClassNames:[rE],popupTriggerProps:e,children:I(cl,{Component:tf,stylists:t})})}),I(Fc,{children:e})]})}const oE=vi(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M14.075 2.10645H0.924988V5.09395H14.075V2.10645Z",strokeMiterlimit:10}),r.createElement("path",{d:"M14.075 5.09375H0.924988V14.0625H14.075V5.09375Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 8.08105H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 8.08105H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 8.08105H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 8.08105H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 11.0752H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 11.0752H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 11.0752H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 11.0752H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M3.91254 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M11.0875 0.3125V3.3",strokeMiterlimit:10})),"Date"),iE=or({base:{display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative"},variants:{width:{lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"}},sm:{minWidth:{sm:"360px",base:"100dvw"},maxWidth:{sm:"392px",base:"100dvw"}}}}});function lE({width:e="lg",children:t}){const n=gr(lr["modal-popup"],iE({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const sE=tr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),cE=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),dE=tr({display:"flex",flexDirection:"column",gap:"12px"}),uE=tr({display:"flex",flexDirection:"row",gap:"10px"}),hE=tr({display:"flex",flexDirection:"column",gap:"10px"}),pE=({acknowledged:e,setAcknowledged:t})=>R("div",{className:dE,children:[I(sc,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),R("div",{className:uE,children:[I(sw,{checked:e,onClick:()=>t(!e)}),I(sc,{wrap:"wrap",children:"I understand."})]})]});function mE({bankAccounts:e}){const{apiPartnerName:t}=i(Qc),n=e.reduce((e,t)=>{const n=Nt(t.tranStartDate||""),r=Nt(e.tranStartDate||"");return n&&r&&Et(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutateAsync:n}=Bh(),r=kc();return vb({defaultValues:{tranStartDate:t},onSubmit:async t=>{var a,o;await n((a=e,o=t.value.tranStartDate,a.map(e=>({id:cs(e.id),tranStartDate:o,duplicateBankAccountIds:[]})))),r.close(),ih({title:"Start Date Updated",body:R("div",{className:hE,children:[I(sc,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(sc,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:qu,type:oh.SUCCESS}]})}})})(e,n),a=kc(),o=()=>{a.close()},[l,s]=d(!1),{query:{data:c}}=Hu(),u=c?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Nt(e.reduce((e,t)=>{const n=Nt(t.tranMinStartDate||""),r=Nt(e.tranMinStartDate||"");return n&&r&&Et(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${uh(e[0]?.name,e[0]?.mask)} account dating back to ${Ft(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${Ft(h)}.`;return R("form",{className:sE,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit()},children:[I(To,{children:"Set Bank Transaction Start Date"}),I(sc,{wrap:"wrap",children:p}),I(sc,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),I(r.AppField,{name:"tranStartDate",children:e=>I(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),I(r.Subscribe,{selector:e=>e,children:e=>{const t=Nt(e.values.tranStartDate||""),r=Nt(n),a=t&&r&&Et(t,r);return R(N,{children:[e.isDirty&&a&&I(pE,{acknowledged:l,setAcknowledged:s}),R("div",{className:cE,children:[I(wb,{showIcon:!1,onClick:o}),I(Jh,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!l})]})]})}})]})}function gE({bankAccounts:e}){return R(Tc,{placement:"right-start",children:[I(Ec,{children:e=>R(Wm,{...e,children:[I(Sd,{Component:oE}),I(To,{children:"Edit Start Date"})]})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(mE,{bankAccounts:e})})})})]})}const vE=vi(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M7.49998 14.4245C11.3242 14.4245 14.4244 11.3244 14.4244 7.50011C14.4244 3.67585 11.3242 0.575684 7.49998 0.575684C3.67573 0.575684 0.575562 3.67585 0.575562 7.50011C0.575562 11.3244 3.67573 14.4245 7.49998 14.4245Z",strokeMiterlimit:10}),r.createElement("path",{d:"M2.88599 12.625L12.6672 2.84375"})),"Stop"),fE=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M11.7346 14.5L11.7346 12.9152C11.7333 12.2895 11.5704 11.6747 11.2616 11.1305C10.9528 10.5863 10.5087 10.1311 9.97233 9.80895L7.43662 8.29386C6.90079 7.97055 6.45795 7.51384 6.1513 6.96831C5.84465 6.42279 5.68467 5.80708 5.68698 5.18127L5.68698 3.60913",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 1.1875L5.68701 14.5",strokeMiterlimit:10}),r.createElement("path",{d:"M3.26538 3.60911L5.68699 1.1875L8.10859 3.60911",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 7.24146L5.68701 2.39825",strokeMiterlimit:10})),"Combine"),bE={QBO:"QuickBooks Online",XERO:"Xero",STRIPE:"Stripe",SHOPIFY:"Shopify",SQUARE:"Square",RUTTER:"Rutter",UBER:"Uber",MOOV:"Moov",QUALPAY:"Qualpay",BENCH:"Bench",WAVE:"Wave",MANUAL_ENTRY:"Manual Entry",CSV_IMPORT:"CSV Import",PARTNER_IMPLEMENTATION:"Partner Implementation",FRESHBOOKS:"FreshBooks",FRESHBOOKS2:"FreshBooks"};function yE(e){const{apiPartnerName:t,unitIntegrationBankName:n}=i(Qc);return"UNIT"===e?n??t??"Unit":bE[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const wE=tr({display:"flex",flexDirection:"column",gap:"16px"}),CE=gr(null,tr({color:"brand.danger"}));function xE({integration:e,accounts:t}){const{mutate:n}=oy(),r=kc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=sy(),{query:{data:l}}=(s=e.id,Bu({},{select:e=>{return{...e,data:(t=e.data,n=s,t?.find(e=>e.id===n))};var t,n}}));var s;const c=l?.data,{query:{data:d}}=ig(e.id),u=d?.data,h=yE(e.apiName),p="PLAID"===e.apiName;return R(Lm,{children:[p&&!o&&R(Wm,{onClick:()=>(a({plaidEvent:jb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(Sd,{Component:Os}),I(To,{children:"Add Account"})]}),p&&u&&I(gE,{bankAccounts:u}),Je(t)&&R(Wm,{onClick:()=>Lb({plaidItemAccounts:t}),children:[I(Sd,{Component:fE}),I(To,{children:"Merge Accounts"})]}),p&&R(Wm,{onClick:()=>(async()=>{let o;var l;o=Je(t)?await(async e=>ih({title:"Remove Institution",body:I("div",{className:wE,children:I(sc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether? If you unlink now and relink ${e} again in the future, you may see duplicate transactions.`})}),buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Remove",type:oh.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ih({title:"Remove Institution",body:I("div",{className:wE,children:I(sc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Remove",type:oh.DANGER}]}))(h),r.close(),o===ju&&(p&&i?a({plaidEvent:qb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[I(Sd,{stylists:[CE],Component:vE}),I(To,{stylists:[CE],children:"Delete Connection"})]})]})}const TE=tr({userSelect:"none"});function kE({children:e}){return I("div",{className:TE,children:e})}const EE=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"16px 12px 16px 16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"});function AE({children:e}){return I("div",{className:EE,children:e})}const SE=gr(lr.badge,NC),IE=gr(null,to),NE=gr(null,ll),RE=gr(lr["neutral-badge"],PC),PE=gr(lr["highlight-badge"],MC),DE=gr(lr["success-badge"],FC),ME=gr(lr["warning-badge"],VC),LE=gr(lr["danger-badge"],lr["critical-badge"],BC);function FE({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=LE;break;case"warning":o=ME;break;case"neutral":o=RE;break;case"success":o=DE;break;case"highlight":o=PE}const i=Cr([SE,IE,o,NE]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function OE({plaidItem:e}){const t=wk(e),n=sr(e.apiErrorCode)&&kh(e);return R(FE,{type:n?"highlight":"danger",onClick:n=>{n.stopPropagation(),t&&(ya(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Ck(t))},disabled:sr(t),children:[I(Sd,{Component:n?Du:bi}),I(Eo,{children:n?"Relink for Statements":"Fix Bank Error"}),I(cl,{Component:rl})]})}const VE=or({base:{padding:"16px 16px 16px 24px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",color:"icon.base",display:"flex",borderTop:"none",borderLeft:"none",borderRight:"none",width:"100%",justifyContent:"space-between",alignItems:"center"},variants:{active:{true:{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",cursor:"pointer"}}}}}),UE=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function BE({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=rr(VE({active:a}),ll);return R("button",{className:l,onClick:t=>{t.stopPropagation(),rs("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:UE,children:[I(Sd,{Component:i?Aw:gg}),I(fg,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(Sd,{Component:rl})]})}const HE=tr({display:"flex",flexDirection:"column",gap:"4px"}),WE=tr({display:"flex",alignItems:"center",gap:"8px"}),zE=gr(null,tr({color:"brand.primary.weak"})),_E=tr({overflow:"hidden"});function jE({integration:e,isCompact:t=!1}){const{query:{data:n}}=ig(e.id),r=n?.data,a="PLAID"===e.apiName,o=yE(e.apiName);if(!Je(r))return null;const i=e.iconUrl?Cg(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(kE,{children:[R(AE,{children:[R(zv,{children:[I(Td,{Component:i??gg}),R("div",{className:HE,children:[I(sc,{children:e.apiInstitutionName??o}),I(Eo,{children:Hb(r)})]})]}),R("div",{className:WE,children:[a&&(l=e,cr(l.apiErrorCode)||kh(l))&&I(OE,{plaidItem:e}),I(aE,{stylists:[zE],shouldUseButtonDiscreteStyles:t,children:I(xE,{integration:e,accounts:r})})]})]}),I("div",{className:_E,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(BE,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Wb(t),active:n,integration:e},t.id)})})]});var l}const qE=Cg("data:image/png;base64,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","Stripe"),KE=Cg("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAABGNJREFUeAHtnD1sEzEUx58vd72UpmUBJhYqZtQFIYG6ICiUsXxIwARDEUJiABZWQGIBBgZAlWBjKpQBUEVbIaEWWBFiRGJgLAP0K7nch/n7koaUJvWdk1zTnF0lufN7tt/7xXc5u/ZjJEm2be91AxoyiE6SwfYR5z0owiXF2lXMiLFlCvjXgOilZdCU4zjfNzKW1ROaZnaQDH6VMTYEnb56els8f4FzPkUBe+h5hdlavtQClLNs+y4RG0WBrlqFOjCviItizHWcm/Btqdq/NYBylNvp2O5zwDlarZSeYz5tO9b5JVqaX/W5GlCvZWcnIDiyKkzp54zrFEbg+6LwP7MKwbK77+H47Op5ij/7M6aVC3xvUjAIe5Bpdh9iGf4e52m558i+/yL32WHPy3/ErzdShq7hXcMJYYRvXWUm6EHZ7B6L0xdkd+pP+T+34x0tuIwGDMPnwxpOTXJ9go2Ba+x0TbHOJMGGmXZ2HnfqHZrHegIYT/0yymOr9VKdg4dr3mOCg+rA08ct/gX59C5g7DfqqX7obAe83OB8O36NjsPDUzCo8swXwzjOzC57GQPSbTEKCVUXOC67hcLTmOU2Rd3KZi8C0hM0bsUxAAPZldJzUJxSQpfTxFaBI8yFrc+EzeI4blIF9DZuQ5utH1DwRsUGJUC456yZElBpOPkymWWVNpUAoaF2uyFH8V3JZlVAUQzqCB0NSPI1akAakISARKx7kAYkISAR6x4kASQGq0mlbrMrex1PUAfRoNIzCcpx/H3yioX7OM4nYXhigADnBmN0q2GnGA2jLgZItxuuK0IFyV1ijAYj2BNNpZl1SVpMDhBh5qh5qZl1bWhVkoA2NKRdhRqQ5JvRgDQgCQGJWPcgDUhCQCLWPUgDkhCQiHUP0oAkBCRi3YM0IAkBiVj3oDYCpLK6op75zayrXhthfnI9iNPshpbEEXKai6PeiG5iM4qYAbyHmUDehCnXz+Up10b8jlw2MUCwKA/H7kS2rE0Uk7vE2sThuGZoQBJiGpAGJCEgEesepAFJCEjEuge1CJDq4nOJOS0VK9ms1IOwgj3XUldaUrkvtrPHTkqAMFw4EbulTS5gkKFksyqgESzvv7DJPkduPrSVITCCQlLdqyGa8rBWZxwvbGYJ/uBcdc2PgtmRimAzi9EHq47hdQYlYo87xV4NAWgFm1m6IzWZMiUAyhthLIuUOR7ZXcT5MBDo41vkAmlTBBsDUVDG0+Z3VH8FG70tvD6t0rZwKhR+YB50pr5eOiUhE7ApPQf59AAYECJGpzKBIlZUCialja5B4P1EQI9dOD9QVkj5B3vkufkxAaHy/yVEO5nLmOZ+5PWnnI4Ij3MJDMIrqnqosWg75jksZp9OLyARYEkwKMUOEhwqPUicFKm4Evj+q4yZQaATNvC/XOh0aEJv4Y8RomsUDEQMgEpaA6icWwSkSYOZH4jxXgxDdiPfrpTorAMR5O01grxd8VxH7KsPL6tqF6UDzLSHCfwLHN4iAPR6ZXwAAAAASUVORK5CYII=","Square"),YE=Cg("data:image/png;base64,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","Shopify"),ZE=Cg("data:image/png;base64,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","Gusto"),GE=Cg("data:image/png;base64,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","Freshbooks"),QE=Cg("data:image/png;base64,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","Uber"),XE=Cg("data:image/png;base64,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","Bank"),JE={GUSTO:ZE,FRESHBOOKS:GE,FRESHBOOKS2:GE,SHOPIFY:YE,STRIPE:qE,SQUARE:KE,UBER:QE};function $E(e){return JE[e]??XE}const eA=tr({display:"flex",flexDirection:"column",gap:"4px"});function tA({integration:e,isCompact:t}){const n=yE(e.apiName),r=function(e){if(e)return`Last synced ${Lt(e)}`}(e.lastSyncedDate),a=$E(e.apiName);return I(kE,{children:R(AE,{children:[R(zv,{children:[I(Td,{Component:a}),R("div",{className:eA,children:[I(sc,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(Eo,{intent:"normal",children:r})]})]}),I(aE,{shouldUseButtonDiscreteStyles:t,children:I(xE,{integration:e})})]})})}const nA=tr({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),rA=tr.raw({color:"typography.base.weak"}),aA=tr({overflow:"hidden"});function oA({manualBankAccounts:e,isCompact:t=!1}){const n=wT(),r=t||n?zc:Xs;return R(kE,{children:[R("div",{className:nA,children:[I(sc,{extraClassNames:[rA],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>rs("BankAccountForm"),active:!1,children:I(cl,{Component:Os})})]}),I("div",{className:aA,children:e.map(e=>I(BE,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const iA=gr(lr["selector-row"],rr(tr(_s,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),ol)),lA=tr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),sA=tr({display:"flex",alignItems:"center",gap:"8px"}),cA=tr({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),dA=gr(null,tr({width:"20px",height:"20px"}));function uA(){const{linkPlaid:e,loading:t}=cy();return I("button",{...iA,disabled:t,onClick:()=>{ya("Add New Connection button pressed"),e({plaidEvent:zb,message:"Add New Connection button pressed"})},children:R("div",{className:lA,children:[R("div",{className:sA,children:[I(Td,{stylists:[dA],Component:gg}),R("div",{className:cA,children:[I(sc,{children:"Connect your bank"}),I(Eo,{children:"Find your banking institution with Plaid"})]})]}),I(Sd,{Component:rl})]})})}const hA=tr({paddingInline:"16px",paddingBottom:"8px"}),pA=tr.raw({color:"typography.base.weak",fontWeight:"label"});function mA({title:e,children:t}){return R("div",{children:[I("div",{className:hA,children:I(sc,{extraClassNames:[pA],children:e})}),t]})}const gA=tr({minWidth:"100%",height:"45px"});function vA(){return R(N,{children:[I(Xo,{styles:gA}),I(Xo,{styles:gA}),I(Xo,{styles:gA})]})}const fA=gr(lr["selector-row"],rr(tr(_s,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),ol)),bA=tr({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),yA=tr({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),wA=tr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function CA({integration:e}){const{linkPlaid:t,loading:n}=sy(),r="PLAID"===e.apiName,a=yE(e.apiName),o=e.iconUrl?Cg(e.iconUrl,"Institution Icon"):gg;return I("button",{...fA,disabled:n||!r,onClick:()=>{ya(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:jb,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:bA,children:[R("div",{className:yA,children:[I(Td,{Component:o}),I(sc,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:wA,children:[I(cl,{Component:Du}),I(sc,{children:"Relink"})]})]})})}const xA=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:224,height:64,viewBox:"0 0 224 64",...e},r.createElement("g",{fill:"none",fillRule:"nonzero"},r.createElement("path",{fill:"#95BF47",d:"M48.024 12.24a.567.567 0 0 0-.536-.495c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69c-.357-.36-1.073-.27-1.341-.18-.045 0-.716.225-1.878.585-1.118-3.285-3.086-6.255-6.529-6.255h-.313C27.768.585 26.517 0 25.487 0c-8.048 0-11.894 10.125-13.1 15.255-3.13.99-5.367 1.665-5.635 1.755-1.744.54-1.789.585-2.012 2.25C4.56 20.52 0 56.07 0 56.07l35.549 6.705L54.82 58.59c0-.045-6.752-46.035-6.797-46.35zm-14.443-3.6c-.894.27-1.922.585-2.996.945V8.91c0-1.98-.268-3.6-.715-4.905 1.789.27 2.951 2.295 3.711 4.635zm-5.947-4.185c.492 1.26.805 3.015.805 5.445v.36c-1.967.63-4.07 1.26-6.215 1.935 1.207-4.635 3.487-6.885 5.41-7.74zm-2.37-2.295c.358 0 .716.135 1.029.36-2.594 1.215-5.321 4.275-6.484 10.44-1.7.54-3.354 1.035-4.919 1.53 1.342-4.68 4.606-12.33 10.374-12.33z"}),r.createElement("path",{fill:"#5E8E3E",d:"M47.488 11.7c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69a.716.716 0 0 0-.492-.225l-2.683 55.35 19.273-4.185s-6.752-46.035-6.797-46.35a.776.776 0 0 0-.581-.54z"}),r.createElement("path",{fill:"#FFF",d:"M29.02 22.41l-2.37 7.11S24.55 28.395 22 28.395c-3.756 0-3.935 2.385-3.935 2.97 0 3.24 8.407 4.5 8.407 12.105 0 5.985-3.757 9.855-8.854 9.855-6.126 0-9.211-3.825-9.211-3.825l1.654-5.445s3.22 2.79 5.902 2.79c1.789 0 2.504-1.395 2.504-2.43 0-4.23-6.886-4.41-6.886-11.385 0-5.85 4.159-11.52 12.61-11.52 3.22-.045 4.83.9 4.83.9z"}),r.createElement("path",{fill:"#000",d:"M77.835 35.263c-1.938-1.032-2.93-1.93-2.93-3.141 0-1.526 1.398-2.513 3.56-2.513 2.524 0 4.777 1.032 4.777 1.032L85 25.256S83.378 24 78.6 24c-6.669 0-11.31 3.814-11.31 9.154 0 3.051 2.163 5.34 5.047 7 2.343 1.301 3.154 2.243 3.154 3.634 0 1.436-1.171 2.603-3.334 2.603-3.2 0-6.264-1.66-6.264-1.66L64 50.115S66.794 52 71.526 52c6.85 0 11.807-3.365 11.807-9.423-.045-3.32-2.524-5.61-5.498-7.314zM103.897 24.304c-3.316 0-5.925 1.62-7.914 4.053l-.089-.045L98.768 13h-7.472L84 52h7.473l2.476-13.33c.972-5.044 3.537-8.152 5.925-8.152 1.68 0 2.343 1.171 2.343 2.838 0 1.035-.088 2.341-.31 3.377L99.078 52h7.473l2.919-15.762c.31-1.666.53-3.648.53-4.999.045-4.368-2.166-6.935-6.102-6.935zM127.92 24C118.943 24 113 32.23 113 41.4c0 5.859 3.565 10.6 10.255 10.6C132.058 52 138 43.994 138 34.6c.044-5.456-3.081-10.6-10.08-10.6zm-3.653 22.185c-2.552 0-3.609-2.191-3.609-4.965 0-4.338 2.201-11.405 6.25-11.405 2.641 0 3.521 2.326 3.521 4.562 0 4.652-2.244 11.808-6.162 11.808zM157.168 24c-5.102 0-8.01 4.489-8.01 4.489h-.09l.447-4.045h-6.713c-.313 2.712-.94 6.89-1.521 10L136 62h7.563l2.104-11.156h.179s1.566.978 4.43.978c8.906 0 14.724-9.066 14.724-18.222 0-5.067-2.282-9.6-7.832-9.6zm-7.25 22.133c-1.969 0-3.133-1.11-3.133-1.11L148.04 38c.895-4.711 3.356-7.822 5.996-7.822 2.328 0 3.044 2.133 3.044 4.133 0 4.889-2.91 11.822-7.16 11.822zM176.287 14A4.25 4.25 0 0 0 172 18.284c0 2.186 1.414 3.716 3.536 3.716h.088c2.343 0 4.332-1.574 4.376-4.284 0-2.186-1.459-3.716-3.713-3.716zM166 52h7.736L179 25h-7.782zM198.487 25.574h-5.453l.277-1.276c.462-2.642 2.034-4.965 4.668-4.965 1.387 0 2.496.41 2.496.41l1.525-6.06S200.66 13 197.748 13c-2.773 0-5.546.774-7.672 2.551-2.681 2.233-3.929 5.467-4.53 8.747l-.23 1.276h-3.652l-1.156 5.831h3.652L180 53h7.81l4.16-21.595h5.408l1.11-5.831z"}),r.createElement("path",{fill:"#000",d:"M216.005 25s-4.788 11.928-6.912 18.45h-.09c-.135-2.1-1.897-18.45-1.897-18.45h-8.04l4.607 24.615c.09.536.045.894-.18 1.251-.904 1.698-2.395 3.35-4.157 4.557-1.445 1.027-3.071 1.697-4.336 2.144L197.123 64c1.536-.313 4.788-1.608 7.498-4.11 3.479-3.216 6.731-8.22 10.029-15.01L224 25h-7.995z"}))),TA=gr(lr["selector-row"],rr(tr(_s,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ol)),kA=tr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),EA=tr({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),AA=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),SA=tr({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",outline:"none",backgroundColor:"surface.foreground",fontWeight:"label.strong",fontSize:{sm:"label.strong",base:"lg"},fontFamily:"label",color:"typography.label.strong",lineHeight:"template",padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),IA=tr({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function NA(){const e=kc(),{mutateAsync:t}=ty(),[n,r]=d("");return R("div",{className:EA,children:[I(To,{children:"Enter your shop name"}),I("div",{className:IA,children:I(xA,{})}),I(sc,{children:"Please enter the name of your shop below."}),I("input",{className:SA,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:AA,children:[I(wb,{showIcon:!1,onClick:()=>{e.close()}}),I(Xh,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(To,{children:"Connect"})})]})]})}function RA(){const e=$E("SHOPIFY")??Du;return R(Tc,{placement:"bottom",children:[I(Ec,{children:t=>R("button",{...TA,...t,children:[R("div",{className:kA,children:[I(Td,{Component:e}),I(sc,{children:"Shopify"})]}),I(Sd,{Component:rl})]})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(NA,{})})})})]})}const PA=gr(lr["selector-row"],rr(tr(_s,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),ol)),DA=tr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function MA({apiName:e}){const{mutateAsync:t}=ty(),n=yE(e),r=dn(e=>e.events.gusto);if("SHOPIFY"===e)return I(RA,{});const a=$E(e)??Du;return R("button",{...PA,onClick:async()=>{if("GUSTO"===e){let e=!1;if(cr(r)&&(r.listener({type:"GUSTO_NEW",result:"SUCCESS",data:null,error:null}),e=r.preventDefault??!1),e)return}const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:DA,children:[I(Td,{Component:a}),I(sc,{children:n})]}),I(Sd,{Component:rl})]})}const LA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function FA(e){return LA.includes(e)}const OA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],VA=tr({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),UA=tr({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function BA(){const{query:{data:e},isFilling:t}=Yw(),n=e?.multiAccountIntegrations,r=e?.integrations,a=cr(n)&&n.length>0||cr(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=i(Qc),n=dn(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(FA),a=e?.map(e=>e.apiName)||[];let o=r??OA;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:VA,children:[(t||a)&&I(mA,{title:"Already Connected",children:t?I(vA,{}):R(N,{children:[n?.map(e=>I(CA,{integration:e},e.id)),r?.map(e=>I(CA,{integration:e},e.id))]})}),I(mA,{title:"Available Banks",children:I(uA,{})}),o&&o.length>0&&I(mA,{title:"Integrations",children:I("div",{className:UA,children:o.map(e=>I(MA,{apiName:e},e))})})]})}const HA=tr({marginTop:"16px"}),WA=tr({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),zA=tr.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function _A({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(BA,{}):t?R(N,{children:[R("div",{className:HA,children:[I(sc,{extraClassNames:[zA],children:"Connected Accounts"}),r?.map(t=>I(jE,{integration:t,isCompact:e},t.id)),a?.map(t=>I(tA,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(oA,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(oA,{manualBankAccounts:o}):R("div",{className:WA,children:[I(Td,{Component:gg}),I(To,{wrap:"wrap",textAlign:"center",children:"If you prefer to manually input your transactions as opposed to having them automatically tracked, you can add your Manually Tracked Bank Account(s) here."})]})}const jA=gr(null,tr({color:"typography.base.weak"})),qA=gr(lr["drawer-header"],tr({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Vv)),KA=tr({display:"flex",gap:"8px"}),YA=tr({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),ZA=or({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),GA=tr({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),QA=tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),XA=gr(null,tr({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),JA=or({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function $A({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=wT()||e,{query:{data:a},isFilling:o}=Yw(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=bh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>Wh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:ag(e?.data)};var t}}),{mutate:c,isPending:d}=ry(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),m=p&&Kw(p,!1),g="connected"===dn(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&g,f=g?"Add New Connection":"Add New Account",b=()=>{rs(g?"NewConnection":"BankAccountForm")},y=r?zc:Xs;return R(Jb,{onPlaidLink:n,children:[R("div",{...qA,children:[R(zv,{children:[t&&I($u,{}),r?I(To,{children:"Banks & Integrations"}):I(kr,{stylists:[jA],children:"Banks & Integrations"})]}),R("div",{className:KA,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(Sd,{Component:Du,stylists:[gr(null,JA({refreshLoading:d}))]}),!r&&I(sc,{children:"Sync Accounts"})]}),R(y,{onClick:()=>b(),active:!1,children:[I(Sd,{Component:Os}),!r&&I(sc,{children:"Add New Connection"})]})]})]}),m&&I("div",{className:QA,children:I(Qk,{task:m})}),o?I(nE,{}):R(N,{children:[I("div",{className:ZA({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:YA,children:I(_A,{isCompact:r,showPlaidItems:g,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(g&&v)&&I("div",{className:GA,children:R(Xs,{stylists:[XA],onClick:()=>b(),children:[I(Sd,{Component:Os}),I(To,{children:f})]})})]})]})}const eS=tr({display:"flex",justifyContent:"center"}),tS=tr({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1150px",border:"{borderWidths.md} solid {colors.border.layout.weak}",borderRadius:"lg",backgroundColor:"surface.foreground",marginBottom:"42px",overflow:"hidden"});function nS({onPlaidLink:e}){return I(Kk,{children:I(Yk,{source:"BanksAndIntegrations",children:I("div",{className:eS,children:I("div",{className:tS,children:I($A,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})})}function rS(e){return $e({key:"customer",name:"Customer",possibleValues:e})}function aS(e,t){if(e?.id&&t.id){const n=t.id?.in?.filter(t=>!e.id?.in?.includes(t));return{...t,id:{in:[...e.id.in??[],...n??[]]}}}return e?.id&&!t.id?{...t,id:e.id}:t}const oS=tr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function iS({children:e}){return I("div",{className:oS,children:e})}function lS({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(Tc,{children:[I(Ec,{children:e=>R(pf,{popupTriggerChildrenProps:e,children:[R(iS,{children:[t&&I(Sd,{Component:Cg(t,"")}),I(sc,{wrap:"wrap",children:i})]}),I(Sd,{Component:rl})]})}),I(Kv,{title:r,Footer:o??null,children:a})]})}function sS(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ae(i??[],r),[i,r]);return o(()=>{if(!i)return{};const t=l.search(e);return function(e){const t={};for(const{parent:n,child:r}of e){const e=n.id;n.id===r.id?t[e]={parent:n,children:[]}:t[e]?t[e].children.push(r):t[e]={parent:n,children:[r]}}return t}(a(t,i))},[i,l,e,a])}function cS({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return I(N,{children:e.map((e,o)=>I(r,{groupIndex:o,children:e.map((e,n)=>I(a,{item:e},t(e,n)))},n(e,o)))})}const dS=tr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),uS=gr(lr["list-body"],tr({display:"block"}));function hS({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return R("div",{className:dS,children:[e&&I(sc,{intent:"weak",children:e}),n?I(rf,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):I("div",{...uS,children:t})]})}const pS=tr({display:"flex",flexDirection:"column",gap:"16px"});function mS({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I(mf,{handleClick:t,selected:n,isMultiSelect:r,children:R(iS,{children:[e.iconUrl&&I(Sd,{Component:Cg(e.iconUrl,"")}),I(sc,{wrap:"wrap",children:e.name??""})]})},e.id)}function gS({groupedResults:e,onItemClick:t,selectedIds:n,isMultiSelect:r}){const a=o(()=>Object.entries(e),[e]),i=o(()=>a.map(([,e])=>{const t=e.children;return t.length>0?t:[e.parent]}),[a]);return I(of,{children:I("div",{className:pS,children:I(cS,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>I(mS,{item:e,onItemClick:()=>t(e),selected:n.has(e.id),isMultiSelect:r}),GroupComponent:({children:e,groupIndex:t})=>{const n=a[t][1],r=n.children.length>0?n.parent.name:void 0;return I(hS,{label:r,children:e})}})})})}function vS({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=sS(e,{items:n,fuseOptions:Ex,processResults:Sx});return r?I(yf,{}):0===Object.keys(i).length?I(rf,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(gS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function fS(e,t){return qC(e,t).map(e=>({parent:e.parent,child:e.child}))}function bS({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=sS(e,{items:n,fuseOptions:_C,processResults:fS});return r?I(yf,{}):0===Object.keys(i).length?I(rf,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(gS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function yS(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...yS(n));return t}function wS(e,t){return e.value?.[t]?.value?.id?.in??[]}function CS(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&wS(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{wS(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function xS(e,t){const n=[];return e.forEach(e=>wS(e,t).forEach(e=>n.push(e))),new Set(n)}function TS(e,t,n,r){return u(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!wS(t,e).some(e=>n.includes(e)));return ZT(t,e,r)})},[t,r,e])}const kS=tr.raw({width:"100%",justifyContent:"center"}),ES=tr({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"16px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout}",marginTop:"auto",width:"100%"});function AS({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:ES,children:[R(kd,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[I(sc,{children:"Apply"}),I(cl,{Component:Qh})]}),I(Xs,{onClick:e,styles:kS,children:I(sc,{children:"Clear All"})})]})}function SS({onApply:e,onClearAll:t}){const n=kc();return I(AS,{onApply:()=>{e(),n.close()},onClearAll:t})}function IS({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>yS(e),[e]),m=u(()=>{i(p)},[p,i]),g=u(()=>{if(p&&l&&s){const e=YT(s,"category"),t=CS(l,e,p,"category");d(t)}},[p,l,s,d]),v=I(SS,{onApply:g,onClearAll:m});return I(lS,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:I($v,{placeholder:"Search expense categories...",onClick:a,SearchList:vS,DefaultList:NS,listLength:e.children?.length??0,extraProps:{categories:e.children??[],label:e.name??"",isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}})})}function NS({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(yf,{}):I(sf,{title:I(To,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=yS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(IS,{categories:e.children??[],label:e.name??"",category:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return I(mf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(iS,{children:[e.iconUrl&&I(Sd,{Component:Cg(e.iconUrl,e.name??"")}),I(sc,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const RS=[];function PS({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=wx(),s=i?.data??RS,c=xS(YT(t,"category"),"category"),d=u(e=>{const t=DS(e);n(t)},[n]),h=TS("category",r,0,a);return a&&o?I($v,{placeholder:"Search expense categories...",onClick:d,SearchList:vS,DefaultList:NS,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function DS(e){const t=e.name??"",n=(e=>e.id?e.id.toString():"")(e);return{name:t,value:{category:{name:t,value:{id:{in:[n]}}}}}}function MS(){const{query:{data:e},isFilling:t}=vx(),n=e?.data,r=o(()=>n?.map(DS),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function LS(e){return $e({key:"category",name:"Category",NestedListComponent:PS,possibleValues:e})}const FS=[{value:"in",label:"In"}];function OS(e){return $e({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:FS})}function VS(){const e=function(){const e=Ki();return(e?Vi:Ui).map(t=>ji(t,e))}(),t=o(()=>function(e){const t="in";return[...e].map(e=>({name:e.text,value:{reviewStatus:{name:e.text,value:{[t]:e.value}}}}))}(e),[e]);return u(()=>({values:t,isFilling:!1}),[t])}function US(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const BS=S.object({minAmount:S.number().nullable(),maxAmount:S.number().nullable()}).refine(e=>null===e.minAmount||null===e.maxAmount||e.minAmount<=e.maxAmount,{message:"Minimum amount must be less than or equal to maximum amount",path:["amounts"]});function HS(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:cr((a=t).greaterThanEqual)?sh(a.greaterThanEqual):null,maxAmount:cr(a.lessThanEqual)?sh(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const WS=tr({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function zS({children:e,title:t}){return I(Kv,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:WS,children:e})})}const _S=tr({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),jS=tr({display:"flex",flexDirection:"column",flex:1}),qS=tr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function KS({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(zS,{title:"Amount",children:I(YS,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function YS({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=kc();return vb({defaultValues:HS(0,r),validators:{onChange:BS},onSubmit:()=>{if(!r||!n)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:a,pendingFilters:n}),i=Te(o.store,e=>e.errorMap),l=i&&Object.values(i).some(e=>void 0!==e),s=()=>{if(!r)return;if(l)return void r([]);const t=function(e,t,n){const r=n.operators?.find(e=>"greaterThanEqual"===e.value),a=n.operators?.find(e=>"lessThanEqual"===e.value),o=[];if(null!==e&&r){const t=vo(e,{dollarSign:!0,signage:"default"}),a=ch(e),i=n.createFilter({name:`${t}${r.label}`,value:{[n.key]:{name:"",value:{[r.value]:a}}}});o.push(i)}if(null!==t&&a){const e=vo(t,{dollarSign:!0,signage:"default"}),r=ch(t),i=n.createFilter({name:`${a.label} ${e}`,value:{[n.key]:{name:"",value:{[a.value]:r}}}});o.push(i)}return o}(o.getFieldValue("minAmount"),o.getFieldValue("maxAmount"),e);r(t)};return R(N,{children:[I("div",{className:qS,children:R(of,{children:[R("div",{className:_S,children:[I("div",{className:jS,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(To,{children:"To"}),I("div",{className:jS,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I(dp,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(AS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const ZS=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"greaterThan",label:"Greater than"},{value:"greaterThanEqual",label:"+"},{value:"lessThan",label:"Less than"},{value:"lessThanEqual",label:"Up to"}];function GS(){return $e({key:"amount",name:"Amount",operators:ZS,ModalComponent:KS})}function QS(){const{query:{data:e},isFilling:t}=bh(),n=e?.data,r=function({institutionIds:e}){const t=Pr(),n=Or(),r=[...new Set(e)],a=V({queries:r.map(e=>({queryKey:bg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await zu({institutionId:e,accessToken:t,environment:n})}),staleTime:864e5}))}),o={};return a.forEach(e=>{e.data&&(o[e.data.institutionId]=e.data?.data?.map?.logo)}),o}({institutionIds:o(()=>n?.map(e=>e.integration?.apiInstitutionId).filter(e=>cr(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=uh(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return u(()=>({values:a??[],isFilling:t}),[a,t])}function XS(e){return $e({key:"bankAccount",name:"Bank Account",possibleValues:e})}const JS=e=>e.value.bankAccount?.value.id?.in?e.value.bankAccount?.value.id?.in:e.value.bankAccount?.value.id?.notIn?e.value.bankAccount?.value.id?.notIn:[],$S=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:xi(t[1].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function eI(e){return Vr({queryKey:["dimensionValues"],queryFn:$S,...e})}function tI(){const{query:{data:e},isFilling:t}=wv({filter:{status:{in:["ACTIVE"]}}}),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Customer";return{name:t,value:{customer:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function nI(e){return $e({key:"vendor",name:"Vendor",possibleValues:e})}function rI(e){const t=e.map(({name:e,types:t})=>function(e,t){const n="in";return{name:t,value:{type:{name:t,value:{[n]:e.map(e=>e.value)}}}}}(t,e));return $e({key:"type",name:"Type",possibleValues:()=>({values:t})})}const aI=vi(e=>r.createElement("svg",{stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",...e},r.createElement("path",{d:"M8 15.3859C12.0792 15.3859 15.3861 12.079 15.3861 7.99982C15.3861 3.92062 12.0792 0.61377 8 0.61377C3.9208 0.61377 0.613953 3.92062 0.613953 7.99982C0.613953 12.079 3.9208 15.3859 8 15.3859Z",strokeMiterlimit:10}),r.createElement("circle",{fill:"currentColor",cx:8,cy:8,r:3.2})),"CircleFilled"),oI=gr(null,tr({fill:"surface.intent.action.active"}));function iI({isSelected:e}){return I(Sd,e?{Component:aI,stylists:[oI]}:{Component:cf})}function lI({filters:e,model:t,setFilters:n}){if(!t||!n)return null;const r=t.possibleValues?.();if(!r)return null;const a=t.selectedValues(e);return I(sf,{title:I(Eo,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?uI(l.value.status?.value):a.some(e=>C(e.value,l.value)));var l;return R(pf,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[I(iS,{children:I(sc,{wrap:"wrap",children:r.name})}),I(iI,{isSelected:i})]},`${r.name}_${o}`)})})}const sI="status",cI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function dI(){const e="in";return{values:cI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function uI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function hI(e){return uI(e.value.status?.value)}function pI(){return $e({key:sI,name:"Status",possibleValues:dI,singleSelect:!0,SimpleListComponent:lI})}const mI=(gI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(gI));var gI;function vI({onApply:e,onClearAll:t}){const n=kc();return I(AS,{onApply:()=>{e(),n.close()},onClearAll:t})}function fI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>yS(e),[e]),m=u(()=>{i(p)},[p,i]),g=u(()=>{if(p&&l&&s){const e=YT(s,"glAccount"),t=CS(l,e,p,"glAccount");d(t)}},[p,l,s,d]),v=I(vI,{onApply:g,onClearAll:m});return I(lS,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:I($v,{placeholder:"Search GL accounts...",onClick:a,SearchList:bS,DefaultList:bI,listLength:e.children?.length??0,extraProps:{glAccounts:e.children??[],label:e.name,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}})})}function bI({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(yf,{}):I(sf,{title:I(To,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=yS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(fI,{glAccounts:e.children??[],label:e.name,glAccount:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return I(mf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(iS,{children:I(sc,{wrap:"wrap",children:e.name})})},e.id)})})}const yI=[];function wI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=kC(),s=i??yI,c=xS(YT(t,"glAccount"),"glAccount"),d=u(e=>{const t=CI(e);n(t)},[n]),h=TS("glAccount",r,0,a);return a&&o?I($v,{placeholder:"Search GL accounts...",onClick:d,SearchList:bS,DefaultList:bI,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function CI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function xI(e){return $e({key:"glAccount",name:"GL Account",NestedListComponent:wI,possibleValues:e})}function TI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(pt(e)){const t=yt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(gt(e)){const t={};return t.greaterThanEqual=e.beginDate,t.lessThanEqual=e.endDate,t}}(r.date.value)),r.amount&&(n.amount=(a=e.amount,o=r.amount.value,a?{...a,...o}:o)),r.description&&(n.description=r.description.value),r.category&&(n.category=(i=e.category,l=r.category.value,aS(i,l))),r.reviewStatus&&(n.reviewStatus=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.reviewStatus,r.reviewStatus.value)),r.bankAccount&&(n.bankAccount=function(e,t){return aS(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return aS(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return aS(e,t)}(e.glAccount,r.glAccount.value)),r.type&&(n.type=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.type,r.type.value)),r.search&&(n.search=r.search.value),r.status&&(n.status=function(e,t){return e?{...e,...t}:t}(e.status,r.status.value)),r.vendor&&(n.vendor=function(e,t){return aS(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return aS(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function kI(e,t){const n=e.reduce(TI,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return mI.forEach(e=>{const n=t[e];t[e]=k(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const EI=e=>{const t=dn(e=>e.transactionsDashboardFilters),n=dn(e=>e.expenseDashboardFilters),r=dn(e=>e.incomeDashboardFilters),a=dn(e=>e.setTransactionsDashboardFilters),o=dn(e=>e.addTransactionsDashboardFilters),i=dn(e=>e.removeTransactionsDashboardFilter),l=dn(e=>e.hasInitializedTransactionsDashboardFilters),s=dn(e=>e.setExpenseDashboardFilters),c=dn(e=>e.addExpenseDashboardFilters),d=dn(e=>e.removeExpenseDashboardFilter),u=dn(e=>e.hasInitializedExpenseDashboardFilters),h=dn(e=>e.setIncomeDashboardFilters),p=dn(e=>e.addIncomeDashboardFilters),m=dn(e=>e.removeIncomeDashboardFilter),g=dn(e=>e.hasInitializedIncomeDashboardFilters);switch(e){case"transactionsDashboard":return{filters:t,setFilters:a,addFilters:o,removeFilter:i,hasUserConfiguredFilters:l};case"expenseDashboard":return{filters:n,setFilters:s,addFilters:c,removeFilter:d,hasUserConfiguredFilters:u};case"incomeDashboard":return{filters:r,setFilters:h,addFilters:p,removeFilter:m,hasUserConfiguredFilters:g}}};function AI(){return{getCategories:MS(),getBankAccounts:QS(),getCustomers:tI(),getVendors:function(){const{query:{data:e},isFilling:t}=qg(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Vendor";return{name:t,value:{vendor:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return u(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=eI(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Dimension Value";return{name:t,value:{dimensionValues:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=vC(),n=o(()=>e?.map(e=>CI(e)),[e]);return u(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:VS()}}function SI(e,t,n){return n?function(e,t){let n;return e.forEach(e=>{const r=e.value[t]?.value?.contain;r&&(n=r)}),n||""}(n,e):""}const II=tr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function NI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(zS,{title:"Back",children:I(RI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function RI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=kc();return vb({defaultValues:{[e.key]:SI(e.key,0,r)},onSubmit:()=>{if(!n||!r)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:n,pendingFilters:a});return R(N,{children:[I("div",{className:II,children:I(of,{children:I(o.AppField,{name:e.key,listeners:{onBlur:()=>{const t=function(e,t){const n=e.trim();if(!n)return null;const r=t.operators?.find(e=>"contain"===e.value);return r?t.createFilter({name:`${r.label} "${n}"`,value:{[t.key]:{name:"",value:{[r.value]:n}}}}):null}(o.getFieldValue(e.key),e);r(t?[t]:[])}},children:t=>I(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),I(AS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const PI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function DI(){return $e({key:"description",name:"Description",operators:PI,ModalComponent:NI})}const MI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function LI(){return $e({key:"notes",name:"Notes",operators:MI,ModalComponent:NI})}const FI=[{name:"Expense",types:vw.Expense},{name:"Income",types:vw.Income},{name:"Transfer",types:vw.Transfer}];function OI(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=EI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=AI(),p=o(()=>({reviewStatus:OS(h),amount:GS(),bankAccount:XS(l),category:LS(i),customer:rS(c),date:Ht,description:DI(),glAccount:xI(d),notes:LI(),status:pI(),vendor:nI(s),type:rI(FI),search:tt}),[l,i,s,c,d,h]),m=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),g=/* @__PURE__ */(new Date).getDate(),v=o(()=>kI(e,void 0),[e,g]),f=u(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:m,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}function VI(e,t,n,r,a){const o=dn(e=>e.initializeTransactionsDashboardFilters),i=dn(e=>e.initializeExpenseDashboardFilters),l=dn(e=>e.initializeIncomeDashboardFilters),c=dn(e=>e.hasInitializedTransactionsDashboardFilters),d=dn(e=>e.hasInitializedExpenseDashboardFilters),u=dn(e=>e.hasInitializedIncomeDashboardFilters),h=Yi(),p="transactionsDashboard"===e?c:"expenseDashboard"===e?d:u;s(()=>{const s=h?.value??[];!p&&!r&&t&&a&&("transactionsDashboard"===e?o({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):"expenseDashboard"===e?i({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):l({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}))},[p,r,t,a,e,n,h,o,i,l])}const UI=l(void 0);function BI(){const e=i(UI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function HI({filters:e,removeFilter:t}){return function(e){const t=[];let n=null,r=null,a=null,o=null,i=null;for(let s=0;s<e.length;s++){const l=e[s];if(l.modelKey!==et&&l.modelKey!==Ut&&(l.modelKey!==sI||!hI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(sr(n)&&cr(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(sr(r)&&cr(e?.lessThanEqual)){r=s,o=e.lessThanEqual;continue}}t.push({key:l.id,text:l.name,indicesToRemove:[s]})}}const l=function(e,t,n,r,a){if(null!==e&&null!==t&&null!==n&&null!==r){const o=vo(sh(n),{dollarSign:!0,signage:"default"}),i=vo(sh(r),{dollarSign:!0,signage:"default"});return{key:`${a[e].id}-${a[t].id}`,text:`${o} - ${i}`,indicesToRemove:[e,t].sort((e,t)=>t-e)}}return null!==e?{key:a[e].id,text:a[e].name,indicesToRemove:[e]}:null!==t?{key:a[t].id,text:a[t].name,indicesToRemove:[t]}:null}(n,r,a,o,e);return l&&t.splice(i??t.length,0,l),t}(e).map(e=>I(hb,{text:e.text,additionalValidClassName:lr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const WI=vi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_24404_41655)"},r.createElement("path",{d:"M1 1V3.366L6.317 9.866V14L8.683 12.817V9.866L14 3.366V1H1Z",strokeWidth:1,strokeMiterlimit:10}))),"Filter"),zI=tr({width:"17px",height:"17px",borderRadius:"sm"});function _I({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:zI}),I("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["medium-icon"],lr.icon),...n??[]],size:17})}const jI=tr({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),qI={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function KI(){const e=wT(),{dashboardKey:t}=BI();return I(Xs,{onClick:()=>{rs(qI[t],{routeProps:{}})},stylists:[gr(null,jI)],children:e?I(_I,{Component:WI}):R(N,{children:[I(cl,{Component:WI}),I(sc,{children:"Filters"})]})})}const YI=S.object({beginDate:S.string().nullable(),endDate:S.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Nt(e.beginDate),n=Nt(e.endDate);if(t&&n)return!Et(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),ZI=tr({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),GI=tr({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),QI=gr(null,tr({marginTop:"22px"}));function XI({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,vb({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:YI},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=Te(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return R("div",{className:ZI,children:[R("div",{className:GI,children:[I(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),I(Td,{Component:mT,stylists:[QI]}),I(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&I(dp,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const JI={width:"fit-content"};function $I({onDateRangeChange:e}){const{filters:t}=BI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Ut);if(void 0!==t){const e=t.value.date?.value;if(gt(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(QC,{triggerChildren:I($C,{displayLabel:"Custom"}),popupChildren:I(Fc,{style:JI,children:I(XI,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const eN=tr({width:200,minWidth:200});function tN({dateFilter:e,addFilter:t}){return I(Wm,{onClick:()=>t(e),children:I(To,{children:ht[e]})})}function nN({getModel:e,addFilters:t}){const{setOpen:n}=kc(),r=r=>{const a=e(Ut);if(void 0===a)return;const o=a.createFilter({name:ht[r],value:{[a.key]:{name:ht[r],value:r}}});t([o]),n(!1)};return I(Fc,{children:R(Lm,{style:eN,children:[I(tN,{dateFilter:ut.ALL_TIME,addFilter:r}),I(ip,{alignment:"horizontal"}),I(tN,{dateFilter:ut.THIS_MONTH,addFilter:r}),I(tN,{dateFilter:ut.LAST_MONTH,addFilter:r}),I(tN,{dateFilter:ut.LAST_3_MONTHS,addFilter:r}),I(tN,{dateFilter:ut.LAST_12_MONTHS,addFilter:r}),I(ip,{alignment:"horizontal"}),I(tN,{dateFilter:ut.THIS_QUARTER,addFilter:r}),I(tN,{dateFilter:ut.LAST_QUARTER,addFilter:r}),I(ip,{alignment:"horizontal"}),I(tN,{dateFilter:ut.THIS_YEAR,addFilter:r}),I(tN,{dateFilter:ut.LAST_YEAR,addFilter:r}),I(ip,{alignment:"horizontal"}),I($I,{onDateRangeChange:n=>{const r=e(Ut);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const rN=[gr(null,jI)];function aN({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Ut);let n=ht[ut.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=pt(e)?ht[e]:gt(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Nt(e.beginDate):null,n=e.endDate?Nt(e.endDate):null;return t&&!n?`After ${Ft(t)}`:!t&&n?`Before ${Ft(n)}`:t&&n?`${At(t)} - ${At(n)}`:"Custom"}(e):t.name}return n})(e);return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Xs,{stylists:rN,popupTriggerProps:e,children:I(sc,{children:r})})}),I(nN,{getModel:t,addFilters:n})]})}const oN=tr({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),iN=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function lN({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=kc();return I(Wm,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:R("div",{className:oN,children:[R("span",{className:iN,children:[n&&I(Sd,{Component:n}),I(To,{children:e})]}),o&&I(Sd,{Component:rl})]})})}const sN=[{label:fw[mw.EXPENSE],type:mw.EXPENSE},{label:fw[mw.REVENUE],type:mw.REVENUE},{label:fw.BANK_TRANSFER,type:"TRANSFER_IN"},{label:fw.BANK_TRANSFER,type:"TRANSFER_OUT"}],cN=gr(null,jI);function dN({manualTransactionOptions:e}){const t=sN.filter(t=>e.includes(t.type)),n=wT();return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Xs,{stylists:[cN],popupTriggerProps:e,children:n?I(_I,{Component:Os}):R(N,{children:[I(cl,{Component:Os}),I(sc,{children:"Add Transaction"})]})})}),I(Fc,{children:I(Lm,{children:t.map(({label:e,type:t})=>I(lN,{closeOnClick:!0,onClick:()=>us(null,{initialType:t}),children:e},t))})})]})}const uN=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.2016 7.5C13.2023 7.15497 13.1694 6.81068 13.1034 6.47202L14.4718 5.68631L12.5926 2.4125L11.2307 3.19821C10.7043 2.75208 10.1007 2.40592 9.44979 2.17679V0.625H5.70455V2.20298C5.05363 2.43211 4.45006 2.77827 3.9236 3.2244L2.56169 2.43869L0.682526 5.7125L2.05098 6.49821C1.92 7.17727 1.92 7.87511 2.05098 8.55417L0.682526 9.33988L2.56169 12.6137L3.9236 11.828C4.45006 12.2741 5.05363 12.6203 5.70455 12.8494V14.375H9.44979V12.797C10.1007 12.5679 10.7043 12.2217 11.2307 11.7756L12.5926 12.5613L14.4718 9.2875L13.1034 8.50179C13.1677 8.17171 13.2006 7.83628 13.2016 7.5Z"}),r.createElement("path",{d:"M7.57716 10.0012C8.95853 10.0012 10.0784 8.88134 10.0784 7.49997C10.0784 6.1186 8.95853 4.99878 7.57716 4.99878C6.19579 4.99878 5.07597 6.1186 5.07597 7.49997C5.07597 8.88134 6.19579 10.0012 7.57716 10.0012Z"})),"Gear"),hN=tr.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function pN(){return I(Xs,{styles:hN,onClick:()=>rs("TransactionSettingsDrawer"),children:I(Sd,{Component:uN})})}const mN=tr.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function gN({children:e,styles:t}){return I("div",{className:tr(mN,t),children:e})}const vN=gr(lr["dashboard-header"],tr({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),fN=gr(null,tr({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),bN=tr.raw({paddingLeft:"15px",paddingRight:"15px"}),yN=tr({display:"none",xl:{display:"flex"}});function wN({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=BI(),l=wT(),s=o(()=>sr(n)?"":n.find(e=>e.modelKey===et)?.value.search?.value??"",[n]);return R("div",{...vN,children:[R("div",{...fN,children:[I(UT,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(et);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:qT(l)}),I(KI,{}),I(dN,{manualTransactionOptions:t}),!l&&I(aN,{filters:n,getModel:a,addFilters:i}),I(pN,{}),I("div",{className:yN,children:I(ml,{})})]}),n.length>0&&I(gN,{styles:bN,children:I(HI,{filters:n,removeFilter:r})})]})}const CN=pn.filter(e=>e!==hn.COMMENTS&&e!==hn.DIMENSION_VALUE),xN=gr(null,tr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function TN(){return I("div",{...xN,children:I(ml,{})})}const kN=tr.raw({gap:"6px"});function EN({Icon:e,label:t,children:n,onClick:r}){return n?R(Tc,{placement:"bottom-start",children:[I(Ec,{children:n=>R(zc,{popupTriggerProps:n,extraClassNames:[kN],children:[e&&I(cl,{Component:e}),I(sc,{children:t})]})}),n]}):R(zc,{onClick:r,extraClassNames:[kN],children:[e&&I(cl,{Component:e}),I(sc,{children:t})]})}const AN=vi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M10.6196 14.2124H4.3803C4.06894 14.2128 3.7693 14.0937 3.54327 13.8795C3.31724 13.6654 3.18207 13.3726 3.16568 13.0617L2.61591 3.22968H12.384L11.8342 13.0617C11.8179 13.3726 11.6827 13.6654 11.4567 13.8795C11.2306 14.0937 10.931 14.2128 10.6196 14.2124Z",strokeMiterlimit:10}),r.createElement("path",{d:"M1.3949 3.22968H13.605",strokeMiterlimit:10}),r.createElement("path",{d:"M6.27894 0.787598H8.72097C9.0448 0.787598 9.35537 0.91624 9.58435 1.14522C9.81334 1.37421 9.94198 1.68478 9.94198 2.00861V3.22963H5.05792V2.00861C5.05792 1.68478 5.18656 1.37421 5.41555 1.14522C5.64453 0.91624 5.9551 0.787598 6.27894 0.787598Z",strokeMiterlimit:10}),r.createElement("path",{d:"M9.09821 5.05792V12.384",strokeMiterlimit:10}),r.createElement("path",{d:"M5.90167 5.05792V12.384",strokeMiterlimit:10})),"Delete"),SN=gr(null,tr({whiteSpace:"normal"}));function IN({transactions:e,id:t,label:n,resetSelected:r}){const{mutateAsync:a}=cC({mutationFn:aC,meta:{toastOptions:{defaultErrorMessage:"Couldn't update review statuses"}}}),o=kc();return Zi(t)?I(Wm,{onClick:()=>(async t=>{if(o.close(),e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));await a(r)}var n;r&&r()})(t),children:I(Eg,{stylists:[SN],children:n})}):null}const NN={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},RN=e=>e.map(e=>({id:e.id,status:NN.INACTIVE})),PN=vi(e=>r.createElement("svg",{stroke:"currentColor",width:"16px",height:"16px",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.84644 15.0764C11.6751 15.0764 14.7788 11.9727 14.7788 8.14405C14.7788 4.3154 11.6751 1.21167 7.84644 1.21167C4.0178 1.21167 0.914062 4.3154 0.914062 8.14405C0.914062 11.9727 4.0178 15.0764 7.84644 15.0764Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.79217 9.6784V8.95116C7.79192 8.79114 7.82335 8.63265 7.88467 8.48484C7.94598 8.33703 8.03596 8.20282 8.14941 8.08996L8.65337 7.586C8.88132 7.35726 9.00972 7.04774 9.01061 6.7248V6.61636C9.00892 6.29431 8.8798 5.98603 8.65149 5.75891C8.42317 5.53179 8.11422 5.40429 7.79217 5.4043C7.47012 5.40429 7.16117 5.53179 6.93285 5.75891C6.70453 5.98603 6.57542 6.29431 6.57373 6.61636",strokeMiterlimit:10}),r.createElement("path",{d:"M7.18604 10.8838H8.39809",strokeMiterlimit:10})),"Uncategorized"),DN=[{id:"delete",label:"Delete",Icon:AN,component:function({transactions:e,resetSelected:t,...n}){const{mutateAsync:r}=cC({mutationFn:aC,meta:{toastOptions:{defaultSuccessMessage:(e,t)=>1===t.length?"Transaction deleted":`${t.length} transactions deleted`,defaultErrorMessage:e=>1===e.length?"Couldn't delete transaction":"Couldn't delete transactions",defaultPartialMessage:"Some transactions couldn't be deleted"}}}),a=async()=>{const n=RN(e);await r(n),t&&t()};return I(EN,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ih({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Delete",type:oh.DANGER}]}).then(e=>{e===ju&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:PN,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=uC(),o=e.length;return o>0&&I(EN,{label:`${t} ${lh("Expense","Expenses",o,!0)}`,...r,children:I(Mx,{onClick:async function(t){var r,o;t?.id&&(await a((r=e,o=t.id.toString(),r.map(e=>({id:e.id,categoryId:o})))),n&&n())}})})}},{id:"recategorize-revenues",label:"Recategorize",Icon:PN,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=uC(),o=e.length;return I(EN,{label:`${t} ${lh("Revenue","Revenues",o,!0)}`,...r,children:I(rx,{onClick:async function(t){var r,o;await a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:EC,placeholder:"Search revenue accounts..."})})}}];function MN({subActionList:e}){return I(Lm,{children:e})}function LN({subActions:e,transactions:t,label:n,Icon:r,resetSelected:a}){const i=o(()=>e.map(e=>{const{component:n,id:r,filter:o,label:i}=e,l=t.filter(e=>!o||o(e));return l.length>0?I(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return I(EN,{label:n,Icon:r,children:I(Fc,{children:i.length>0?I(MN,{subActionList:i}):I(Wm,{children:I(sc,{children:"No Actions Available for Selection"})},"no-actions")})})}const FN=gr(lr["bulk-select"],tr({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function ON({table:e}){const t=e.getSelectedRowModel(),n=t.rows.some(e=>"EXPENSE"===e.original.type),r=t.rows.some(e=>"REVENUE"===e.original.type),a=o(()=>t.rows.map(e=>e.original),[t]),i=t.rows.length,l=(()=>{const e=_i();return o(()=>[...DN,{id:"review",label:"Change Review Status",Icon:wi,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:IN}))}],[e])})(),s=()=>e.resetRowSelection(!0);return R("div",{...FN,children:[I(gT,{table:e}),I(To,{children:`${i} selected`}),l.map(e=>{if("recategorize-expenses"===e.id&&!n)return null;if("recategorize-revenues"===e.id&&!r)return null;const{component:t,subActions:o,id:i,filter:l,...c}=e,d=a.filter(e=>!l||l(e));return o?I(LN,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&I(t,{transactions:d,resetSelected:s,...c},i)})]})}function VN({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r,zeroStateEventName:o}){const i=wT(),l=function({transactions:e,columns:t}){const n=wT(),r=xT({transactions:e,columns:t?[hn.SELECT,...t,hn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!sr(t.getColumn(un.SELECT)),o=a(r?e:null);if(r){if(o.current!==e&&void 0!==o.current){const e=t.getSelectedRowModel().rows.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{});t.setRowSelection(e)}o.current=e}}(e,r,!n),r}({transactions:e,columns:t}),{setFilters:s}=BI(),c=l.getIsAllRowsSelected(),d=l.getIsSomeRowsSelected(),u=c||d;let h;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?h=I(XT,{buttonText:"Clear Filters",onButtonClick:()=>s([])}):r&&0===e?.length&&(h=I(RT,{})):h=I(IT,{eventSource:o});const p=u&&sr(h)&&!i;return R(nc,{dashboard:"transactionDashboard",children:[p?I(ON,{table:l}):I(Hl,{headerGroups:l.getHeaderGroups()}),sr(h)?I(jT,{table:l}):I(Cd,{children:h})]})}const UN={transform(e){const{align:t,justify:n,direction:r,gap:a,...o}=e;return{display:"flex",flexDirection:r,alignItems:t,justifyContent:n,gap:a,...o}},defaultValues:{direction:"column",gap:"8px"}},BN=(e={})=>{const t=Kn(UN,e);return UN.transform(t,qn)},HN=e=>tr(BN(e));HN.raw=BN;const WN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},zN=(e={})=>{const t=Kn(WN,e);return WN.transform(t,qn)},_N=e=>tr(zN(e));_N.raw=zN;const jN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},qN=(e={})=>{const t=Kn(jN,e);return jN.transform(t,qn)},KN=e=>tr(qN(e));KN.raw=qN;const YN={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},ZN=(e={})=>{const t=Kn(YN,e);return YN.transform(t,qn)},GN=e=>tr(ZN(e));GN.raw=ZN;const QN=tr({display:"flex",padding:"16px 12px",borderWidth:"md",borderStyle:"solid",borderRadius:"lg",borderColor:"border.layout",backgroundColor:"surface.foreground"}),XN=gr(lr.card,QN,tr({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function JN({children:e}){return I("div",{...XN,children:e})}const $N=gr(lr["card-header"],tr({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function eR({children:e}){return I("div",{...$N,children:e})}const tR=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function nR({children:e}){return I("div",{className:tR,children:e})}const rR=or({base:{display:"flex",height:"48px",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",borderRadius:"sm",cursor:"pointer",background:"surface.background",gap:"8px",alignSelf:"stretch",userSelect:"none"},variants:{filterStatus:{inactive:{padding:"8px"},active:{paddingTop:"8px",paddingBottom:"8px",paddingRight:"8px",paddingLeft:"4px",borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:"brand.action.strong",background:"surface.background.hover"},zeroState:{color:"typography.base.weak",cursor:"default",padding:"8px"}}},defaultVariants:{filterStatus:"inactive"}});function aR({filterApiNames:e,filterModelKey:t,extractFilterValue:n,filterStatus:r,buttonClassName:a,isZeroState:o,filterEffectiveValueExtractor:i,children:l}){const{addFilters:s,filters:c,getModel:d,removeFilter:u}=BI();if(!d(t))return null;const h="active"===r,p=gr(lr["card-button"],rR({filterStatus:r}),a);return I("div",o?{...p,children:l}:{...p,onClick:h?()=>{return t=u,void function(e,t,n){const r=[];return e.forEach((e,a)=>{n(e).some(e=>t.includes(e))&&r.push(a)}),r.reverse()}(c,e,i).forEach(e=>{t(e)});var t}:()=>((e,t,n,r,a)=>{const o=e(t);if(!o||!o.possibleValues)return;const i=[];o.possibleValues().values.forEach(e=>{const t=n(e.value);if(t&&t.some(e=>r.includes(e))){const t=o.createFilter(e);i.push(t)}}),a(i)})(d,t,n,e,s),children:l})}const oR=or({base:{display:"flex",padding:"10px",justifyContent:"center",alignItems:"center",gap:"8px",borderRadius:"sm",borderWidth:"1px",borderStyle:"solid"},variants:{intent:{danger:{borderColor:"border.intent.danger",background:"surface.intent.danger"},warning:{borderColor:"border.intent.warning",background:"surface.intent.warning"},success:{borderColor:"border.intent.success",background:"surface.intent.success"},neutral:{borderColor:"border.intent.secondary",background:"surface.intent.secondary"}}},defaultVariants:{intent:"neutral"}}),iR=tr({minWidth:"200px"}),lR=tr({marginLeft:"auto"});function sR({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=BI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Vr({queryKey:tC({groupBy:e,filter:t}),queryFn:nC})}({groupBy:"REVIEW_STATUS",filter:e});return{data:t?.data??void 0,isFilling:n,isRehydrating:r}}(r);let o=e.value.some(e=>{return t=n,!(!(r=e)||!Zi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,gr(lr["card-button-icon-container"],oR({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Zi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return R(aR,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:iR,isZeroState:t,filterEffectiveValueExtractor:US,children:[I("div",{...l,children:I(Sd,{Component:e.Icon})}),!t&&i&&R(N,{children:[I(To,{children:e.text}),I("div",{className:lR,children:I(Iu,{children:s})})]}),!t&&!i&&R(N,{children:[I(sc,{children:e.text}),I("div",{className:tr({marginLeft:"auto"}),children:I(Iu,{children:s})})]}),t&&R(N,{children:[I(sc,{intent:"weak",children:e.text}),I("div",{className:tr({marginLeft:"auto"}),children:I(Iu,{children:s})})]})]},e.text)}function cR({isZeroState:e}){const t=function(){const e=Ki();return(e?Bi:Hi).map(t=>ji(t,e))}();return R(JN,{children:[I(eR,{children:I(sc,{intent:"weak",children:"Review Status"})}),I(nR,{children:t.map(t=>I(sR,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const dR=tr({width:"20px",height:"20px",borderRadius:"sm"});function uR({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:dR}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["medium-icon"],lr.icon),...n??[]],size:20})}const hR=tr({minWidth:"269px"}),pR=tr({marginLeft:"auto"});function mR({account:e,isZeroState:t}){const{apiFilters:n}=BI(),r=(i=n,l=e.id,i.bankAccount?.id?.in?.includes(l)?"active":"inactive"),a="active"===r,o=e.name??"";var i,l;const s=Ir(e.mask)?void 0:dh(e.mask),c=vo(null!=(d=e.accountBalance)?sh(d):0,{dollarSign:!0});var d;return R(aR,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:hR,isZeroState:t,filterEffectiveValueExtractor:JS,children:[e.iconUrl&&I(uR,{imageUrl:e.iconUrl,Component:gg}),!t&&a&&R(N,{children:[I(To,{children:o}),s&&I(sc,{wrap:"wrap",children:s}),I("div",{className:pR,children:I(Iu,{children:c})})]}),!t&&!a&&R(N,{children:[I(sc,{children:o}),s&&I(sc,{wrap:"wrap",children:s}),I("div",{className:pR,children:I(Iu,{children:c})})]}),t&&R(N,{children:[I(sc,{intent:"weak",children:o}),s&&I(sc,{intent:"weak",wrap:"wrap",children:s}),I("div",{className:pR,children:I(Iu,{children:c})})]})]},e.id)}const gR=[{name:"Expenses Card",mask:"0000",accountBalance:1e6},{name:"Travel Card",mask:"0001",accountBalance:5e5},{name:"Primary Checking",mask:"0002",accountBalance:15e5},{name:"Emergency Savings",mask:"0003",accountBalance:15e5}];function vR({isZeroState:e}){const{query:{data:t}}=bh({params:{filter:{apiName:{in:[...eg]}}}}),n=(r=t?.data??[],e?gR:r.filter(e=>"ACTIVE"===e.status).sort((e,t)=>{const n=e.latestTransactionDate??"",r=t.latestTransactionDate??"";if(n!==r)return r.localeCompare(n);const a=e.accountBalance??0;return(t.accountBalance??0)-a}).slice(0,4));var r;return R(JN,{children:[I(eR,{children:I(sc,{intent:"weak",children:"Account Balances"})}),I(nR,{children:n.map((t,n)=>I(mR,{account:t,isZeroState:e},n))})]})}const fR=tr({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),bR=tr({display:{"@page/xl":"flex",base:"none"}}),yR=tr({display:{"@page/xl":"none",base:"flex"}}),wR=tr({maxWidth:"100%",display:{"@page/md":"grid",base:"none"},gridTemplateColumns:{"@page/xl":"1fr 2fr 4fr","@page/md":"1fr 1fr"},gridTemplateRows:{"@page/xl":"1fr"},height:"auto",gap:"16px",alignSelf:"stretch",borderRadius:"borderWidths.sm"});function CR({showZeroStates:e,Chart:t}){return R("div",{className:wR,children:[I("div",{className:bR,children:I(cR,{isZeroState:e})}),I("div",{className:bR,children:I(vR,{isZeroState:e})}),I("div",{className:fR,children:I(t,{})}),I("div",{className:yR,children:I(cR,{isZeroState:e})}),I("div",{className:yR,children:I(vR,{isZeroState:e})})]})}const xR=tr({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),TR=GN({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),kR=tr({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),ER=tr({paddingTop:"8px"}),AR=tr({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),SR=tr({display:"flex",flexDirection:"column",gap:"10px"});function IR({columns:e=CN,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1,zeroStateEventName:d}){const{filters:u}=BI(),{hasPlaidLinkedBankAccount:h}=ng(),p=h??!1,m=wT();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(wl,{});if(void 0!==t){const r=function(e,t){let n;return n=0===e?"FILTERS_NOT_APPLIED":e>0&&0===t?"FILTERS_MATCHED_NONE":"FILTERS_MATCHED_ANY",n}(1===u.length&&cr(u[0].value?.date)?0:u.length,t.length);return I("div",{className:TR,children:R("div",{className:xR,children:[m&&c&&I("div",{className:SR,children:I(Hk,{})}),I(CR,{Chart:l,showZeroStates:!i}),R("div",{className:kR,children:[I("div",{className:ER,children:I(wN,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:AR,children:I(VN,{hasLinkedBankAccount:p,filterState:r,transactions:t,columns:e,zeroStateEventName:d})})]}),I(TN,{})]})})}return"zero state"}const NR=tr({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),RR=gr(lr.card,QN,NR);function PR({children:e}){return I("div",{...RR,children:e})}const DR=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function MR({children:e}){return I("div",{className:DR,children:e})}const LR=gr(lr["card-header"],tr({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function FR({children:e}){return I("div",{...LR,children:e})}const OR=tr({minWidth:"300px"});function VR({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:OR,children:I(Df,{options:e,handleClick:t,selectedIndex:n})})}function UR(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=dt(e);return{beginDate:ct(rt(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:nt(rt(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:ot()}:"LAST_12_MONTHS"}const BR=No.var("colors.border.layout"),HR=gr(lr["profit-loss-graph"],tr({"& .recharts-surface":{outline:"none"}})),WR=No.var("colors.money.positive.weak"),zR=No.var("colors.money.positive"),_R=No.var("colors.money.negative.weak"),jR=No.var("colors.money.negative"),qR=No.var("colors.surface.intent.action"),KR=No.var("colors.surface.intent.action.active"),YR=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],ZR=()=>{const[e,t]=d(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Ba({accountingMethod:"CASH",filter:UR(e),grouping:e,select:t=>{if("SUCCESS"!==t.result)return[];const n=t.json?.data;if(void 0===n)return[];let r=n;return"YEARLY"===e&&(r=function(e){let t=!1;const n=[],r=e.length-1,a=e.length-2;return e.forEach((e,o)=>{((e?.income?.total??0)>0||(e?.expenses?.total??0)>0)&&(t=!0),(t||o===r||o===a)&&n.push(e)}),n}(n)),r.map(t=>{const n=t.period?.beginDate,{label:r,longLabel:a}=function(e,t){return void 0===e?{label:"",longLabel:""}:"MONTHLY"===t?function(e){const t=Nt(e??"");return{longLabel:t?Mt(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:Wa(e)}}(e):"QUARTERLY"===t?function(e){const t=at(e),n=t.getMonth(),r=Math.trunc(n/3)+1,a=t.getFullYear();return{label:`Q${r} ${"'"+a%100}`,longLabel:`Quarter ${r} ${a}`}}(e):"YEARLY"===t?function(e){const t=at(e).getFullYear();return{label:t.toString(),longLabel:t.toString()}}(e):{label:"",longLabel:""}}(n,e);return{longLabel:a,income:(t.income?.total??0)+(t.otherIncome?.total??0),expense:(t.cogs?.total??0)+(t.expenses?.total??0)+(t.otherExpenses?.total??0),label:r}})}});return t??[]}(YR[e].value)}};function GR({selectedIndex:e,onSelect:t}){return I(VR,{options:YR,handleClick:t,selectedIndex:e})}const QR={top:20,right:20,left:20,bottom:5},XR={fill:No.var("colors.typography.base"),fontSize:No.var("fontSizes.metric.sm")};function JR({data:e,children:t,tooltip:n}){return I(W,{width:"100%",height:"100%",...HR,style:{flexGrow:1},children:R(z,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:QR,children:[I(q,{dataKey:"label",interval:0,tickLine:!1,stroke:BR,tick:XR}),I(Y,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const $R=tr({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function eP(){return R("div",{className:$R,children:[I(Mo,{color:WR,label:"Income",diameter:10}),I(Mo,{color:_R,label:"Expense",diameter:10})]})}const tP=gr(null,tr({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),nP=gr(null,tr({width:"100%",height:"1px",backgroundColor:"border.layout"})),rP=gr(null,tr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),aP=No.var("colors.money.positive"),oP=No.var("colors.money.negative");function iP({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t.find(e=>"income"===e.dataKey),r=t.find(e=>"expense"===e.dataKey),a=t[0]?.payload?.longLabel||"",o=n?.value??0,i=r?.value??0;return R("div",{...tP,children:[I(To,{children:a}),I("div",{...nP}),R("div",{...rP,children:[I(Mo,{color:aP,label:"Income",diameter:12}),I(Iu,{children:fo(Number(o))})]}),R("div",{...rP,children:[I(Mo,{color:oP,label:"Expense",diameter:12}),I(Iu,{children:fo(Number(i))})]})]})}function lP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=ZR(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(PR,{children:[R(MR,{children:[R(FR,{children:[I(sc,{intent:"weak",children:"All Transactions"}),I(co,{title:fo(r),label:void 0})]}),R(FR,{children:[I(GR,{selectedIndex:e,onSelect:t}),I(eP,{})]})]}),R(JR,{data:n,tooltip:({active:e,payload:t})=>I(iP,{active:e,payload:t}),children:[I(Z,{name:"Income",dataKey:"income",minPointSize:2,fill:WR,isAnimationActive:!1,activeBar:{fill:zR}}),I(Z,{name:"Expense",dataKey:"expense",minPointSize:2,fill:_R,isAnimationActive:!1,activeBar:{fill:jR}})]})]})}const sP=tr({display:"flex",flexDirection:"column",gap:{base:0,sm:"16px"}});function cP({columns:e,limit:t=100}){const n=OI(),{userRole:r}=i(Qc),{sortInstance:a,setSortInstance:o,apiSort:l}=aw(),s=Bk(),{isFilling:c,paginationControls:d,query:{data:u,isError:h,error:p,isFetching:m}}=ws({limit:t,sort:l,filter:{...n.apiFilters}}),g=u?.data,v=ks();return VI("transactionsDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,c,v),R("div",{className:sP,children:[s&&I(Fk,{}),I(UI.Provider,{value:n,children:I(sl.Provider,{value:d,children:I(rc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(IR,{columns:e,transactions:g,isFetching:m,isFilling:c,isError:h,error:p??null,hasTransactions:v,Chart:lP,manualTransactionOptions:[mw.EXPENSE,mw.REVENUE,"TRANSFER_IN"],zeroStateEventName:"TransactionsDashboardZeroState"})})})})]})}const dP=e=>I(Kk,{children:I(Yk,{source:"TransactionsDashboard",children:I(cP,{...e})})}),uP={in:["EXPENSE","TRANSFER_OUT"]},hP=[{name:"Expense",types:vw.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:mw.TRANSFER_OUT}]}];function pP(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=EI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=AI(),p=o(()=>({reviewStatus:OS(h),amount:GS(),bankAccount:XS(l),category:LS(i),customer:rS(c),date:Ht,description:DI(),glAccount:xI(d),notes:LI(),status:pI(),vendor:nI(s),type:rI(hP),search:tt}),[l,i,s,c,d,h]),m=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),g=/* @__PURE__ */(new Date).getDate(),v=o(()=>kI(e,uP),[e,g]),f=u(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:m,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}const mP=gr(lr.text,tr({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa);function gP({children:e}){return I("div",{...mP,children:e})}const vP=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function fP({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t[0]?.payload?.longLabel||"",r=Number(t[0]?.value??0);return R("div",{className:vP,children:[I(gy,{children:n}),I(gP,{children:yo(r)})]})}const bP=tr({width:"160px",height:"32px"}),yP=tr({width:"54px",height:"32px"}),wP=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:bP,children:I(sc,{children:String(t.value)})}),CP=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:yP,children:I(sc,{alignment:"right",children:(r=n.value,vo(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},xP=({active:e,payload:t})=>I(fP,{active:e,payload:t});function TP({data:e}){return I(W,{width:"100%",height:44*(e?.length??0)+12,...HR,children:R(z,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[I(q,{type:"number",hide:!0,domain:[0,"dataMax"]}),I(K,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:wP,width:172}),I(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:CP,width:66}),I(Y,{content:xP,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(Z,{dataKey:"total",minPointSize:2,fill:qR,isAnimationActive:!1,activeBar:{fill:KR},barSize:32})]})})}const kP=e=>{if("SUCCESS"!==e.result)return[];const t=e.json?.data?.[0];return void 0!==t&&void 0!==t.expenses&&t.expenses.children?t.expenses.children.map(e=>{const t=e.name??"Uncategorized";return{name:t,longLabel:t,total:e.total??0}}).filter(e=>0!==e.total).sort((e,t)=>t.total-e.total).slice(0,5):[]},EP=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function AP(){const[e,t]=d(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Rt(n),endDate:Rt(t)}})(EP[e].value),{query:{data:r}}=Ba({filter:n,select:kP}),a=n?`${At(Nt(n.beginDate))} - ${At(Nt(n.endDate))}`:"";return R(PR,{children:[R(MR,{children:[R(FR,{children:[I(sc,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(sc,{intent:"weak",wrap:"ellipsis",children:a})]}),I(VR,{options:EP,handleClick:e=>t(e),selectedIndex:e})]}),I(TP,{data:r})]})}function SP({columns:e,limit:t=100}){const n=pP(),{userRole:r}=i(Qc),{sortInstance:a,setSortInstance:o,apiSort:l}=aw(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ws({limit:t,sort:l,filter:{...n.apiFilters}}),m=d?.data,g=ks();return VI("expenseDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,g),I(UI.Provider,{value:n,children:I(sl.Provider,{value:c,children:I(rc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(IR,{columns:e,transactions:m,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:g,Chart:AP,manualTransactionOptions:[mw.EXPENSE,"TRANSFER_OUT"],showTasks:!0,zeroStateEventName:"ExpenseDashboardZeroState"})})})})}const IP=e=>I(Kk,{children:I(Yk,{source:"ExpenseDashboard",children:I(SP,{...e})})}),NP={in:["REVENUE","TRANSFER_IN"]},RP=[{name:pw,types:vw.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:mw.TRANSFER_IN}]}];function PP(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=EI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=AI(),h=o(()=>({reviewStatus:OS(d),amount:GS(),bankAccount:XS(l),category:LS(i),customer:rS(s),date:Ht,description:DI(),glAccount:xI(c),notes:LI(),status:pI(),type:rI(RP),search:tt}),[l,i,s,c,d]),p=o(()=>[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type],[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type]),m=/* @__PURE__ */(new Date).getDate(),g=o(()=>kI(e,NP),[e,m]),v=u(e=>h[e],[h]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:p,setFilters:t,addFilters:n,removeFilter:r,apiFilters:g,getModel:v,hasUserConfiguredFilters:a}}function DP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=ZR(),r=n.reduce((e,t)=>e+t.income,0);return R(PR,{children:[R(MR,{children:[R(FR,{children:[I(sc,{intent:"weak",children:"Total Income"}),I(co,{title:fo(r),label:void 0})]}),I(FR,{children:I(GR,{selectedIndex:e,onSelect:t})})]}),I(JR,{data:n,tooltip:({active:e,payload:t})=>I(fP,{active:e,payload:t}),children:I(Z,{name:"Revenue",dataKey:"income",minPointSize:2,fill:qR,isAnimationActive:!1,activeBar:{fill:KR}})})]})}function MP({columns:e,limit:t=100}){const n=PP(),{userRole:r}=i(Qc),{sortInstance:a,setSortInstance:o,apiSort:l}=aw(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ws({limit:t,sort:l,filter:{...n.apiFilters}}),m=d?.data,g=ks();return VI("incomeDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,g),I(UI.Provider,{value:n,children:I(sl.Provider,{value:c,children:I(rc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(IR,{columns:e,transactions:m,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:g,Chart:DP,manualTransactionOptions:[mw.REVENUE,"TRANSFER_IN"],showTasks:!0,zeroStateEventName:"IncomeDashboardZeroState"})})})})}const LP=e=>I(Kk,{children:I(Yk,{source:"IncomeDashboard",children:I(MP,{...e})})});var FP=(e=>(e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e))(FP||{});function OP(e){return"object"==typeof e&&null!=e&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function VP(e={}){const{initialEntries:t=["/"],initialIndex:n,v5Compat:r=!1}=e;let a;a=t.map((e,t)=>d(e,"string"==typeof e?null:e.state,0===t?"default":void 0,"string"==typeof e?void 0:e.mask));let o=s(null==n?a.length-1:n),i="POP",l=null;function s(e){return Math.min(Math.max(e,0),a.length-1)}function c(){return a[o]}function d(e,t=null,n,r){const o=HP(a?c().pathname:"/",e,t,n,r);return BP("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function u(e){return"string"==typeof e?e:WP(e)}return{get index(){return o},get action(){return i},get location(){return c()},createHref:u,createURL:e=>new URL(u(e),"http://localhost"),encodeLocation(e){const t="string"==typeof e?zP(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,t){i="PUSH";const n=OP(e)?e:d(e,t);o+=1,a.splice(o,a.length,n),r&&l&&l({action:i,location:n,delta:1})},replace(e,t){i="REPLACE";const n=OP(e)?e:d(e,t);a[o]=n,r&&l&&l({action:i,location:n,delta:0})},go(e){i="POP";const t=s(o+e),n=a[t];o=t,l&&l({action:i,location:n,delta:e})},listen:e=>(l=e,()=>{l=null})}}function UP(e,t){if(!1===e||null==e)throw new Error(t)}function BP(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function HP(e,t,n=null,r,a){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?zP(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10),mask:a}}function WP({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function zP(e){const t={};if(e){const n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));const r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}var _P=(e=>(e.data="data",e.redirect="redirect",e.error="error",e))(_P||{});class jP{#e=/* @__PURE__ */new Map;constructor(e){if(e)for(const[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(void 0!==e.defaultValue)return e.defaultValue;throw new Error("No value found for context")}set(e,t){this.#e.set(e,t)}}const qP=/* @__PURE__ */new Set(["lazy","caseSensitive","path","id","index","children"]),KP=/* @__PURE__ */new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function YP(e){return KP.has(e)}function ZP(e,t,n=[],r={},a=!1){return e.map((e,o)=>{const i=[...n,String(o)],l="string"==typeof e.id?e.id:i.join("-");if(UP(!0!==e.index||!e.children,"Cannot specify children on an index route"),UP(a||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),!0===e.index){const n={...e,id:l};return r[l]=GP(n,t(n)),n}{const n={...e,id:l,children:void 0};return r[l]=GP(n,t(n)),e.children&&(n.children=ZP(e.children,t,i,r,a)),n}})}function GP(e,t){return Object.assign(e,{...t,..."object"==typeof t.lazy&&null!=t.lazy?{lazy:{...e.lazy,...t.lazy}}:{}})}function QP(e,t,n,r,a){const o=uD(("string"==typeof t?zP(t):t).pathname||"/",n);if(null==o)return null;const i=a??JP(e);let l=null;const s=function(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return BP(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}(o);for(let c=0;null==l&&c<i.length;++c)l=cD(i[c],s,r);return l}function XP(e,t){const{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function JP(e){const t=$P(e);return t.sort((e,t)=>{return e.score!==t.score?t.score-e.score:(n=e.routesMeta.map(e=>e.childrenIndex),r=t.routesMeta.map(e=>e.childrenIndex),n.length===r.length&&n.slice(0,-1).every((e,t)=>e===r[t])?n[n.length-1]-r[r.length-1]:0);var n,r}),t}function $P(e,t=[],n=[],r="",a=!1){const o=(e,o,i=a,l)=>{const s={relativePath:void 0===l?e.path||"":l,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};if(s.relativePath.startsWith("/")){if(!s.relativePath.startsWith(r)&&i)return;UP(s.relativePath.startsWith(r),`Absolute route path "${s.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),s.relativePath=s.relativePath.slice(r.length)}const c=wD([r,s.relativePath]),d=n.concat(s);e.children&&e.children.length>0&&(UP(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),$P(e.children,t,d,c,i)),(null!=e.path||e.index)&&t.push({path:c,score:sD(c,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(const n of eD(e.path))o(e,t,!0,n);else o(e,t)}),t}function eD(e){const t=e.split("/");if(0===t.length)return[];const[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];const i=eD(r.join("/")),l=[];return l.push(...i.map(e=>""===e?o:[o,e].join("/"))),a&&l.push(...i),l.map(t=>e.startsWith("/")&&""===t?"/":t)}const tD=/^:[\w-]+$/,nD=3,rD=2,aD=1,oD=10,iD=-2,lD=e=>"*"===e;function sD(e,t){const n=e.split("/");let r=n.length;return n.some(lD)&&(r+=iD),t&&(r+=rD),n.filter(e=>!lD(e)).reduce((e,t)=>e+(tD.test(t)?nD:""===t?aD:oD),r)}function cD(e,t,n=!1){const{routesMeta:r}=e,a={};let o="/";const i=[];for(let l=0;l<r.length;++l){const e=r[l],s=l===r.length-1,c="/"===o?t:t.slice(o.length)||"/";let d=dD({path:e.relativePath,caseSensitive:e.caseSensitive,end:s},c);const u=e.route;if(!d&&s&&n&&!r[r.length-1].route.index&&(d=dD({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:wD([o,d.pathname]),pathnameBase:xD(wD([o,d.pathnameBase])),route:u}),"/"!==d.pathnameBase&&(o=wD([o,d.pathnameBase]))}return i}function dD(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});const[n,r]=function(e,t=!1,n=!0){BP("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);const r=[];let a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n,a,o)=>{if(r.push({paramName:t,isOptional:null!=n}),n){const t=o.charAt(a+e.length);return t&&"/"!==t?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");return[new RegExp(a,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;const o=a[0];let i=o.replace(/(.)\/+$/,"$1");const l=a.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if("*"===t){const e=l[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const a=l[r];return e[t]=n&&!a?void 0:(a||"").replace(/%2F/g,"/"),e},{}),pathname:o,pathnameBase:i,pattern:e}}function uD(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;const n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}const hD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pD=e=>hD.test(e);function mD(e,t){const n=CD(t).split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function gD(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function vD(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function fD(e){const t=vD(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function bD(e,t,n,r=!1){let a;"string"==typeof e?a=zP(e):(a={...e},UP(!a.pathname||!a.pathname.includes("?"),gD("?","pathname","search",a)),UP(!a.pathname||!a.pathname.includes("#"),gD("#","pathname","hash",a)),UP(!a.search||!a.search.includes("#"),gD("#","search","hash",a)));const o=""===e||""===a.pathname,i=o?"/":a.pathname;let l;if(null==i)l=n;else{let e=t.length-1;if(!r&&i.startsWith("..")){const t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}l=e>=0?t[e]:"/"}const s=function(e,t="/"){let n,{pathname:r,search:a="",hash:o=""}="string"==typeof e?zP(e):e;return r?(r=yD(r),n=r.startsWith("/")?mD(r.substring(1),"/"):mD(r,t)):n=t,{pathname:n,search:TD(a),hash:kD(o)}}(a,l),c=i&&"/"!==i&&i.endsWith("/"),d=(o||"."===i)&&n.endsWith("/");return s.pathname.endsWith("/")||!c&&!d||(s.pathname+="/"),s}const yD=e=>e.replace(/\/\/+/g,"/"),wD=e=>yD(e.join("/")),CD=e=>e.replace(/\/+$/,""),xD=e=>CD(e).replace(/^\/*/,"/"),TD=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",kD=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class ED{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function AD(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}function SD(e){const t=e.map(e=>e.route.path).filter(Boolean);return wD(t)||"/"}const ID="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ND(e,t){let n=e;if("string"!=typeof n||!hD.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};const r=n;let a=!1;if(ID)try{const e=new URL(window.location.href),r=n.startsWith("//")?new URL(e.protocol+n):new URL(n),o=uD(r.pathname,t);r.origin===e.origin&&null!=o?n=o+r.search+r.hash:a=!0}catch(o){BP(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}const RD=Symbol("Uninstrumented");function PD(e,t){const n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){const t=Object.keys(n);for(const r of t)e[r]&&n[r].push(e[r])}}));const r={};if("function"==typeof t.lazy&&n.lazy.length>0){const e=DD(n.lazy,t.lazy,()=>{});e&&(r.lazy=e)}if("object"==typeof t.lazy){const e=t.lazy;["middleware","loader","action"].forEach(t=>{const a=e[t],o=n[`lazy.${t}`];if("function"==typeof a&&o.length>0){const e=DD(o,a,()=>{});e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return["loader","action"].forEach(e=>{const a=t[e];if("function"==typeof a&&n[e].length>0){const t=a[RD]??a,o=DD(n[e],t,(...e)=>LD(e[0]));o&&("loader"===e&&!0===t.hydrate&&(o.hydrate=!0),o[RD]=t,r[e]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{const t=e[RD]??e,r=DD(n.middleware,t,(...e)=>LD(e[0]));return r?(r[RD]=t,r):e})),r}function DD(e,t,n){return 0===e.length?null:async(...r)=>{const a=await MD(e,n(...r),()=>t(...r),e.length-1);if("error"===a.type)throw a.value;return a.value}}async function MD(e,t,n,r){const a=e[r];let o;if(a){let l;const s=async()=>(l?console.error("You cannot call instrumented handlers more than once"):l=MD(e,t,n,r-1),o=await l,UP(o,"Expected a result"),"error"===o.type&&o.value instanceof Error?{status:"error",error:o.value}:{status:"success",error:void 0});try{await a(s,t)}catch(i){console.error("An instrumentation function threw an error:",i)}l||await s(),await l}else try{const e=await n();o={type:"success",value:e}}catch(i){o={type:"error",value:i}}return o||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function LD(e){const{request:t,context:n,params:r,pattern:a}=e;return{request:OD(t),params:{...r},pattern:a,context:VD(n)}}function FD(e,t){return{currentUrl:WP(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function OD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function VD(e){if(function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t||Object.getOwnPropertyNames(t).sort().join("\0")===UD}(e)){const t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}const UD=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),BD=["POST","PUT","PATCH","DELETE"],HD=new Set(BD),WD=["GET",...BD],zD=new Set(WD),_D=/* @__PURE__ */new Set([301,302,303,307,308]),jD=/* @__PURE__ */new Set([307,308]),qD={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},KD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},YD={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ZD=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),GD="remix-router-transitions",QD=Symbol("ResetLoaderData");let XD=class{#t;#n;#r;#a;constructor(e){this.#t=e,this.#n=JP(e)}get stableRoutes(){return this.#t}get activeRoutes(){return this.#r??this.#t}get branches(){return this.#a??this.#n}get hasHMRRoutes(){return null!=this.#r}setRoutes(e){this.#t=e,this.#n=JP(e)}setHmrRoutes(e){this.#r=e,this.#a=JP(e)}commitHmrRoutes(){this.#r&&(this.#t=this.#r,this.#n=this.#a,this.#r=void 0,this.#a=void 0)}};function JD(e,t,n,r,a,o){let i,l;if(a){i=[];for(const e of t)if(i.push(e),e.route.id===a){l=e;break}}else i=t,l=t[t.length-1];const s=bD(r||".",fD(i),uD(e.pathname,n)||e.pathname,"path"===o);if(null==r&&(s.search=e.search,s.hash=e.hash),(null==r||""===r||"."===r)&&l){const e=BM(s.search);if(l.route.index&&!e)s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&e){const e=new URLSearchParams(s.search),t=e.getAll("index");e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));const n=e.toString();s.search=n?`?${n}`:""}}return"/"!==n&&(s.pathname=function({basename:e,pathname:t}){return"/"===t?e:wD([e,t])}({basename:n,pathname:s.pathname})),WP(s)}function $D(e,t,n){if(!n||(null==(r=n)||!("formData"in r&&null!=r.formData||"body"in r&&void 0!==r.body)))return{path:t};var r,a;if(n.formMethod&&(a=n.formMethod,!zD.has(a.toUpperCase())))return{path:t,error:NM(405,{method:n.formMethod})};const o=()=>({path:t,error:NM(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=PM(t);if(void 0!==n.body){if("text/plain"===n.formEncType){if(!UM(i))return o();const e="string"==typeof n.body?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===n.formEncType){if(!UM(i))return o();try{const e="string"==typeof n.body?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch(r){return o()}}}let s,c;if(UP("function"==typeof FormData,"FormData is not available in this environment"),n.formData)s=xM(n.formData),c=n.formData;else if(n.body instanceof FormData)s=xM(n.body),c=n.body;else if(n.body instanceof URLSearchParams)s=n.body,c=TM(s);else if(null==n.body)s=new URLSearchParams,c=new FormData;else try{s=new URLSearchParams(n.body),c=TM(s)}catch(r){return o()}const d={formMethod:i,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(UM(d.formMethod))return{path:t,submission:d};const u=zP(t);return e&&u.search&&BM(u.search)&&s.append("index",""),u.search=`?${s}`,{path:WP(u),submission:d}}function eM(e,t,n,r,a,o,i,l,s,c,d,u,h,p,m,g,v,f,b,y,w,C){const x=w?LM(w[1])?w[1].error:w[1].data:void 0,T=a.createURL(o.location),k=a.createURL(s);let E;if(d&&o.errors){const e=Object.keys(o.errors)[0];E=i.findIndex(t=>t.route.id===e)}else if(w&&LM(w[1])){const e=w[0];E=i.findIndex(t=>t.route.id===e)-1}const A=w?w[1].statusCode:void 0,S=A&&A>=400,I={currentUrl:T,currentParams:o.matches[0]?.params||{},nextUrl:k,nextParams:i[0].params,...l,actionResult:x,actionStatus:A},N=SD(i),R=i.map((a,i)=>{const{route:l}=a;let h=null;if(null!=E&&i>E)h=!1;else if(l.lazy)h=!0;else if(tM(l))if(d){const{shouldLoad:e}=nM(l,o.loaderData,o.errors);h=e}else(function(e,t,n){const r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a})(o.loaderData,o.matches[i],a)&&(h=!0);else h=!1;if(null!==h)return mM(n,r,e,s,N,a,c,t,h);let p=!1;"boolean"==typeof C?p=C:S?p=!1:(u||T.pathname+T.search===k.pathname+k.search||T.search!==k.search||function(e,t){const n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}(o.matches[i],a))&&(p=!0);const m={...I,defaultShouldRevalidate:p},g=rM(a,m);return mM(n,r,e,s,N,a,c,t,g,m,C)}),P=[];return m.forEach((e,l)=>{if(d||!i.some(t=>t.route.id===e.routeId)||p.has(l))return;const s=o.fetchers.get(l),m=s&&"idle"!==s.state&&void 0===s.data,w=QP(v,e.path,f??"/",!1,y);if(!w){if(b&&m)return;return void P.push({key:l,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null})}if(g.has(l))return;const x=HM(w,e.path),T=new AbortController,k=wM(a,e.path,T.signal);let E=null;if(h.has(l))h.delete(l),E=gM(n,r,k,e.path,w,x,c,t);else if(m)u&&(E=gM(n,r,k,e.path,w,x,c,t));else{let a;a="boolean"==typeof C?C:!S&&u;const o={...I,defaultShouldRevalidate:a};rM(x,o)&&(E=gM(n,r,k,e.path,w,x,c,t,o))}E&&P.push({key:l,routeId:e.routeId,path:e.path,matches:E,match:x,request:k,controller:T})}),{dsMatches:R,revalidatingFetchers:P}}function tM(e){return null!=e.loader||null!=e.middleware&&e.middleware.length>0}function nM(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!tM(e))return{shouldLoad:!1,renderFallback:!1};const r=null!=t&&e.id in t,a=null!=n&&void 0!==n[e.id];if(!r&&a)return{shouldLoad:!1,renderFallback:!1};if("function"==typeof e.loader&&!0===e.loader.hydrate)return{shouldLoad:!0,renderFallback:!r};const o=!r&&!a;return{shouldLoad:o,renderFallback:o}}function rM(e,t){if(e.route.shouldRevalidate){const n=e.route.shouldRevalidate(t);if("boolean"==typeof n)return n}return t.defaultShouldRevalidate}function aM(e,t,n,r,a,o){let i;if(e){const t=r[e];UP(t,`No route found to patch children into: routeId = ${e}`),t.children||(t.children=[]),i=t.children}else i=n.activeRoutes;const l=[],s=[];if(t.forEach(e=>{const t=i.find(t=>oM(e,t));t?s.push({existingRoute:t,newRoute:e}):l.push(e)}),l.length>0){const t=ZP(l,a,[e||"_","patch",String(i?.length||"0")],r);i.push(...t)}if(o&&s.length>0)for(let c=0;c<s.length;c++){const{existingRoute:e,newRoute:t}=s[c],n=e,[r]=ZP([t],a,[],{},!0);Object.assign(n,{element:r.element?r.element:n.element,errorElement:r.errorElement?r.errorElement:n.errorElement,hydrateFallbackElement:r.hydrateFallbackElement?r.hydrateFallbackElement:n.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function oM(e,t){return"id"in e&&"id"in t&&e.id===t.id||e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive&&(!(e.children&&0!==e.children.length||t.children&&0!==t.children.length)||(e.children?.every((e,n)=>t.children?.some(t=>oM(e,t)))??!1))}const iM=/* @__PURE__ */new WeakMap,lM=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{const a=n[t.id];if(UP(a,"No route found in manifest"),!a.lazy||"object"!=typeof a.lazy)return;const o=a.lazy[e];if(!o)return;let i=iM.get(a);i||(i={},iM.set(a,i));const l=i[e];if(l)return l;const s=(async()=>{const t=(l=e,qP.has(l)),n=void 0!==a[e]&&"hasErrorBoundary"!==e;var l;if(t)BP(!t,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(n)BP(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{const t=await o();null!=t&&(Object.assign(a,{[e]:t}),Object.assign(a,r(a)))}"object"==typeof a.lazy&&(a.lazy[e]=void 0,Object.values(a.lazy).every(e=>void 0===e)&&(a.lazy=void 0))})();return i[e]=s,s},sM=/* @__PURE__ */new WeakMap;async function cM(e){const t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function dM(e){return e.matches.some(e=>e.route.middleware)?uM(e,()=>cM(e)):cM(e)}function uM(e,t){return async function(t,n,r,a){const{matches:o,...i}=t,l=o.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),s=await hM(i,l,n,e=>{if(VM(t=e)&&(n=t.status,_D.has(n))&&t.headers.has("Location"))throw e;var t,n;return e},a,function(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:"error",result:t}}));{const{matches:r}=e,a=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),o=SM(r,r[a].route.id).route.id;return Promise.resolve({[o]:{type:"error",result:t}})}});return s}(e,t,0,DM)}async function hM(e,t,n,r,a,o,i=0){const{request:l}=e;if(l.signal.aborted)throw l.signal.reason??new Error(`Request aborted: ${l.method} ${l.url}`);const s=t[i];if(!s)return await n();const[c,d]=s;let u;const h=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{const l=await hM(e,t,n,r,a,o,i+1);return u={value:l},u.value}catch(l){return u={value:await o(l,c,u)},u.value}};try{const t=await d(e,h),n=null!=t?r(t):void 0;return a(n)?n:u?n??u.value:(u={value:await h()},u.value)}catch(p){return await o(p,c,u)}}function pM(e,t,n,r,a){const o=lM({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=function(e,t,n,r,a){const o=n[e.id];if(UP(o,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if("function"==typeof e.lazy){const t=sM.get(o);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};const n=(async()=>{UP("function"==typeof e.lazy,"No lazy route function found");const t=await e.lazy(),n={};for(const e in t){const r=t[e];if(void 0===r)continue;const a=YP(e),i=void 0!==o[e]&&"hasErrorBoundary"!==e;a?BP(!a,"Route property "+e+" is not a supported property to be returned from a lazy route function. This property will be ignored."):i?BP(!i,`Route "${o.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(o,n),Object.assign(o,{...r(o),lazy:void 0})})();return sM.set(o,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}const i=Object.keys(e.lazy),l=[];let s;for(const d of i){if(a&&a.includes(d))continue;const o=lM({key:d,route:e,manifest:n,mapRouteProperties:r});o&&(l.push(o),d===t&&(s=o))}const c=l.length>0?Promise.all(l).then(()=>{}):void 0;return c?.catch(()=>{}),s?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:s}}(r.route,UM(n.method)?"action":"loader",t,e,a);return{middleware:o,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function mM(e,t,n,r,a,o,i,l,s,c=null,d){let u=!1;const h=pM(e,t,n,o,i);return{...o,_lazyPromises:h,shouldLoad:s,shouldRevalidateArgs:c,shouldCallHandler:e=>(u=!0,c?rM(o,"boolean"==typeof d?{...c,defaultShouldRevalidate:d}:"boolean"==typeof e?{...c,defaultShouldRevalidate:e}:c):s),resolve(e){const{lazy:t,loader:i,middleware:c}=o.route,d=u||s||e&&!UM(n.method)&&(t||i),p=c&&c.length>0&&!i&&!t;return!d||!UM(n.method)&&p?Promise.resolve({type:_P.data,result:void 0}):async function({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:o,handlerOverride:i,scopedContext:l}){let s,c;const d=UM(e.method),u=d?"action":"loader",h=a=>{let o;const s=new Promise((e,t)=>o=t);c=()=>o(),e.signal.addEventListener("abort",c);const d=o=>"function"!=typeof a?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${u}" [routeId: ${r.route.id}]`)):a({request:e,url:CM(e,t),pattern:n,params:r.params,context:l},...void 0!==o?[o]:[]),h=(async()=>{try{return{type:"data",result:await(i?i(e=>d(e)):d())}}catch(e){return{type:"error",result:e}}})();return Promise.race([h,s])};try{const t=d?r.route.action:r.route.loader;if(a||o)if(t){let e;const[n]=await Promise.all([h(t).catch(t=>{e=t}),a,o]);if(void 0!==e)throw e;s=n}else{await a;const t=d?r.route.action:r.route.loader;if(!t){if("action"===u){const t=new URL(e.url),n=t.pathname+t.search;throw NM(405,{method:e.method,pathname:n,routeId:r.route.id})}return{type:_P.data,result:void 0}}[s]=await Promise.all([h(t),o])}else{if(!t){const t=new URL(e.url);throw NM(404,{pathname:t.pathname+t.search})}s=await h(t)}}catch(p){return{type:_P.error,result:p}}finally{c&&e.signal.removeEventListener("abort",c)}return s}({request:n,path:r,pattern:a,match:o,lazyHandlerPromise:h?.handler,lazyRoutePromise:h?.route,handlerOverride:e,scopedContext:l})}}}function gM(e,t,n,r,a,o,i,l,s=null){return a.map(c=>c.route.id!==o.route.id?{...c,shouldLoad:!1,shouldRevalidateArgs:s,shouldCallHandler:()=>!1,_lazyPromises:pM(e,t,n,c,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:mM(e,t,n,r,SD(a),c,i,l,!0,s))}async function vM(e){const{result:t,type:n}=e;if(VM(t)){let e;try{e=await async function(e){const t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?null==e.body?null:e.json():e.text()}(t)}catch(a){return{type:_P.error,error:a}}return n===_P.error?{type:_P.error,error:new ED(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:_P.data,data:e,statusCode:t.status,headers:t.headers}}return n===_P.error?OM(t)?t.data instanceof Error?{type:_P.error,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:_P.error,error:(r=t,new ED(r.init?.status??500,r.init?.statusText??"Internal Server Error",r.data)),statusCode:AD(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:_P.error,error:t,statusCode:AD(t)?t.status:void 0}:OM(t)?{type:_P.data,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:_P.data,data:t};var r}function fM(e,t,n,r,a){let o=e.headers.get("Location");if(UP(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!pD(o)){const i=r.slice(0,r.findIndex(e=>e.route.id===n)+1);o=JD(new URL(t.url),i,a,o),e.headers.set("Location",o)}return e}const bM=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function yM(e,t,n,r){if(pD(e)){const r=e,a=r.startsWith("//")?new URL(t.protocol+r):new URL(r);if(bM.includes(a.protocol))throw new Error("Invalid redirect location");const o=null!=uD(a.pathname,n);if(a.origin===t.origin&&o)return yD(a.pathname)+a.search+a.hash}try{const t=r.createURL(e);if(bM.includes(t.protocol))throw new Error("Invalid redirect location")}catch(a){}return e}function wM(e,t,n,r){const a=e.createURL(PM(t)).toString(),o={signal:n};if(r&&UM(r.formMethod)){const{formMethod:e,formEncType:t}=r;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(r.json)):"text/plain"===t?o.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?o.body=xM(r.formData):o.body=r.formData}return new Request(a,o)}function CM(e,t){const n=new URL(e.url),r="string"==typeof t?zP(t):t;if(n.pathname=r.pathname||"/",r.search){const e=new URLSearchParams(r.search),t=e.getAll("index");e.delete("index");for(const n of t.filter(Boolean))e.append("index",n);n.search=e.size?`?${e.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function xM(e){const t=new URLSearchParams;for(const[n,r]of e.entries())t.append(n,"string"==typeof r?r:r.name);return t}function TM(e){const t=new FormData;for(const[n,r]of e.entries())t.append(n,r);return t}function kM(e,t,n,r,a,o,i){let{loaderData:l,errors:s}=function(e,t,n,r=!1,a=!1){const o={};let i,l=null,s=!1;const c={};let d=n&&LM(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;const u=n.route.id,h=t[u];if(UP(!FM(h),"Cannot handle redirect results in processLoaderData"),LM(h)){let t=h.error;if(void 0!==d&&(t=d,d=void 0),l=l||{},a)l[u]=t;else{const n=SM(e,u);null==l[n.route.id]&&(l[n.route.id]=t)}r||(o[u]=QD),s||(s=!0,i=AD(h.error)?h.error.status:500),h.headers&&(c[u]=h.headers)}else o[u]=h.data,h.statusCode&&200!==h.statusCode&&!s&&(i=h.statusCode),h.headers&&(c[u]=h.headers)}),void 0!==d&&n&&(l={[n[0]]:d},n[2]&&(o[n[2]]=void 0)),{loaderData:o,errors:l,statusCode:i||200,loaderHeaders:c}}(t,n,r);return a.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{const{key:n,match:r,controller:a}=t;if(a&&a.signal.aborted)return;const l=o[n];if(UP(l,"Did not find corresponding fetcher result"),LM(l)){const t=SM(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:l.error}),i.delete(n)}else if(FM(l))UP(!1,"Unhandled fetcher revalidation redirect");else{const e=jM(l.data);i.set(n,e)}}),{loaderData:l,errors:s}}function EM(e,t,n,r){const a=Object.entries(t).filter(([,e])=>e!==QD).reduce((e,[t,n])=>(e[t]=n,e),{});for(const o of n){const n=o.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&o.route.loader&&(a[n]=e[n]),r&&r.hasOwnProperty(n))break}return a}function AM(e){return e?LM(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function SM(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>!0===e.route.hasErrorBoundary)||e[0]}function IM(e){const t=1===e.length?e[0]:e.find(e=>e.index||!e.path||"/"===e.path)||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function NM(e,{pathname:t,routeId:n,method:r,type:a,message:o}={}){let i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",r&&t&&n?l=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l=`Route "${n}" does not match URL "${t}"`):404===e?(i="Not Found",l=`No route matches URL "${t}"`):405===e&&(i="Method Not Allowed",r&&t&&n?l=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(l=`Invalid request method "${r.toUpperCase()}"`)),new ED(e||500,i,new Error(l),!0)}function RM(e){const t=Object.entries(e);for(let n=t.length-1;n>=0;n--){const[e,r]=t[n];if(FM(r))return{key:e,result:r}}}function PM(e){return WP({..."string"==typeof e?zP(e):e,hash:""})}function DM(e){return null!=e&&"object"==typeof e&&Object.entries(e).every(([e,t])=>{return"string"==typeof e&&(null!=(n=t)&&"object"==typeof n&&"type"in n&&"result"in n&&(n.type===_P.data||n.type===_P.error));var n})}function MM(e){return VM(e.result)&&_D.has(e.result.status)}function LM(e){return e.type===_P.error}function FM(e){return(e&&e.type)===_P.redirect}function OM(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function VM(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function UM(e){return HD.has(e.toUpperCase())}function BM(e){return new URLSearchParams(e).getAll("index").some(e=>""===e)}function HM(e,t){const n="string"==typeof t?zP(t).search:t.search;if(e[e.length-1].route.index&&BM(n||""))return e[e.length-1];const r=vD(e);return r[r.length-1]}function WM(e){const{formMethod:t,formAction:n,formEncType:r,text:a,formData:o,json:i}=e;if(t&&n&&r)return null!=a?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a}:null!=o?{formMethod:t,formAction:n,formEncType:r,formData:o,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}:void 0}function zM(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function _M(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function jM(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function qM(){let e,t;const n=new Promise((r,a)=>{e=async e=>{r(e);try{await n}catch(t){}},t=async e=>{a(e);try{await n}catch(t){}}});return{promise:n,resolve:e,reject:t}}const KM=r.createContext(null);KM.displayName="DataRouter";const YM=r.createContext(null);YM.displayName="DataRouterState";const ZM=r.createContext(!1),GM=r.createContext({isTransitioning:!1});GM.displayName="ViewTransition";const QM=r.createContext(/* @__PURE__ */new Map);QM.displayName="Fetchers",r.createContext(null).displayName="Await";const XM=r.createContext(null);XM.displayName="Navigation";const JM=r.createContext(null);JM.displayName="Location";const $M=r.createContext({outlet:null,matches:[],isDataRoute:!1});$M.displayName="Route";const eL=r.createContext(null);eL.displayName="RouteError";const tL="REACT_ROUTER_ERROR";function nL(){return null!=r.useContext(JM)}function rL(){return UP(nL(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(JM).location}const aL="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function oL(e){r.useContext(XM).static||r.useLayoutEffect(e)}function iL(){const{isDataRoute:e}=r.useContext($M);return e?function(){const{router:e}=function(){const e=r.useContext(KM);return UP(e,gL("useNavigate")),e}(),t=fL("useNavigate"),n=r.useRef(!1);return oL(()=>{n.current=!0}),r.useCallback(async(r,a={})=>{BP(n.current,aL),n.current&&("number"==typeof r?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))},[e,t])}():function(){UP(nL(),"useNavigate() may be used only in the context of a <Router> component.");const e=r.useContext(KM),{basename:t,navigator:n}=r.useContext(XM),{matches:a}=r.useContext($M),{pathname:o}=rL(),i=JSON.stringify(fD(a)),l=r.useRef(!1);return oL(()=>{l.current=!0}),r.useCallback((r,a={})=>{if(BP(l.current,aL),!l.current)return;if("number"==typeof r)return void n.go(r);const s=bD(r,JSON.parse(i),o,"path"===a.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:wD([t,s.pathname])),(a.replace?n.replace:n.push)(s,a.state,a)},[t,n,i,o,e])}()}const lL=r.createContext(null);function sL(e,{relative:t}={}){const{matches:n}=r.useContext($M),{pathname:a}=rL(),o=JSON.stringify(fD(n));return r.useMemo(()=>bD(e,JSON.parse(o),a,"path"===t),[e,o,a,t])}function cL(e,t,n){UP(nL(),"useRoutes() may be used only in the context of a <Router> component.");const{navigator:a}=r.useContext(XM),{matches:o}=r.useContext($M),i=o[o.length-1],l=i?i.params:{};!i||i.pathname;const s=i?i.pathnameBase:"/";i&&i.route;const c=rL();let d;if(t){const e="string"==typeof t?zP(t):t;UP("/"===s||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=c;const u=d.pathname||"/";let h=u;if("/"!==s){const e=s.replace(/^\//,"").split("/");h="/"+u.replace(/^\//,"").split("/").slice(e.length).join("/")}const p=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):function(e,t,n="/"){return QP(e,t,n,!1)}(e,{pathname:h}),m=function(e,t=[],n){const r=n?.state;if(null==e){if(!r)return null;if(r.errors)e=r.matches;else{if(0!==t.length||r.initialized||!(r.matches.length>0))return null;e=r.matches}}let a=e;const o=r?.errors;if(null!=o){const e=a.findIndex(e=>e.route.id&&void 0!==o?.[e.route.id]);UP(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let e=0;e<a.length;e++){const t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){const{loaderData:e,errors:o}=r,s=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!o||void 0===o[t.route.id]);if(t.route.lazy||s){n.isStatic&&(i=!0),a=l>=0?a.slice(0,l+1):[a[0]];break}}}}const s=n?.onError,c=r&&s?(e,t)=>{s(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:SD(r.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,s)=>{let d,u=!1,h=null,p=null;r&&(d=o&&n.route.id?o[n.route.id]:void 0,h=n.route.errorElement||dL,i&&(l<0&&0===s?(bL["route-fallback"]||(bL["route-fallback"]=!0,BP(!1,"No `HydrateFallback` element provided to render during initial hydration")),u=!0,p=null):l===s&&(u=!0,p=n.route.hydrateFallbackElement||null)));const m=t.concat(a.slice(0,s+1)),g=()=>{let t;return t=d?h:u?p:n.route.Component?I(n.route.Component,{}):n.route.element?n.route.element:e,I(mL,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===s)?I(uL,{location:r.location,revalidation:r.revalidation,component:h,error:d,children:g(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:c}):g()},null)}(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:wD([s,a.encodeLocation?a.encodeLocation(e.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:wD([s,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),o,n);return t&&m?I(JM.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:FP.Pop},children:m}):m}const dL=I(function(){const e=function(){const e=r.useContext(eL),t=vL("useRouteError"),n=fL("useRouteError");return void 0!==e?e:t.errors?.[n]}(),t=AD(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return R(N,{children:[I("h2",{children:"Unexpected Application Error!"}),I("h3",{style:{fontStyle:"italic"},children:t}),n?I("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},children:n}):null,null]})},{});class uL extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=ZM;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&"object"==typeof e&&e&&"digest"in e&&"string"==typeof e.digest){const t=function(e){if(e.startsWith(`${tL}:ROUTE_ERROR_RESPONSE:{`))try{const t=JSON.parse(e.slice(40));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText)return new ED(t.status,t.statusText,t.data)}catch{}}(e.digest);t&&(e=t)}const t=void 0!==e?I($M.Provider,{value:this.props.routeContext,children:I(eL.Provider,{value:e,children:this.props.component})}):this.props.children;return this.context?I(pL,{error:e,children:t}):t}}const hL=/* @__PURE__ */new WeakMap;function pL({children:e,error:t}){const{basename:n}=r.useContext(XM);if("object"==typeof t&&t&&"digest"in t&&"string"==typeof t.digest){const e=function(e){if(e.startsWith(`${tL}:REDIRECT:{`))try{const t=JSON.parse(e.slice(28));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText&&"string"==typeof t.location&&"boolean"==typeof t.reloadDocument&&"boolean"==typeof t.replace)return t}catch{}}(t.digest);if(e){const r=hL.get(t);if(r)throw r;const a=ND(e.location,n);if(ID&&!hL.get(t)){if(!a.isExternal&&!e.reloadDocument){const n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw hL.set(t,n),n}window.location.href=a.absoluteURL||a.to}return I("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function mL({routeContext:e,match:t,children:n}){const a=r.useContext(KM);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),I($M.Provider,{value:e,children:n})}function gL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vL(e){const t=r.useContext(YM);return UP(t,gL(e)),t}function fL(e){const t=function(e){const t=r.useContext($M);return UP(t,gL(e)),t}(e),n=t.matches[t.matches.length-1];return UP(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}const bL={},yL={};function wL(e,t){e||yL[t]||(yL[t]=!0,console.warn(t))}const CL=r.useOptimistic,xL=()=>{};class TL{status="pending";promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}})}}function kL({router:e,flushSync:t,onError:n,useTransitions:a}){const o=r.useContext(ZM);a=o||a;const[i,l]=r.useState(e.state),[s,c]=(d=i,CL?CL(d):[d,xL]);var d;const[u,h]=r.useState(),[p,m]=r.useState({isTransitioning:!1}),[g,v]=r.useState(),[f,b]=r.useState(),[y,w]=r.useState(),C=r.useRef(/* @__PURE__ */new Map),x=r.useCallback((o,{deletedFetchers:i,newErrors:s,flushSync:d,viewTransitionOpts:u})=>{s&&n&&Object.values(s).forEach(e=>n(e,{location:o.location,params:o.matches[0]?.params??{},pattern:SD(o.matches)})),o.fetchers.forEach((e,t)=>{void 0!==e.data&&C.current.set(t,e.data)}),i.forEach(e=>C.current.delete(e)),wL(!1===d||null!=t,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `tight-react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "tight-react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');const p=null!=e.window&&null!=e.window.document&&"function"==typeof e.window.document.startViewTransition;if(wL(null==u||p,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),u&&p){if(t&&d){t(()=>{f&&(g?.resolve(),f.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:u.currentLocation,nextLocation:u.nextLocation})});const n=e.window.document.startViewTransition(()=>{t(()=>l(o))});return n.finished.finally(()=>{t(()=>{v(void 0),b(void 0),h(void 0),m({isTransitioning:!1})})}),void t(()=>b(n))}f?(g?.resolve(),f.skipTransition(),w({state:o,currentLocation:u.currentLocation,nextLocation:u.nextLocation})):(h(o),m({isTransitioning:!0,flushSync:!1,currentLocation:u.currentLocation,nextLocation:u.nextLocation}))}else t&&d?t(()=>l(o)):!1===a?l(o):r.startTransition(()=>{!0===a&&c(e=>EL(e,o)),l(o)})},[e.window,t,f,g,a,c,n]);r.useLayoutEffect(()=>e.subscribe(x),[e,x]),r.useEffect(()=>{p.isTransitioning&&!p.flushSync&&v(new TL)},[p]),r.useEffect(()=>{if(g&&u&&e.window){const t=u,n=g.promise,o=e.window.document.startViewTransition(async()=>{!1===a?l(t):r.startTransition(()=>{!0===a&&c(e=>EL(e,t)),l(t)}),await n});o.finished.finally(()=>{v(void 0),b(void 0),h(void 0),m({isTransitioning:!1})}),b(o)}},[u,g,e.window,a,c]),r.useEffect(()=>{g&&u&&s.location.key===u.location.key&&g.resolve()},[g,f,s.location,u]),r.useEffect(()=>{!p.isTransitioning&&y&&(h(y.state),m({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),w(void 0))},[p.isTransitioning,y]);const T=r.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),k=e.basename||"/",E=r.useMemo(()=>({router:e,navigator:T,static:!1,basename:k,onError:n}),[e,T,k,n]);return R(N,{children:[I(KM.Provider,{value:E,children:I(YM.Provider,{value:s,children:I(QM.Provider,{value:C.current,children:I(GM.Provider,{value:p,children:I(RL,{basename:k,location:s.location,navigationType:s.historyAction,navigator:T,useTransitions:a,children:I(AL,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})})})})})}),null]})}function EL(e,t){return{...e,navigation:"idle"!==t.navigation.state?t.navigation:e.navigation,revalidation:"idle"!==t.revalidation?t.revalidation:e.revalidation,actionData:"submitting"!==t.navigation.state?t.actionData:e.actionData,fetchers:t.fetchers}}const AL=r.memo(function({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:o}){return cL(e,void 0,{manifest:t,state:r,isStatic:a,onError:o})});function SL({basename:e,children:t,initialEntries:n,initialIndex:a,useTransitions:o}){const i=r.useRef();null==i.current&&(i.current=VP({initialEntries:n,initialIndex:a,v5Compat:!0}));const l=i.current,[s,c]=r.useState({action:l.action,location:l.location}),d=r.useCallback(e=>{!1===o?c(e):r.startTransition(()=>c(e))},[o]);return r.useLayoutEffect(()=>l.listen(d),[l,d]),I(KM.Provider,{value:null,children:I(YM.Provider,{value:null,children:I(RL,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:l,useTransitions:o})})})}function IL(e){return function(e){const t=r.useContext($M).outlet;return r.useMemo(()=>t&&I(lL.Provider,{value:e,children:t}),[t,e])}(e.context)}function NL(e){UP(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function RL({basename:e="/",children:t=null,location:n,navigationType:a=FP.Pop,navigator:o,static:i=!1,useTransitions:l}){const s=e.replace(/^\/*/,"/"),c=r.useMemo(()=>({basename:s,navigator:o,static:i,useTransitions:l,future:{}}),[s,o,i,l]);"string"==typeof n&&(n=zP(n));const{pathname:d="/",search:u="",hash:h="",state:p=null,key:m="default",mask:g}=n,v=r.useMemo(()=>{const e=uD(d,s);return null==e?null:{location:{pathname:e,search:u,hash:h,state:p,key:m,mask:g},navigationType:a}},[s,d,u,h,p,m,a,g]);return BP(null!=v,`<Router basename="${s}"> is not able to match the URL "${d}${u}${h}" because it does not start with the basename, so the <Router> won't render anything.`),null==v?null:I(XM.Provider,{value:c,children:I($M.Provider,{value:PL,children:I(JM.Provider,{children:t,value:v})})})}const PL={outlet:null,matches:[],isDataRoute:!1};function DL({children:e,location:t}){return cL(ML(e),t)}function ML(e,t=[]){const n=[];return r.Children.forEach(e,(e,a)=>{if(!r.isValidElement(e))return;const o=[...t,a];if(e.type===r.Fragment)return void n.push.apply(n,ML(e.props.children,o));UP(e.type===NL,`[${"string"==typeof e.type?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),UP(!e.props.index||!e.props.children,"An index route cannot have child routes.");const i={id:e.props.id||o.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:!0===e.props.hasErrorBoundary||null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(i.children=ML(e.props.children,o)),n.push(i)}),n}const LL="get",FL="application/x-www-form-urlencoded";function OL(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}let VL=null;const UL=/* @__PURE__ */new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function BL(e){return null==e||UL.has(e)?e:(BP(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${FL}"`),null)}const HL="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{HL&&(window.__reactRouterVersion=REACT_ROUTER_VERSION)}catch(ir){}const WL=r.forwardRef(function({onClick:e,relative:t,reloadDocument:n,replace:a,mask:o,state:i,target:l,to:s,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:u,...h},p){const{basename:m,navigator:g,useTransitions:v}=r.useContext(XM),f=ND(s,m),b=function(e,{relative:t}={}){UP(nL(),"useHref() may be used only in the context of a <Router> component.");const{basename:n,navigator:a}=r.useContext(XM),{hash:o,pathname:i,search:l}=sL(e,{relative:t});let s=i;return"/"!==n&&(s="/"===i?n:wD([n,i])),a.createHref({pathname:s,search:l,hash:o})}(s=f.to,{relative:t}),y=rL();let w=null;if(o){const e=bD(o,[],y.mask?y.mask.pathname:"/",!0);"/"!==m&&(e.pathname="/"===e.pathname?m:wD([m,e.pathname])),w=g.createHref(e)}const C=function(e,{target:t,replace:n,mask:a,state:o,preventScrollReset:i,relative:l,viewTransition:s,defaultShouldRevalidate:c,useTransitions:d}={}){const u=iL(),h=rL(),p=sL(e,{relative:l});return r.useCallback(m=>{if(v=t,!(0!==(g=m).button||v&&"_self"!==v||(f=g,f.metaKey||f.altKey||f.ctrlKey||f.shiftKey))){m.preventDefault();const t=void 0!==n?n:WP(h)===WP(p),g=()=>u(e,{replace:t,mask:a,state:o,preventScrollReset:i,relative:l,viewTransition:s,defaultShouldRevalidate:c});d?r.startTransition(()=>g()):g()}var g,v,f},[h,u,p,n,a,o,t,e,i,l,s,c,d])}(s,{replace:a,mask:o,state:i,target:l,preventScrollReset:c,relative:t,viewTransition:d,defaultShouldRevalidate:u,useTransitions:v}),x=!(f.isExternal||n);return I("a",{...h,href:(x?w:void 0)||f.absoluteURL||b,onClick:x?function(t){e&&e(t),t.defaultPrevented||C(t)}:e,ref:p,target:l})});WL.displayName="Link";const zL=r.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:l,children:s,...c},d){const u=sL(i,{relative:c.relative}),h=rL(),p=r.useContext(YM),{navigator:m,basename:g}=r.useContext(XM),v=null!=p&&function(e,{relative:t}={}){const n=r.useContext(GM);UP(null!=n,"`useViewTransitionState` must be used within `tight-react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `tight-react-router`?");const{basename:a}=_L("useViewTransitionState"),o=sL(e,{relative:t});if(!n.isTransitioning)return!1;const i=uD(n.currentLocation.pathname,a)||n.currentLocation.pathname,l=uD(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=dD(o.pathname,l)||null!=dD(o.pathname,i)}(u)&&!0===l;let f=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,b=h.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(b=b.toLowerCase(),y=y?y.toLowerCase():null,f=f.toLowerCase()),y&&g&&(y=uD(y,g)||y);const w="/"!==f&&f.endsWith("/")?f.length-1:f.length,C=b===f||!a&&b.startsWith(f)&&"/"===b.charAt(w),x=null!=y&&(y===f||!a&&y.startsWith(f)&&"/"===y.charAt(f.length)),T={isActive:C,isPending:x,isTransitioning:v},k=C?e:void 0;let E;E="function"==typeof n?n(T):[n,C?"active":null,x?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");const A="function"==typeof o?o(T):o;return I(WL,{...c,"aria-current":k,className:E,ref:d,style:A,to:i,viewTransition:l,children:"function"==typeof s?s(T):s})});function _L(e){const t=r.useContext(KM);return UP(t,`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`),t}zL.displayName="NavLink",r.forwardRef(({fetcherKey:e,navigate:t,reloadDocument:n,replace:a,state:o,method:i=LL,action:l,onSubmit:s,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:h,...p},m)=>{const{useTransitions:g}=r.useContext(XM),v=function(){const{router:e}=_L("useSubmit"),{basename:t}=r.useContext(XM),n=fL("useRouteId"),a=e.fetch,o=e.navigate;return r.useCallback(async(e,r={})=>{const{action:i,method:l,encType:s,formData:c,body:d}=function(e,t){let n,r,a,o,i;if(OL(s=e)&&"form"===s.tagName.toLowerCase()){const i=e.getAttribute("action");r=i?uD(i,t):null,n=e.getAttribute("method")||LL,a=BL(e.getAttribute("enctype"))||FL,o=new FormData(e)}else if(OL(l=e)&&"button"===l.tagName.toLowerCase()||function(e){return OL(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){const i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');const s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?uD(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||LL,a=BL(e.getAttribute("formenctype"))||BL(i.getAttribute("enctype"))||FL,o=new FormData(i,e),!function(){if(null===VL)try{new FormData(document.createElement("form"),0),VL=!1}catch(l){VL=!0}return VL}()){const{name:t,type:n,value:r}=e;if("image"===n){const e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(OL(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=LL,r=null,a=FL,i=e}var l,s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}(e,t);if(!1===r.navigate){const e=r.fetcherKey||qL();await a(e,n,r.action||i,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||l,formEncType:r.encType||s,flushSync:r.flushSync})}else await o(r.action||i,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||l,formEncType:r.encType||s,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[a,o,t,n])}(),f=function(e,{relative:t}={}){const{basename:n}=r.useContext(XM),a=r.useContext($M);UP(a,"useFormAction must be used inside a RouteContext");const[o]=a.matches.slice(-1),i={...sL(e||".",{relative:t})},l=rL();if(null==e){i.search=l.search;const e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));const n=e.toString();i.search=n?`?${n}`:""}}return e&&"."!==e||!o?.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(i.pathname="/"===i.pathname?n:wD([n,i.pathname])),WP(i)}(l,{relative:c}),b="get"===i.toLowerCase()?"get":"post";return I("form",{ref:m,method:b,action:f,onSubmit:n?s:n=>{if(s&&s(n),n.defaultPrevented)return;n.preventDefault();const l=n.nativeEvent.submitter,p=l?.getAttribute("formmethod")||i,m=()=>v(l||n.currentTarget,{fetcherKey:e,method:p,navigate:t,replace:a,state:o,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:h});g&&!1!==t?r.startTransition(()=>m()):m()},...p})}).displayName="Form";let jL=0;const qL=()=>`__${String(++jL)}__`;function KL(){return I(ip,{color:"weak",alignment:"horizontal"})}function YL(e){return t=>{"Enter"!==t.key&&"Space"!==t.code||(t.preventDefault(),e?.(t))}}const ZL=or({base:{display:"flex",padding:"16px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...il,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),GL=or({base:{...no},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function QL({name:e,disabled:t,onClick:n}){const r=t?void 0:n,a=t?void 0:YL(n);return R("div",{className:ZL({disabled:t}),role:"button",tabIndex:t?-1:0,onKeyDown:a,onClick:r,children:[I("div",{className:GL({disabled:t??!1}),children:e}),!t&&I(Sd,{Component:rl})]})}const XL=tr({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),JL=tr({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 12px",width:"100%",cursor:"pointer"}),$L=tr(no,{color:"typography.base.weak"});function eF({label:e,defaultExpanded:t=!1,children:n}){const[r,a]=d(t),o=()=>a(e=>!e),i=YL(o);return R("div",{className:XL,children:[R("div",{className:JL,role:"button",tabIndex:0,"aria-expanded":r,onClick:o,onKeyDown:i,children:[I("div",{className:$L,children:e}),I(Sd,{Component:r?Lp:rl})]}),r&&n]})}const tF={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}},"profit-and-loss/general-ledger":{path:"general-ledger",route:"/profit-and-loss/general-ledger",handle:{label:"General Ledger"}},"balance-sheet":{path:"balance-sheet",route:"/balance-sheet",handle:{label:"Balance Sheet"}},"cash-flow-statement":{path:"cash-flow-statement",route:"/cash-flow-statement",handle:{label:"Cash Flow Statement"}}};function nF(){const e=iL();return u((t,n)=>{e(tF[t].route,n)},[e])}function rF(){const e=nF();return R(eF,{label:"Accounting",defaultExpanded:!0,children:[I(KL,{}),I(QL,{name:"Profit & Loss",onClick:()=>e("profit-and-loss")}),I(KL,{}),I(QL,{name:"Balance Sheet",onClick:()=>e("balance-sheet")}),I(KL,{}),I(QL,{name:"Cash Flow Statement",onClick:()=>e("cash-flow-statement")}),I(KL,{}),I(QL,{disabled:!0,name:"Trial Balance"})]})}function aF(){return R(eF,{label:"Income and Invoices",children:[I(KL,{}),I(QL,{disabled:!0,name:"Income Analysis"}),I(KL,{}),I(QL,{disabled:!0,name:"Accounts Receivable Aging"})]})}function oF(){return R(eF,{label:"Expenses and Bills",children:[I(KL,{}),I(QL,{disabled:!0,name:"Expense Analysis"}),I(KL,{}),I(QL,{disabled:!0,name:"Accounts Payable Aging"}),I(KL,{}),I(QL,{disabled:!0,name:"Time & Task Analysis"}),I(KL,{}),I(QL,{disabled:!0,name:"Mileage Analysis"})]})}function iF(){return R(eF,{label:"Taxes",children:[I(KL,{}),I(QL,{disabled:!0,name:"Schedule C"}),I(KL,{}),I(QL,{disabled:!0,name:"Form 1065"}),I(KL,{}),I(QL,{disabled:!0,name:"Form 1120-S"}),I(KL,{}),I(QL,{disabled:!0,name:"Form 1120"}),I(KL,{}),I(QL,{disabled:!0,name:"T2125"}),I(KL,{}),I(QL,{disabled:!0,name:"Tax Details for Filing"})]})}const lF=HN({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),sF=_N({gap:"16px",width:"100%"}),cF=KN({gap:"8px",alignItems:"center"}),dF=tr(no,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),uF=tr(no,{color:"typography.base"});function hF(){const e=function(){const{matches:e,loaderData:t}=vL("useMatches");return r.useMemo(()=>e.map(e=>XP(e,t)),[e,t])}(),t=iL(),n=e.flatMap(e=>function(e){try{return JV.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:I("nav",{className:cF,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return R(f,{children:[r>0&&I(cl,{Component:rl}),a?I("span",{className:uF,"aria-current":"page",children:e.label}):I("button",{type:"button",className:dF,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const pF=_N({gap:"16px",alignItems:"flex-start",width:"100%"}),mF=tr({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),gF=l(void 0);function vF({children:e}){const[t,n]=d(()=>yt(ut.LAST_6_MONTHS)),[r,a]=d("MONTHLY"),[o,i]=d("ACCRUAL"),[l,s]=d(void 0),[c,u]=d([]);return I(gF.Provider,{value:{dateRange:t,setDateRange:n,period:r,setPeriod:a,accountingMethod:o,setAccountingMethod:i,dimensionId:l,setDimensionId:s,reportDimensionFilters:c,setReportDimensionFilters:u},children:e})}const fF={[ut.LAST_6_MONTHS]:"Last 6 Months",[ut.LAST_12_MONTHS]:"Last 12 Months (TTM)",[ut.LAST_QUARTER]:"Last Quarter",[ut.LAST_YEAR]:"Last Year",[ut.THIS_QUARTER]:"This Quarter",[ut.THIS_YEAR]:"This Year"},bF=[ut.LAST_6_MONTHS,ut.LAST_12_MONTHS,ut.LAST_QUARTER,ut.LAST_YEAR,ut.THIS_QUARTER,ut.THIS_YEAR];const yF=tr({width:"200px",minWidth:"200px"}),wF={width:"fit-content"};function CF({onPresetSelect:e,onCustomSelect:t}){const{close:n}=kc();return I(Fc,{children:R(Lm,{style:yF,children:[bF.map((t,r)=>R(f,{children:[I(Wm,{onClick:()=>(e(t),void n()),children:I(To,{children:fF[t]})}),(1===r||3===r)&&I(ip,{alignment:"horizontal"})]},t)),I(ip,{alignment:"horizontal"}),I(QC,{triggerChildren:I($C,{displayLabel:"Custom"}),popupChildren:I(Fc,{style:wF,children:I(XI,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function xF({value:e,onChange:t}){const n=function(e){const t=Nt(e.endDate),n=Nt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:At(n)} - ${null===t?e.endDate:At(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${At(n)} - ${At(t)}`;const r=n.getFullYear(),a=t.getFullYear(),o=n.getMonth(),i=t.getMonth();return 0===o&&11===i?r===a?`${r}`:`${r} - ${a}`:r===a&&o===i?Mt(n,{abbreviateMonth:!0}):`${Mt(n,{abbreviateMonth:!0})} - ${Mt(t,{abbreviateMonth:!0})}`}(e);return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:oE}),I(sc,{wrap:"nowrap",children:n})]})}),I(CF,{onPresetSelect:e=>{t(yt(e))},onCustomSelect:e=>{t(e)}})]})}const TF={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},kF={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},EF=["NONE","MONTHLY","QUARTERLY","YEARLY"],AF=tr({width:"200px",minWidth:"200px"});function SF({onSelect:e}){const{close:t}=kc();return I(Fc,{children:I(Lm,{style:AF,children:EF.map(n=>I(Wm,{onClick:()=>(e(n),void t()),children:I(To,{children:TF[n]})},n))})})}function IF({value:e,onChange:t}){const n=kF[e];return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:ou}),I(sc,{wrap:"nowrap",children:n})]})}),I(SF,{onSelect:t})]})}function NF({popupTriggerProps:e,text:t}){return R(pf,{popupTriggerChildrenProps:e,children:[I(iS,{children:I(sc,{wrap:"wrap",children:t})}),I(Sd,{Component:rl})]})}function RF({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=YT(n,e.key),i=QT(e.name,o,1);return R(Tc,{children:[I(Ec,{children:e=>I(NF,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>ZT(n,e.key,t))},filters:a})]})}const PF=vi(mg,"Bank");function DF({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(iI,{isSelected:n}):I(uf,{selected:n,showEmptyIndicator:!0});return R(pf,{handleClick:t,selected:n,children:[R(iS,{children:[o&&I(Td,{imageUrl:e.iconUrl,Component:PF}),I(sc,{wrap:"wrap",children:e.name})]}),i]})}function MF({values:e,model:t,pendingFilters:n,onClick:r}){return I(sf,{title:I(Eo,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=YT(n,t.key),i=(l=e,o.some(e=>C(e.value,l.value)));var l;return I(DF,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(rf,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function LF({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ae(e,Zm),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return I(MF,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function FF({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I($v,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:LF,DefaultList:MF,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function OF({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=kc();return I(Kv,{title:"Back",Footer:I(AS,{onClearAll:()=>{a(e=>ZT(e,t.key,[]))},onApply:()=>{const e=YT(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?I(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):I(FF,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function VF({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=kc();return I(AS,{onApply:()=>{n(GT(e)),a()},onClearAll:()=>{t(e=>ZT(e,r,[]))}})}function UF({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=YT(n,e.key),a=e.singleSelect?(o=r,i=t,l=e.createFilter,o.some(e=>C(e.value,i.value))?o:[l(i)]):function(e,t,n){const r=e.findIndex(e=>C(e.value,t.value));return-1!==r?e.filter((e,t)=>t!==r):[...e,n(t)]}(r,t,e.createFilter);var o,i,l;return ZT(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=I(Kv,{title:"Back",Footer:I(VF,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:I(e.SimpleListComponent,{filters:t,pendingFilters:n,onToggle:o,model:e,setPendingFilters:r,setFilters:a})});else if(void 0!==e.possibleValues){const{values:l,isFilling:s}=e.possibleValues();if(sr(l)||!Je(l))return null;if(s)return I(vf,{});i=I(OF,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=YT(n,e.key),s=QT(e.name,l);return R(Tc,{children:[I(Ec,{children:e=>I(NF,{popupTriggerProps:e,text:s})}),i]})}const BF=tr({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function HF({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=wT();return I("div",{className:BF,children:I(sf,{title:I(Eo,{children:"Filter by"}),children:t.filter(e=>{return n=o,(t=e)&&(n||!n&&!t.hideInFilterListOnDesktop);var t,n}).map(t=>{const o=t.possibleValues?t.possibleValues():null;return sr(o)&&void 0===t.SimpleListComponent?I(RF,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):I(UF,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function WF(e){return function(e){const t=[],n=/* @__PURE__ */new Set;for(const r of e){const{id:e,name:a,requiredness:o}=r.dimension;if(sr(e)||n.has(e))continue;const i=r.children.find(e=>!sr(e.dimension.id)),l=i?.dimension,s=l?.id,c=s?{id:s,name:l?.name??"",status:"ACTIVE",requiredness:l?.requiredness??"NOT_REQUIRED",child:null}:null;n.add(e),t.push({id:e,name:a??"",status:"ACTIVE",requiredness:o??"NOT_REQUIRED",child:c})}return t}(e?.data??[]).sort((e,t)=>e.id.localeCompare(t.id))}function zF(){return eI({select:WF})}function _F(e){return!sr(e)&&e.startsWith("dimension_")}const jF=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:xi(t[1].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function qF(){return Vr({queryKey:["dimensions"],queryFn:jF})}function KF({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=qF(),{query:{data:i}}=eI(),l=_F(t?.key)?t.key:"dimension_NO_MODEL_YOU_MESSED_UP",s=o(()=>a?.data??[],[a]),c=o(()=>(i?.data??[]).filter(t=>t.dimension.id===e.id).filter(e=>{if(e.children.length>0)return!0;const t=s.find(t=>t.id===e.dimension?.id);return!t||!qf(t)}).map(e=>[e,...e.children]),[i,s,e.id]),d=o(()=>c.flat(),[c]),u=o(()=>{const e=n.get(l),t={};return e?.forEach(e=>{const n=e.value[l];void 0!==n&&(t[n.value.dimensionValueId]=!0)}),t},[n,l]);return I(eb,{fieldDimension:e.name,dimensionValueOptions:c,dimensions:s,flatDimensionValues:d,selectedRow:u,setSelectedRow:e=>{if(void 0===r)return;const n=Object.entries(e).filter(([,e])=>e).flatMap(([e])=>{if(void 0===t)return[];const n=d.find(t=>t.id===e);if(void 0===n)return[];const r=n.name??"",a=n.dimension.id??"";return[t.createFilter({name:r,value:{[l]:{name:r,value:{dimensionId:a,dimensionValueId:e}}}})]});r(e=>ZT(e,l,n))},allowMultiselect:!0})}function YF(e,t){return $e({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>I(KF,{...e,dimension:t})})}function ZF({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=tI(),t=function(){const{query:{data:e}}=zF();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,YF(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:rS(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=kc(),[a,i]=d(()=>KT(e,n));return I(qv,{title:"Filter By",padChildren:!1,Footer:I(AS,{onApply:()=>{t(GT(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:I(HF,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function GF({filters:e,setFilters:t}){const{open:n}=kc();return I(Ov,{overlay:!0,children:n&&I(ZF,{filters:e,setFilters:t})})}function QF({filters:e,setFilters:t}){return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:WI}),I(sc,{wrap:"nowrap",children:"Filters"})]})}),I(GF,{filters:e,setFilters:t})]})}const XF=e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_43563_992)"},r.createElement("path",{d:"M5.99982 3.61C6.78959 3.61 7.42982 2.96977 7.42982 2.18C7.42982 1.39023 6.78959 0.75 5.99982 0.75C5.21006 0.75 4.56982 1.39023 4.56982 2.18C4.56982 2.96977 5.21006 3.61 5.99982 3.61Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.705 11.25C2.23243 11.25 2.66 10.8224 2.66 10.295C2.66 9.76756 2.23243 9.34 1.705 9.34C1.17757 9.34 0.75 9.76756 0.75 10.295C0.75 10.8224 1.17757 11.25 1.705 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M5.99992 11.25C6.52735 11.25 6.95492 10.8224 6.95492 10.295C6.95492 9.76756 6.52735 9.34 5.99992 9.34C5.47249 9.34 5.04492 9.76756 5.04492 10.295C5.04492 10.8224 5.47249 11.25 5.99992 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.2948 11.25C10.8223 11.25 11.2498 10.8224 11.2498 10.295C11.2498 9.76756 10.8223 9.34 10.2948 9.34C9.76741 9.34 9.33984 9.76756 9.33984 10.295C9.33984 10.8224 9.76741 11.25 10.2948 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.70508 9.33998V6.47998H10.2951V9.33998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6 9.33999V3.61499",strokeMiterlimit:10,strokeLinecap:"square"})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_43563_992"},r.createElement("rect",{width:12,height:12,fill:"none"})))),JF=vi(XF,"DimensionValue"),$F=tr({width:"200px",minWidth:"200px"});function eO({labels:e,onSelect:t}){const{close:n}=kc(),r=e=>{t(e),n()};return I(Fc,{children:R(Lm,{style:$F,children:[I(Wm,{onClick:()=>r(void 0),children:I(To,{children:"None"})}),e.map(e=>I(Wm,{onClick:()=>r(e.id),children:I(To,{children:e.name})},e.id))]})})}function tO({value:e,onChange:t}){const{query:{data:n=[]}}=zF();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:JF}),I(sc,{wrap:"nowrap",children:a})]})}),I(eO,{labels:n,onSelect:t})]})}function nO({accountingMethod:e,onChange:t,textOverrides:n}){const r=o(()=>{return e=n?.cash,t=n?.accrual,[{label:t??"Accrual",value:"ACCRUAL"},{label:e??"Cash",value:"CASH"}];var e,t},[n?.cash,n?.accrual]),a=o(()=>Object.fromEntries(r.map((e,t)=>[e.value,t])),[r])[e],i=u(e=>{t(r[e].value)},[t,r]);return I("div",{children:I(Df,{width:"fit",options:r,selectedIndex:a,handleClick:i})})}const rO=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.1641 9.87903V14.125H0.835876V9.87903",strokeMiterlimit:10}),r.createElement("path",{d:"M7.49988 10.4883V0.1875",strokeMiterlimit:10}),r.createElement("path",{d:"M11.7395 6.85162L7.4999 11.0913L3.26025 6.85162",strokeMiterlimit:10})),"Download");function aO(){return R(Xs,{disabled:!0,children:[I(cl,{Component:rO}),I(sc,{children:"Export Report"})]})}function oO(){return R(Xs,{disabled:!0,children:[I(cl,{Component:Nd}),I(sc,{children:"Send Report"})]})}function iO({filters:e,setFilters:t}){return e.map((n,r)=>I(hb,{text:n.name,onClickRemove:()=>t(Xe(e,r)),additionalValidClassName:lr["filter-pill"]},n.id))}function lO(){const e=i(gF);if(void 0===e)throw new Error("useReportPreviewContext must be used within a ReportPreviewProvider");return e}const sO=KN({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),cO=KN({gap:"8px",flexWrap:"wrap"});function dO({hasDimensionFiltering:e=!0,textOverrides:t}){const{dateRange:n,setDateRange:r,period:a,setPeriod:o,accountingMethod:i,setAccountingMethod:l,dimensionId:s,setDimensionId:c,reportDimensionFilters:d,setReportDimensionFilters:u}=lO();return R(N,{children:[R("div",{className:sO,children:[R("div",{className:cO,children:[I(xF,{value:n,onChange:r}),I(IF,{value:a,onChange:o}),e&&I(QF,{filters:d,setFilters:u}),e&&I(tO,{value:s,onChange:c})]}),R("div",{className:cO,children:[I(nO,{textOverrides:t?.accountingMethod,accountingMethod:i,onChange:l}),I(aO,{}),I(oO,{})]})]}),e&&I(gN,{children:I(iO,{filters:d,setFilters:u})})]})}const uO=or({base:{border:"inherit",whiteSpace:"nowrap",padding:"6px 8px",color:"typography.base"},variants:{alignment:{end:{textAlign:"end"},start:{textAlign:"start"},center:{textAlign:"center"}},weight:{inherit:{},regular:no,bold:ro},clickable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},false:{cursor:"inherit"}},border:{left:{borderLeftStyle:"solid",borderLeftWidth:"md",borderLeftColor:"border.layout"},right:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout"}},stickyLeft:{true:{position:"sticky",left:0,zIndex:1,backgroundColor:"inherit",_scrolledX:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout",filter:"drop-shadow(4px 2px 4px rgba(0, 0, 0, 0.05))"}}}},defaultVariants:{alignment:"end",clickable:!1,weight:"inherit",stickyLeft:!1}});function hO({children:e,colspan:t,...n}){return I("th",{colSpan:t,className:uO({...n}),children:e})}const pO=or({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:no,bold:ro},expandable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},false:{cursor:"auto"}},rowType:{normal:{},expandTotal:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout"},reportTotal:{borderTopWidth:"4px",borderTopStyle:"double",borderTopColor:"border.layout.strong",borderBottomWidth:"4px",borderBottomStyle:"double",borderBottomColor:"border.layout.strong"},sectionStart:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout.strong"},sectionEnd:{borderBottomWidth:"md",borderBottomStyle:"solid",borderBottomColor:"border.layout.strong"}}},defaultVariants:{weight:"regular",expandable:!1,rowType:"normal"}}),mO=GN({name:"report-table-container",containerType:"scroll-state",overflowX:"auto",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout",width:"fit-content",maxWidth:"100%",paddingBottom:"16px",maxHeight:"80dvh",isolation:"isolate",boxSizing:"border-box"}),gO=tr({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),vO=tr({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),fO=tr({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function bO({table:e}){const t=a(null),n=u(()=>{const e=r.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[r=t]);var r;const o=e.getExpandedRowModel().rows;return I("div",{className:mO,ref:t,onScroll:n,children:R("table",{className:gO,children:[I("thead",{className:vO,children:e.getHeaderGroups().map(e=>I("tr",{className:fO,children:e.headers.map((e,t)=>e.isPlaceholder?I(hO,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):I(f,{children:X(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),I("tbody",{children:o.map((e,t)=>{const n=e.getCanExpand(),r=n?()=>e.toggleExpanded():void 0,a=e.original.type,i=n||"expandTotal"===a?"bold":"regular";let l=e.original.type;if(t<o.length-1){const e=o[t+1];"sectionEnd"===a&&"reportTotal"===e.original.type&&(l=void 0)}return I("tr",{className:pO({rowType:l,expandable:n,weight:i}),onClick:r,children:e.getVisibleCells().map(e=>I(f,{children:X(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})}const yO=e=>["reports","profitAndLoss",e],wO=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result?r.data:void 0};function CO(e){const t=[];return{caboose:()=>[...t],car(e){return t.push(e),this}}}const xO="Total";function TO(e){return Ir(e)?xO:`${xO} ${e}`}function kO(e){if(void 0!==e)return vo(sh(e),{cents:"always",signage:"parens"})}function EO(e){if(!sr(e))return vo(sh(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function AO(e,t,n,r){return e.map((e,a)=>{const o=`${t}.${a}`,i=e=>n(e)?.[a],l=r(i),s=e.children??[],c=s.length>0?AO(s,o,e=>i(e)?.children,r):void 0;return{key:o,label:e.name,values:l,accountId:e.accountId??void 0,subrows:c}})}function SO(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function IO(e){if(!sr(e))return vo(e,{cents:"always",decorator:"%",signage:"parens"})}function NO({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return I("td",{rowSpan:e,onClick:n,className:uO({clickable:r??void 0!==n,...a}),children:t})}const RO=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e}),"Nothing");function PO({expanded:e,canExpand:t=!0}){return I(Sc,{Component:t?e?Lp:rl:RO})}const DO=tr({alignItems:"center",display:"flex",gap:8});function MO({depth:e=0,children:t}){return I("div",{className:DO,style:{paddingLeft:9*e},children:t})}function LO({context:e}){const t=e.table.getIsAllRowsExpanded();return I(NO,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:R(MO,{children:[I(PO,{expanded:t}),t?"Collapse All":"Expand All"]})})}function FO(e){return"expandTotal"===e.row.original.type?e.row.depth-1:e.row.depth}function OO({context:e}){return I(NO,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:R(MO,{depth:FO(e),children:[I(PO,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})}const VO=J();function UO(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const BO=VO.accessor("label",{id:"label",header:e=>I(LO,{context:e}),cell:e=>I(OO,{context:e})});const HO={placeholderData:L},WO=S.object({glAccountId:S.string(),dateRange:S.object({start:S.string().optional(),end:S.string().optional()}).optional(),accountingMethod:S.enum(["CASH","ACCRUAL"])}),zO=[];function _O(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function jO(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!_F(e.modelKey))return;const n=e.value[e.modelKey];if(void 0===n)return;const{dimensionId:r,dimensionValueId:a}=n.value;t.set(r,[...t.get(r)??[],a])}),0!==t.size)return Array.from(t.entries()).map(([e,t])=>({dimensionId:e,dimensionValueIds:t}))}function qO(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=lO(),i=function(){const e=nF();return u((t,n)=>{e(t,{state:n})},[e])}(),{query:{data:l},isFilling:s}=(c={filter:{...e,dimensionValues:jO(a),customerIds:_O(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},d=HO,Vr({queryKey:yO(c??{}),queryFn:wO,...d}));var c,d;const h=u((e,t)=>{sr(e.accountId)||i("profit-and-loss/general-ledger",{glAccountId:e.accountId,dateRange:{start:t.period?.beginDate,end:t.period?.endDate},accountingMethod:n})},[i,n]),p=o(()=>function(e){const t=e?.json;if(void 0===t)return[];const n=/* @__PURE__ */function(e){return(t,n)=>{const r=n((i=e,i[0]?.data?.[0]??{})),a=r?.name,o=SO(e,e=>EO(n(e)?.total));var i;return{key:t,label:a,values:o,subrows:[...AO(r?.children??[],t,e=>n(e)?.children,t=>SO(e,e=>kO(t(e)?.total))),{key:`${t}.total`,label:TO(a),type:"expandTotal",values:o}]}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,type:a,values:SO(e,r)})}(t);return CO().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>EO(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>IO(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>EO(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>IO(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>EO(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}(l),[l]),m=o(()=>function(e,t){const n=e?.json??[],r=n[0],a=r?.data,o=n.map((e,o)=>{const i=e.data?.length??0,l=o!==n.length-1&&(i>1||a?.[0]?.name!==r?.name),s=(d=o,u=l,h=t,void 0===(c=e).data?[]:c.data.map((e,t)=>VO.accessor(`values.${d}[${t}]`,{header:t=>I(hO,{border:UO(t.column)?"left":void 0,weight:u?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.original,n=e.row.getCanExpand()&&e.row.getIsExpanded(),r=void 0!==h&&Nr(t.accountId)?()=>h(t,c):void 0;return I(NO,{border:UO(e.column)?"left":void 0,alignment:"end",onClick:r,children:!n&&e.cell.getValue()})}})));var c,d,u,h;return l?VO.group({id:`valueRecord.${o}`,header:t=>I(hO,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:s}):s[0]});return[BO,...o]}(l,h),[l,h]);return{table:$({data:p??zO,columns:m,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{income:!0,cogs:!0,expenses:!0,otherExpenses:!0,otherIncome:!0},columnPinning:{left:["label"]}}}),isFilling:s}}function KO(){const{table:e,isFilling:t}=qO();return R(N,{children:[I(dO,{hasDimensionFiltering:!0}),!t&&I(bO,{table:e})]})}const YO=e=>["reports","balanceSheet",e],ZO=async e=>{const t=e.queryKey,n={path:"/v6/reports/balanceSheet",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result?r.data:void 0};function GO(e,t){const n=e.map((e,n)=>[`${n}[0]`,t(e)]);return Object.fromEntries(n)}function QO(e,t,n,r){const a=GO(n,e=>EO(r(e)?.total)),o=[...AO(e.children??[],t,e=>r(e)?.children,e=>GO(n,t=>kO(e(t)?.total))),{key:`${t}.total`,label:TO(e.name),type:"expandTotal",values:a}];return{key:t,label:e.name,values:a,subrows:o}}const XO=TO("Liabilities and Equity");const JO=J(),$O=JO.accessor("label",{id:"label",header:e=>I(LO,{context:e}),cell:e=>I(OO,{context:e})});const eV=[];function tV(){const{dateRange:e,period:t,accountingMethod:n}=lO(),{query:{data:r},isFilling:a}=(i=HO,Vr({queryKey:YO({filter:e,grouping:{period:t},accountingMethod:n}),queryFn:ZO,...i}));var i;const l=o(()=>function(e){return function(e){const t=e?.json;if(void 0===t||0===t.length)return[];const n=t[0],r=CO(),a=n.assets;a&&r.car(QO(a,"assets",t,e=>e.assets));const o=n.liabilitiesAndEquity?.liabilities;o&&r.car(QO(o,"liabilities",t,e=>e.liabilitiesAndEquity?.liabilities));const i=n.liabilitiesAndEquity?.equity;i&&r.car(QO(i,"equity",t,e=>e.liabilitiesAndEquity?.equity));const l=n.liabilitiesAndEquity?.name;return r.car({key:"totalLiabilitiesAndEquity",label:void 0!==l?TO(l):XO,type:"reportTotal",values:GO(t,e=>EO(e.liabilitiesAndEquity?.total))}),r.caboose().filter(e=>void 0!==Object.values(e.values)[0])}(e)}(r),[r]),s=o(()=>function(e){const t=(e?.json??[]).map((e,t)=>{return n=e,r=t,JO.accessor(`values.${r}[0]`,{header:()=>I(hO,{border:"left",weight:"bold",alignment:"end",children:n.name}),cell:e=>{const t=e.row.getCanExpand()&&e.row.getIsExpanded();return I(NO,{border:"left",alignment:"end",children:!t&&e.cell.getValue()})}});var n,r});return[$O,...t]}(r),[r]);return{table:$({data:l??eV,columns:s,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{assets:!0,liabilities:!0,equity:!0},columnPinning:{left:["label"]}}}),isFilling:a}}function nV(){const{table:e,isFilling:t}=tV();return R(N,{children:[I(dO,{hasDimensionFiltering:!1}),!t&&I(bO,{table:e})]})}const rV=e=>["reports","cashFlowStatement",e],aV=async e=>{const t=e.queryKey,n={path:"/v6/reports/cashFlowStatement",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result?r.data:void 0};function oV(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function iV(e,t,n,r){const a=AO(e.children??[],t,e=>r(e)?.children,e=>oV(n,t=>kO(e(t)?.total))),o=oV(n,e=>EO(r(e)?.total)),i=[...a,{key:`${t}.total`,label:TO(e.name),type:"expandTotal",values:o}];return{key:t,label:e.name,values:o,subrows:i}}const lV=J();function sV(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const cV=lV.accessor("label",{id:"label",header:e=>I(LO,{context:e}),cell:e=>I(OO,{context:e})});const dV=[];function uV(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!_F(e.modelKey))return;const n=e.value[e.modelKey];if(void 0===n)return;const{dimensionId:r,dimensionValueId:a}=n.value;t.set(r,[...t.get(r)??[],a])}),0!==t.size)return Array.from(t.entries()).map(([e,t])=>({dimensionId:e,dimensionValueIds:t}))}function hV(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=lO(),{query:{data:i},isFilling:l}=(s={filter:{...e,dimensionValues:uV(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},c=HO,Vr({queryKey:rV(s??{}),queryFn:aV,...c}));var s,c;const d=o(()=>function(e){return function(e){const t=e?.json;if(void 0===t||0===t.length)return[];const n=t[0].data?.[0];if(!n)return[];const r=CO();return n.operatingActivities&&r.car(iV(n.operatingActivities,"operatingActivities",t,e=>e.operatingActivities)),n.investingActivities&&r.car(iV(n.investingActivities,"investingActivities",t,e=>e.investingActivities)),n.financingActivities&&r.car(iV(n.financingActivities,"financingActivities",t,e=>e.financingActivities)),r.car({key:"changeInCash",label:"Change in Cash",type:"sectionStart",values:oV(t,e=>EO(e.netCashChange))}),r.car({key:"beginCash",label:"Beginning Cash",values:oV(t,e=>EO(e.beginCashBalance))}),r.car({key:"endCash",label:"End Cash",type:"reportTotal",values:oV(t,e=>EO(e.endCashBalance))}),r.caboose().filter(e=>void 0!==Object.values(e.values)[0])}(e)}(i),[i]),u=o(()=>function(e){const t=e?.json??[],n=t[0],r=n?.data,a=t.map((e,a)=>{const o=e.data?.length??0,i=a!==t.length-1&&(o>1||r?.[0]?.name!==n?.name),l=(c=a,d=i,void 0===(s=e).data?[]:s.data.map((e,t)=>lV.accessor(`values.${c}[${t}]`,{header:t=>I(hO,{border:sV(t.column)?"left":void 0,weight:d?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.getCanExpand()&&e.row.getIsExpanded();return I(NO,{border:sV(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?lV.group({id:`valueRecord.${a}`,header:t=>I(hO,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[cV,...a]}(i),[i]);return{table:$({data:d??dV,columns:u,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{operatingActivities:!0,investingActivities:!0,financingActivities:!0},columnPinning:{left:["label"]}}}),isFilling:l}}const pV={accountingMethod:{cash:"Cash (Direct)",accrual:"Accrual (Indirect)"}};function mV(){const{table:e,isFilling:t}=hV();return R(N,{children:[I(dO,{hasDimensionFiltering:!0,textOverrides:pV}),!t&&I(bO,{table:e})]})}const gV=e=>r.createElement("svg",{width:90,height:24,viewBox:"0 0 90 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M15.6182 11.5362V8.24941C15.6182 3.87291 12.0796 0.325012 7.71366 0.325012H1.375V12.1459H15.0099C15.1782 12.1459 15.3141 12.2822 15.3141 12.4508V15.7376C15.3141 20.1141 18.8534 23.662 23.2194 23.662H29.558V11.8411H15.9231C15.7549 11.8411 15.619 11.7049 15.619 11.5362H15.6182Z",fill:"white"}),r.createElement("path",{d:"M52.4967 23.6612V20.9282H59.1775C60.8137 20.9282 61.7406 20.1628 61.7406 18.3313V16.336C60.7045 17.5392 59.1225 18.2218 57.3504 18.2218C53.3969 18.2218 50.5337 15.2147 50.5337 11.3336C50.5337 7.45246 53.6153 4.4729 57.3779 4.4729C59.15 4.4729 60.7595 5.12881 61.7956 6.41387V4.74613H64.6863V18.1951C64.6863 21.9943 62.2865 23.662 59.0958 23.662H52.4967V23.6612ZM61.6589 11.3336C61.6589 8.98237 59.941 7.26112 57.5954 7.26112C55.2499 7.26112 53.5595 8.98318 53.5595 11.3336C53.5595 13.684 55.2499 15.4069 57.5954 15.4069C59.941 15.4069 61.6589 13.6848 61.6589 11.3336Z",fill:"white"}),r.createElement("path",{d:"M43.3378 18.3037C40.2563 18.3037 38.7842 16.9643 38.7842 14.1485V7.53353H36.5479V4.74531H38.1024C38.5116 4.74531 38.7842 4.47209 38.7842 3.97995V1.35632H41.8108V4.74612H45.41V7.53434H41.8108V13.8486C41.8108 14.9147 42.3292 15.4612 43.5562 15.4612H45.4108V18.3045H43.3386L43.3378 18.3037Z",fill:"white"}),r.createElement("path",{d:"M66.536 18.3037V0.325012H69.5633V6.11224C70.4086 5.07365 71.7172 4.47207 73.3809 4.47207C76.7351 4.47207 79.1073 6.85004 79.1073 10.595V18.3037H76.0799V10.8682C76.0799 8.65399 74.8805 7.34217 72.9167 7.34217C70.9529 7.34217 69.5625 8.70912 69.5625 10.8682V18.3037H66.5352H66.536Z",fill:"white"}),r.createElement("path",{d:"M86.0307 18.3037C82.9491 18.3037 81.4771 16.9643 81.4771 14.1485V7.53353H79.2407V4.74531H80.7953C81.2045 4.74531 81.4771 4.47209 81.4771 3.97995V1.35632H84.5037V4.74612H88.1029V7.53434H84.5037V13.8486C84.5037 14.9147 85.0221 15.4612 86.2491 15.4612H88.1037V18.3045H86.0315L86.0307 18.3037Z",fill:"white"}),r.createElement("path",{d:"M49.3991 4.74609H46.3726V18.3045H49.3991V4.74609Z",fill:"white"}),r.createElement("path",{d:"M48.1859 0.325012H46.3726V3.22998H49.3991V1.54116C49.3991 0.869845 48.8564 0.325012 48.1859 0.325012Z",fill:"white"})),vV=tr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"center",paddingTop:"15%",width:"100%",height:"100vh"}),fV=tr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"flex-start"}),bV=tr({display:"flex",flexDirection:"column",gap:"24px",width:{xl:"368px",sm:"316px",base:"auto"},minHeight:{md:"110px",base:"140px"},padding:"36px 24px",alignItems:"flex-start",borderRadius:"4px",backgroundLinear:"to-t",gradientFrom:"#009C75",gradientTo:"#2AD17B",gradientFromPosition:"23.41%",gradientToPosition:"106.24%"}),yV=tr({display:"flex",flexDirection:"column",gap:"12px"}),wV=tr({fontFamily:"Duplet Semibold, sans-serif",fontWeight:"md",fontSize:"md",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),CV=tr({fontFamily:"Duplet Regular, sans-serif",fontWeight:"sm",fontSize:"md",lineHeight:"template",letterSpacing:"0.84px",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),xV=tr({display:"inline"});function TV(){const e=Bk();return I("div",{className:vV,children:R("div",{className:fV,children:[e&&I(Fk,{}),R("div",{className:bV,children:[I(gV,{width:89,height:24,overflow:"visible"}),R("div",{className:yV,children:[R("span",{className:xV,children:[I("span",{className:wV,children:"This component is currently only available in the "}),I("a",{className:wV,href:"https://docs.tight.com/v5.0/embeddable-ui/white-labeled-experience/how-to-embed",target:"_blank",rel:"noreferrer",children:"v5 Javascript SDK"})]}),R("span",{className:xV,children:[I("span",{className:CV,children:"It will be available in "}),I("a",{className:CV,href:"https://docs.tight.com/embeddable-ui/tight-embeddable-ui",target:"_blank",rel:"noreferrer",children:"v6 React Components"}),I("span",{className:CV,children:" soon"})]})]})]})]})})}function kV({onClick:e,accounts:t,listLabel:n,nestedTitle:r,isFilling:a,selectedAccountId:o,onSelect:i,Header:l}){return a?I(yf,{}):R(N,{children:[l,I(sf,{title:I(To,{children:n}),children:t.map(t=>t.hasChilds?I(lS,{text:t.name,iconUrl:t.iconUrl,title:r,children:I(EV,{accounts:t.children,selectedAccountId:o,onSelect:i,listLabel:t.name,nestedTitle:r})},t.id):I(mf,{handleClick:()=>e(t),selected:t.id===o,children:I(iS,{children:I(sc,{wrap:"wrap",children:t.name})})},t.id))})]})}function EV({accounts:e,selectedAccountId:t,onSelect:n,isFilling:r=!1,listLabel:a="All Accounts",placeholder:o="Search accounts...",nestedTitle:i="All Accounts",Header:l}){const s=kc(),c=e=>{n(e),s.close()},d=t?/* @__PURE__ */new Set([t]):/* @__PURE__ */new Set;return I($v,{placeholder:o,onClick:c,SearchList:({searchTerm:t,onClick:n})=>I(bS,{searchTerm:t,onClick:n,glAccounts:e,isFilling:r,selectedIds:d}),DefaultList:kV,listLength:e.length,extraProps:{accounts:e,listLabel:a,nestedTitle:i,isFilling:r,selectedAccountId:t,onSelect:c,Header:l},forceSearchVisible:!0})}const AV=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function SV({children:e,...t}){return I("button",{className:AV,type:"button",...t,children:e})}const IV=tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",minWidth:"280px"});function NV({isMobile:e}){const t=kc(),n=a(e);return s(()=>{n.current!==e&&(n.current=e,t.close())},[e,t]),null}function RV({selectedAccountId:e,onSelect:t}){const{query:{data:n},isFilling:r}=mC({select:e=>TC(e.filter(e=>"ACTIVE"===e.status))});return I(Kv,{title:"Select Account",overlay:!0,children:I(EV,{accounts:n??[],isFilling:r,onSelect:t,selectedAccountId:e})})}function PV({onSelect:e}){return I(rx,{onClick:e,activeOnly:!0})}function DV({selectedAccountId:e,onSelect:t,initialOpen:n=!1}){const r=wT(),{query:{data:a}}=mC(),o=a?.find(t=>t.id===e);return R(Tc,{placement:"bottom-start",initialOpen:n,children:[I(NV,{isMobile:r}),I(Ec,{children:e=>{return I(wp,{label:"Account",popupTriggerProps:e,additionalStyles:IV,children:R(SV,{children:[I(sc,{intent:o?"default":"weak",children:(t=o,t?(n=t.accountNo,r=t.name,`${n?`#${n}`:""} ${r??""}`.trim()):"Select an account")}),I(Sd,{Component:rl})]})});var t,n,r}}),r?I(RV,{selectedAccountId:e,onSelect:t}):I(PV,{onSelect:t})]})}const MV=(e,t)=>["generalLedger",e,t],LV=async e=>{const t=e.queryKey,n={path:"/v6/accounting/glAccounts/{id}/generalLedger",pathParams:{id:t[1]},bodyParams:{...t[2],cursor:t[3].cursor},accessToken:t[4].accessToken,endpointManager:xi(t[4].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor,beginningBalance:r.beginningBalance}:{data:void 0,cursor:void 0,beginningBalance:void 0}};function FV({name:e,align:t="left"}){return I(Kc,{align:t,padding:"right"===t?"large":"default",children:I(vc,{children:e})})}const OV={...gw,INVOICE:"Invoice",BILL:"Bill",PAYROLL:"Payroll",JOURNAL_ENTRY:"Journal Entry"};function VV(e){return null===e||0===e?"":yo(sh(e))}function UV({entry:e}){return I(ic,{children:I(Mw,{label:e.entity?.displayName??"",subLabel:e.entity?.secondaryDisplayName??void 0,iconSpacing:!1})})}function BV({label:e}){return I(ic,{children:I(sc,{children:e})})}function HV({balance:e}){return I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:(t=e??null,wo(null===t?0:sh(t)))})});var t}const WV=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"100%"});function zV(e){return function(t){return"entry"!==t.row.original.kind?null:I(e,{entry:t.row.original.entry})}}const _V=J(),jV=[_V.display({id:"date",cell:zV(function({entry:e}){return I(ic,{children:I(hw,{date:e.date})})}),header:()=>I(FV,{name:"Date"}),size:100,maxSize:130}),_V.display({id:"type",cell:zV(function({entry:e}){return I(ic,{children:I(sc,{children:(t=e.type,sr(t)?"":OV[t])})});var t}),header:()=>I(FV,{name:"Type"}),size:110}),_V.display({id:"source",cell:e=>{const t=e.row.original;if("entry"===t.kind)return I(UV,{entry:t.entry});const n="beginningBalance"===t.kind?"Beginning Balance":"Ending Balance";return I(BV,{label:n})},header:()=>I(FV,{name:"Source"}),size:180}),_V.display({id:"debit",cell:zV(function({entry:e}){return I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:VV(e.drAmount)})})}),header:()=>I(FV,{name:"Debit",align:"right"}),size:100,maxSize:130}),_V.display({id:"credit",cell:zV(function({entry:e}){return I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:VV(e.crAmount)})})}),header:()=>I(FV,{name:"Credit",align:"right"}),size:100,maxSize:130}),_V.display({id:"balance",cell:e=>{const t=e.row.original,n="entry"===t.kind?t.entry.runningBalance:t.balance;return I(HV,{balance:n})},header:()=>I(FV,{name:"Balance",align:"right"}),size:110,maxSize:140}),_V.display({id:"account",cell:zV(function({entry:e}){const t=e.glAccount?.iconUrl,n=Nr(t)?Cg(t,""):void 0;return I(ic,{children:R("div",{className:WV,children:[n&&I(Sd,{Component:n}),I(sc,{children:e.glAccount?.displayName??""})]})})}),header:()=>I(FV,{name:"Account"}),size:140}),_V.display({id:"drilldown",cell:zV(function(){return I(ic,{alignVariant:"center",children:I(Sd,{Component:rl})})}),size:40,maxSize:60})];function qV(e){return"beginningBalance"===e.kind?"__beginning_balance__":"endingBalance"===e.kind?"__ending_balance__":e.entry.id??""}const KV=_N({gap:"16px",alignItems:"stretch",width:"100%"}),YV=tr({alignSelf:"flex-start"}),ZV=tr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}),GV=[];function QV({glAccountId:e,onGlAccountChange:t,dateRange:n,accountingMethod:r,limit:a=100}){const i=o(()=>function(e){if(void 0!==e)return{beginDate:e.start,endDate:e.end}}(n),[n]),{query:{data:l},isFilling:s,paginationControls:c}=function(e,t={},n){return kl({queryKey:MV(e??"",t),queryFn:LV,...n,enabled:Nr(e)&&!0})}(e,{filter:i,accountingMethod:r,limit:a}),d=l?.data,u=l?.beginningBalance,h=o(()=>{if(void 0===d||0===d.length)return GV;const e=[];c.hasPreviousPage||e.push({kind:"beginningBalance",balance:u});for(const t of d)e.push({kind:"entry",entry:t});if(!c.hasNextPage){const t=d[d.length-1];e.push({kind:"endingBalance",balance:t.runningBalance})}return e},[d,u,c.hasPreviousPage,c.hasNextPage]),p=function({rows:e}){return $({data:e,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,columns:jV,getCoreRowModel:ee(),getRowId:qV})}({rows:h});return R("div",{className:KV,children:[I("div",{className:YV,children:I(DV,{selectedAccountId:e,onSelect:e=>t(e.id)})}),e&&R(sl.Provider,{value:c,children:[I(nc,{dashboard:"generalLedger",children:s?I(wl,{numColumns:jV.length}):R(N,{children:[I(Hl,{headerGroups:p.getHeaderGroups()}),h.length>0?I(zl,{children:p.getRowModel().rows.map(e=>I(ns,{rowData:e,shouldDisplayDivider:()=>!1},e.id))}):I(Cd,{children:I(sc,{children:"No entries for this account."})})]})}),I("div",{className:ZV,children:I(ml,{})})]})]})}const XV=_N({gap:"16px",alignItems:"flex-start",width:"100%"}),JV=S.object({label:S.string()}),$V=(eU=[{path:tF["/"].path,errorElement:I(N,{}),element:I(IL,{}),handle:tF["/"].handle,children:[{index:!0,Component:function(){const e=Bk();return R("div",{className:lF,children:[e&&I(Fk,{}),R("div",{className:sF,children:[I(rF,{}),I(aF,{}),I(oF,{}),I(iF,{})]})]})}},{Component:function(){return R("div",{className:pF,children:[I(hF,{}),I("div",{className:mF,children:I(IL,{})})]})},children:[{path:tF["profit-and-loss"].path,element:I(IL,{}),handle:tF["profit-and-loss"].handle,children:[{index:!0,Component:function(){return I(vF,{children:I(KO,{})})}},{path:tF["profit-and-loss/general-ledger"].path,Component:function(){const e=ze(),{state:t}=rL(),n=(r=t,WO.safeParse(r).success?t:void 0);var r;const[a,o]=d(n?.glAccountId),[i,l]=d(n?.dateRange),[s,c]=d(n?.accountingMethod??tn);return e?I("div",{className:XV,children:I(QV,{glAccountId:a,onGlAccountChange:o,dateRange:i,onDateRangeChange:l,accountingMethod:s,onAccountingMethodChange:c})}):I(TV,{})},handle:tF["profit-and-loss/general-ledger"].handle}]},{path:tF["balance-sheet"].path,Component:function(){return I(vF,{children:I(nV,{})})},handle:tF["balance-sheet"].handle},{path:tF["cash-flow-statement"].path,Component:function(){return I(vF,{children:I(mV,{})})},handle:tF["cash-flow-statement"].handle}]}]}],function(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,n=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement;UP(e.routes.length>0,"You must provide a non-empty routes array to createRouter");const r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||ZD;let o=a;if(e.instrumentations){const t=e.instrumentations;o=e=>({...a(e),...PD(t.map(e=>e.route).filter(Boolean),e)})}let i={};const l=new XD(ZP(e.routes,o,void 0,i));let s=e.basename||"/";s.startsWith("/")||(s=`/${s}`);const c=e.dataStrategy||dM,d={...e.future};let u=null;const h=/* @__PURE__ */new Set;let p,m,g,v=null,f=null,b=null,y=null,w=null!=e.hydrationData,C=QP(l.activeRoutes,e.history.location,s,!1,l.branches),x=!1,T=null;if(null!=C||e.patchRoutesOnNavigation)if(C&&!e.hydrationData&&pe(C,l.activeRoutes,e.history.location.pathname).active&&(C=null),C)if(C.some(e=>e.route.lazy))p=!1,m=!p;else if(C.some(e=>tM(e.route))){const t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;let r=C;if(n){const e=C.findIndex(e=>void 0!==n[e.route.id]);r=r.slice(0,e+1)}m=!1,p=!0,r.forEach(e=>{const r=nM(e.route,t,n);m=m||r.renderFallback,p=p&&!r.shouldLoad})}else p=!0,m=!p;else{p=!1,m=!p,C=[];const t=pe(null,l.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(x=!0,C=t.matches)}else{const t=NM(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=IM(l.activeRoutes);p=!0,m=!p,C=n,T={[r.id]:t}}let k,E={historyAction:e.history.action,location:e.history.location,matches:C,initialized:p,renderFallback:m,navigation:qD,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||T,fetchers:/* @__PURE__ */new Map,blockers:/* @__PURE__ */new Map},A=FP.Pop,S=null,I=!1,N=!1;const R=/* @__PURE__ */new Map;let P=null,D=!1,M=!1;const L=/* @__PURE__ */new Set,F=/* @__PURE__ */new Map;let O=0,V=-1;const U=/* @__PURE__ */new Map,B=/* @__PURE__ */new Set,H=/* @__PURE__ */new Map,W=/* @__PURE__ */new Map,z=/* @__PURE__ */new Set,_=/* @__PURE__ */new Map;let j,q=null;function K(e,t={}){e.matches&&(e.matches=e.matches.map(e=>{const t=i[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e})),E={...E,...e};const n=[],r=[];E.fetchers.forEach((e,t)=>{"idle"===e.state&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{E.fetchers.has(e)||F.has(e)||n.push(e)}),0===h.size&&(v={newErrors:e.errors??null}),[...h].forEach(r=>r(E,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),n.forEach(e=>ne(E.fetchers,e)),r.forEach(e=>E.fetchers.delete(e))}function Y(t,n,{flushSync:r}={}){const a=null!=E.actionData&&null!=E.navigation.formMethod&&UM(E.navigation.formMethod)&&"loading"===E.navigation.state&&!0!==t.state?._isRedirect;let o;o=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:a?E.actionData:null;const i=n.loaderData?EM(E.loaderData,n.loaderData,n.matches||[],n.errors):E.loaderData;let s=E.blockers;s.size>0&&(s=new Map(s),s.forEach((e,t)=>s.set(t,YD)));const c=!D&&he(t,n.matches||E.matches),d=!0===I||null!=E.navigation.formMethod&&UM(E.navigation.formMethod)&&!0!==t.state?._isRedirect;let u;if(l.commitHmrRoutes(),D||A===FP.Pop||(A===FP.Push?e.history.push(t,t.state):A===FP.Replace&&e.history.replace(t,t.state)),A===FP.Pop){const e=R.get(E.location.pathname);e&&e.has(t.pathname)?u={currentLocation:E.location,nextLocation:t}:R.has(t.pathname)&&(u={currentLocation:t,nextLocation:E.location})}else if(N){let e=R.get(E.location.pathname);e?e.add(t.pathname):(e=/* @__PURE__ */new Set([t.pathname]),R.set(E.location.pathname,e)),u={currentLocation:E.location,nextLocation:t}}K({...n,actionData:o,loaderData:i,historyAction:A,location:t,initialized:!0,renderFallback:!1,navigation:qD,revalidation:"idle",restoreScrollPosition:c,preventScrollReset:d,blockers:s},{viewTransitionOpts:u,flushSync:!0===r}),A=FP.Pop,I=!1,N=!1,D=!1,M=!1,S?.resolve(),S=null,q?.resolve(),q=null}async function Z(t,n,a){k&&k.abort(),k=null,A=t,D=!0===(a&&a.startUninterruptedRevalidation),function(e,t){if(f&&y){const n=ue(e,t);f[n]=y()}}(E.location,E.matches),I=!0===(a&&a.preventScrollReset),N=!0===(a&&a.enableViewTransition);const c=l.activeRoutes;let d=a?.initialHydration&&E.matches&&E.matches.length>0&&!x?E.matches:QP(c,n,s,!1,l.branches),u=!0===(a&&a.flushSync);if(d&&E.initialized&&!M&&(h=E.location,p=n,h.pathname===p.pathname&&h.search===p.search&&(""===h.hash?""!==p.hash:h.hash===p.hash||""!==p.hash))&&!(a&&a.submission&&UM(a.submission.formMethod)))return void Y(n,{matches:d},{flushSync:u});var h,p;const m=pe(d,c,n.pathname);if(m.active&&m.matches&&(d=m.matches),!d){const{error:e,notFoundMatches:t,route:r}=de(n.pathname);return void Y(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}let g=a&&a.overrideNavigation?{...a.overrideNavigation,matches:d,historyAction:t}:void 0;k=new AbortController;let v=wM(e.history,n,k.signal,a&&a.submission);const b=e.getContext?await e.getContext():new jP;let w;if(a&&a.pendingError)w=[SM(d).route.id,{type:_P.error,error:a.pendingError}];else if(a&&a.submission&&UM(a.submission.formMethod)){const c=await async function(t,n,a,c,d,u,h,p,m={}){$();const g=function(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}(n,c,d,a);if(K({navigation:g},{flushSync:!0===m.flushSync}),h){const e=await me(c,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){const{matches:t,route:n}=IM(l.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:_P.error,error:e.error}]}}const t=SM(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:_P.error,error:e.error}]}}if(!e.matches){const{notFoundMatches:e,error:t,route:r}=de(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:_P.error,error:t}]}}c=e.matches}let v;const f=HM(c,n);if(f.route.action||f.route.lazy){const e=gM(o,i,t,n,c,f,p?[]:r,u),a=await X(t,n,e,u,null);if(v=a[f.route.id],!v)for(const t of c)if(a[t.route.id]){v=a[t.route.id];break}if(t.signal.aborted)return{shortCircuited:!0}}else v={type:_P.error,error:NM(405,{method:t.method,pathname:n.pathname,routeId:f.route.id})};if(FM(v)){let n;return n=m&&null!=m.replace?m.replace:yM(v.response.headers.get("Location"),new URL(t.url),s,e.history)===E.location.pathname+E.location.search,await Q(t,v,!0,{submission:a,replace:n}),{shortCircuited:!0}}if(LM(v)){const e=SM(c,f.route.id);return!0!==(m&&m.replace)&&(A=FP.Push),{matches:c,pendingActionResult:[e.route.id,v,f.route.id]}}return{matches:c,pendingActionResult:[f.route.id,v]}}(v,n,a.submission,d,t,b,m.active,a&&!0===a.initialHydration,{replace:a.replace,flushSync:u});if(c.shortCircuited)return;if(c.pendingActionResult){const[e,t]=c.pendingActionResult;if(LM(t)&&AD(t.error)&&404===t.error.status)return k=null,void Y(n,{matches:c.matches,loaderData:{},errors:{[e]:t.error}})}d=c.matches||d,w=c.pendingActionResult,g=zM(n,d,t,a.submission),u=!1,m.active=!1,v=wM(e.history,v.url,v.signal)}const{shortCircuited:C,matches:T,loaderData:S,errors:R,workingFetchers:P}=await async function(t,n,a,c,d,u,h,p,m,g,v,f,b,y){const w=h||zM(n,a,c,p),C=p||m||WM(w),x=!D&&!v;if(u){if(x){const e=G(b);K({navigation:w,...void 0!==e?{actionData:e}:{}},{flushSync:f})}const e=await me(a,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){const{matches:t,route:n}=IM(l.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}const t=SM(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(!e.matches){const{error:e,notFoundMatches:t,route:r}=de(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}a=e.matches}const T=l.activeRoutes,{dsMatches:A,revalidatingFetchers:S}=eM(t,d,o,i,e.history,E,a,C,n,v?[]:r,!0===v,M,L,z,H,B,T,s,null!=e.patchRoutesOnNavigation,l.branches,b,y);if(V=++O,!e.dataStrategy&&!A.some(e=>e.shouldLoad)&&!A.some(e=>e.route.middleware&&e.route.middleware.length>0)&&0===S.length){const e=new Map(E.fetchers),t=oe(e);return Y(n,{matches:a,loaderData:{},errors:b&&LM(b[1])?{[b[0]]:b[1].error}:null,...AM(b),...t?{fetchers:e}:{}},{flushSync:f}),{shortCircuited:!0}}if(x){const e={};if(!u){e.navigation=w;const t=G(b);void 0!==t&&(e.actionData=t)}S.length>0&&(e.fetchers=function(e){const t=new Map(E.fetchers);return e.forEach(e=>{const n=t.get(e.key),r=_M(void 0,n?n.data:void 0);t.set(e.key,r)}),t}(S)),K(e,{flushSync:f})}S.forEach(e=>{re(e.key),e.controller&&F.set(e.key,e.controller)});const I=()=>S.forEach(e=>re(e.key));k&&k.signal.addEventListener("abort",I);const{loaderResults:N,fetcherResults:R}=await J(A,S,t,n,d);if(t.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",I),S.forEach(e=>F.delete(e.key));let P=RM(N);if(P)return await Q(t,P.result,!0,{replace:g}),{shortCircuited:!0};if(P=RM(R),P)return B.add(P.key),await Q(t,P.result,!0,{replace:g}),{shortCircuited:!0};const U=new Map(E.fetchers);let{loaderData:W,errors:_}=kM(E,a,N,b,S,R,U);v&&E.errors&&(_={...E.errors,..._});const j=oe(U),q=ie(V,U);return{matches:a,loaderData:W,errors:_,...j||q||S.length>0?{workingFetchers:U}:{}}}(v,n,d,t,b,m.active,g,a&&a.submission,a&&a.fetcherSubmission,a&&a.replace,a&&!0===a.initialHydration,u,w,a&&a.callSiteDefaultShouldRevalidate);C||(k=null,Y(n,{matches:T||d,...AM(w),loaderData:S,errors:R,...P?{fetchers:P}:{}}))}function G(e){return e&&!LM(e[1])?{[e[0]]:e[1].data}:E.actionData?0===Object.keys(E.actionData).length?null:E.actionData:void 0}async function Q(r,a,o,{submission:i,fetcherSubmission:l,preventScrollReset:c,replace:d}={}){o||(S?.resolve(),S=null),a.response.headers.has("X-Remix-Revalidate")&&(M=!0);let u=a.response.headers.get("Location");UP(u,"Expected a Location header on the redirect Response"),u=yM(u,new URL(r.url),s,e.history);const h=HP(E.location,u,{_isRedirect:!0});if(n){let e=!1;if(a.response.headers.has("X-Remix-Reload-Document"))e=!0;else if(pD(u)){const n=function(e,t,n=!1){let r="http://localhost";e&&(r="null"!==e.location.origin?e.location.origin:e.location.href),UP(r,"No window.location.(origin|href) available to create URL");let a="string"==typeof t?t:WP(t);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}(t,u,!0);e=n.origin!==t.location.origin||null==uD(n.pathname,s)}if(e)return void(d?t.location.replace(u):t.location.assign(u))}k=null;const p=!0===d||a.response.headers.has("X-Remix-Replace")?FP.Replace:FP.Push,{formMethod:m,formAction:g,formEncType:v}=E.navigation;!i&&!l&&m&&g&&v&&(i=WM(E.navigation));const f=i||l;if(jD.has(a.response.status)&&f&&UM(f.formMethod))await Z(p,h,{submission:{...f,formAction:u},preventScrollReset:c||I,enableViewTransition:o?N:void 0});else{const e=zM(h,[],p,i);await Z(p,h,{overrideNavigation:e,fetcherSubmission:l,preventScrollReset:c||I,enableViewTransition:o?N:void 0})}}async function X(e,t,n,r,a){let o;const i={};try{o=await async function(e,t,n,r,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));const i={request:t,url:CM(t,n),pattern:SD(r),params:r[0].params,context:o,matches:r},l=await e({...i,fetcherKey:a,runClientMiddleware:e=>{const t=i;return uM(t,()=>e({...t,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch(s){}return l}(c,e,t,n,a,r)}catch(l){return n.filter(e=>e.shouldLoad).forEach(e=>{i[e.route.id]={type:_P.error,error:l}}),i}if(e.signal.aborted)return i;if(!UM(e.method))for(const s of n){if(o[s.route.id]?.type===_P.error)break;o.hasOwnProperty(s.route.id)||E.loaderData.hasOwnProperty(s.route.id)||E.errors&&E.errors.hasOwnProperty(s.route.id)||!s.shouldCallHandler()||(o[s.route.id]={type:_P.error,result:new Error(`No result returned from dataStrategy for route ${s.route.id}`)})}for(const[c,d]of Object.entries(o))if(MM(d)){const t=d.result;i[c]={type:_P.redirect,response:fM(t,e,c,n,s)}}else i[c]=await vM(d);return i}async function J(e,t,n,r,a){const o=X(n,r,e,a,null),i=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){const t=(await X(e.request,e.path,e.matches,a,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:_P.error,error:NM(404,{pathname:e.path})}})}));return{loaderResults:await o,fetcherResults:(await i).reduce((e,t)=>Object.assign(e,t),{})}}function $(){M=!0,H.forEach((e,t)=>{F.has(t)&&L.add(t),re(t)})}function ee(e,t,n={}){const r=new Map(E.fetchers);r.set(e,t),K({fetchers:r},{flushSync:!0===(n&&n.flushSync)})}function te(e,t,n,r={}){const a=SM(E.matches,t),o=new Map(E.fetchers);ne(o,e),K({errors:{[a.route.id]:n},fetchers:o},{flushSync:!0===(r&&r.flushSync)})}function ne(e,t){const n=E.fetchers.get(t);!F.has(t)||n&&"loading"===n.state&&U.has(t)||re(t),H.delete(t),U.delete(t),B.delete(t),z.delete(t),L.delete(t),e.delete(t)}function re(e,t){const n=F.get(e);n&&(n.abort(t),F.delete(e))}function ae(e,t){for(const n of e){const e=t.get(n);UP(e,`Expected fetcher: ${n}`);const r=jM(e.data);t.set(n,r)}}function oe(e){const t=[];let n=!1;for(const r of B){const a=e.get(r);UP(a,`Expected fetcher: ${r}`),"loading"===a.state&&(B.delete(r),t.push(r),n=!0)}return ae(t,e),n}function ie(e,t){const n=[];for(const[r,a]of U)if(a<e){const e=t.get(r);UP(e,`Expected fetcher: ${r}`),"loading"===e.state&&(re(r),U.delete(r),n.push(r))}return ae(n,t),n.length>0}function le(e){E.blockers.delete(e),_.delete(e)}function se(e,t){const n=E.blockers.get(e)||YD;UP("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,`Invalid blocker state transition: ${n.state} -> ${t.state}`);const r=new Map(E.blockers);r.set(e,t),K({blockers:r})}function ce({currentLocation:e,nextLocation:t,historyAction:n}){if(0===_.size)return;_.size>1&&BP(!1,"A router only supports one blocker at a time");const r=Array.from(_.entries()),[a,o]=r[r.length-1],i=E.blockers.get(a);return i&&"proceeding"===i.state?void 0:o({currentLocation:e,nextLocation:t,historyAction:n})?a:void 0}function de(e){const t=NM(404,{pathname:e}),n=l.activeRoutes,{matches:r,route:a}=IM(n);return{notFoundMatches:r,route:a,error:t}}function ue(e,t){return b&&b(e,t.map(e=>XP(e,E.loaderData)))||e.key}function he(e,t){if(f){const n=ue(e,t),r=f[n];if("number"==typeof r)return r}return null}function pe(t,n,r){if(e.patchRoutesOnNavigation){const e=l.branches;if(!t)return{active:!0,matches:QP(n,r,s,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:QP(n,r,s,!0,e)}}return{active:!1,matches:null}}async function me(t,n,r,a){if(!e.patchRoutesOnNavigation)return{type:"success",matches:t};let c=t;for(;;){const t=i;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:c,fetcherKey:a,patch:(e,n)=>{r.aborted||aM(e,n,l,t,o,!1)}})}catch(d){return{type:"error",error:d,partialMatches:c}}if(r.aborted)return{type:"aborted"};const u=l.branches,h=QP(l.activeRoutes,n,s,!1,u);let p=null;if(h){if(0===Object.keys(h[0].params).length)return{type:"success",matches:h};if(p=QP(l.activeRoutes,n,s,!0,u),!(p&&c.length<p.length&&ge(c,p.slice(0,c.length))))return{type:"success",matches:h}}if(p||(p=QP(l.activeRoutes,n,s,!0,u)),!p||ge(c,p))return{type:"success",matches:null};c=p}}function ge(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}return g={get basename(){return s},get future(){return d},get state(){return E},get routes(){return l.stableRoutes},get branches(){return l.branches},get manifest(){return i},get window(){return t},initialize:function(){if(u=e.history.listen(({action:t,location:n,delta:r})=>{if(j)return j(),void(j=void 0);BP(0===_.size||null!=r,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");const a=ce({currentLocation:E.location,nextLocation:n,historyAction:t});if(a&&null!=r){const t=new Promise(e=>{j=e});return e.history.go(-1*r),se(a,{state:"blocked",location:n,proceed(){se(a,{state:"proceeding",proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){const e=new Map(E.blockers);e.set(a,YD),K({blockers:e})}}),S?.resolve(),void(S=null)}return Z(t,n)}),n){!function(e,t){try{const n=e.sessionStorage.getItem(GD);if(n){const e=JSON.parse(n);for(const[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch(n){}}(t,R);const e=()=>function(e,t){if(t.size>0){const r={};for(const[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(GD,JSON.stringify(r))}catch(n){BP(!1,`Failed to save applied view transitions in sessionStorage (${n}).`)}}}(t,R);t.addEventListener("pagehide",e),P=()=>t.removeEventListener("pagehide",e)}return E.initialized||Z(FP.Pop,E.location,{initialHydration:!0}),g},subscribe:function(e){if(h.add(e),v){const{newErrors:t}=v;v=null,e(E,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>h.delete(e)},enableScrollRestoration:function(e,t,n){if(f=e,y=t,b=n||null,!w&&E.navigation===qD){w=!0;const e=he(E.location,E.matches);null!=e&&K({restoreScrollPosition:e})}return()=>{f=null,y=null,b=null}},navigate:async function t(n,r){if(S?.resolve(),S=null,"number"==typeof n){S||(S=qM());const t=S.promise;return e.history.go(n),t}const a=JD(E.location,E.matches,s,n,r?.fromRouteId,r?.relative),{path:o,submission:i,error:l}=$D(!1,a,r);let c;r?.mask&&(c={pathname:"",search:"",hash:"",..."string"==typeof r.mask?zP(r.mask):{...E.location.mask,...r.mask}});const d=E.location;let u=HP(d,o,r&&r.state,void 0,c);u={...u,...e.history.encodeLocation(u)};const h=r&&null!=r.replace?r.replace:void 0;let p=FP.Push;!0===h?p=FP.Replace:!1===h||null!=i&&UM(i.formMethod)&&i.formAction===E.location.pathname+E.location.search&&(p=FP.Replace);const m=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,g=!0===(r&&r.flushSync),v=ce({currentLocation:d,nextLocation:u,historyAction:p});v?se(v,{state:"blocked",location:u,proceed(){se(v,{state:"proceeding",proceed:void 0,reset:void 0,location:u}),t(n,r)},reset(){const e=new Map(E.blockers);e.set(v,YD),K({blockers:e})}}):await Z(p,u,{submission:i,pendingError:l,preventScrollReset:m,replace:r&&r.replace,enableViewTransition:r&&r.viewTransition,flushSync:g,callSiteDefaultShouldRevalidate:r&&r.defaultShouldRevalidate})},fetch:async function(t,n,a,c){re(t);const d=!0===(c&&c.flushSync),u=l.activeRoutes,h=JD(E.location,E.matches,s,a,n,c?.relative);let p=QP(u,h,s,!1,l.branches);const m=pe(p,u,h);if(m.active&&m.matches&&(p=m.matches),!p)return void te(t,n,NM(404,{pathname:h}),{flushSync:d});const{path:g,submission:v,error:f}=$D(!0,h,c);if(f)return void te(t,n,f,{flushSync:d});const b=e.getContext?await e.getContext():new jP,y=!0===(c&&c.preventScrollReset);v&&UM(v.formMethod)?await async function(t,n,a,c,d,u,h,p,m,g){$(),H.delete(t);const v=E.fetchers.get(t);var f,b;ee(t,(b=v,{state:"submitting",formMethod:(f=m).formMethod,formAction:f.formAction,formEncType:f.formEncType,formData:f.formData,json:f.json,text:f.text,data:b?b.data:void 0}),{flushSync:h});const y=new AbortController,w=wM(e.history,a,y.signal,m);if(u){const e=await me(c,new URL(w.url).pathname,w.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void te(t,n,e.error,{flushSync:h});if(!e.matches)return void te(t,n,NM(404,{pathname:a}),{flushSync:h});c=e.matches}const C=HM(c,a);if(!C.route.action&&!C.route.lazy){const e=NM(405,{method:m.formMethod,pathname:a,routeId:n});return void te(t,n,e,{flushSync:h})}F.set(t,y);const x=O,T=gM(o,i,w,a,c,C,r,d),S=await X(w,a,T,d,t);let I=S[C.route.id];if(!I)for(const e of T)if(S[e.route.id]){I=S[e.route.id];break}if(w.signal.aborted)return void(F.get(t)===y&&F.delete(t));if(z.has(t)){if(FM(I)||LM(I))return void ee(t,jM(void 0))}else{if(FM(I))return F.delete(t),V>x?void ee(t,jM(void 0)):(B.add(t),ee(t,_M(m)),Q(w,I,!1,{fetcherSubmission:m,preventScrollReset:p}));if(LM(I))return void te(t,n,I.error)}const N=E.navigation.location||E.location,R=wM(e.history,N,y.signal),P=l.activeRoutes,D="idle"!==E.navigation.state?QP(P,E.navigation.location,s,!1,l.branches):E.matches;UP(D,"Didn't find any matches after fetcher action");const W=++O;U.set(t,W);const{dsMatches:_,revalidatingFetchers:j}=eM(R,d,o,i,e.history,E,D,m,N,r,!1,M,L,z,H,B,P,s,null!=e.patchRoutesOnNavigation,l.branches,[C.route.id,I],g),q=_M(m,I.data),Z=new Map(E.fetchers);Z.set(t,q),j.filter(e=>e.key!==t).forEach(e=>{const t=e.key,n=Z.get(t),r=_M(void 0,n?n.data:void 0);Z.set(t,r),re(t),e.controller&&F.set(t,e.controller)}),K({fetchers:Z});const G=()=>j.forEach(e=>re(e.key));y.signal.addEventListener("abort",G);const{loaderResults:ne,fetcherResults:ae}=await J(_,j,R,N,d);if(y.signal.aborted)return;y.signal.removeEventListener("abort",G),U.delete(t),F.delete(t),j.forEach(e=>F.delete(e.key));const oe=E.fetchers.has(t),le=e=>{if(!oe)return e;const n=new Map(e.fetchers);return n.set(t,jM(I.data)),{...e,fetchers:n}};let se=RM(ne);if(se)return E=le(E),Q(R,se.result,!1,{preventScrollReset:p});if(se=RM(ae),se)return B.add(se.key),E=le(E),Q(R,se.result,!1,{preventScrollReset:p});const ce=new Map(E.fetchers);oe&&ce.set(t,jM(I.data));const{loaderData:de,errors:ue}=kM(E,D,ne,void 0,j,ae,ce);ie(W,ce),"loading"===E.navigation.state&&W>V?(UP(A,"Expected pending action"),k&&k.abort(),Y(E.navigation.location,{matches:D,loaderData:de,errors:ue,fetchers:ce})):(K({errors:ue,loaderData:EM(E.loaderData,de,D,ue),fetchers:ce}),M=!1)}(t,n,g,p,b,m.active,d,y,v,c&&c.defaultShouldRevalidate):(H.set(t,{routeId:n,path:g}),await async function(t,n,a,l,s,c,d,u,h){const p=E.fetchers.get(t);ee(t,_M(h,p?p.data:void 0),{flushSync:d});const m=new AbortController,g=wM(e.history,a,m.signal);if(c){const e=await me(l,new URL(g.url).pathname,g.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void te(t,n,e.error,{flushSync:d});if(!e.matches)return void te(t,n,NM(404,{pathname:a}),{flushSync:d});l=e.matches}const v=HM(l,a);F.set(t,m);const f=O,b=gM(o,i,g,a,l,v,r,s),y=await X(g,a,b,s,t);let w=y[v.route.id];if(!w)for(const e of l)if(y[e.route.id]){w=y[e.route.id];break}if(F.get(t)===m&&F.delete(t),!g.signal.aborted){if(!z.has(t))return FM(w)?V>f?void ee(t,jM(void 0)):(B.add(t),void(await Q(g,w,!1,{preventScrollReset:u}))):void(LM(w)?te(t,n,w.error):ee(t,jM(w.data)));ee(t,jM(void 0))}}(t,n,g,p,b,m.active,d,y,v))},revalidate:function(){q||(q=qM()),$(),K({revalidation:"loading"});const e=q.promise;return"submitting"===E.navigation.state?e:"idle"===E.navigation.state?(Z(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),e):(Z(A||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:!0===N}),e)},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:function(e){return W.set(e,(W.get(e)||0)+1),z.has(e)&&z.delete(e),E.fetchers.get(e)||KD},resetFetcher:function(e,t){re(e,t?.reason),ee(e,jM(null))},deleteFetcher:function(e){const t=(W.get(e)||0)-1;t<=0?(W.delete(e),z.add(e)):W.set(e,t),K({fetchers:new Map(E.fetchers)})},dispose:function(){u&&u(),P&&P(),h.clear(),k&&k.abort(),E.fetchers.forEach((e,t)=>ne(E.fetchers,t)),E.blockers.forEach((e,t)=>le(t))},getBlocker:function(e,t){const n=E.blockers.get(e)||YD;return _.get(e)!==t&&_.set(e,t),n},deleteBlocker:le,patchRoutes:function(e,t,n=!1){aM(e,t,l,i,o,n),l.hasHMRRoutes||K({})},_internalFetchControllers:F,_internalSetRoutes:function(e){i={},l.setHmrRoutes(ZP(e,o,void 0,i))},_internalSetStateDoNotUseOrYouWillBreakYourApp(e){K(e)}},e.instrumentations&&(g=function(e,t){const n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){const t=Object.keys(e);for(const r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){const t=e.navigate[RD]??e.navigate,r=DD(n.navigate,t,(...t)=>{const[n,r]=t;return{to:"number"==typeof n||"string"==typeof n?n:n?WP(n):".",...FD(e,r??{})}});r&&(r[RD]=t,e.navigate=r)}if(n.fetch.length>0){const t=e.fetch[RD]??e.fetch,r=DD(n.fetch,t,(...t)=>{const[n,,r,a]=t;return{href:r??".",fetcherKey:n,...FD(e,a??{})}});r&&(r[RD]=t,e.fetch=r)}return e}(g,e.instrumentations.map(e=>e.router).filter(Boolean))),g}({basename:undefined,getContext:undefined,future:undefined,history:VP({initialEntries:undefined,initialIndex:undefined}),hydrationData:undefined,routes:eU,hydrationRouteProperties:["HydrateFallback","hydrateFallbackElement"],mapRouteProperties:function(e){const t={hasErrorBoundary:e.hasErrorBoundary||null!=e.ErrorBoundary||null!=e.errorElement};return e.Component&&Object.assign(t,{element:r.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:r.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:r.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t},dataStrategy:undefined,patchRoutesOnNavigation:undefined,instrumentations:undefined}).initialize());var eU;function tU(){return s(()=>()=>{$V.navigate(tF["/"].route)},[]),I(kL,{router:$V})}function nU(){return I(Kk,{children:I(tU,{})})}const rU=Pe("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),aU={queryClient:Lr,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await rU).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await rU).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await rU).delete("queryClient",e)}(e)}}}(),maxAge:Mr,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function oU({children:e}){return I(De,{client:Lr,persistOptions:aU,children:e})}const iU=tr({position:"absolute",top:0,left:{base:0,sm:"auto"},right:0,bottom:{base:0,sm:"auto"},width:"100%",height:"100%",minWidth:"100%",minHeight:"100%",maxHeight:"100%",maxWidth:"100%",overflow:"hidden",overscrollBehavior:{base:"contain",xl:"none"}}),lU=tr({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:"overlay",overscrollBehavior:{base:"contain",xl:"none"}}),sU=gr(null,lr.component,iU);function cU({children:e}){const t=a(null),n=a(null),r=wT();return m(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),I(fe,{children:I(be,{lockScroll:!0,className:lU,children:I("div",{onMouseDown:e=>{n.current=e.target},onClick:e=>{const r=n.current===t.current,a=e.target===t.current;r&&a&&(n.current=null,dn.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...sU,children:e})})})}const dU=l({closingQueue:[],drawerHistory:[]});function uU({children:e}){const t=dn(e=>e.drawerHistory),n=dn(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(dU.Provider,{value:r,children:a&&I(cU,{children:e})})}const hU=l({isActive:!0,isClosing:!1});function pU({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=i(dU),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),l=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==l,d=(o&&o[t])??(l&&l[t]);return I(hU.Provider,{value:{isActive:s,isClosing:c},children:d&&I(e,{...d.routeProps})})}const mU=or({base:{position:"absolute",display:"flex",top:0,bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",backgroundColor:"surface.background",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},overscrollBehavior:{base:"contain",xl:"none"},_focus:{outline:"none"}},variants:{side:{right:{right:0,left:{base:0,sm:"auto"}},left:{left:0,right:{base:0,sm:"auto"}}},mobileCoverage:{full:{},partial:{width:{base:"80%"},minWidth:{base:"auto"}}}},defaultVariants:{side:"right",mobileCoverage:"full"}}),gU=tr({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function vU({children:e,side:t="right",mobileCoverage:n="full"}){const r=a(null),{isActive:o,isClosing:l}=i(hU),{onExitAnimationEnd:c,onInitialAnimationComplete:h}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=d(!0),o=u(()=>{dn.getState().confirmCloseDrawer()},[]),i=u(()=>{a(!1)},[a]);return s(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:o,isClosing:l,focusRef:r}),{context:p,refs:m}=re({open:o&&!l}),g=ve([r,m.setFloating]);return I(Ie,{onExitComplete:c,children:!l&&I(ye,{context:p,modal:!0,initialFocus:-1,children:R(Ne.div,{tabIndex:-1,ref:g,onAnimationComplete:()=>h(),transition:Sv,initial:Nv(t),animate:Iv,exit:Rv(t),...gr(lr.drawer,mU({side:t,mobileCoverage:n})),children:[e,!o&&I("div",{className:gU})]})})})}const fU=or({base:{display:"flex",height:"100%",maxHeight:"100%",minHeight:0,flexDirection:"column",minWidth:{base:"128px",sm:"512px"},maxWidth:{base:"100%",sm:"512px"},flexGrow:1,overflow:"hidden"},variants:{background:{foreground:{backgroundColor:"surface.foreground"}}}});function bU({background:e,children:t}){return I("div",{className:fU({background:e}),children:t})}const yU=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function wU(e){return void 0!==yU[e]}function CU(e){return yU[e]}const xU=vi(e=>r.createElement("svg",{id:"Layer_1","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,width:24,height:24,...e},r.createElement("defs",null,r.createElement("style",null,".cls-63ce7444ea57ea6c838005ed-1{fill:none;stroke:currentColor;stroke-miterlimit:10;}")),r.createElement("path",{className:"cls-63ce7444ea57ea6c838005ed-1",d:"M6.27,21.55H8.5l2.33.95h7.92a2.86,2.86,0,0,0,2.85-2.59l.88-9.13c0-.14,0-.28,0-.42h0a2.18,2.18,0,0,0-2.18-2.18H15.63l.52-1.09a6.27,6.27,0,0,0,.62-2.73h0A2.86,2.86,0,0,0,13.91,1.5h0A1.9,1.9,0,0,0,12,3.41h0a6,6,0,0,1-1.25,3.66l-2.33,3H6.27"}),r.createElement("rect",{className:"cls-63ce7444ea57ea6c838005ed-1",x:1.5,y:9.14,width:4.77,height:13.36})),"ThumbsUp"),TU=tr({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function kU({cldrShortName:e}){return I("div",{className:TU,children:CU(e)})}const EU=or({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),AU=tr({display:"flex",gap:"4px",backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",padding:"4px 8px",alignItems:"center",justifyContent:"center",scrollbar:"hidden",overflow:"hidden"});function SU({reactions:e,type:t,handleClick:n}){return I("div",{className:AU,children:e.map((e,r)=>I("button",{className:EU({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(kU,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const IU=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:xi(n)};return await Ra(o)},NU=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:xi(n)};return await $g(o)};function RU(e,t,n){return Er(Es({id:e}),t,n)}async function PU(e){const t=Es({id:e});return ya("mutation successful, invalidating messages queries"),Lr.invalidateQueries({queryKey:t}).catch(e=>wa({error:e,severity:"error"}))}function DU(e,t,n){const r=[...e];return r[n]=t,r}const MU=tr({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),LU=Object.keys(yU).filter(wU).map(e=>({emojiCode:e,authorInfo:[]}));function FU({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:l}=i(Qc),{mutate:s}=function(e){const{userId:t,userEmail:n}=i(Qc);return Xg({mutationFn:IU,meta:{toastOptions:{defaultErrorMessage:"Failed to react to message"}},onMutateFn:({data:r,accessToken:a,environment:o})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a,userEmail:o}){const i=RU(n,t,r);await Lr.cancelQueries({queryKey:i});const l=Lr.getQueryData(i);return Lr.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:DU(t,(r=t[n],i=e,l=a,s=o,{...r,reactions:[...r.reactions,{emojiCode:i.emojiCode,authorInfo:[{userId:l,email:s}]}]}),n);var r,i,l,s}),{oldMessages:l}}({data:r,accessToken:a,conversationId:e,environment:o,userId:t,userEmail:n})},onSettled:()=>PU(e)})}(e);return R(Tc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(Ec,{children:e=>I("button",{className:MU,...e,children:I(Sd,{Component:xU})})}),I(Fc,{type:"reaction",children:I(SU,{reactions:LU,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===l);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const OU=or({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function VU({reactions:e,type:t,handleClick:n}){const r=OU({type:t});return I("div",{className:r,children:I(SU,{reactions:e,handleClick:n,type:t})})}const UU=or({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),BU=or({base:{position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"column",alignItems:"flex-start",borderRadius:"md",borderWidth:1,borderStyle:"solid",flexShrink:1,overflow:"wrap",wordBreak:"break-word",whiteSpace:"pre-wrap"},variants:{type:{sent:{color:"typography.intent.primary",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary"},received:{color:"typography.base",borderColor:"border.layout",backgroundColor:"surface.foreground"}}}}),HU=tr({position:"relative",display:"flex",flexDirection:"column"});function WU({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const l=a(null),{isHover:c,setIsHover:u,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=d(!1),[r,a]=d(!1);return s(()=>{if(null===o.current||!i||c)return;const e=o.current,t=t=>{t.target===e||e.contains(t.target)||l(!1)};return window.addEventListener("mousemove",t),()=>{window.removeEventListener("mousemove",t)}},[i=t,o=e,c=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,c}(l),{mutate:m}=function(e){const{userId:t}=i(Qc);return Xg({mutationFn:NU,meta:{toastOptions:{defaultErrorMessage:"Failed to delete reaction"}},onMutateFn:({data:n,accessToken:r,environment:a})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a}){const o=RU(n,t,r);await Lr.cancelQueries({queryKey:o});const i=Lr.getQueryData(o);return Lr.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return sr(r)||0===r.reactions.length?t:DU(t,function(e,t,n){const r=e.reactions.filter(e=>e.emojiCode!==t||!e.authorInfo.some(e=>e.userId===n));return{...e,reactions:r}}(r,e.emojiCode,a),n)}),{oldMessages:i}}({data:n,accessToken:r,conversationId:e,environment:a,userId:t})},onSettled:()=>PU(e)})}(e),g=n?"sent":"received",v=o.filter(e=>wU(e.emojiCode)),f=v.length>0,b="sent"===g?lr["message-sent"]:lr["message-received"],y=gr(lr[b],BU({type:g}));return R("div",{className:UU({type:g,hasReactionsOnMessage:f}),ref:l,onMouseEnter:()=>"received"===g&&u(!0),children:[R("div",{className:HU,children:[I("div",{...y,children:r}),f&&I(VU,{reactions:v,type:g,handleClick:e=>m({id:t,emojiCode:e})})]}),c&&I(FU,{conversationId:e,messageId:t,type:g,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const zU=or({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),_U=tr({position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"12px",borderRadius:"md",borderWidth:1,borderStyle:"solid",borderColor:"border.layout",backgroundColor:"surface.foreground",flexShrink:1}),jU=tr({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),qU=tr({textDecoration:"none",color:"inherit",cursor:"pointer"});function KU({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=wT();return I("div",{className:zU({type:e?"sent":"received"}),children:I("div",{onClick:async()=>{if(o)window.open(a,"_self","noopener,noreferrer");else try{if(a){const e=await fetch(a),t=await e.blob(),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n??"attachment",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}}catch(e){await wa({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:qU,children:R("div",{className:_U,children:[R("div",{className:jU,children:[I(sc,{children:n}),I(Eo,{children:`${r}`})]}),I(Sd,{Component:rO})]})})})}const YU=gr(null,tr({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function ZU({children:e}){return I("div",{...YU,children:e})}const GU=gr(null,tr({display:"flex",flexDirection:"column-reverse",alignItems:"flex-start",gap:"26px",flex:"1 1 0%",alignSelf:"stretch",overflowY:"auto",overflowX:"hidden",flexFlow:"column",padding:15,scrollbarWidth:"thin",maxHeight:"calc(100% + 15px)",marginBottom:"-15px"})),QU=tr({minHeight:1,width:"100%"}),XU=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=u(()=>{t&&cr(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){s(()=>{const r=e.current;if(null!==r){let e=r.scrollTop,a=Date.now();const o=()=>{if(t){const{scrollVelocity:t,currentScrollTop:o,currentTime:i}=function(e,t,n){const r=e.scrollTop,a=Date.now(),o=Math.abs(r-t),i=a-n;return{scrollVelocity:i>0?o/i:0,currentScrollTop:r,currentTime:a}}(r,e,a);t>5&&n(),e=o,a=i}};return r.addEventListener("scroll",o),()=>{r.removeEventListener("scroll",o)}}},[t,n,e])}(i,t,l),R("div",{tabIndex:-1,...GU,ref:i,children:[I("div",{className:QU,ref:o}),e]})}),JU=Object.freeze({message:{text:"",attachments:[]}}),$U=tr({width:"24px",height:"24px",objectFit:"contain"});function eB({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:$U})}const tB=tr({display:"flex",flex:"1 1 0",flexDirection:"row",justifyContent:"space-between",backgroundColor:"surface.foreground",borderWidth:"1px",borderStyle:"solid",borderColor:"border.layout",padding:"8px 16px",marginBottom:"8px"}),nB=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),rB=tr({display:"grid",flexDirection:"column",minWidth:0}),aB="LOADING",oB="LOADED",iB="ERROR";function lB({attachment:e,onRemove:t}){const n=e.hasError?iB:e.isPending?aB:oB;return R("div",{className:tB,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:nB,children:[e.iconUrl&&I(eB,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:rB,children:[I(sc,{children:e.displayFileName}),n===aB&&e.displayText&&I(Eo,{accent:"strongest",children:e.displayText}),n===oB&&e.fileSize&&I(Eo,{children:e.fileSize}),n===iB&&I(Eo,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(zc,{onClick:async n=>{n.stopPropagation(),await ih({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Remove",type:oh.DANGER}]})===ju&&t(e)},children:I(cl,{Component:Ac})})]})}const sB=tr({width:"100%"});function cB({conversationId:e,addMessage:t,blockSubmit:n,isMobile:r,scrollRef:o,setActiveKeyboard:i,inputRef:l,defaultValues:s}){const{form:c}=function({onSubmit:e,defaultValues:t}){return{form:vb({defaultValues:t??JU,onSubmit:t=>{gm.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),d=a(null),h=u(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:m}=Dh({mutationFn:dm,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Lr.invalidateQueries({queryKey:["files/attachments"]}),await Lr.invalidateQueries({queryKey:["conversations"]})}}),g=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&m({id:e.id})},[c,m]);return I("form",{className:sB,ref:d,onKeyDown:e=>function(e,t,n,r){if(!r&&!e.shiftKey&&"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),null!==t&&!n)){const e=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});t.dispatchEvent(e)}}(e,d.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:I(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>I(lB,{attachment:e,onRemove:g},e.localId)),I(c.AppField,{name:"message",children:t=>I(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function dB(e,t){return{id:`placeholder_${e.conversationId}_${Date.now()}`,conversationId:e.conversationId,author:{userId:t??"placeholderUserId",email:"placeholderEmail"},status:"ACTIVE",createdDateTime:"",lastUpdatedDateTime:"",text:e.text??"",reactions:[],attachments:[]}}async function uB(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return ya("mutation successful, invalidating messages queries"),Promise.all([Lr.invalidateQueries({queryKey:e}),Lr.invalidateQueries({queryKey:t}),Lr.invalidateQueries({queryKey:n})]).catch(e=>wa({error:e,severity:"error"}))}const hB=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Fl({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),pB=async({data:e,accessToken:t,environment:n})=>Fl({data:{data:[e]},accessToken:t,environment:n}),mB=tr({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),gB=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),vB=tr({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),fB="Marked As Resolved";function bB({resolver:e}){const t=e?`${e} ${fB}`:fB;return R("div",{className:gB,children:[I("div",{className:mB}),I("div",{className:vB,children:t}),I("div",{className:mB})]})}const yB=or({variants:{width:{xs:{width:"30px"},sm:{width:"60px"},md:{width:"120px"},lg:{width:"240px"},xl:{width:"420px"}},height:{xs:{height:"5px"},sm:{height:"10px"},md:{height:"20px"},lg:{height:"40px"},xl:{height:"80px"}}}});function wB({width:e="md",height:t="md"}){return I(Xo,{styles:yB({width:e,height:t})})}const CB=tr({display:"flex",flexDirection:"row-reverse"});function xB(){return R(N,{children:[I(wB,{width:"lg",height:"lg"}),I("div",{className:CB,children:I(wB,{width:"md",height:"lg"})}),I("div",{className:CB,children:I(wB,{width:"lg",height:"xl"})}),I(wB,{width:"md",height:"lg"})]})}const TB=tr({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function kB({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(ZU,{children:I(WU,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(ZU,{children:I(xB,{})}):R("div",{className:TB,children:[I(To,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(sc,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const EB=gr(null,tr({display:"flex",alignItems:"center",justifyContent:"center",maxWidth:"100%",minHeight:0,height:"auto",flexDirection:"column",position:"relative",backgroundColor:"surface.background",borderTop:"{borderWidths.lg} solid",borderTopColor:"border.layout",padding:"12px 15px"}));function AB({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:l,defaultValues:c,defaultSubject:u}){const{userId:h}=i(Qc),{mutate:p}=function(){const{userId:e}=i(Qc);return Xg({mutationFn:Is,meta:{toastOptions:{defaultErrorMessage:"Failed to send message"}},onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=Er(Es({id:e.conversationId}),t,n);await Lr.cancelQueries({queryKey:a});const o=Lr.getQueryData(a);return Lr.setQueryData(a,t=>[dB(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:uB})}(),{query:{data:m},isFilling:g}=function(e){const t=cr(e);return Vr({queryKey:Es({id:e??""}),queryFn:Ss,select:As,enabled:t})}(e),{mutate:v,isPending:f,variables:b}=(k=t,E=l,Xg({mutationFn:pB,meta:{toastOptions:{defaultErrorMessage:"Failed to create conversation"}},onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(sr(e)||sr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(cr(E)){const e={id:E};ls(E,is.BANK_TRANSACTION)?o=async()=>{const t=bs(e);return await Lr.invalidateQueries({queryKey:t})}:ls(E,is.FINANCIAL_SUMMARY)&&(i=async()=>await Lr.invalidateQueries({queryKey:a}))}return ya("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Lr.invalidateQueries({queryKey:n}),Lr.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>wa({error:e,severity:"error"}))}})),{mutate:y}=Xg({mutationFn:hB,meta:{toastOptions:{defaultErrorMessage:"Failed to mark conversation as read"}},onSuccess:async()=>{const e=["conversations"],t=["tasks"];return ya("mutation successful, invalidating conversations queries"),Promise.all([Lr.invalidateQueries({queryKey:e}),Lr.invalidateQueries({queryKey:t})]).catch(e=>wa({error:e,severity:"error"}))}}),[w,C]=d(!1),x=a(null),T=a(null);var k,E;s(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),s(()=>{Jp(T)},[m,T]);const A=sr(e)||sr(m)||g;return R(N,{children:[A?I(XU,{ref:T,inputRef:x,activeKeyboard:w,setActiveKeyboard:C,children:I(kB,{isConversationLoading:f,isFilling:g,message:b?.message?.text})}):R(XU,{ref:T,activeKeyboard:w,setActiveKeyboard:C,inputRef:x,children:[n&&I(bB,{resolver:"Conversation"}),m.map((t,n)=>{const r=t[0].author.userId===h;return I(ZU,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!sr(e)).map(e=>I(KU,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(WU,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...EB,children:I(cB,{scrollRef:T,inputRef:x,conversationId:e,blockSubmit:f,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),i=o.map(e=>`att_${e.id}`),s=a.length>0,c=i.length>0;if(s||c)if(sr(e)){const e=function(e,t,n){let r="";return cr(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(u,a,o[0]?.displayFileName),t=(d=a,h=i,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...cr(m=l)&&{attachedEntityId:m},message:{text:d,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:i}});var d,h,m},setActiveKeyboard:C,defaultValues:c})})]})}function SB({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=d(e),{query:{data:o}}=Ll(r),i="CLOSED"===o?.resolutionStatus;return R(bU,{children:[I(Hv,{}),I(AB,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const IB=gr(lr["form-body"],tr({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"16px",overflowY:"auto",overflowX:"hidden",overscrollBehavior:{base:"contain",xl:"none"},minWidth:{base:0,sm:"512px"},width:"100%"}));function NB({children:e}){return I("div",{...IB,tabIndex:-1,children:e})}const RB=gr(null,tr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),PB=gr(null,tr({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),DB=tr({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),MB=e=>{kp(e),Ep(e)},LB=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:o,conversationId:l,transactionId:c,transaction:d})=>{const{isClosing:u}=i(hU),h=a(d);s(()=>{h.current=d},[d]);const p=a(!1);return s(()=>{if(!u||p.current)return;p.current=!0;const{events:e}=dn.getState(),t=h.current;cr(t)&&(ls(t.id,is.BANK_TRANSACTION)?ds(e.transactionForm,{type:"CLOSE_BANK_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}):ds(e.transactionForm,{type:"CLOSE_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}))},[u]),I(vU,{children:R("div",{...RB,children:[I(bU,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:MB,...PB,children:[n,I(NB,{children:e}),r]})}),null!==o&&I("div",{className:DB}),"conversation"===o&&c&&I(SB,{conversationId:l,attachedEntityId:c,defaultSubject:d?.description})]})})},FB=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],OB=["FEDERAL","STATE","SALES"],VB=["Q1","Q2","Q3","Q4"],UB=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function BB(e){if(!sr(e))return UB.find(t=>t.value===e)?.name}const HB=S.object({id:S.string(),type:S.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:S.enum(Object.values(Di)),amount:S.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:S.string("Required").refine(e=>(function(e,t){const n=rt(e.getFullYear(),e.getMonth(),e.getDate()),r=rt(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||Tt(new Date(e),/* @__PURE__ */new Date))&&Et(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),frequency:S.union([S.object({name:S.string(),value:S.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),S.undefined()]),category:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),dimensionValues:S.array(S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).optional()),bankAccount:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:S.string().nullable(),itemizedByOptions:S.object({category:S.boolean(),customer:S.boolean()}).optional(),attachments:S.array(mm)}),WB=S.object({id:S.string(),name:S.string().optional(),requiredness:S.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),zB=S.object({id:S.string(),name:S.string().optional(),dimension:WB.optional()}),_B=zB.extend({child:zB.optional()}),jB=S.object({id:S.string().optional(),lineItemType:S.literal("itemized"),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).optional(),dimensionValues:S.array(_B),customer:S.object({id:S.string(),name:S.string().optional()}).nullable(),amount:S.number()}),qB=S.object({lineItemType:S.literal("invoice"),amount:S.number().nullable(),invoice:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),KB=S.object({lineItemType:S.literal("bill"),amount:S.number().nullable(),bill:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),YB=S.object({lineItemType:S.literal("fee"),amount:S.number()}),ZB=S.object({lineItemType:S.literal("payment"),amount:S.number(),payment:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string(),bankAccount:S.object({id:S.string(),displayName:S.string()})})}),GB=S.discriminatedUnion("lineItemType",[jB,qB,YB,KB,ZB]),QB=HB.extend({children:S.array(GB),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).nullable()});QB.extend({tax:S.object({paymentInfo:S.object({region:S.enum(OB).optional(),year:S.number().optional(),quarter:S.enum(VB).optional()}).nullable().optional()}).optional()});const XB=HB.extend({id:S.string(),type:S.literal(Object.values(mw)),description:S.string(),displayName:S.string(),iconUrl:S.string(),status:S.literal(Object.values(NN)),reviewStatus:S.literal(Object.values(Di)),apiName:S.literal(Object.values({PLAID:"PLAID",UNIT:"UNIT",STRIPE:"STRIPE",SHOPIFY:"SHOPIFY",SQUARE:"SQUARE",RUTTER:"RUTTER",UBER:"UBER",MOOV:"MOOV",QUALPAY:"QUALPAY",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",QBO:"QBO",XERO:"XERO",BENCH:"BENCH",WAVE:"WAVE"})),apiSourceId:S.string().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()},{message:"Required"}),customer:S.object({id:S.string(),name:S.string().optional(),email:S.string().optional()}).nullable(),vendor:S.object({id:S.string(),name:S.string().optional()}).nullable(),invoice:S.object({id:S.string(),name:S.string(),date:S.string(),lineItems:S.array(S.object({id:S.string(),amount:S.number()}))}).nullable(),bill:S.object({id:S.string(),name:S.string().optional()}).nullable(),payroll:S.object({id:S.string(),date:S.string().optional(),checkDate:S.string().optional(),description:S.string().optional()}).nullable(),apiItemId:S.string().nullable()}),JB=S.looseObject({amount:S.number().nullable(),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),$B=S.object({children:S.array(JB),itemizeByOptions:S.record(S.string(),S.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.category?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"category"]})})}),eH=QB.extend({type:S.literal("EXPENSE"),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable()}).check(e=>{const t=e.value.children;(function(e,t){if(0===e.length)return!0;if(!e.some(e=>"itemized"===e.lineItemType))return!0;const n=e?.reduce((e,t)=>"itemized"!==t.lineItemType?e:e+(t.amount??0),0);return n===t})(t,e.value.amount)||e.issues.push({code:"custom",message:"Sum of children amounts must equal total amount",input:e.value,path:["children"]}),function(e,t=null){return 0===e.length&&Ir(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),tH=QB.extend({type:S.literal("BANK_TRANSFER"),reconciliationMatch:S.object({id:S.string(),description:S.string().optional(),amount:S.number().optional(),date:S.string().optional(),apiInstitutionId:S.string().nullable().optional(),apiName:S.enum({BOX:"BOX",CLOVER:"CLOVER",STRIPE:"STRIPE",PLAID:"PLAID",KNOX:"KNOX",UBER:"UBER",FRESHBOOKS:"FRESHBOOKS",HARVEST:"HARVEST",KW:"KW",FRESHBOOKS2:"FRESHBOOKS2",CAPITAL_ONE:"CAPITAL_ONE",SQUARE:"SQUARE",DOTLOOP:"DOTLOOP",REALOGY:"REALOGY",UPWORK:"UPWORK",SHOPIFY:"SHOPIFY",DEDUCTR:"DEDUCTR",ENTERPRISE:"ENTERPRISE",MOXIWORKS:"MOXIWORKS",APPDIRECT:"APPDIRECT",LONEWOLF:"LONEWOLF",LONEWOLF_TRANSACTIONDESK:"LONEWOLF_TRANSACTIONDESK",SAMPLE_BANK:"SAMPLE_BANK",TAXBOT:"TAXBOT",GUSTO:"GUSTO",XERO:"XERO",UNIT:"UNIT",MOOV:"MOOV",QBO:"QBO",QUALPAY:"QUALPAY",BENCH:"BENCH",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",CHECK:"CHECK",RUTTER:"RUTTER",WAVE:"WAVE",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",ADYEN:"ADYEN",PAYABLI:"PAYABLI"}).optional()}).nullish()}).refine(e=>{const t=e.reconciliationMatch?.amount,n=e.amount;return!!sr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>tH.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),nH=XB.extend({}),rH=S.looseObject({amount:S.number().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),aH=S.object({children:S.array(rH),itemizeByOptions:S.record(S.string(),S.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.glAccount?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"glAccount"]})})}),oH=QB.extend({type:S.literal("REVENUE"),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()},{message:"Required"}).nullable()}).check(e=>{e.value.children&&e.value.children.length>0||e.value.glAccount&&""!==e.value.glAccount.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["glAccount"]})});function iH(e){return e.reduce((e,t)=>new H(e).plus(t??0).toNumber(),0)}function lH(e,t){const n=new H(e).times(100).round(0),r=new H(t).times(100).round(0);return!n.eq(r)}function sH(e,t){const{dimensionsToIndex:n,childToRootId:r,dimensionFieldCount:a}=t,o=new Array(a).fill(void 0);if(e)for(const i of e){const e=i.dimension?.id;if(Ir(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function cH(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function dH(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function uH(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function hH(e){return"EXPENSE"!==e.type||sr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function pH(e,t,n){if(e(t))return n}const mH={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function gH(e){return Ir(e)?void 0:e}function vH(e,t,n){const r=(e,t)=>pH(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:gH((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:gH(e.id),amount:e.amount?ch(e.amount):0,categoryId:e.category?.id,glAccountId:e.glAccount?.id,dimensionValueIds:e.dimensionValues?.map(e=>e.id),customerId:e.customer?.id}}(e);case"fee":return function(e){return{id:gH(e.id),amount:ch(e.amount)}}(e);case"bill":return function(e){return{id:gH(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:gH(e.payment.id)}}(e)}var t}(e))),o="TAX_PAYMENT"===e.type,i=/* @__PURE__ */new Set;for(const l of e.children)if("itemized"===l.lineItemType)for(const e of l.dimensionValues??[])e.dimension?.id&&i.add(e.dimension.id);return{...{amount:r("amount",e.amount?ch(e.amount):0),date:r("date",e.date),bankAccountId:r("bankAccount",e.bankAccount.id),frequency:r("frequency",e.frequency?.value),notes:r("notes",e.notes),dimensionValueIds:r("dimensionValues",e.dimensionValues?.filter(e=>!sr(e?.dimension?.id)&&!i.has(e.dimension.id)).map(e=>e?.id)),children:a,vendorId:r("vendor",e.vendor?.id||void 0),customerId:r("customer",e.customer?.id||void 0),categoryId:r("category",e.category?.id||void 0),glAccountId:r("glAccount",e.glAccount?.id||void 0),matchingBankTransactionId:r("reconciliationMatch",e.reconciliationMatch?.id||void 0),reviewStatus:r("reviewStatus",e.reviewStatus),tax:r("tax",o?e.tax:void 0),attachmentIds:r("attachments",e.attachments.filter(e=>null!==e.id&&!e.isPending&&!e.hasError).map(e=>`att_${e.id}`))},..."EXPENSE"===e.type&&(n("category")||n("children"))?function(e,t,n){const r=n.find(t=>t.id===e)?.accountId,a=t?.map(e=>{const t=n.find(t=>t.id===e.categoryId)?.accountId;return sr(t)?e:{...e,glAccountId:ss({id:t,prefix:"GL_ACCOUNT"})}});return sr(r)?sr(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:ss({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function fH(e=null){const{mutateAsync:t}=sC(),{mutateAsync:n}=dC({mutationFn:rC,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}}),{query:{data:r}}=vx();return async(a,o,i)=>{const l=r?.data??[];var s,c;e?(await t(function(e,t,n,r){return{...vH(t,n,e=>{return r[e]?.isDirty??(t=e,Object.entries(r).some(([e,n])=>n?.isDirty&&(e.startsWith(`${t}.`)||e.startsWith(`${t}[`))));var t}),id:e}}(e.id,a,l,o)),i()):await n((s=a,c=l,{...vH(s,c,()=>!0),amount:s.amount?ch(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||mH[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}))}}const bH=QB.extend({type:S.literal("TAX_PAYMENT"),tax:S.object({paymentInfo:S.object({region:S.enum(OB,{message:`Tax region must be one of: ${OB.join(", ")}`}),quarter:S.enum(VB,{message:"Required"}),year:S.number({message:"Tax year is required"})}).nullable()})}).superRefine((e,t)=>{e.tax?.paymentInfo||(t.addIssue({path:["tax","paymentInfo","region"],code:"custom",message:`Tax region must be one of: ${OB.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))});function yH(){const e=a(!0);return s(()=>(e.current=!0,()=>{e.current=!1}),[]),u(()=>{e.current&&as()},[])}const wH={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Rt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:ms[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function CH(e){const t=/* @__PURE__ */new Map;for(const n of e){if(sr(n.bill)||!sr(n.paymentId))continue;const e=t.get(n.bill.id);e?t.set(n.bill.id,{...e,amount:e.amount+n.amount}):t.set(n.bill.id,n)}return[...t.values()]}function xH(e){const t=/* @__PURE__ */new Map;for(const n of e){if(sr(n.invoice)||!sr(n.paymentId))continue;const e=t.get(n.invoice.id);e?t.set(n.invoice.id,{...e,amount:e.amount+n.amount}):t.set(n.invoice.id,n)}return[...t.values()]}function TH(e){const t=/* @__PURE__ */new Map;for(const n of e){if(sr(n.paymentId))continue;const e=t.get(n.paymentId);e?t.set(n.paymentId,{...e,amount:e.amount+n.amount}):t.set(n.paymentId,n)}return[...t.values()]}function kH(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function EH(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(sr(e.paymentId)&&sr(e.bill)&&sr(e.invoice)||kH(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...CH(r),...xH(r),...TH(r),...a]}(e.children,t),r=(o=n,void 0===(i=t)||0===i.size?[]:o.filter(e=>{const t=e.glAccount?.id?i.get(e.glAccount.id):void 0;return void 0===t||"DEFERRED_REVENUE"!==t.liabilityType&&"Prepaid Expenses"!==t.name})),a=r.some(e=>!(sr(e.invoice)&&sr(e.payroll)&&sr(e.bill)&&sr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return sr(e.paymentId)||kH(e,n)?t&&kH(e,n)?(r=e,{...r,lineItemType:"fee",amount:sh(r.amount)}):sr(e.invoice)?sr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:sh(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return sr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:sh(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:sh(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:sh(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:sh(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=sh(e.amount);return{lineItemType:"payment",amount:n,payment:{id:t,amount:n,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName??e.bankAccount.name??""}}}}(e,e.paymentId);var r}(e,a,t))}function AH({value:e}){return{fields:SH(function(e){switch(e){case"EXPENSE":return eH;case"TAX_PAYMENT":return bH;case"BANK_TRANSFER":return tH;case"REVENUE":return oH}}(e.type).safeParse(e))}}function SH(e){const t={};if(!e.success)for(const n of e.error.issues){const e=n.path.reduce((e,t,n)=>"number"==typeof t?`${e}[${t}]`:0===n?String(t):`${e}.${String(t)}`,"");t[e]||(t[e]={message:n.message})}return t}function IH(e,t,n){const r=fH(e),{query:{data:a}}=mC({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=yH(),i=e?(s=t,c=a,{id:(l=e).id,type:hH(l),reviewStatus:l.reviewStatus,amount:sh(l.amount),category:l.category,date:l.date,vendor:l.vendor,customer:l.customer,frequency:l.frequency,bankAccount:l.bankAccount,glAccount:l.glAccount,notes:l.notes,dimensionValues:sH(l.dimensionValues,s),children:EH(l,c),reconciliationMatch:l.reconciliationMatch?{...l.reconciliationMatch,amount:sh(l.reconciliationMatch.amount??0)}:void 0,tax:l.tax,attachments:l.attachments?l.attachments.map(e=>({localId:e.id,file:new File([],e.fileName??""),displayFileName:e.fileName??"Unknown",displayText:"",fileSize:e.fileSize??null,id:cs(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...wH,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var l,s,c;return vb({defaultValues:i,canSubmitWhenInvalid:!0,validators:{onBlur:AH,onSubmit:AH},onSubmit:async e=>(await r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),o()),onSubmitInvalid:()=>{}})}function NH({onClick:e}){return I(lN,{Icon:AN,onClick:e,closeOnClick:!0,children:"Archive"})}function RH({onClick:e}){return I(lN,{onClick:e,closeOnClick:!0,children:"Restore"})}function PH(e){return u(async t=>{e.baseStore.setState(e=>({...e,isSubmitting:!0}));try{await t()}finally{e.baseStore.setState(e=>({...e,isSubmitting:!1}))}},[e])}const DH=e=>r.createElement("svg",{stroke:"currentColor",width:16,height:15,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.36217 8.45534H7.95444C8.20781 8.45534 8.45081 8.35469 8.62998 8.17552C8.80914 7.99636 8.9098 7.75336 8.9098 7.49998C8.9098 7.24661 8.80914 7.00361 8.62998 6.82444C8.45081 6.64528 8.20781 6.54463 7.95444 6.54463H7.31753C7.06416 6.54463 6.82116 6.44397 6.64199 6.26481C6.46283 6.08564 6.36217 5.84265 6.36217 5.58927C6.36217 5.33589 6.46283 5.09289 6.64199 4.91373C6.82116 4.73456 7.06416 4.63391 7.31753 4.63391H8.9098",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 3.36011V4.63392",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 8.45532V9.72913",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.54074 14.1875L4.23491 12.9137L5.93545 14.1875L7.62962 12.9137L9.33015 14.1875L11.0307 12.9137L12.7312 14.1875L13.3681 13.5506V0.8125H1.90384V13.5506L2.54074 14.1875Z",strokeMiterlimit:10,strokeLinecap:"square"})),MH=vi(DH,"Bill");function LH({onClick:e,error:t,validate:n}){return I(hp,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const FH=tr({display:"flex",flexDirection:"column",width:"100%"}),OH=gr(lr["value-comparison-summary"],tr({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),VH=tr({display:"flex",flexDirection:"column",gap:"8px"});function UH({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return I("div",{className:FH,children:R("div",{...OH,children:[R("div",{className:VH,children:[I(sc,{intent:"weak",children:"Selected Total"}),I(To,{children:Co(sh(e),r)})]}),R("div",{className:VH,children:[I(sc,{intent:"weak",children:`${n} Total`}),I(To,{children:yo(t)})]})]})})}const BH=tr.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),HH=gr(null,tr({color:"icon.base"}));function WH({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=DT({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return I("div",{className:Zv,children:R("div",{...Gv,children:[l?I(np,{}):I(Sd,{stylists:[HH],Component:Yv}),I("input",{className:Qv,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Ep}),Nr(e)&&I(Xs,{styles:BH,onClick:()=>o(""),children:I(Sd,{Component:Ac})})]})})}const zH=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function _H({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return R("div",{className:zH,children:[I(sc,{intent:"weak",children:"Search"}),I(WH,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function jH(e,t,n){return`${e} | ${At(Nt(t))} | ${yo(sh(n))}`}const qH=gr(lr["linked-entity-row"],tr({display:"flex",alignItems:"center",padding:"16px",gap:"9px",backgroundColor:"surface.foreground",border:"0.75px solid {colors.border.layout}",width:"100%",cursor:"pointer",outline:"none",_supportHover:{backgroundColor:"surface.background"}})),KH=tr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),YH=gr(null,tr({color:"icon.base"}));function ZH({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return R("button",{type:"button",...qH,onClick:o,children:[R("div",{className:KH,children:[I(Sd,{stylists:[YH],Component:r}),I(sc,{wrap:"wrap",children:jH(t,n,e)})]}),I(uf,{selected:a,showEmptyIndicator:!0})]})}const GH={root:null,threshold:1};function QH({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=u(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return s(()=>{const e=new IntersectionObserver(o,GH);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return I("div",{ref:n})}function XH({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return I(N,{children:t.groups.map(t=>R(hS,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>I(ZH,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),I(QH,{onIntersect:a,enable:!r&&o})]},t.key))})}function JH(e){return vo(e,{cents:"always",dollarSign:!0})}function $H(e){return JH(Math.abs(e))}function eW({title:e,body:t}){return ih({title:e,body:t,cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"FEE":"NO_FEE")}function tW(e,t,n){const r=$H(e);return`The selected bills total of ${$H(t)} is less than the expense total of ${r}. Was there a fee of ${$H(n)}?`}const nW=tr(Uv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function rW({children:e}){return I("div",{className:nW,children:e})}function aW({transactionTotal:e,bills:t,previouslySelected:n,onSubmit:r,fetchNextPage:a,hasNextPage:i,isFetching:l,isFetchingNextPage:s,searchTerm:c,onSearchChange:u}){const[h,p]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[m,g]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),v=o(()=>new Set(n.map(e=>e.id)),[n]),f=o(()=>Sr(c)?[...n,...t.filter(e=>!v.has(e.id))]:t,[c,n,t,v]),b=ef({data:[f],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:e=>{p(e),g(t=>{const n={...t},r=f.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:h}}),y=Object.entries(h).filter(([,e])=>e).map(([e])=>m[e]),w=y.reduce((e,t)=>e+t.amount,0),C=l&&!s;return I(qv,{title:"Link Bill",Footer:I(LH,{onClick:()=>{const t=new H(w).div(100).times(-1).toNumber(),n=new H(e).sub(t).toNumber();t>e&&y.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return eW({title:"Bill Payment",body:tW(n,e,t)})}({selectedTotal:t,transactionTotal:e,suggestedFee:n}).then(e=>{let t=0;"FEE"===e&&(t=n),r(y,t)}).catch(()=>{}):r(y,0)}}),padChildren:!1,children:R(rW,{children:[I(UH,{selectedAmount:w,transactionTotal:e,transactionTypeLabel:"Expense"}),I(_H,{searchTerm:c,onChange:u,isFetching:C,searchPlaceholder:"Search bills..."}),I(XH,{listLabel:"Bills",glSourceList:b,icon:MH,fetchNextPage:a,hasNextPage:i,isFetching:l,pluralNoun:"bills",singularNoun:"bill"})]})})}const oW=e=>["bills/bills","infinite",e??{}],iW=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/bills/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:xi(n)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},lW=[];function sW(e){const t=e.lineItems?.reduce((e,t)=>e+t.amount,0)??0;return{id:e.id,name:e.name??"",date:e.date??"",amount:t}}function cW(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return sr(e)||(t.search=e),t}function dW(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(c=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:c}),limit:10,filter:cW(t)},Hg({queryFn:iW,queryKey:oW(s)}));var s,c;const u=(r?.pages??lW).flatMap(e=>(e.data??[]).map(sW));return I(aW,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function uW(e){const t=kc();return I(Ov,{children:t.open&&I(dW,{...e})})}function hW(e){return{lineItemType:"fee",amount:e}}function pW(e){return{lineItemType:"bill",amount:sh(-e.amount),bill:{id:e.id,amount:sh(e.amount),date:e.date,name:e.name}}}function mW(e){return e.map(pW)}function gW(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function vW(e){return`Remove ${e}?`}function fW(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function bW({action:e,titleName:t,entityName:n}){return ih({title:vW(t),body:fW(e,n),cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"YES":"NO").catch(()=>"NO")}const yW={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},wW={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function CW(e,t){const n=wW[t];return bW({titleName:n,entityName:n.toLowerCase(),action:yW[e]})}function xW(e){return e.filter(e=>"bill"===e.lineItemType).map(e=>({id:e.bill.id,name:e.bill.name,date:e.bill.date,amount:ch(e.bill.amount)}))}const TW="bill",kW=fb({defaultValues:wH,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType),a=xW(e.state.values.children);return R(Tc,{open:t,onOpenChange:n,children:[I(lN,{onClick:async()=>{const t=gW(TW,e.state.values.children);TW!==t?"YES"===await CW(TW,t)&&n(!0):n(!0)},Icon:MH,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),I(uW,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=mW(t);0!==r&&a.push(hW(r)),e.setFieldValue("children",a),n(!1)},previouslySelected:a})]})}}),EW=e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M5.71252 10.4813H7.80002C8.03706 10.4813 8.26439 10.3871 8.432 10.2195C8.59961 10.0519 8.69377 9.82454 8.69377 9.5875C8.69377 9.35046 8.59961 9.12313 8.432 8.95552C8.26439 8.78791 8.03706 8.69375 7.80002 8.69375H7.17502C6.93799 8.69375 6.71066 8.59959 6.54305 8.43198C6.37544 8.26437 6.28127 8.03704 6.28127 7.8C6.28127 7.56296 6.37544 7.33563 6.54305 7.16802C6.71066 7.00041 6.93799 6.90625 7.17502 6.90625H9.26252",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 5.11249V6.90624",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 10.4813V12.275",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V14.0625H2.13123V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V4.51875H9.28748V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10})),AW=vi(EW,"Payroll");function SW(e,t,n){const r=$H(e);return`The selected invoice total of ${$H(t)} is greater than the transaction total of ${r}. Was there a fee of ${$H(n)}?`}const IW=e=>["payments/payments","infinite",e??{}],NW=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/payments/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:xi(n)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},RW=tr({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),PW=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),DW=tr({marginLeft:"auto"});function MW({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:RW,children:[R("div",{className:PW,children:[I(sc,{children:e}),t&&I(sc,{wrap:"nowrap",children:bo(t)})]}),R("div",{className:PW,children:[n&&I(Eo,{children:n}),I("span",{className:DW,children:r&&I(Eo,{wrap:"nowrap",children:At(Nt(r))})})]})]})}function LW({payment:e,selected:t,onClick:n}){return I(mf,{handleClick:n,selected:t,isMultiSelect:!0,children:I(MW,{description:e.description,amount:sh(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}function FW(e){return e}function OW(e){return e.pages.flatMap(e=>(e.data??[]).map(FW))}function VW(e){return Object.values(e).some(e=>e)}function UW(e,t){return e===ch(t)}function BW(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:Sr(t)?void 0:t}}function HW({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const[a,i]=d(""),{query:{data:l,fetchNextPage:s,isFetching:c,hasNextPage:h,isFetchingNextPage:p}}=(m={filter:BW(n,a)},g={select:OW},Hg({queryFn:NW,queryKey:IW(m),...g}));var m,g;const[v,f]=d(r),[b,y]=d([]),w=o(()=>Object.fromEntries([...v,...b].map(e=>[e.id,!0])),[v,b]),C=o(()=>new Set(r.map(e=>e.id)),[r]),x=o(()=>Sr(a)?[...r,...(l??[]).filter(e=>!C.has(e.id))]:l??[],[a,r,l,C]),T=[...v,...b].reduce((e,t)=>e+t.amount,0),[k,E]=d(void 0),A=u(e=>{const n=r.filter(t=>e[t.id]),a=b.filter(t=>e[t.id]),o=new Set(a.map(e=>e.id)),i=(l??[]).filter(t=>e[t.id]&&!C.has(t.id)&&!o.has(t.id)),s=[...a,...i],c=[...n,...s].reduce((e,t)=>e+t.amount,0),d=VW(e);void 0===k||!UW(c,t)&&d||E(void 0),f(n),y(s)},[r,b,l,C,t,k]),S=ef({data:[x],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:w},onSelectedChange:A}),N=c&&!p;return I(qv,{title:"Link Transactions",Footer:I(LH,{validate:()=>{const e=UW(T,t),n=VW(w),r=e||!n;return r||E("The selected total must equal the income amount."),r},error:k,onClick:()=>{e(v.map(e=>e.id),b)}}),padChildren:!1,children:R(rW,{children:[I(UH,{selectedAmount:T,transactionTotal:t,transactionTypeLabel:pw,selectedAmountSignage:"default"}),I(_H,{searchTerm:a,onChange:i,isFetching:N,searchPlaceholder:"Search transactions..."}),S.groups.map(e=>{const t=e.getRows();return I(hS,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return I(LW,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),I(QH,{onIntersect:s,enable:!c&&h})]})})}function WW({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const a=kc();return I(Ov,{children:a.open&&I(HW,{transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r,onSubmit:e})})}function zW({transactionTotal:e,invoices:t,previouslySelected:n,onInvoiceSubmit:r,onPaymentSubmit:a,hasExistingInvoices:i,parentBankAccountId:l,fetchNextPage:s,hasNextPage:c,isFetching:u,isFetchingNextPage:h,searchTerm:p,onSearchChange:m}){const[g,v]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[f,b]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),[y,w]=d(!1),C=o(()=>new Set(n.map(e=>e.id)),[n]),x=o(()=>Sr(p)?[...n,...t.filter(e=>!C.has(e.id))]:t,[p,n,t,C]),T=ef({data:[x],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:e=>{v(e),b(t=>{const n={...t},r=x.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:g}}),k=Object.entries(g).filter(([,e])=>e).map(([e])=>f[e]),E=k.reduce((e,t)=>e+t.amount,0),A=u&&!h;return I(qv,{title:"Link Invoice",HeaderRightAction:I(aE,{shouldUseButtonDiscreteStyles:!0,children:I(Lm,{forceNewCascade:!0,children:R(Tc,{open:y,onOpenChange:w,children:[I(lN,{onClick:async()=>{const e=k.length>0;if(i){if("YES"!==await CW("payment","invoice"))return}else if(e&&"YES"!==await async function(){return bW({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;w(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),I(WW,{transactionTotalDollars:e,parentBankAccountId:l,previouslySelected:[],onSubmit:a})]})})}),Footer:I(LH,{onClick:async()=>{const t=sh(E);if(t>e&&k.length>0){const n=new H(t).sub(e),a=n.toNumber(),o=n.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return eW({title:"Invoice Payment",body:SW(n,e,t)})})({selectedTotal:t,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=o),r(k,t)}).catch(()=>{})}else r(k,0)}}),padChildren:!1,children:R(rW,{children:[I(UH,{selectedAmount:E,transactionTotal:e,transactionTypeLabel:pw}),I(_H,{searchTerm:p,onChange:m,isFetching:A,searchPlaceholder:"Search invoices..."}),I(XH,{listLabel:"Invoices",glSourceList:T,icon:AW,fetchNextPage:s,hasNextPage:c,isFetching:u,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const _W=e=>["invoicing/invoices","infinite",e??{}],jW=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return(async({params:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/invoicing/invoices/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:xi(r)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}})({params:n,cursor:e.pageParam,accessToken:r,environment:a})},qW=[];function KW(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return Sr(e)||(t.search=e),t}function YW(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return Hg({queryFn:jW,queryKey:_W(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:KW(t)}});var s;const c=(r?.pages??qW).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return I(zW,{...e,invoices:c,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function ZW(e){const t=kc();return I(Ov,{children:t.open&&I(YW,{...e})})}function GW(e){const t=sh(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const QW=(e,t)=>{const n=e.map(GW);return 0!==t&&n.push(hW(t)),n};function XW(e){const t=sh(e.amount);return{lineItemType:"payment",amount:t,payment:{id:e.id,amount:t,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName}}}}function JW(e){return e.map(XW)}function $W(e){return e.filter(e=>"invoice"===e.lineItemType).map(e=>({id:e.invoice.id,name:e.invoice.name,date:e.invoice.date,amount:ch(e.invoice.amount)}))}const ez="invoice",tz=fb({defaultValues:wH,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType),a=$W(e.state.values.children);return R(Tc,{open:t,onOpenChange:n,children:[I(lN,{onClick:async()=>{const t=gW(ez,e.state.values.children);ez!==t?"YES"===await CW(ez,t)&&n(!0):n(!0)},Icon:AW,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),I(ZW,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=QW(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:(t,r)=>{const a=JW(r);e.setFieldValue("children",a),n(!1)},hasExistingInvoices:r,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),nz=ms.filter(e=>"ONE_TIME"!=e.value);function rz({onClick:e}){const t=kc();return I(QC,{triggerChildren:I($C,{displayLabel:"Make recurring"}),popupChildren:I(Sf,{frequencies:nz,onClick:n=>{e(n),t.close()}})})}function az({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(zc,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(Td,{Component:t})})}function oz({activeTab:e,onClick:t,popupTriggerProps:n}){return I(az,{active:"conversation"===e,onClick:()=>t("conversation"),icon:Ed,ariaLabel:"conversation-tab",popupTriggerProps:n})}const iz=tr({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function lz({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=kc(),[a,o]=d(e),{query:{data:i}}=Ll(a),l="CLOSED"===i?.resolutionStatus;return I(Pv,{children:R("div",{className:iz,children:[I(Hv,{children:R(zv,{children:[I($u,{Icon:nl,handleClose:()=>r.setOpen(!1)}),I(To,{children:"Back"})]})}),I(AB,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const sz={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:pw},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},cz=Object.values(sz);function dz({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=We();return a?I(yf,{}):I(sf,{title:R(N,{children:[s&&t&&I(To,{children:"Suggested"}),I(To,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(lS,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(pz,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I(mf,{handleClick:()=>e(t),selected:n,children:R(iS,{children:[t.iconUrl&&I(Sd,{Component:Cg(t.iconUrl,t.name??"")}),I(sc,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const uz="Search expense categories...",hz=[];function pz({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=wx(),s=r??i?.data??hz,c=kc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I($v,{placeholder:uz,onClick:d,SearchList:vS,DefaultList:dz,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function mz({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,glAccount:r}){const{query:{data:a},isFilling:o}=kC(),i=AC(a,EC),l=We()&&n?I(sf,{title:I(To,{children:"Suggested"})}):void 0;return I(EV,{accounts:i,selectedAccountId:r?.id,onSelect:e=>t({type:"REVENUE",value:e}),isFilling:o,listLabel:e,placeholder:"Search income categories...",nestedTitle:"All Categories",Header:l})}function gz({list:e,onClick:t,NestedChildList:n}){return I(of,{children:e.groups.map(e=>I(hS,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(lS,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:I(n,{row:e})},e.key);const r=e.getIsSelected();return I(mf,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(iS,{children:[e.value.iconUrl&&I(Sd,{Component:Cg(e.value.iconUrl,e.value.name)}),I(sc,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const vz="All Tax Categories";function fz({handleConversion:e,region:t}){const n=kc(),r=ef({data:[UB],groups:[{label:vz,key:vz}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(gz,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function bz({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=We(),d=!l&&i&&0===r.length;return l?I(yf,{}):R(of,{children:[a&&I("div",{children:I(pf,{handleClick:t,children:I(sc,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(To,{children:"Suggested"}),!d&&R(N,{children:[I(To,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I(mf,{handleClick:()=>e(t),selected:n,children:I(MW,{description:t.description,amount:sh(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const yz={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function wz({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ae(n??[],yz),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?I(yf,{}):0===l.length?I(rf,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I(of,{children:I("div",{children:l.map(e=>{const n=a?.id===e.id;return I(mf,{handleClick:()=>t(e),selected:n,children:I(MW,{description:e.description,amount:sh(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const Cz=[];function xz({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Nt(o),s=(c=r,{filter:{status:{in:["ACTIVE"]},type:{in:[(d=a)>0?"EXPENSE":"REVENUE",d>0?"TRANSFER_OUT":"TRANSFER_IN"]},amount:{equal:-d},date:{greaterThanEqual:Rt(Ot(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Rt(Ot(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:m}=ws(s,{enabled:null!==l}),g=h?.data??Cz,{query:{data:v}}=mC({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),f=kc();return I($v,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),f.close()},SearchList:wz,DefaultList:bz,listLength:g.length??0,extraProps:{listLabel:e,bankTransfers:g,isFetched:p,isFilling:m,holdingAccount:v,showSuggestedCategories:n,transactionDate:o,onNeedsMatchClick:()=>{v&&t({type:"BANK_TRANSFER",value:{glAccount:v}}),f.close()},reconciliationMatch:i}})}function Tz({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=d(function(e){switch(e){case"EXPENSE":return cz.indexOf(sz.EXPENSE);case"REVENUE":return cz.indexOf(sz.REVENUE);case"TAX_PAYMENT":return cz.indexOf(sz.TAX_EXPENSE);default:return cz.indexOf(sz.TRANSFER)}}(e)),{category:c,glAccount:u,tax:h,date:p,bankAccount:m,reconciliationMatch:g,amount:v}=o,f=h?.paymentInfo?.region,b=m?.id;return R(Kv,{title:t,children:[!i&&I(Df,{options:cz,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(cz[l].value){case"EXPENSE":return I(pz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(mz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return I(fz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:f});case"BANK_TRANSFER":return I(xz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:v??0,transactionDate:p,reconciliationMatch:g})}},{})]})}function kz({children:e}){const{startPrefetch:t,cancelPrefetch:n}=kx();return I(SV,{onMouseEnter:t,onMouseLeave:n,children:e})}const Ez=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function Az({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!sr(o)&&""!==o.id,l=sr(o?.iconUrl)?void 0:Cg(o.iconUrl,"Expense Icon");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:"Category",popupTriggerProps:e,children:R(kz,{children:[i?R("div",{className:Ez,children:[l&&I(Sd,{Component:l}),I(sc,{wrap:"wrap",children:o.name})]}):I(sc,{intent:"weak",children:"Select category"}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function Sz(){const{query:{data:e}}=eI(),{query:{data:t=[]}}=zF(),n=o(()=>e?.data??[],[e]),r=o(()=>function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return e.forEach((e,r)=>{t.set(e.id,r),e.child?.id&&(t.set(e.child.id,r),n.set(e.child.id,e.id))}),{dimensionsToIndex:t,childToRootId:n,dimensionFieldCount:e.length}}(t),[t]);return{nestedDimensionValues:n,nestedDimensions:t,dimensionLookup:r}}const Iz=tr({display:"flex",gap:"8px",alignItems:"center"});function Nz({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!sr(o)&&""!==o.id,l=sr(o?.iconUrl)?void 0:Cg(o.iconUrl,"Revenue Icon");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:"Category",popupTriggerProps:e,children:R(kz,{children:[i?R("div",{className:Iz,children:[l&&I(Sd,{Component:l}),I(sc,{children:o.name})]}):I(sc,{intent:"weak",children:"Select category"}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function Rz(e){return{id:e.id??"",type:e.type??"EXPENSE",date:e.date??"",amount:e.amount??0,displayName:e.displayName??"",description:e.description??"",notes:e.notes??null,reviewStatus:e.reviewStatus??"USER_REVIEW_REQUIRED",apiName:e.apiName??"MANUAL_ENTRY",iconUrl:e.iconUrl??"",apiSourceId:e.apiSourceId??null,bankAccount:e.bankAccount??{id:""},glAccount:e.glAccount??{id:""},dimensionValues:e.dimensionValues??[],customer:e.customer??null,vendor:e.vendor??null,category:e.category??null,invoice:e.invoice??null,bill:e.bill??null,payroll:e.payroll??null,paymentId:e.paymentId??null,...void 0!==e.apiItemId?{apiItemId:e.apiItemId}:{}}}const Pz=(e,t,n)=>{const r=new Set((e=>{const t=[];for(const n of e)for(const e of n.dimensionValues)e.dimension?.id&&t.push(e.dimension.id);return t})(e).map(e=>n.childToRootId.get(e)??e)),a=e.some(e=>!sr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},Dz={id:"customer",name:"Customer"};function Mz(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function Lz(e){return Rz({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function Fz(e,t,n,r,a){if(1===e.length){const o=e[0];"EXPENSE"===t?n(o.category??null):r(o.glAccount??null),a([])}else a(e)}const Oz=gr(lr["line-item-card"],tr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),Vz=tr({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),Uz=tr({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),Bz=fb({defaultValues:{children:[],itemizeByOptions:{}},props:{index:0,transactionType:"EXPENSE",onUnitemize:()=>{}},render:function({form:e,index:t,transactionType:n,onUnitemize:r}){const{nestedDimensionValues:a,nestedDimensions:o,dimensionLookup:i}=Sz(),l=n=>{switch(n.type){case"EXPENSE":return void e.setFieldValue(`children[${t}].category`,n.value);case"REVENUE":return void e.setFieldValue(`children[${t}].glAccount`,n.value)}};return R("div",{...Oz,children:[R("div",{className:Vz,children:[I(sc,{children:`Line Item #${t+1}`}),R(zc,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(sc,{children:"Remove"}),I(Sd,{Component:AN})]})]}),R("div",{className:Uz,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(Az,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(Nz,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),I(e.Subscribe,{selector:e=>({itemizeByOptions:e.values.itemizeByOptions,childDimensionValues:e.values.children[t].dimensionValues}),children:({itemizeByOptions:n,childDimensionValues:r})=>function(e,t,n,r,a,o){const{childToRootId:i}=o;return Object.entries(e).filter(([e,t])=>e!==a&&t).map(([e])=>{const a=(t??[]).findIndex(t=>!sr(t?.dimension?.id)&&(i.get(t.dimension.id)??t.dimension.id)===e);return-1===a?null:{fieldDimension:r.find(t=>t.id===e)?.name??"",dimensionValueOptions:cH(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,Dz.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>I(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(dH(t))})},r[0][0].id))}),I(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&I(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),Hz=tr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function Wz({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=kc();return I(Fc,{children:R(Lm,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return I(Wm,{onClick:()=>{n(e.id,!r)},children:R("div",{className:Hz,children:[I(sc,{children:a(e)}),I(Sd,{Component:r?wi:cf})]})},e.id)}),!sr(r)&&I(Wm,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(sc,{children:"Confirm Selection"})})]})})}const zz=e=>Object.keys(e).filter(t=>e[t]);function _z({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return R(Tc,{placement:"bottom-end",children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Itemize By"}),I(Sd,{Component:Lp})]})}),I(Wz,{items:[...e,Dz],selectedIds:zz(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const jz=tr({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),qz=tr({display:"flex",justifyContent:"space-between",alignItems:"center"}),Kz=tr.raw({color:"surface.intent.danger.active"}),Yz=tr({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function Zz({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=iH(n),i=lH(t,o),l=a&&i,s=a&&r<2,c=o<t?"Your line item amounts are under-allocated":"Your line item amounts are over-allocated";return R("div",{className:jz,children:[R("div",{className:qz,children:[I(sc,{children:`${fw[e]} amount`}),I(sc,{children:JH(t)})]}),R("div",{className:qz,children:[I(sc,{children:"Line items total"}),I(sc,{children:JH(o)})]}),R("div",{className:qz,children:[I(sc,{extraClassNames:l?[Kz]:void 0,children:"Difference"}),I(sc,{extraClassNames:l?[Kz]:void 0,children:(d=t,u=o,Co(new H(d).minus(u).toNumber(),"default"))})]}),l&&R("div",{className:Yz,children:[I(cl,{Component:bi}),I(sc,{extraClassNames:[Kz],children:c})]}),s&&R("div",{className:Yz,children:[I(cl,{Component:bi}),I(sc,{extraClassNames:[Kz],children:"At least 2 line items are required"})]})]});var d,u}function Gz({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(hp,{onSave:e,children:I(Zz,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const Qz=tr({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function Xz(e){const{form:t,dimensions:n,handleAddLineItem:r,handleUnitemize:a,handleItemizeCheckboxChange:i}=function({childTransactions:e,onSubmit:t,transactionType:n,amount:r,category:a,glAccount:i}){const{nestedDimensions:l,dimensionLookup:s}=Sz(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new H(r).div(2).round(2,H.roundDown),n=new H(r).sub(t);return[Rz({amount:t.toNumber(),...structuredClone(c)}),Rz({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=kc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return $B;case"BANK_TRANSFER":return nH;case"REVENUE":return aH}}(r);return vb({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=SH(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=iH(e.children.map(e=>e.amount));return lH(n,r)?{form:"amount-mismatch",fields:t}:Object.keys(t).length>0?{fields:t}:void 0}},onSubmit:e=>{a(e.value.children)}})}({childTransactions:d,itemizeByOptions:Pz(d,l,s),parentAmount:r,transactionType:n,onSubmit:e=>{t(e),u.close()}});return{form:h,dimensions:l,handleAddLineItem:()=>{const e=h.state.values.children,t=e[0];h.setFieldValue("children",[...e,Rz({...t,id:"",amount:0,customer:null,...c})])},handleUnitemize:()=>{const e=h.state.values.children[0];t([e]),u.close()},handleItemizeCheckboxChange:(e,t)=>{if(h.setFieldValue("itemizeByOptions",{...h.state.values.itemizeByOptions,[e]:t}),e===Dz.id)return void(t||h.setFieldValue("children",h.state.values.children.map(e=>({...e,customer:null}))));if(t){const t=l.find(t=>t.id===e);if(sr(t))return;const n={id:"",dimension:t},r=h.state.values.children.map(e=>({...e,dimensionValues:[...e.dimensionValues??[],n]}));return void h.setFieldValue("children",r)}const n=h.state.values.children.map(t=>({...t,dimensionValues:t.dimensionValues.filter(t=>t.dimension?.id!==e)}));h.setFieldValue("children",n)}}}(e),l=I(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>I(_z,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=I(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>I(Gz,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(qv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[I(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>I(Bz,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),I(t.Subscribe,{selector:e=>e.values.children,children:e=>I("div",{className:Qz,children:e.length<10&&R(zc,{onClick:r,active:!1,children:[I(sc,{children:"Add Line Item"}),I(cl,{Component:Os})]})})})]})}function Jz(e){const t=kc();return I(Ov,{children:t.open&&I(Xz,{...e})})}function $z({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=kc();return R(Tc,{children:[I(Ec,{children:e=>I(lN,{Icon:sx,popupTriggerProps:e,children:"Itemize"})}),I(Jz,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(Mz)),r.close()}})]})}const e_=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(Tc,{children:[I(Ec,{children:e=>I(oz,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(lz,{conversationId:r,attachedEntityId:a})]}):I(oz,{onClick:n,activeTab:t}),t_=fb({defaultValues:wH,props:{title:"Transaction",transaction:null,activeTab:null,tabOnClick:()=>{},conversationId:null,transactionId:void 0},render:function({form:e,title:t,transaction:n,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}){const l=He(),s=wT(),c=!sr(n)&&Am(n)&&"EXPENSE"===n.type,{mutateAsync:d}=cC({mutationFn:aC,meta:{toastOptions:{defaultSuccessMessage:"Transactions saved",defaultErrorMessage:"Couldn't save transactions"}}}),h=PH(e),p=u(t=>{Fz(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(Hv,{children:R(zv,{children:[I($u,{}),I(To,{children:t}),i&&I(e_,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(aE,{shouldUseButtonDiscreteStyles:!0,children:R(Lm,{children:[I(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>R(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&I(kW,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&I(tz,{form:e}),0===t.length&&I($z,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:p}),uH(t)&&I(lN,{Icon:sx,onClick:()=>p([t[0]]),children:"Unitemize"})]})}),c&&I(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&I(rz,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===NN.ACTIVE&&I(NH,{onClick:async()=>{sr(n)||await async function(){return ih({title:"Archive transaction",body:"Are you sure you want to archive this transaction?",buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Archive",type:oh.DANGER}]}).then(e=>e===ju)}()&&await h(async()=>{await d(RN([n])),as()})}}),n?.status===NN.INACTIVE&&I(RH,{onClick:async()=>{sr(n)||await h(async()=>{var e;await d((e=[n],e.map(e=>({id:e.id,status:NN.ACTIVE})))),as()})}})]})})]})})}});function n_(e){return 0===e.length||uH(e)&&e.every(e=>null===e.customer)}const r_=fb({defaultValues:wH,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=He();return R(N,{children:[I(e.Subscribe,{selector:e=>{return 0===(t=e.values.children).length||t.every(e=>{switch(e.lineItemType){case"invoice":return!1;case"itemized":return!0}});var t},children:t=>t&&I(e.AppField,{name:"vendor",children:e=>I(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),I(e.Subscribe,{selector:e=>n_(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),I(e.Subscribe,{selector:e=>e.values.frequency,children:r=>{return a&&n&&(o=t?.type,void 0!==(i=r)&&"ONE_TIME"!==i.value&&"EXPENSE"===o)&&I(e.AppField,{name:"frequency",children:e=>I(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"category",children:t=>I(Az,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),a_=fb({defaultValues:wH,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.Subscribe,{selector:e=>n_(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"glAccount",children:t=>I(Nz,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}});function o_({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===lx(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:a,popupTriggerProps:e,children:R(kz,{children:[r?I(MW,{description:r.description||"",amount:r.amount||0,date:r.date||At(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(sc,{intent:"weak",children:"Needs Match"}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const i_=fb({defaultValues:wH,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"reconciliationMatch",children:()=>I(o_,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function l_({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:"Category",popupTriggerProps:e,children:R(kz,{children:[I(sc,{children:BB(r?.paymentInfo?.region)??"Select region..."}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const s_=fb({defaultValues:wH,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(l_,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),I(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>I(e.ButtonGroupField,{label:"Quarter",options:FB})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:xt({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),c_=fb({defaultValues:wH,props:{transaction:null,isManual:!1},render:function({form:e,transaction:t,isManual:n}){const r=t=>{switch(t.type){case"EXPENSE":return e.setFieldValue("category",t.value),void e.setFieldValue("type","EXPENSE");case"REVENUE":return e.setFieldValue("glAccount",t.value),void e.setFieldValue("type","REVENUE");case"TAX_PAYMENT":case"TAX_EXPENSE":return e.setFieldValue("tax.paymentInfo.region",t.value),void e.setFieldValue("type","TAX_PAYMENT");case"BANK_TRANSFER":case"TRANSFER_IN":case"TRANSFER_OUT":return cr(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:sh(t.value.transfer.amount)}),cr(t.value.glAccount)&&(e.setFieldValue("glAccount",t.value.glAccount),e.setFieldValue("reviewStatus","AWAITING_MATCH"),e.setFieldValue("reconciliationMatch",void 0)),void e.setFieldValue("type","BANK_TRANSFER")}};return I(N,{children:I(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return I(r_,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return I(a_,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return I(i_,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return I(s_,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),d_=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function u_({transaction:e,bankAccount:t}){const n=e?e.description:"",r=sr(t)||sr(e)?"":((e,t)=>{const n=Cw(t.type),r=lx(t.amount);return`${n?`${r} `:""}${uh(e.name,e.mask)}`})(t,e);return R("div",{...d_,children:[I(To,{wrap:"wrap",children:n}),t&&I(Eo,{children:r})]})}const h_=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),p_=tr({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function m_({attachments:e,onRemove:t}){return I("div",{className:h_,children:I("div",{className:p_,children:e.map(e=>I(lB,{attachment:e,onRemove:t},e.localId))})})}const g_=fb({defaultValues:wH,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=Dh({mutationFn:dm,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Lr.invalidateQueries({queryKey:["files/attachments"]}),await Lr.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>R(N,{children:[I(e.AttachmentDropzoneField,{entityId:cs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(m_,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),v_=tr({display:"flex",flexDirection:"column",gap:"8px"});function f_({children:e}){return I("div",{className:v_,children:e})}const b_=or({base:{display:"flex",flexDirection:"column",gap:"8px",padding:"8px 12px",backgroundColor:"surface.background",border:"1px solid",borderColor:"border.layout",borderRadius:"md",overflow:"hidden",width:"100%"},variants:{surface:{foreground:{backgroundColor:"surface.foreground"},background:{backgroundColor:"surface.background"}}}});function y_({children:e,surface:t,style:n}){const r=tr(b_.raw({surface:t}),n);return I("div",{className:r,children:e})}function w_(){return I(ip,{alignment:"horizontal"})}const C_=tr({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function x_(e){return I("div",{className:C_,children:e.children})}function T_({property:e}){return"string"==typeof e?I(sc,{children:e}):e}function k_({label:e,value:t}){return R(x_,{children:[I(T_,{property:e}),I(T_,{property:t})]})}function E_(e){return At(Nt(e))}function A_({amount:e,date:t,description:n}){return R(y_,{surface:"foreground",children:[I(k_,{label:"Description",value:n}),I(w_,{}),I(k_,{label:"Date",value:E_(t)}),I(w_,{}),I(k_,{label:"Amount",value:JH(e)})]})}const S_=tr.raw({padding:12});function I_({amount:e}){return I(y_,{surface:"background",style:S_,children:I(k_,{label:"Fee",value:JH(e)})})}const N_=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),R_=tr({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function P_({label:e,warning:t}){return R("div",{className:N_,children:[I(sc,{children:e}),t&&R("div",{className:R_,children:[I(Sd,{Component:bi}),t]})]})}function D_(e){return JH(Math.abs(e))}function M_(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new H(0)),o=(i=a.toNumber(),l=r,"REVENUE"===(s=n)||"BANK_TRANSFER"===s&&l>0?i<l?"overpaid":i>l?"underpaid":"exact":"EXPENSE"===s||"BANK_TRANSFER"===s&&l<0?i>l?"overpaid":i<l?"underpaid":"exact":"exact");var i,l,s;if("exact"===o)return null;const c=a.minus(r).toNumber();return"overpaid"===o?`${D_(c)} Overpaid`:"underpaid"===o?function(e){return`${D_(e)} Underpaid`}(c):null}const L_=fb({defaultValues:wH,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=$W(e.state.values.children);return R(f_,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=M_(t,e.amount,e.type);return I(P_,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?I(A_,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?I(I_,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(Tc,{open:n,onOpenChange:r,children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Linked Invoices"}),I(cl,{Component:rl})]})}),I(ZW,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=QW(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:(t,n)=>{const a=JW(n);e.setFieldValue("children",a),r(!1)},hasExistingInvoices:!0,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function F_({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:JH(t)},{label:"Category",value:"EXPENSE"===e?n?.name??"":r?.name??""},...o.map(e=>{const t=a.find(t=>t.dimension?.id===e.id);return void 0===t?null:{label:e.name??"",value:t.name??""}}).filter(e=>null!==e),...null!==i?[{label:"Customer",value:i.name??""}]:[]];return I(y_,{children:l.map((e,t)=>R(f,{children:[t>0&&I(w_,{}),I(k_,{label:e.label,value:e.value.toString()})]},e.label))})}const O_=fb({defaultValues:wH,render:function({form:e}){const{query:{data:t}}=qF(),n=e.state.values.children;if(uH(n))return R(f_,{children:[I(sc,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(F_,{transactionType:e.state.values.type,amount:n.amount??0,category:n.category??null,glAccount:n.glAccount??null,dimensionValues:n.dimensionValues,dimensions:t?.data??[],customer:n.customer},`${n.id}_${r}`)),R(Tc,{children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Line Items"}),I(cl,{Component:rl})]})}),I(Jz,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(Lz),onSubmit:t=>{Fz(t.map(Mz),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),V_=fb({defaultValues:wH,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=xW(e.state.values.children);return R(f_,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=M_(t,e.amount,e.type);return I(P_,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?I(A_,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?I(I_,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(Tc,{open:n,onOpenChange:r,children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Linked Bills"}),I(cl,{Component:rl})]})}),I(uW,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=mW(t);0!==n&&a.push(hW(n)),e.setFieldValue("children",a),r(!1)},previouslySelected:a})]})]})}});function U_({amount:e,bankAccountName:t,date:n,description:r}){return R(y_,{surface:"foreground",children:[I(k_,{label:"Description",value:r}),I(w_,{}),t&&R(N,{children:[I(k_,{label:"Account",value:t}),I(w_,{})]}),I(k_,{label:"Date",value:E_(n)}),I(w_,{}),I(k_,{label:"Amount",value:JH(e)})]})}const B_=fb({defaultValues:wH,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.filter(e=>"payment"===e.lineItemType).map(e=>({id:e.payment.id,amount:ch(e.payment.amount),date:e.payment.date,description:e.payment.name,bankAccount:{displayName:e.payment.bankAccount.displayName}}));return R(f_,{children:[I(P_,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?I(U_,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),R(Tc,{open:t,onOpenChange:n,children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Linked Transactions"}),I(cl,{Component:rl})]})}),I(WW,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,previouslySelected:r,onSubmit:(t,r)=>{const a=e.state.values.children.filter(e=>"payment"===e.lineItemType&&t.includes(e.payment.id)),o=JW(r);e.setFieldValue("children",[...a,...o]),n(!1)}})]})]})}}),H_=fb({defaultValues:wH,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?I(L_,{form:e}):t.some(e=>"bill"===e.lineItemType)?I(V_,{form:e}):t.some(e=>"payment"===e.lineItemType)?I(B_,{form:e}):uH(t)?I(O_,{form:e}):null}});function W_({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:c}=Sz(),u=void 0===i?bw[s]:yw[s],[h,p]=d(l??null),m=I(t_,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),g=I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(hp,{disabled:e,isSubmitting:t})});return R(LB,{onSubmit:n.handleSubmit,Header:m,Footer:g,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(u_,{transaction:e,bankAccount:r}),I(n.AppField,{name:"amount",children:e=>I(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),I(n.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),I(c_,{form:n,transaction:e,isManual:a}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>function(e,t,n){const r=new Set(e.map(e=>e?.dimension?.id)),a=n.filter(e=>!r.has(e.dimension?.id));return t.filter(e=>!r.has(e.id)).map(e=>{const n=t.findIndex(t=>t.id===e.id),r=cH(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,c).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>I(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>I(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(dH(e))})},r[0][0].id))}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>Je(e)&&I(H_,{form:n})}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(g_,{form:n,transactionId:i})]})}function z_({transactionId:e,initialTab:t,initialType:n}){const{transaction:r,nestedDimensions:a,form:o,bankAccount:i,isManual:l,isLoading:s}=function({transactionId:e,initialType:t}){const{nestedDimensions:n,dimensionLookup:r}=Sz(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=xs({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:IH(a,r,t),bankAccount:lg(a?.bankAccount?.id??""),isManual:sr(a)||Am(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return I(o.Subscribe,{selector:e=>e.values.type,children:n=>I(W_,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function __({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=xs({id:e});return s(()=>{!r&&sr(n)&&as()},[n,r]),sr(n)?null:I(z_,{transactionId:e,initialTab:t})}function j_({transactionId:e,initialTab:t,initialType:n}){return e?I(__,{transactionId:e,initialTab:t}):!e&&n?I(z_,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function q_({subject:e,children:t}){return R(Hv,{children:[R(zv,{children:[I($u,{}),I(To,{children:e})]}),I("div",{className:KN({alignItems:"center",gap:15}),children:t})]})}function K_({conversationId:e,defaultValues:t}){const[n,r]=d(e),{query:{data:a}}=Ll(n),o="CLOSED"===a?.resolutionStatus;return I(vU,{children:R(bU,{children:[I(q_,{subject:a?.subject??"Conversation"}),I(AB,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const Y_=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_18201_5557)"},r.createElement("path",{d:"M7.5 14.0625C11.1244 14.0625 14.0625 11.1244 14.0625 7.5C14.0625 3.87563 11.1244 0.9375 7.5 0.9375C3.87563 0.9375 0.9375 3.87563 0.9375 7.5C0.9375 11.1244 3.87563 14.0625 7.5 14.0625Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M7.49999 10.4812V6.30624H6.30624",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.30624 10.4813H8.69374",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.90625 4.51874H8.09375",strokeWidth:.9375,strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_18201_5557"},r.createElement("rect",{width:15,height:15,fill:"white"})))),"Info");function Z_({onClick:e,active:t}){return I(Xs,{type:"button",onClick:e,active:t,children:I(Sd,{Component:Y_})})}const G_=tr({display:"flex",flexDirection:"column"});function Q_({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:G_,children:[I(Eo,{children:e}),n?I(wB,{width:r}):I(To,{wrap:"wrap",children:t??""})]})}function X_({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=xs({id:e}),a=lg(n?.bankAccount.id??"");if(sr(n))return null;const o=_N({alignItems:"stretch",gap:5,paddingLeft:16,paddingRight:16,backgroundColor:"surface.foreground",borderWidth:0,borderBottomStyle:"solid",borderColor:"border.layout.strong",maxHeight:0,overflow:"hidden",transition:"all 300ms ease-out","&[data-open='true']":{maxHeight:"1/3",paddingTop:16,paddingBottom:16,borderWidth:"lg",overflow:"scroll"}});return R("div",{"data-open":t,className:o,children:[R("div",{className:KN({justifyContent:"space-between"}),children:[I(Q_,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(Q_,{label:"Amount",data:bo(sh(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(Q_,{label:"Bank Account",data:uh(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(Q_,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function J_({conversationId:e,transactionId:t}){const[n,r]=d(e),[a,o]=d(!0),{query:{data:i}}=Ll(n),l="CLOSED"===i?.resolutionStatus;return I(vU,{children:R(bU,{children:[I(q_,{subject:i?.subject??"Conversation",children:cr(t)&&I(Z_,{onClick:()=>o(!a),active:a},"infoButton")}),cr(t)&&I(X_,{transactionId:t,isOpen:a}),I(AB,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function $_(){const e=os().length>1;return I(vU,{children:R(bU,{background:"foreground",children:[I(Hv,{children:R(zv,{children:[I($u,e?{Icon:nl}:{}),I(To,{children:"Add New Connection"})]})}),I(BA,{})]})})}function ej(){return I(Hv,{children:R(zv,{children:[I($u,{}),I(To,{children:"Financial Summary"})]})})}const tj=tr({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),nj=xr.raw({body:"default"}),rj=tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},nj);function aj({summaryText:e}){return I("div",{className:tj,children:I("div",{className:rj,children:e})})}const oj=tr({display:"flex",flexDirection:"column",overflow:"auto"});function ij({summary:e}){return R("div",{className:oj,children:[I(ej,{}),I(aj,{summaryText:e})]})}const lj=tr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function sj({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Vr({queryKey:Ps({id:e}),queryFn:Ms})}({id:e});return I(vU,{children:R("div",{className:lj,children:[I(bU,{children:I(ij,{summary:n?.summary})}),I(ip,{}),I(SB,{conversationId:t??null,attachedEntityId:e})]})})}function cj(){return I(vU,{children:I(bU,{children:I($A,{showCloseButton:!0,inOverlay:!0})})})}const dj=S.object({id:S.string(),name:S.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:S.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:S.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Ir(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),uj={mergeDestination:Ng,selectedAccount:null};const hj=tr({display:"flex",flexDirection:"column",gap:"20px"}),pj=tr({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),mj=tr.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),gj=tr(mj,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),vj=tr(mj,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),fj=tr(mj,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),bj=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),yj=tr({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),wj=tr({width:"100%",display:"flex",justifyContent:"flex-start"}),Cj=tr({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),xj=tr({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),Tj=e=>{kp(e),Ep(e)};function kj({account:e}){const t=kc(),n=function(e,t){const{mutateAsync:n}=Uh(),r=yH();return vb({defaultValues:uj,onSubmit:async a=>{if(await jh()===ju&&cr(e)&&cr(a.value.selectedAccount)){const s=(o=e,i=a.value.mergeDestination,l=a.value.selectedAccount,i===Ng?{...zh(l),duplicateBankAccountIds:[cs(o.id)]}:{...zh(o),duplicateBankAccountIds:[cs(l.id)]});try{await n(s),t.close(),a.value.mergeDestination===Ng&&r()}catch{await qh()}}var o,i,l},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=bh();if(!(r&&r.data||a))return null;const o=r?.data?.filter(t=>t.glAccountId&&t.isSupported&&t.id!==e?.id&&t.integration?.id!==e?.integration?.id);return R("form",{className:hj,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:Tj,children:[I(To,{children:"Merge Accounts"}),I("div",{className:pj,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:gj,children:[I("div",{className:wj,children:I(To,{children:"Duplicate Account"})}),t===Ng?I(Tg,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Pg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Dg(t,e,n.state.value)})})]}),R("div",{className:vj,children:[I("div",{className:Cj,children:I(To,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:yj,children:I(Xs,{onClick:()=>e.handleChange(e.state.value===Ng?Ig:Ng),children:I(Sd,{Component:rl})})})})]}),R("div",{className:fj,children:[I("div",{className:xj,children:I(To,{children:"Destination Account"})}),t===Ng?I(n.AppField,{name:"selectedAccount",children:n=>I(Pg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Dg(t,e,n.state.value)})}):I(Tg,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:bj,children:[I(wb,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(Jh,{disabled:sr(e),showIcon:!1,textContent:"Merge"})})]})]})}function Ej({bankAccount:e}){return I(Lm,{children:R(Tc,{placement:"right-start",children:[I(Ec,{children:e=>R(Wm,{...e,children:[I(Sd,{Component:fE}),I(To,{children:"Merge Account"})]})}),I(Pv,{children:I(Lv,{children:I(lE,{children:I(kj,{account:e})})})})]})})}const Aj=tr({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"left",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}}),Sj=({tranStartDate:e})=>R(N,{children:[I(Eo,{children:"Start Date"}),Nr(e)?I(To,{children:`${Ft(Nt(e))}`}):I(To,{children:"Set Start Date"})]});function Ij({bankAccount:e}){return R(Tc,{placement:"right-start",children:[I(Ec,{children:t=>I("button",{className:rr(ur(lr["start-date-form-section"]),Aj,ll),...t,type:"button",children:I(Sj,{tranStartDate:e.tranStartDate})})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(mE,{bankAccounts:[e]})})})})]})}const Nj=e=>["accounting/manualJournalEntry",e.id],Rj=async e=>{const t=e.queryKey,n=t[2].accessToken,r=t[2].environment,a={path:"/accounting/manualJournalEntry?id={id}",pathParams:{id:t[1]},accessToken:n,environment:r};return await Ai(a)};function Pj({id:e}){return Vr({queryKey:Nj({id:String(cs(e))}),queryFn:Rj,enabled:cr(e)})}const Dj=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/accounting/manualJournalEntry",bodyParams:{manualJournalEntry:e},accessToken:t,endpointManager:Oa(n)};return await Pa(r)})({data:e,accessToken:t,environment:n});const Mj=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Oa(n)};return await Pa(r)},Lj=S.object({amount:S.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:S.string("Required")}),Fj=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===cs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},Oj=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=Pj({id:t??null}),r=function(){const{query:{data:e}}=vC();return AC(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutateAsync:a}=Dh({mutationFn:Mj,meta:{toastOptions:{defaultErrorMessage:"Couldn't save beginning balance"}},onSuccess:async()=>{ya("beginning balance mutation successful, invalidating bank account queries");try{return Lr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}}});const{mutateAsync:o}=Dh({onSuccess:async()=>{ya("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Lr.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Lr.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}},mutationFn:Dj,meta:{toastOptions:{defaultErrorMessage:"Couldn't update journal entry"}}}),i=kc(),l=((e,t)=>{const n=Fj(e,t);return{amount:cr(e.beginningBalanceData.journalEntry?.id)?n:"",date:cr(t?.date)?t.date:""}})(e,n);return vb({defaultValues:l,validators:{onBlur:Lj},onSubmit:async l=>{if(sr(t)||sr(n))await a({bankAccountId:cs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(sr(e.id))return null;const o={...e,id:e.id},i=a.map(e=>cs(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===cs(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),sr(l)?null:(o.transactions?.forEach(e=>{i.includes(e.glAccountId)&&(e.drAmount?e.drAmount=Number(e.drAmount)-l:e.crAmount&&(e.crAmount=Number(e.crAmount)-l))}),o.date=Rt(t)??o.date,o)})(n,Nt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);cr(t)&&await o(t)}return i.close()}})},Vj=tr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),Uj=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function Bj({bankAccount:e}){const t=Oj(e),n=kc(),r=()=>{n.close()};return R("form",{className:Vj,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(To,{children:"Set Beginning Balance"}),I(t.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),I(t.AppField,{name:"amount",children:e=>I(e.EditableAmountField,{label:"Beginning Balance Amount"})}),I(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:Uj,children:[I(wb,{showIcon:!1,onClick:r}),I(Jh,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const Hj=or({base:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"right",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}},variants:{layout:{left:{alignItems:"flex-start"},right:{alignItems:"flex-end"}}}}),Wj=tr({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function zj({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=gr(lr["beginning-balance-form-section"],Hj({layout:a}),ll),i=gr(lr["beginning-balance-form-section"],Hj({layout:"right"}),ll),l=r&&Ft(r);return R(Tc,{placement:"right-start",children:[I(Ec,{children:e=>R("div",{className:Wj,children:[R("button",{...o,...e,type:"button",children:[I(Eo,{children:"Beginning Balance"}),I(To,{children:cr(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{...i,...e,type:"button",children:[I(Eo,{children:"Migration Date"}),I(To,{children:l})]})]})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(Bj,{bankAccount:e})})})})]})}const _j=or({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function jj({bankAccount:e,showStartDate:t}){const{query:{data:n}}=Pj({id:e?.beginningBalanceData.journalEntry?.id??null}),r=Fj(e,n),a=cr(n?.date)?Nt(n?.date):null,o=cr(e.tranStartDate)?Nt(e.tranStartDate):null,i=cr(a)&&cr(o)&&!Tt(a,o),l=i?"left":t?"right":"left";return R("div",{className:_j({layout:i?"stacked":"inline"}),children:[t&&I(Ij,{bankAccount:e}),I(zj,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const qj=tr({marginTop:"15px",marginBottom:"15px"}),Kj={id:"",name:"",mask:"",type:void 0};const Yj=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],Zj=e=>{kp(e),Ep(e)};function Gj({bankAccountId:e}){const t=lg(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:Kj,[r,a]=d(n),o=function(e,t){const{mutateAsync:n}=Uh(),{mutateAsync:r}=Vh({mutationFn:Lh,meta:{toastOptions:{defaultSuccessMessage:"Account created",defaultErrorMessage:"Couldn't create account"}}}),a=Nr(String(e.id)),o=yH();return vb({defaultValues:e,validators:{onBlur:dj},onSubmit:async e=>{if(a)await n(zh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((i=e.value,{apiAccountName:i.name,apiAccountNo:i.mask??void 0,apiAccountType:i.type||"DEPOSITORY",duplicateBankAccountIds:[]})),a={id:ss({id:n?.dataObject?.id,prefix:"BANK_ACCOUNT"}),name:n?.dataObject?.apiAccountName??"",mask:n?.dataObject?.apiAccountNo??"",type:e.value.type};t(a),e.formApi.reset(a,{keepDefaultValues:!0})}var i;return o()},onSubmitInvalid:()=>{}})}(r,a),i=!t||Hh(t.apiName),l=!!t&&Wh(t.apiName),s=uh(r?.name??"",r?.mask??""),c=Nr(s)?s:"New Bank Account",u=l&&cr(t?.tranStartDate);return I(vU,{children:I(bU,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:Zj,children:[R(Hv,{children:[R(zv,{children:[I($u,{Icon:nl}),I(To,{children:c}),cr(t)&&I(aE,{shouldUseButtonDiscreteStyles:!0,children:I(Ej,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),R(NB,{children:[I(o.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),I(o.AppField,{name:"mask",children:e=>I(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),I(o.AppField,{name:"type",children:e=>I(e.GenericSelectorField,{label:"Account Type",options:Yj,disabled:!i})}),cr(t)&&R(N,{children:[I("div",{className:qj,children:I(ip,{alignment:"horizontal"})}),I(jj,{bankAccount:t,showStartDate:u})]})]})]})})})}function Qj({filters:e,filterModels:t,setFilters:n}){const r=os().length>1,[a,o]=d(()=>KT(e,t));return I(vU,{children:R(bU,{children:[I(Hv,{children:R(zv,{children:[I($u,r?{Icon:nl}:{}),I(sc,{children:"Back"})]})}),I(HF,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),I(AS,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=GT(a);n(e),as()}})]})})}function Xj({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=EI(e);return I(Qj,{filters:n,filterModels:t,setFilters:r})}function Jj(){const e=pP();return I(Xj,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function $j(){const e=PP();return I(Xj,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function eq(){const e=OI();return I(Xj,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function tq({Icon:e,label:t,popupTriggerChildrenProps:n}){return R(pf,{popupTriggerChildrenProps:n,children:[R(iS,{children:[I(Sd,{Component:e}),I(sc,{children:t})]}),I(Sd,{Component:rl})]})}const nq=vi(DH,"Expenses");function rq(){return I(tq,{Icon:nq,label:"Categories"})}const aq=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.50005 8.39072C9.01022 8.39072 10.2345 7.16647 10.2345 5.6563C10.2345 4.14612 9.01022 2.92188 7.50005 2.92188C5.98987 2.92188 4.76562 4.14612 4.76562 5.6563C4.76562 7.16647 5.98987 8.39072 7.50005 8.39072Z"}),r.createElement("path",{d:"M11.5981 13.1742V12.4749C11.5944 11.3904 11.161 10.3516 10.3929 9.58611C9.62473 8.82059 8.58446 8.39074 7.49999 8.39075C6.4131 8.39075 5.37072 8.82251 4.60217 9.59106C3.83362 10.3596 3.40186 11.402 3.40186 12.4889V13.1882"}),r.createElement("path",{d:"M7.50011 14.4244C11.3244 14.4244 14.4245 11.3242 14.4245 7.49998C14.4245 3.67573 11.3244 0.575562 7.50011 0.575562C3.67585 0.575562 0.575684 3.67573 0.575684 7.49998C0.575684 11.3242 3.67585 14.4244 7.50011 14.4244Z"})),"Person"),oq=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function iq(e){return{id:e.id,name:e.name,status:e.status,additionalContactName:e.additionalContactName,businessName:e.businessName,email:e.email,ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoiceSettings:e.invoiceSettings,address:e.address}}function lq(e,t){return{search:Nr(e)?e:void 0,status:{in:t}}}function sq(e){return e.pages.flatMap(e=>(e.data??[]).map(iq))}const cq=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function dq(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function uq(e,t){const n=(e,n)=>pH(e=>!t(e),e,n);return{state:n("state",Ir(e.state)?void 0:e.state),city:n("city",Ir(e.city)?void 0:e.city),zip:n("zip",Ir(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Ir(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Ir(e.address1)?void 0:e.address1),address2:n("address2",Ir(e.address2)?void 0:e.address2)}}const hq=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:cq});function pq(e){return{id:e.id,status:e.status,name:e.name,billingContactName:e.additionalContactName||"",email:e.email||"",ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoicePrefix:e.invoiceSettings.invoicePrefix||"",address:dq(e.address)}}const mq=S.object({state:S.string(),city:S.string(),zip:S.string(),phoneWork:S.string(),address1:S.string(),address2:S.string()}),gq=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:S.string().optional(),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),email:S.email().or(S.literal("")),ccEmails:S.array(S.email()),bccEmails:S.array(S.email()),invoicePrefix:S.string().optional(),address:mq.optional()});function vq({customer:e}){const{mutateAsync:t}=Ev(),n=kc();return vb({defaultValues:e??hq,validators:{onSubmit:gq},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>pH(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(cq).filter(e=>e in cq).some(e=>!n(e))?uq(e.address??cq,n):void 0,i=a("invoicePrefix",Nr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Nr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Nr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:sr(i)?void 0:{invoicePrefix:i},address:o}}(e,0,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}const fq=Object.entries({UNKNOWN:"UNKNOWN",ALABAMA:"AL",ALASKA:"AK",AMERICAN_SAMOA:"AS",ARIZONA:"AZ",ARKANSAS:"AR",CALIFORNIA:"CA",COLORADO:"CO",CONNECTICUT:"CT",DELAWARE:"DE",DISTRICT_of_COLUMBIA:"DC",FLORIDA:"FL",GEORGIA:"GA",GUAM:"GU",HAWAII:"HI",IDAHO:"ID",ILLINOIS:"IL",INDIANA:"IN",IOWA:"IA",KANSAS:"KS",KENTUCKY:"KY",LOUISIANA:"LA",MAINE:"ME",MARYLAND:"MD",MASSACHUSETTS:"MA",MICHIGAN:"MI",MINNESOTA:"MN",MISSISSIPPI:"MS",MISSOURI:"MO",MONTANA:"MT",NEBRASKA:"NE",NEVADA:"NV",NEW_HAMPSHIRE:"NH",NEW_JERSEY:"NJ",NEW_MEXICO:"NM",NEW_YORK:"NY",NORTH_CAROLINA:"NC",NORTH_DAKOTA:"ND",MARIANA_ISLANDS:"MP",OHIO:"OH",OKLAHOMA:"OK",OREGON:"OR",PENNSYLVANIA:"PA",PUERTO_RICO:"PR",RHODE_ISLAND:"RI",SOUTH_CAROLINA:"SC",SOUTH_DAKOTA:"SD",TENNESSEE:"TN",TEXAS:"TX",UTAH:"UT",VERMONT:"VT",VIRGIN_ISLANDS:"VI",VIRGINIA:"VA",WASHINGTON:"WA",WEST_VIRGINIA:"WV",WISCONSIN:"WI",WYOMING:"WY"}).filter(([e])=>"UNKNOWN"!==e).map(([e,t])=>({label:e.split("_").map(e=>/^[a-z]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),value:t})),bq=tr({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),yq=tr({width:"100%"}),wq=bb({defaultValues:cq,props:{disabled:!1},render:function({group:e,disabled:t}){return R(N,{children:[I(e.AppField,{name:"address1",children:e=>I(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),I(e.AppField,{name:"address2",children:e=>I(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),I(e.AppField,{name:"city",children:e=>I(e.TextField,{label:"City",placeholder:"City",disabled:t})}),R("div",{className:bq,children:[I("div",{className:yq,children:I(e.AppField,{name:"state",children:()=>I(hg,{label:"State",options:[{label:"Select State",value:""},...fq],isEmpty:Ir,disabled:t})})}),I("div",{className:yq,children:I(e.AppField,{name:"zip",children:e=>I(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),I(e.AppField,{name:"phoneWork",children:e=>I(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),Cq=tr.raw({width:"100%"});function xq({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o,isSubmitting:i}){const l=wT();return R(N,{children:[I(ip,{alignment:"horizontal",color:"normal"}),R("div",{className:lp,children:[!o&&I(ap,{disabled:a,onClick:t,isSubmitting:i}),o&&l&&I(Xs,{onClick:n,styles:Cq,children:I(sc,{children:r})}),e]})]})}const Tq=tr({display:"flex",gap:"8px"});function kq({title:e,customer:t}){const n=vq({customer:t}),[r,a]=d(n.state.values.ccEmails.length>0),[o,i]=d(n.state.values.bccEmails.length>0),l=kc(),s=wT(),c="ACTIVE"===t?.status,u="INACTIVE"===t?.status,h=u&&!s,{mutateAsync:p}=Xg({mutationFn:Tv,onSuccess:kv,meta:{toastOptions:{defaultSuccessMessage:"Customer deleted",defaultErrorMessage:"Couldn't delete customer"}}}),{mutateAsync:m}=Ev(),g=PH(n),v=async()=>{if(sr(t))return;"RESTORE"===await async function(e){return ih({title:"Restore customer",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&await g(async()=>{await m({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),l.close()})},f=c||h?I(aE,{shouldUseButtonDiscreteStyles:!0,children:R(Lm,{children:[c&&I(NH,{onClick:async()=>{if(sr(t))return;const{id:e}=t;if(sr(e))return;"ARCHIVE"===await async function(e){return ih({title:"Archive customer",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&await g(async()=>{await p({id:e}),l.close()})}}),u&&I(RH,{onClick:v})]})}):null,b=h?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(xq,{onSave:n.handleSubmit,disabled:e,restoreLabel:"Restore Customer",onRestore:v,isArchived:u,isSubmitting:t})});return I(qv,{title:e,HeaderRightAction:f,Footer:b,padChildren:!1,children:R(NB,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:u})}),I(n.AppField,{name:"billingContactName",children:e=>I(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:u})}),I(n.AppField,{name:"email",children:e=>I(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:u})}),I(n.AppField,{name:"ccEmails",children:e=>r&&I(e.MultiEmailField,{label:"CC Billing Emails",disabled:u})}),I(n.AppField,{name:"bccEmails",children:e=>o&&I(e.MultiEmailField,{label:"BCC Billing Emails",disabled:u})}),(!r||!o)&&R("div",{className:Tq,children:[!r&&I(zc,{onClick:()=>a(!0),children:"CC"}),!o&&I(zc,{onClick:()=>i(!0),children:"BCC"})]}),I(n.AppField,{name:"invoicePrefix",children:e=>I(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:u})}),I(wq,{form:n,fields:"address",disabled:u})]})})}function Eq({title:e,customer:t}){const n=kc();return I(Ov,{children:n.open&&I(kq,{title:e,customer:t})})}const Aq=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function Sq({customer:e}){const t=kf(),[n,r]=d(!1),a=R(N,{children:[R(iS,{children:[I(Td,{Component:aq}),R("div",{className:Aq,children:[I(sc,{children:e.name}),e.email&&I(Eo,{children:e.email})]})]}),I(Sd,{Component:rl})]});if(t?.preventDefault)return I(pf,{handleClick:()=>{t.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null})},children:a});const o=()=>{t?.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null}),r(!0)};return R(Tc,t?{enableClickMiddleware:!1,open:n,onOpenChange:r,children:[I(Ec,{children:e=>I(pf,{handleClick:o,popupTriggerChildrenProps:e,children:a})}),I(Eq,{title:"Edit Customer",customer:pq(e)})]}:{children:[I(Ec,{children:e=>I(pf,{popupTriggerChildrenProps:e,children:a})}),I(Eq,{title:"Edit Customer",customer:pq(e)})]})}const Iq=tr.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function Nq({selectedValue:e,Icon:t=Lp,options:n,onClick:r,additionalStyles:a=[]}){return R(Tc,{children:[I(Ec,{children:n=>R(Xs,{popupTriggerProps:n,styles:[Iq,...a],children:[I(sc,{children:e.label}),I(Sd,{Component:t})]})}),I(sg,{options:n,onClick:r})]})}const Rq=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),Pq=tr({display:"flex",gap:"8px"}),Dq=tr.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function Mq({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return R("div",{className:Rq,children:[I(sc,{intent:"weak",children:"Search"}),R("div",{className:Pq,children:[I(WH,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),I(Nq,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[Dq]})]})]})}const Lq=R(N,{children:[I(Sd,{Component:Os}),I(sc,{children:"Add Customer"})]});function Fq(){const e=kf(),[t,n]=d(!1);if(e?.preventDefault)return I(Xs,{onClick:()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null})},children:Lq});if(cr(e)){const r=()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}),n(!0)};return R(Tc,{enableClickMiddleware:!1,open:t,onOpenChange:n,children:[I(Ec,{children:e=>I(Xs,{onClick:r,popupTriggerProps:e,children:Lq})}),I(Eq,{title:"Add Customer",customer:void 0})]})}return R(Tc,{children:[I(Ec,{children:e=>I(Xs,{popupTriggerProps:e,children:Lq})}),I(Eq,{title:"Add Customer",customer:void 0})]})}function Oq(){const[e,t]=d(""),[n,r]=d(oq[0]),{list:a,fetchNextPage:o,canFetchNextPage:i,isLoading:l}=function({searchTerm:e,statuses:t,selected:n,onSelectedChange:r}){const{query:{data:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isFetchingNextPage:s,isPending:c}}=function(e={},t){return Hg({queryFn:Cv,queryKey:fv(e),...t})}({filter:lq(e,t)},{select:sq});return{list:ef({data:[a??[]],getRowKey:e=>e.id,getGroupKey:()=>"customers",state:void 0!==n?{selected:n}:void 0,onSelectedChange:r}),data:a,fetchNextPage:o,canFetchNextPage:!i&&l,isLoading:i&&!s||c}}({searchTerm:e,statuses:n.value});return R(qv,{title:"Back",HeaderRightAction:I(Fq,{}),padChildren:!0,children:[I(Mq,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:oq,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>I(hS,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>I(Sq,{customer:e.value},e.value.id))},e.key)),I(QH,{onIntersect:o,enable:i})]})}function Vq(){const e=kc();return I(Ov,{children:e.open&&I(Oq,{})})}function Uq(){return R(Tc,{children:[I(Ec,{children:e=>I(tq,{Icon:aq,label:"Customers",popupTriggerChildrenProps:e})}),I(Vq,{})]})}const Bq=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,strokeLinecap:"square",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.05348 1.63635V5.42983C4.05348 5.88785 3.87154 6.3271 3.54768 6.65096C3.22381 6.97483 2.78456 7.15677 2.32655 7.15677C1.86853 7.15677 1.42928 6.97483 1.10542 6.65096C0.781554 6.3271 0.599609 5.88785 0.599609 5.42983L1.97971 1.63635H4.05348Z"}),r.createElement("path",{d:"M7.50007 1.63635V5.42983C7.51534 5.66553 7.4821 5.90185 7.4024 6.12419C7.3227 6.34653 7.19825 6.55015 7.03673 6.72248C6.8752 6.8948 6.68005 7.03216 6.46333 7.12607C6.24661 7.21997 6.01293 7.26842 5.77674 7.26842C5.54055 7.26842 5.30687 7.21997 5.09015 7.12607C4.87343 7.03216 4.67828 6.8948 4.51676 6.72248C4.35524 6.55015 4.23078 6.34653 4.15108 6.12419C4.07139 5.90185 4.03815 5.66553 4.05342 5.42983V1.63635H7.50007Z"}),r.createElement("path",{d:"M10.9468 1.63635V5.42983C10.9621 5.66553 10.9289 5.90185 10.8492 6.12419C10.7695 6.34653 10.645 6.55015 10.4835 6.72248C10.322 6.8948 10.1268 7.03216 9.91011 7.12607C9.69339 7.21997 9.45971 7.26842 9.22352 7.26842C8.98733 7.26842 8.75365 7.21997 8.53693 7.12607C8.32021 7.03216 8.12506 6.8948 7.96354 6.72248C7.80201 6.55015 7.67756 6.34653 7.59786 6.12419C7.51817 5.90185 7.48493 5.66553 7.5002 5.42983V1.63635H10.9468Z"}),r.createElement("path",{d:"M14.4007 5.42983C14.4007 5.88785 14.2187 6.3271 13.8948 6.65096C13.571 6.97483 13.1317 7.15677 12.6737 7.15677C12.2157 7.15677 11.7764 6.97483 11.4526 6.65096C11.1287 6.3271 10.9468 5.88785 10.9468 5.42983V1.63635H13.0205L14.4007 5.42983Z"}),r.createElement("path",{d:"M13.0206 7.15678V13.3636H1.97974V7.15678H2.32657C2.55335 7.15678 2.77792 7.11211 2.98744 7.02532C3.19696 6.93854 3.38734 6.81133 3.5477 6.65097C3.70806 6.49061 3.83526 6.30023 3.92205 6.09071C4.00884 5.88119 4.05351 5.65662 4.05351 5.42984C4.03824 5.66554 4.07148 5.90186 4.15117 6.12419C4.23087 6.34653 4.35532 6.55016 4.51685 6.72248C4.67837 6.89481 4.87352 7.03217 5.09024 7.12607C5.30696 7.21998 5.54064 7.26842 5.77683 7.26842C6.01302 7.26842 6.2467 7.21998 6.46342 7.12607C6.68014 7.03217 6.87529 6.89481 7.03681 6.72248C7.19834 6.55016 7.32279 6.34653 7.40249 6.12419C7.48218 5.90186 7.51542 5.66554 7.50015 5.42984C7.48488 5.66554 7.51812 5.90186 7.59782 6.12419C7.67752 6.34653 7.80197 6.55016 7.96349 6.72248C8.12502 6.89481 8.32017 7.03217 8.53689 7.12607C8.75361 7.21998 8.98729 7.26842 9.22348 7.26842C9.45967 7.26842 9.69335 7.21998 9.91007 7.12607C10.1268 7.03217 10.3219 6.89481 10.4835 6.72248C10.645 6.55016 10.7694 6.34653 10.8491 6.12419C10.9288 5.90186 10.9621 5.66554 10.9468 5.42984C10.9468 5.65662 10.9915 5.88119 11.0783 6.09071C11.165 6.30023 11.2922 6.49061 11.4526 6.65097C11.613 6.81133 11.8033 6.93854 12.0129 7.02532C12.2224 7.11211 12.447 7.15678 12.6737 7.15678H13.0206Z"}),r.createElement("path",{d:"M10.2604 9.91696H4.73999V13.3636H10.2604V9.91696Z"})),"Vendor"),Hq=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:cq,iconUrl:void 0});function Wq(e){return{id:e.id,name:e.name,status:e.status,address:dq(e.address),iconUrl:e.iconUrl||void 0}}const zq=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),address:mq.optional(),iconUrl:S.string().optional()});const _q=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function jq(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address}}function qq(e,t,n){return{search:Nr(e)?e:void 0,name:sr(n)?void 0:{notEqual:n},status:{in:t}}}function Kq(e){return e.pages.flatMap(e=>(e.data??[]).map(jq))}function Yq({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:qq(e,t,n)},u={select:Kq},Hg({queryFn:Kg,queryKey:zg(d),...u}));var d,u;return{list:ef({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"vendors",state:void 0!==r?{selected:r}:void 0,onSelectedChange:a}),data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isLoading:l&&!c}}const Zq=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.4375 7.5H0.3125",strokeMiterlimit:10}),r.createElement("path",{d:"M8.6626 2.72498L13.4376 7.49998L8.6626 12.275",strokeMiterlimit:10})),"LongArrowRight"),Gq=tr({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),Qq=tr({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),Xq=or({base:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"8px",padding:"8px",borderWidth:"md",borderColor:"border.layout",borderStyle:"solid",flex:"1",minWidth:"0"},variants:{archivedVendor:{true:{backgroundColor:"surface.background"},false:{backgroundColor:"surface.foreground"}}}}),Jq=tr({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),$q=tr({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function eK({targetVendor:e,duplicateVendor:t}){return R("div",{className:Gq,children:[I(sc,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),R("div",{className:Qq,children:[R("div",{className:Xq({archivedVendor:!0}),children:[I(Sd,{imageUrl:t.iconUrl,Component:Bq}),I(sc,{intent:"weak",children:t.name})]}),R("div",{className:Jq,children:[I(Sd,{Component:Zq,stylists:[gr(null,$q)]}),I(Eo,{intent:"weak",children:"Merging Into"})]}),R("div",{className:Xq({archivedVendor:!1}),children:[I(Sd,{imageUrl:e.iconUrl,Component:Bq}),I(sc,{children:e.name})]})]}),I(sc,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function tK({vendor:e,onClose:t}){const{mutate:n}=Xg({mutationFn:nv,onSuccess:rv}),[r,a]=d({}),[o,i]=d(""),{list:l,data:s,fetchNextPage:c,isFetching:u,hasNextPage:h,isLoading:p}=Yq({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),m=kc(),g=I(hp,{onSave:async()=>{const a=Object.keys(r).find(e=>r[e]),o=s?.find(e=>e.id===a);if(!o)return;const i={name:o.name,iconUrl:o.iconUrl||void 0};"MERGE"===await async function({targetVendor:e,duplicateVendor:t}){return ih({title:"Confirm Merge",body:I(eK,{targetVendor:e,duplicateVendor:t}),cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"action",key:"MERGE",label:"Merge"}]}).then(e=>"MERGE"===e?"MERGE":"CANCEL").catch(()=>"CANCEL")}({targetVendor:i,duplicateVendor:e})&&(n({targetId:o.id,duplicateId:e.id??""}),t()),m.close()},disabled:p||Object.values(r).every(e=>!e)});return R(qv,{title:"Back",Footer:g,padChildren:!0,children:[I(WH,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>I(hS,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>I(mf,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:R(iS,{children:[I(Td,{imageUrl:e.value.iconUrl??void 0,Component:Bq}),I(sc,{children:e.value.name})]})},e.value.id))},e.key)),I(QH,{onIntersect:c,enable:!u&&h})]})}function nK({vendor:e,onClose:t}){const n=kc();return I(Ov,{children:n.open&&I(tK,{vendor:e,onClose:()=>{t(),n.close()}})})}function rK({vendor:e,onClose:t}){return R(Tc,{children:[I(Ec,{children:e=>I(lN,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),I(nK,{vendor:e,onClose:t})]})}const aK=tr.raw({width:"100%"});function oK({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o,isSubmitting:i}){const l=wT();return I(xq,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,isSubmitting:i,children:l&&!sr(e)&&R(Tc,{children:[I(Ec,{children:e=>I(Xs,{popupTriggerProps:e,styles:aK,children:I(sc,{children:"Merge"})})}),I(nK,{vendor:e,onClose:r})]})})}function iK({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=av(),n=kc();return vb({defaultValues:e??Hq,validators:{onSubmit:zq},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(cq).filter(e=>e in cq).some(e=>!t(e))?uq(e.address??cq,t):void 0;return{id:e.id,name:e.name,address:n}}(e,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}({vendor:t}),r=kc(),a=wT(),o="ACTIVE"===t?.status,i="INACTIVE"===t?.status,{mutateAsync:l}=Xg({mutationFn:tv,onSuccess:rv,meta:{toastOptions:{defaultSuccessMessage:"Vendor deleted",defaultErrorMessage:"Couldn't delete vendor"}}}),{mutateAsync:s}=av(),c=PH(n),d=async()=>{if(sr(t))return;"RESTORE"===await async function(e){return ih({title:"Restore vendor",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&await c(async()=>{await s({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),r.close()})},u=o&&(!a||o),h=i&&!a,p=sr(t)||!u&&!h?null:I(aE,{shouldUseButtonDiscreteStyles:!0,children:R(Lm,{children:[i&&I(RH,{onClick:d}),!a&&I(rK,{vendor:t,onClose:()=>r.close()}),o&&I(NH,{onClick:async()=>{if(sr(t)||sr(t.id))return;const{id:e}=t;if(sr(e))return;"ARCHIVE"===await async function(e){return ih({title:"Archive vendor",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&await c(async()=>{await l({id:e}),r.close()})}})]})}),m=i&&!a?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:a})=>I(oK,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>r.close(),disabled:e,isSubmitting:a,isArchived:i})});return I(qv,{title:e,HeaderRightAction:p,Footer:m,padChildren:!1,children:R(NB,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:i,maxLength:255})}),I(wq,{form:n,fields:"address",disabled:i})]})})}function lK({title:e,vendor:t}){const n=kc();return I(Ov,{children:n.open&&I(iK,{title:e,vendor:t})})}const sK=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function cK({vendor:e}){return R(Tc,{children:[I(Ec,{children:t=>R(pf,{popupTriggerChildrenProps:t,children:[R(iS,{children:[I(Td,{imageUrl:e.iconUrl??void 0,Component:Bq}),I("div",{className:sK,children:I(sc,{children:e.name})})]}),I(Sd,{Component:rl})]})}),I(lK,{title:"Edit Vendor",vendor:Wq(e)})]})}function dK(){const[e,t]=d(""),[n,r]=d(_q[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=Yq({searchTerm:e,statuses:n.value}),c=wT();return R(qv,{title:"Back",HeaderRightAction:R(Tc,{children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:Os}),!c&&I(sc,{children:"Add Vendor"})]})}),I(lK,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[I(Mq,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:_q,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>I(hS,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>I(cK,{vendor:e.value},e.value.id))},e.key)),I(QH,{onIntersect:o,enable:!i&&l})]})}function uK(){const e=kc();return I(Ov,{children:e.open&&I(dK,{})})}function hK(){return R(Tc,{children:[I(Ec,{children:e=>I(tq,{Icon:Bq,label:"Vendors",popupTriggerChildrenProps:e})}),I(uK,{})]})}const pK=tr({padding:"16px"});function mK(){const e=dn(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return I(vU,{children:R(bU,{children:[I(Hv,{children:R(zv,{children:[I($u,{Icon:nl}),I(To,{children:"Back"})]})}),I("div",{className:pK,children:R(hS,{label:"Transaction Settings",children:[e&&I(rq,{}),I(hK,{}),I(Uq,{})]})})]})})}const gK=or({base:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"8px",cursor:"pointer",padding:"12px 16px",minHeight:"42px",width:"100%",borderRadius:"zero",borderWidth:"md",borderStyle:"solid",borderColor:"transparent",borderLeftWidth:"xl",color:"typography.intent.secondary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",borderColor:"border.intent.action.hover"}},"&:focus-visible":{outlineWidth:"xl",outlineStyle:"solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.foreground",borderLeftColor:"border.intent.action.active"},false:{backgroundColor:"surface.background",borderLeftColor:"transparent"}}}});function vK({children:e,handleClick:t,selected:n=!1}){return I("button",{...gr(lr["selector-row"],gK({selected:n}),ol),"aria-current":n,onClick:t,type:"button",children:e})}const fK=tr({display:"flex",alignItems:"center",gap:"8px",flex:"1 0 0"});function bK({children:e}){return I("div",{className:fK,children:e})}const yK={FinancialOverview:"/",TransactionsDashboard:"/transactions",BanksAndIntegrations:"/banks",ExpenseDashboard:"/expense",IncomeDashboard:"/income",ReportDashboard:"/reports",Invoices_NOT_IMPL:"/invoices",TimeAndTasks_NOT_IMPL:"/time-and-tasks",Mileage_NOT_IMPL:"/mileage",Payroll_NOT_IMPL:"/payroll",ChartOfAccounts_NOT_IMPL:"/chart-of-accounts",GeneralLedger:"/general-ledger",Journal_NOT_IMPL:"/journal",Taxes_NOT_IMPL:"/taxes"};function wK(e,t){return yK[e.page]===t}const CK=tr({display:"flex",flexDirection:"column",gap:"8px"}),xK=tr({marginTop:"8px",marginBottom:"16px"});function TK({section:e,index:t,onClick:n}){const r=function(){const{isApp:e,navigate:t,location:n}=i(Pd);if(e)return{navigate:t,location:n}}();if(sr(r))return null;const{navigate:a,location:o}=r;return R("div",{className:CK,children:[t>0&&I("div",{className:xK,children:I(ip,{alignment:"horizontal"})}),void 0!==e.label&&I(Eo,{intent:"weak",children:e.label}),e.items.map(e=>I(vK,{selected:wK(e,o.pathname),handleClick:()=>{a&&(n?.(),a({page:e.page}))},children:R(bK,{children:[I(Sd,{Component:e.Icon}),I(sc,{children:e.label})]})},e.label))]})}const kK=l(null),EK=l(void 0),AK=tr({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"flex-start",alignItems:"center",width:"fit-content",color:"typography.intent.secondary",fontWeight:"label.strong"}),SK=tr({height:"32px",width:"auto",maxWidth:"100%",objectFit:"contain",objectPosition:"left"}),IK=tr({flex:1,overflowY:"auto",display:"flex",flexDirection:"column",padding:"16px",height:"100%"}),NK=tr({paddingTop:"16px",paddingBottom:"16px"});function RK({onClick:e}){const t=i(kK),n=i(EK);if(sr(t))return null;const{sections:r}=t;return R("div",{className:IK,children:[void 0!==n&&R(N,{children:[I("div",{className:AK,children:I("img",{src:n.partnerLogoUrl,alt:n.partnerName,className:SK})}),I("div",{className:NK,children:I(vK,{handleClick:n.onRtlExit,children:R(bK,{children:[I(Sd,{Component:nl}),I(sc,{children:"Exit Bookkeeping"})]})})})]}),r.map((t,n)=>I(TK,{section:t,index:n,onClick:e},t.label??n))]})}function PK(){return I(vU,{side:"left",mobileCoverage:"partial",children:I(RK,{onClick:()=>as()})})}function DK(){return R(uU,{children:[I(pU,{name:"BankTransactionForm",Component:j_}),I(pU,{name:"Conversation",Component:K_}),I(pU,{name:"MobileConversation",Component:J_}),I(pU,{name:"FinancialSummary",Component:sj}),I(pU,{name:"BanksAndIntegrations",Component:cj}),I(pU,{name:"BankAccountForm",Component:Gj}),I(pU,{name:"NewConnection",Component:$_}),I(pU,{name:"TransactionsFilterList",Component:eq}),I(pU,{name:"ExpensesFilterList",Component:Jj}),I(pU,{name:"RevenueFilterList",Component:$j}),I(pU,{name:"TransactionSettingsDrawer",Component:mK}),I(pU,{name:"NavMenu",Component:PK})]})}const MK=({environment:e,children:t})=>I(Fr.Provider,{value:e,children:t});function LK({children:e}){const{query:{data:t}}=Pi(),n={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?ss({id:t.companyId,prefix:"COMPANY"}):void 0,customerPartnerId:t?.customerPartnerId,apiPartnerName:t?.apiPartnerName,clientId:t?.clientId,unitIntegrationBankName:t?.unitIntegrationBankName??null,supportedIntegrations:t?.supportedIntegrations??[],isDfy:t?.isDfy??!1,hasBookkeeper:t?.isDfy||!1};return I(Qc.Provider,{value:n,children:e})}const FK=e=>["whiteLabels",e??{}],OK=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function VK({children:e}){const t=Ii(),{query:{data:n}}=kl({queryKey:FK({filter:{name:{equal:t}}}),queryFn:OK}),r={icons:n?.data?.[0]?.icons};return I(mi.Provider,{value:r,children:e})}const UK=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const BK="SSE connection failed with status";function HK({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Or();s(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Fa[o]}/sse/v1/subscribe`);var o;return a.searchParams.append("customerPartnerId",n),t.forEach(e=>a.searchParams.append("events",e)),r&&a.searchParams.append("companyId",r),a.toString()}(r,n,t,e);let i=0;return Me(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${BK} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case UK.CONNECTED:return void ya("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case UK.ERROR:throw wa({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case UK.CACHE_BUST:return ya("cache bust event received",{sseTypes:JSON.stringify(Array.from(r))}),void function(e){try{const t=JSON.parse(e);Array.isArray(t)&&t.forEach(e=>{setTimeout(()=>{Lr.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>wa({error:e,severity:"error"}))},500*Math.random()),ya(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void wa({error:t instanceof Error?t:new Error("JSON parse error"),severity:"error",extraData:{data:e}})}}(t)}}({event:a.event,data:a.data,env:r,sseTypes:n,customerPartnerId:t,companyId:e}),onclose:()=>function(){throw wa({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(BK))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>wa({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const WK=[UK.CACHE_BUST];function zK({children:e}){const{companyId:t,customerPartnerId:n}=i(Qc);return HK({companyId:t,customerPartnerId:n,sseTypes:WK}),e}const _K=l({dimensions:{width:null,height:null}}),jK="undefined"!=typeof window?m:s,qK="undefined"==typeof window;const KK=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;qK&&(t=!1);const[n,r]=d(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=PT(r,e.debounceDelay,{leading:!0});function i(){(e.debounceDelay?o:r)({width:window.innerWidth,height:window.innerHeight})}return function(e,t,n,r){const o=a(t);jK(()=>{o.current=t},[t]),s(()=>{const t=window;if(!t||!t.addEventListener)return;const n=e=>{o.current(e)};return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}},[e,void 0,r])}("resize",i),jK(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I(_K.Provider,{value:r,children:e})},YK=({children:e})=>{const{dimensions:t}=i(_K),n=cr(t.width)&&t.width<parseInt(No("sizes.breakpoint-xl"));return I(yT.Provider,{value:n,children:e})},ZK=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",d:"M8.08708 2.34833H7.91602C7.75004 2.34808 7.58676 2.39026 7.44167 2.47087C7.29657 2.55147 7.1745 2.66783 7.08702 2.80888L1.24458 12.1581C1.14602 12.3136 1.09355 12.4938 1.09325 12.6779C1.09324 12.8069 1.11886 12.9346 1.16861 13.0536C1.21837 13.1726 1.29127 13.2805 1.38309 13.3711C1.47491 13.4617 1.58381 13.5332 1.70348 13.5813C1.82314 13.6295 1.95118 13.6534 2.08015 13.6516H13.9229C14.1812 13.6516 14.4289 13.549 14.6115 13.3664C14.7941 13.1838 14.8967 12.9361 14.8967 12.6779C14.8964 12.4938 14.8439 12.3136 14.7454 12.1581L8.91608 2.80888C8.8286 2.66783 8.70652 2.55147 8.56143 2.47087C8.41634 2.39026 8.25306 2.34808 8.08708 2.34833Z",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 5.48663V9.25659",fill:"none",stroke:"inherit",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",fill:"none",stroke:"inherit",strokeMiterlimit:10})),"ToastError"),GK=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",strokeMiterlimit:10,d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z"}),r.createElement("path",{stroke:"inherit",fill:"none",d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"ToastSuccess"),QK=gr(lr.toast,tr({boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",width:{base:"92%",xl:"328px"},paddingInline:"16px",paddingBlock:"12px",borderRadius:"sm",backgroundColor:"surface.intent.notification",color:"typography.intent.notification",boxShadow:"box-shadow",willChange:"translate, opacity",transitionProperty:"opacity, translate",transitionDuration:"toast.enter",transitionTimingFunction:"toast.enter","&[data-state='closed']":{transitionDuration:"toast.exit",transitionTimingFunction:"toast.exit"}})),XK={translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)"},JK=tr({flex:"1 0 0",minWidth:0}),$K=tr.raw({lineClamp:2}),eY=gr(lr["toast-dismiss"],tr({display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",cursor:"pointer",padding:0,color:"typography.intent.notification",flexShrink:0,borderRadius:"sm",outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}})),tY=or({base:{},variants:{type:{error:{fill:"typography.intent.notification",stroke:"surface.intent.notification"},success:{fill:"typography.intent.notification",stroke:"surface.intent.notification"}}}});function nY({title:e,type:t}){const n=gr(null,tY({type:t}));return R(Le.Root,{...QK,style:XK,children:[I(Sd,{Component:"success"===t?GK:ZK,stylists:[n]}),I(Le.Title,{className:JK,children:"string"==typeof e?I(sc,{intent:"notification",wrap:"wrap",extraClassNames:[$K],children:e}):e}),I(Le.CloseTrigger,{...eY,children:I(cl,{Component:Ac})})]})}const rY=Fe({placement:"bottom",offsets:{top:"0px",right:"0px",bottom:"60px",left:"0px"},gap:8,removeDelay:250,duration:3e3,max:24,pauseOnPageIdle:!0,overlap:!1}),aY={success:3e3,error:6e3};function oY(e,t,n){const r=n?.dedupeKey??`${e}:${t}`,a=Date.now();return function(e,t){const n=iY.get(e);return void 0!==n&&t-n<2e3}(r,a)?null:(function(e,t){for(const[n,r]of iY)t-r>=2e3&&iY.delete(n);iY.set(e,t)}(r,a),function(){const e=rY.getVisibleToasts();!function(e){for(const t of lY)e.has(t)||lY.delete(t)}(new Set(e.map(e=>e.id)));const t=e.filter(e=>void 0!==e.id&&!lY.has(e.id));if(t.length<3)return;const n=[...t].reverse().find(e=>"error"!==e.type)??t[t.length-1];void 0!==n?.id&&(lY.add(n.id),rY.update(n.id,{removeDelay:0}),rY.dismiss(n.id))}(),rY.create({type:e,title:t,duration:n?.duration??aY[e]}))}const iY=/* @__PURE__ */new Map,lY=/* @__PURE__ */new Set;function sY({children:e}){const t=o(()=>({createToast:oY,dismiss:rY.dismiss}),[]);return R(Sh.Provider,{value:t,children:[e,I(Ve,{children:I(Oe,{toaster:rY,children:e=>{return I(nY,{title:e.title,type:(t=e.type,"success"===t?"success":"error")},e.id);var t}})})]})}function cY({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return s(()=>{var e,r;e=n,r=t,ma.setProperties(fa),va=r,ga=e},[n,t]),I(MK,{environment:t,children:I(oU,{children:I(Rr.Provider,{value:r,children:I(LK,{children:I(VK,{children:I(zK,{children:I(KK,{children:I(YK,{children:R(sY,{children:[I(we.ConfirmationRoot,{}),e,I(DK,{})]})})})})})})})})})}function dY({children:e,initialNav:t}){const n=iL(),r=rL(),i=a(void 0),l=u(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),c=u(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),d=u(e=>{const t=yK[e.page];t!==r.pathname&&(dn.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&rs(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);s(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&rs(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:d,registerAnchor:c,location:r,initialPageProps:t.pageProps}),[d,c,r,t.pageProps]);return I(Pd.Provider,{value:p,children:e})}const uY=_N({gap:"16px",alignItems:"stretch",width:"100%"});function hY({limit:e}){const t=ze(),n=dn(e=>e.generalLedgerGlAccountId),r=dn(e=>e.generalLedgerDateRange),a=dn(e=>e.generalLedgerAccountingMethod),o=dn(e=>e.setGeneralLedgerGlAccountId),i=dn(e=>e.setGeneralLedgerDateRange),l=dn(e=>e.setGeneralLedgerAccountingMethod);return t?R("div",{className:uY,children:[I(br,{children:I(kr,{children:"General Ledger"})}),I(QV,{glAccountId:n,onGlAccountChange:o,dateRange:r,onDateRangeChange:i,accountingMethod:a,onAccountingMethodChange:l,limit:e})]}):I(TV,{})}const pY={FinancialOverview:{path:yK.FinancialOverview,element:I(Zk,{})},FinancialOverviewDashboard:{path:yK.FinancialOverview,element:I(Zk,{})},TransactionsDashboard:{path:yK.TransactionsDashboard,element:I(dP,{})},BanksAndIntegrations:{path:yK.BanksAndIntegrations,element:I(nS,{})},ExpenseDashboard:{path:yK.ExpenseDashboard,element:I(IP,{})},IncomeDashboard:{path:yK.IncomeDashboard,element:I(LP,{})},Invoices_NOT_IMPL:{path:yK.Invoices_NOT_IMPL,element:I(TV,{})},TimeAndTasks_NOT_IMPL:{path:yK.TimeAndTasks_NOT_IMPL,element:I(TV,{})},Mileage_NOT_IMPL:{path:yK.Mileage_NOT_IMPL,element:I(TV,{})},Payroll_NOT_IMPL:{path:yK.Payroll_NOT_IMPL,element:I(TV,{})},ReportDashboard:{path:yK.ReportDashboard,element:I(nU,{})},ChartOfAccounts_NOT_IMPL:{path:yK.ChartOfAccounts_NOT_IMPL,element:I(TV,{})},GeneralLedger:{path:yK.GeneralLedger,element:I(function({limit:e=100}={}){return ze()?I(Kk,{children:I(hY,{limit:e})}):I(TV,{})},{})},Journal_NOT_IMPL:{path:yK.Journal_NOT_IMPL,element:I(TV,{})},Taxes_NOT_IMPL:{path:yK.Taxes_NOT_IMPL,element:I(TV,{})}},mY=vi(e=>r.createElement("svg",{width:12,height:13,viewBox:"0 0 12 13",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.03662 4.44452H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 6.4079H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 8.37134H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.9267 11.3112H2.07323C1.88019 11.3112 1.68904 11.2732 1.5107 11.1993C1.33236 11.1254 1.17031 11.0172 1.03381 10.8807C0.758141 10.605 0.603271 10.2311 0.603271 9.84124V1.01123L1.8882 1.99291L3.21938 1.01123L4.52487 1.99291L5.83549 1.01123L7.14098 1.99291L8.4516 1.01123V9.84124C8.45296 10.2316 8.60897 10.6054 8.88546 10.881C9.16195 11.1565 9.53637 11.3112 9.9267 11.3112Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.07324 4.44452H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 6.4079H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 8.37134H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M9.43334 4.93286H11.3967V9.84128C11.3745 10.2168 11.2097 10.5696 10.936 10.8276C10.6623 11.0856 10.3003 11.2293 9.92419 11.2293C9.54803 11.2293 9.18609 11.0856 8.91237 10.8276C8.63866 10.5696 8.47385 10.2168 8.45166 9.84128V4.93286H9.43334Z",strokeMiterlimit:10})),"Transactions"),gY=vi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.8474 4.45435H2.84612C2.17063 4.45435 1.62305 5.00193 1.62305 5.67742V13.0094C1.62305 13.6849 2.17063 14.2325 2.84612 14.2325H13.8474C14.5228 14.2325 15.0704 13.6849 15.0704 13.0094V5.67742C15.0704 5.00193 14.5228 4.45435 13.8474 4.45435Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.7927 4.45439H5.90039L6.51513 2.01465H10.1779L10.7927 4.45439Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.12376 11.1779H8.6542C8.89706 11.1779 9.12997 11.0815 9.3017 10.9097C9.47342 10.738 9.5699 10.5051 9.5699 10.2622C9.5699 10.0194 9.47342 9.78647 9.3017 9.61474C9.12997 9.44302 8.89706 9.34654 8.6542 9.34654H8.01385C7.77099 9.34654 7.53808 9.25007 7.36635 9.07834C7.19462 8.90661 7.09814 8.6737 7.09814 8.43084C7.09814 8.18798 7.19462 7.95507 7.36635 7.78334C7.53808 7.61161 7.77099 7.51514 8.01385 7.51514H9.54429",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 6.90039V7.51513",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 11.178V11.7927",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06922 13.6005C4.07207 13.816 4.03519 14.0302 3.96036 14.2326H2.84621C2.68367 14.2318 2.52291 14.1991 2.37322 14.1366C2.22354 14.0741 2.08791 13.9828 1.97417 13.8682C1.86044 13.7536 1.77085 13.6179 1.71061 13.4688C1.65037 13.3198 1.62066 13.1605 1.6232 13.0001V11.9003C1.82715 11.8223 2.04493 11.7858 2.26352 11.7928C2.74476 11.7995 3.20401 11.9929 3.54192 12.3312C3.87984 12.6694 4.06926 13.1254 4.06922 13.6005Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0703 11.9012V13.0126C15.0686 13.3356 14.9392 13.6449 14.7102 13.8733C14.4812 14.1017 14.1711 14.2308 13.8472 14.2325H12.733C12.6582 14.0279 12.6213 13.8115 12.6242 13.5938C12.6242 13.3533 12.6718 13.1153 12.7642 12.8932C12.8566 12.6712 12.9921 12.4696 13.1628 12.2999C13.3336 12.1301 13.5362 11.9957 13.7592 11.9043C13.9821 11.8129 14.2209 11.7663 14.462 11.7671C14.6715 11.7723 14.8781 11.8178 15.0703 11.9012Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06919 5.06911C4.06919 5.31015 4.02223 5.54882 3.93098 5.77144C3.83974 5.99405 3.70602 6.19623 3.53748 6.36637C3.36895 6.53652 3.16892 6.67129 2.94886 6.76295C2.72881 6.8546 2.49305 6.90135 2.25513 6.90051C2.03959 6.90424 1.82525 6.86733 1.62305 6.79165V5.67744C1.62385 5.51434 1.65668 5.35304 1.71961 5.20292C1.78255 5.05281 1.87434 4.91688 1.98964 4.80305C2.10494 4.68922 2.24144 4.59977 2.3912 4.53991C2.54095 4.48005 2.70097 4.45097 2.86192 4.45437H3.96174C4.03315 4.65123 4.06953 4.85937 4.06919 5.06911Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0702 5.68985V6.79252C14.8755 6.86364 14.6695 6.90011 14.4619 6.90025C14.2209 6.90109 13.9821 6.85482 13.7592 6.76411C13.5362 6.6734 13.3336 6.54003 13.1629 6.37165C12.9921 6.20327 12.8567 6.00318 12.7643 5.78287C12.6718 5.56257 12.6242 5.32637 12.6242 5.08782C12.6208 4.87175 12.6577 4.65691 12.7331 4.4541H13.8472C14.0098 4.45492 14.1705 4.48763 14.3202 4.55033C14.4699 4.61304 14.6055 4.7045 14.7193 4.81942C14.833 4.93434 14.9226 5.07044 14.9828 5.21985C15.0431 5.36926 15.0728 5.52901 15.0702 5.68985Z",strokeMiterlimit:10,strokeLinecap:"square"})),"Income"),vY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M3.0668 7.46405H1.11133V11.375H3.0668V7.46405Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.8887 4.53595H8.93323V11.375H10.8887V4.53595Z",strokeMiterlimit:10}),r.createElement("path",{d:"M6.97782 0.625H5.02234V11.375H6.97782V0.625Z",strokeMiterlimit:10}),r.createElement("path",{d:"M0.138672 11.375H11.8613",strokeMiterlimit:10})),"Reports"),fY={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:mY}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:gY},{page:"ExpenseDashboard",label:"Expenses",Icon:nq},{page:"IncomeDashboard",label:"Income",Icon:gY}]},{items:[{page:"ReportDashboard",label:"Reports",Icon:vY}]}]},bY=vi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.66504 7.91458H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.66504 10.6418H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M12.8125 3.95627V13.9937H2.1875V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8125 3.95627V4.54998H9.26877V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10})),"Doc"),yY=vi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.5 14.25C11.2279 14.25 14.25 11.2279 14.25 7.5C14.25 3.77208 11.2279 0.75 7.5 0.75C3.77208 0.75 0.75 3.77208 0.75 7.5C0.75 11.2279 3.77208 14.25 7.5 14.25Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 2.58856V7.49999L10.5664 10.5664",strokeMiterlimit:10})),"TimeAndTasks"),wY=vi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.58591 0.969731H4.86823C4.67602 0.970222 4.4865 1.01495 4.31436 1.10046C4.14222 1.18597 3.99207 1.30996 3.87555 1.46283L2.38978 3.44818L0.53418 4.06455V8.3986H2.38978C2.38978 8.06994 2.52034 7.75473 2.75274 7.52233C2.98514 7.28993 3.30034 7.15937 3.629 7.15937C3.95766 7.15937 4.27287 7.28993 4.50527 7.52233C4.73767 7.75473 4.86823 8.06994 4.86823 8.3986H9.20228C9.20228 8.06994 9.33284 7.75473 9.56524 7.52233C9.79764 7.28993 10.1128 7.15937 10.4415 7.15937C10.7702 7.15937 11.0854 7.28993 11.3178 7.52233C11.5502 7.75473 11.6807 8.06994 11.6807 8.3986H14.1592V5.52437C14.1588 5.27713 14.0844 5.03565 13.9457 4.831C13.8069 4.62636 13.6101 4.46789 13.3806 4.37598L11.0644 3.44818L9.57858 1.46283C9.46275 1.30922 9.31275 1.18469 9.14045 1.09911C8.96815 1.01352 8.77829 0.969227 8.58591 0.969731Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4414 9.63788C11.1258 9.63788 11.6806 9.08306 11.6806 8.39865C11.6806 7.71424 11.1258 7.15942 10.4414 7.15942C9.75697 7.15942 9.20215 7.71424 9.20215 8.39865C9.20215 9.08306 9.75697 9.63788 10.4414 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.62887 9.63788C4.31328 9.63788 4.8681 9.08306 4.8681 8.39865C4.8681 7.71424 4.31328 7.15942 3.62887 7.15942C2.94447 7.15942 2.38965 7.71424 2.38965 8.39865C2.38965 9.08306 2.94447 9.63788 3.62887 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.6021 4.06445H4.25195",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9199 6.54297H14.1591",strokeMiterlimit:10}),r.createElement("path",{d:"M7.34668 2.20898V4.06458",strokeMiterlimit:10})),"Mileage"),CY=vi(EW,"Payroll"),xY=vi(XF,"ChartOfAccounts"),TY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.930835 6.6925H4.15797V7.04359C4.15797 7.44029 4.00038 7.82073 3.71987 8.10124C3.43937 8.38174 3.05892 8.53933 2.66223 8.53933H2.42176C2.02507 8.53933 1.64462 8.38174 1.36412 8.10124C1.08361 7.82073 0.926025 7.44029 0.926025 7.04359V6.6925H0.930835Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M0.469116 3.00363H3.07583C3.28237 3.00199 3.48644 2.95853 3.67573 2.87588C3.86502 2.79322 4.0356 2.67307 4.17719 2.52269C4.31979 2.37361 4.49058 2.25433 4.67964 2.17177C4.8687 2.08921 5.07227 2.04502 5.27855 2.04175H6.72138C6.92915 2.04454 7.13431 2.08849 7.325 2.17104C7.51569 2.25359 7.68813 2.37311 7.83236 2.52269C7.97715 2.67285 8.15037 2.7927 8.34193 2.87527C8.53349 2.95784 8.73956 3.00147 8.94815 3.00363H11.5308",strokeMiterlimit:10}),r.createElement("path",{d:"M6 0.699951V11.2999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.76535 11.2999H3.2345",strokeMiterlimit:10}),r.createElement("path",{d:"M2.7728 3.00366H2.31109L0.930786 6.23079V6.6925H4.15792V6.23079L2.7728 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.84197 6.6925H11.0691V7.04359C11.0691 7.44029 10.9115 7.82073 10.631 8.10124C10.3505 8.38174 9.97006 8.53933 9.57336 8.53933H9.33289C8.9362 8.53933 8.55575 8.38174 8.27525 8.10124C7.99474 7.82073 7.83716 7.44029 7.83716 7.04359V6.6925H7.84197Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.68886 3.00366H9.22716L7.84204 6.23079V6.6925H11.0692V6.23079L9.68886 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"})),"GeneralLedger"),kY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.650024 1.86523V8.67246H4.54278C4.73458 8.67246 4.92449 8.71032 5.10162 8.78387C5.27875 8.85742 5.43962 8.96522 5.57501 9.10108C5.71039 9.23693 5.81762 9.39818 5.89056 9.57557C5.96349 9.75295 6.00069 9.943 6.00002 10.1348V3.32247C6.00002 3.1311 5.96232 2.94161 5.88909 2.76481C5.81586 2.58801 5.70852 2.42737 5.5732 2.29205C5.43788 2.15673 5.27724 2.04939 5.10044 1.97616C4.92364 1.90293 4.73415 1.86523 4.54278 1.86523H0.650024Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 1.86523V8.67246H7.45724C7.26545 8.67246 7.07554 8.71032 6.89841 8.78387C6.72127 8.85742 6.5604 8.96522 6.42502 9.10108C6.28963 9.23693 6.1824 9.39818 6.10947 9.57557C6.03654 9.75295 5.99934 9.943 6.00001 10.1348V3.32247C6.00001 2.93599 6.15354 2.56533 6.42682 2.29205C6.70011 2.01876 7.07076 1.86523 7.45724 1.86523H11.35Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 8.67249V10.1348H7.45725H4.54278H0.650024V8.67249",strokeMiterlimit:10})),"Journal"),EY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.32498 11.2259H0.775757V0.774048H8.37577V3.64998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.47954 2.37524H2.677V4.84696H6.47954V2.37524Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.57825 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M4.57825 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M8.1449 7.27441C8.14484 7.32563 8.10334 7.36713 8.05212 7.36719C8.01365 7.36719 7.98028 7.34389 7.96619 7.31055L7.95935 7.27441C7.95935 7.22312 8.00083 7.18164 8.05212 7.18164L8.08826 7.18848C8.1216 7.20257 8.1449 7.23594 8.1449 7.27441Z"}),r.createElement("path",{d:"M9.77344 8.90295C9.77338 8.95417 9.73188 8.99567 9.68066 8.99573C9.64219 8.99573 9.60882 8.97243 9.59473 8.93909L9.58789 8.90295C9.58789 8.85166 9.62937 8.81018 9.68066 8.81018L9.7168 8.81702C9.75014 8.83111 9.77344 8.86448 9.77344 8.90295Z"}),r.createElement("path",{d:"M9.80828 6.96296L7.92403 9.21425",strokeMiterlimit:10}),r.createElement("path",{d:"M8.86626 10.6502C10.281 10.6502 11.428 9.50333 11.428 8.08855C11.428 6.67377 10.281 5.52686 8.86626 5.52686C7.45148 5.52686 6.30457 6.67377 6.30457 8.08855C6.30457 9.50333 7.45148 10.6502 8.86626 10.6502Z",strokeMiterlimit:10})),"Taxes"),AY={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:mY}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:gY},{page:"ExpenseDashboard",label:"Expenses",Icon:nq},{page:"IncomeDashboard",label:"Income",Icon:gY}]},{items:[{page:"Invoices_NOT_IMPL",label:"Invoices",Icon:bY},{page:"TimeAndTasks_NOT_IMPL",label:"Time & Tasks",Icon:yY},{page:"Mileage_NOT_IMPL",label:"Mileage",Icon:wY},{page:"Payroll_NOT_IMPL",label:"Payroll",Icon:CY},{page:"ReportDashboard",label:"Reports",Icon:vY}]},{label:"Accounting",items:[{page:"ChartOfAccounts_NOT_IMPL",label:"Chart of Accounts",Icon:xY},{page:"GeneralLedger",label:"General Ledger",Icon:TY},{page:"Journal_NOT_IMPL",label:"Journal",Icon:kY}]},{items:[{page:"Taxes_NOT_IMPL",label:"Taxes",Icon:EY}]}]},SY=tr({position:"sticky",top:0,alignSelf:"flex-start",width:"256px",maxWidth:"256px",height:"100dvh",display:"flex",flexDirection:"column",backgroundColor:"surface.background",borderRight:"1px solid {colors.border.layout}",flexShrink:0});function IY(){return I("div",{className:SY,children:I(RK,{})})}const NY=tr({width:"100%",display:"flex",flexDirection:"row"}),RY=tr({flex:1,display:"flex",flexDirection:"column",padding:{xl:"50px",base:"16px"}});function PY(){const e=wT();return R("div",{className:NY,children:[!e&&I(IY,{}),I("div",{className:RY,children:I(DL,{children:Object.entries(pY).map(([e,t])=>I(NL,{path:t.path,element:t.element},e))})})]})}function DY(e){const{accessToken:t,environment:n="PRODUCTION",initialNav:r={page:"FinancialOverview"},buildTarget:a,rtlConfig:o}=e,i=/* @__PURE__ */function(e){return e?AY:fY}("PLAYGROUND"===a||"LAB"===a);return I(SL,{initialEntries:[pY[r.page].path],children:I(EK.Provider,{value:o,children:I(dY,{initialNav:r,children:I(kK.Provider,{value:i,children:I(cY,{environment:n,accessToken:t,children:I(PY,{})})})})})})}const MY=["BanksAndIntegrations"],LY={BanksAndIntegrations:!0,FinancialOverview:!0,TransactionsDashboard:!0,ExpenseDashboard:!0,IncomeDashboard:!0,ReportDashboard:!0,GeneralLedger:!0},FY=new Set(Object.values(pi).flatMap(e=>Object.values(e)));function OY(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!LY[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&MY.includes(i)){const e=function(e){if("BanksAndIntegrations"===e)return{name:e}}(a);void 0!==e&&(o=e)}var i,l;if("FinancialOverview"===n||"FinancialOverviewDashboard"===n){const e=t.searchParams.get("bkAnchor"),r=null!==(l=e)&&FY.has(l)?e:void 0,a=function(e){const t=e.get("bkPage_period_month"),n=e.get("bkPage_period_year");if(null===t||null===n)return;const r=parseInt(t,10),a=parseInt(n,10);return!Number.isInteger(r)||r<0||r>11||!Number.isInteger(a)||a<2e3||a>2100?void 0:{month:r,year:a}}(t.searchParams),i=void 0!==a?{period:a}:void 0;return void 0!==r&&void 0!==o?{page:n,anchor:r,drawer:o,...void 0!==i?{pageProps:i}:{}}:void 0!==r?{page:n,anchor:r,...void 0!==i?{pageProps:i}:{}}:void 0!==o?{page:n,drawer:o,...void 0!==i?{pageProps:i}:{}}:{page:n,...void 0!==i?{pageProps:i}:{}}}return void 0!==o?{page:n,drawer:o}:{page:n}}export{nS as BanksAndIntegrations,IP as ExpenseDashboard,Zk as FinancialOverview,LP as IncomeDashboard,nU as ReportDashboard,cY as Tight,DY as TightApp,dP as TransactionsDashboard,OY as parseNavUrl,En as useEmbeddedEventListeners,kn as useEventSource,xn as useOptions};
1
+ import{create as e}from"zustand";import{devtools as t,persist as n}from"zustand/middleware";import*as r from"react";import{useRef as a,useMemo as o,useContext as i,createContext as l,useEffect as s,Component as c,useState as d,useCallback as u,createElement as h,forwardRef as p,useLayoutEffect as g,useImperativeHandle as m,useReducer as v,Fragment as f}from"react";import"zustand/react/shallow";import{cloneDeep as b,entries as y,mapValues as w,isEqual as C,differenceBy as x,debounce as T,isEmpty as k}from"lodash-es";import{v4 as E}from"uuid";import*as A from"zod";import{z as S}from"zod";import{jsx as I,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as P,useIsRestoring as D,useQuery as M,keepPreviousData as L,useMutationState as F,useMutation as O,useQueries as V,useInfiniteQuery as U}from"@tanstack/react-query";import B from"yocto-queue";import H from"big.js";import{ResponsiveContainer as W,BarChart as _,Legend as z,CartesianGrid as j,XAxis as q,YAxis as K,Tooltip as Y,Bar as Z,ReferenceLine as G,Line as Q}from"recharts";import{flexRender as X,createColumnHelper as J,useReactTable as $,getCoreRowModel as ee,getExpandedRowModel as te}from"@tanstack/react-table";import{useFloatingNodeId as ne,useFloating as re,offset as ae,flip as oe,shift as ie,size as le,autoUpdate as se,useClick as ce,useDismiss as de,useRole as ue,useInteractions as he,useFloatingParentNodeId as pe,FloatingTree as ge,FloatingNode as me,useMergeRefs as ve,FloatingPortal as fe,FloatingOverlay as be,FloatingFocusManager as ye}from"@floating-ui/react";import{ContextAwareConfirmation as we,confirmable as Ce}from"react-confirm";import{createFormHookContexts as xe,useStore as Te,createFormHook as ke}from"@tanstack/react-form";import{NumericFormat as Ee}from"react-number-format";import Ae from"fuse.js";import Se from"react-inlinesvg";import{AnimatePresence as Ie,motion as Ne}from"motion/react";import{useDropzone as Re}from"react-dropzone";import{RadioGroup as Pe}from"@ark-ui/react/radio-group";import{openDB as De}from"idb";import{PersistQueryClientProvider as Me}from"@tanstack/react-query-persist-client";import{fetchEventSource as Le}from"@microsoft/fetch-event-source";import{Toast as Fe,createToaster as Oe,Toaster as Ve}from"@ark-ui/react/toast";import{Portal as Ue}from"@ark-ui/react/portal";function Be(e,t){return`${e.trim()}:${t.trim()}`}const He=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,FEATUREFLAG_CATEGORY_SETTINGS:!1,FEATUREFLAG_GENERAL_LEDGER:!0,FEATUREFLAG_CHART_OF_ACCOUNTS:!1,FEATUREFLAG_REPORT_DOWNLOAD:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,Be("featureFlags","updateFlags"))});function We(){return hn(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function _e(){return hn(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}function ze(){return hn(e=>e.FEATUREFLAG_GENERAL_LEDGER)}let je=null,qe=!1;function Ke(){const e=document.querySelector("meta[name='viewport']");if(!e)return null;const t=Object.fromEntries((e.getAttribute("content")??"").split(",").map(e=>{const[t,n=""]=e.trim().split("=");return[t.trim(),n.trim()]}));return{meta:e,params:t}}function Ye(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Ze(){const e=Ke();if(!e)return;const{meta:t,params:n}=e;if(qe)return t.remove(),qe=!1,void(je=null);je?n["interactive-widget"]=je:delete n["interactive-widget"],je=null,Ye(t,n)}const Ge="drawerNavigation",Qe=(e,t)=>({drawerHistory:[],closingQueue:[],openDrawer:(t,n={})=>e(e=>{const{replaceHistory:r,routeProps:a}=n,o={[t]:{routeProps:a}};if(r||0===e.drawerHistory.length)return 0===e.drawerHistory.length&&function(){let e=Ke();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),qe=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;je=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Ye(t,n)}(),{drawerHistory:[o]};{const t=b(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,Be(Ge,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,Be(Ge,"closeDrawer")),0===t().drawerHistory.length&&Ze()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,Be(Ge,"closeAllDrawers")),Ze()},requestCloseDrawer:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t.length-1,r=t[n];return{drawerHistory:t.slice(0,n),closingQueue:[...e.closingQueue,r]}},void 0,Be(Ge,"requestCloseDrawer")),requestCloseAllDrawers:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t[t.length-1];return{drawerHistory:[],closingQueue:[...e.closingQueue,n]}},void 0,Be(Ge,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,Be(Ge,"confirmCloseDrawer")),0===t().drawerHistory.length&&Ze()}}),Xe=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,Be("externalOptions","setOptions"))});function Je(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function $e(e){return Array.isArray(e)&&e.length>0}function et(e){const t={...e,selectedValues:e=>e.filter(e=>e.modelKey===t.key),createFilter:e=>({...e,modelKey:t.key,id:E()}),searchFunc:e.searchFunc?e.searchFunc:e=>{return n=e,t.name.toLowerCase().includes(n.toLowerCase());var n}};return t}const tt="search",nt=et({key:tt,name:"Search"});function rt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function at(e,t,n){return new Date(e,t,n)}function ot(e){const[t,n,r]=e.split("-");return at(Number(t),Number(n),Number(r))}function it(){return rt(at(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function lt(e,t){return rt(at(t,e,1))}function st(){const e=/* @__PURE__ */new Date;return rt(at(e.getFullYear(),e.getMonth()+1,0))}function ct(e){const t=/* @__PURE__ */new Date;return rt(at(t.getFullYear(),t.getMonth()-e,1))}function dt(e){const t=e.getMonth(),n=t-t%3;return rt(at(e.getFullYear(),n,1))}function ut(e){const t=e.getMonth(),n=t-t%3+3;return rt(at(e.getFullYear(),n,0))}const ht={ALL_TIME:"ALL_TIME",THIS_MONTH:"THIS_MONTH",LAST_MONTH:"LAST_MONTH",LAST_3_MONTHS:"LAST_3_MONTHS",LAST_6_MONTHS:"LAST_6_MONTHS",LAST_12_MONTHS:"LAST_12_MONTHS",THIS_QUARTER:"THIS_QUARTER",LAST_QUARTER:"LAST_QUARTER",THIS_YEAR:"THIS_YEAR",LAST_YEAR:"LAST_YEAR"},pt={ALL_TIME:"All Time",THIS_MONTH:"This Month",LAST_MONTH:"Last Month",LAST_3_MONTHS:"Last 3 Months",LAST_6_MONTHS:"Last 6 Months",LAST_12_MONTHS:"Last 12 Months",THIS_QUARTER:"This Quarter",LAST_QUARTER:"Last Quarter",THIS_YEAR:"This Year",LAST_YEAR:"Last Year"},gt=e=>Object.values(ht).includes(e),mt={[ht.ALL_TIME]:()=>"",[ht.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return lt(e.getMonth(),e.getFullYear())}(),[ht.LAST_YEAR]:()=>rt(at(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[ht.LAST_MONTH]:()=>ct(1),[ht.LAST_6_MONTHS]:()=>ct(5),[ht.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return rt(at(e.getFullYear(),e.getMonth()-11,1))}(),[ht.THIS_YEAR]:()=>rt(at(/* @__PURE__ */(new Date).getFullYear(),0,1)),[ht.LAST_3_MONTHS]:()=>ct(2),[ht.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return dt(at(e.getFullYear(),e.getMonth()-3,1))}(),[ht.THIS_QUARTER]:()=>dt(/* @__PURE__ */new Date)};function vt(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&void 0===t.endDate||void 0===t.beginDate&&"string"==typeof t.endDate||"string"==typeof t.beginDate&&"string"==typeof t.endDate}const ft=e=>mt[e](),bt={[ht.ALL_TIME]:()=>"",[ht.THIS_MONTH]:()=>st(),[ht.LAST_YEAR]:()=>rt(at(/* @__PURE__ */(new Date).getFullYear(),0,0)),[ht.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return rt(at(e.getFullYear(),e.getMonth(),0))}(),[ht.LAST_6_MONTHS]:()=>st(),[ht.LAST_12_MONTHS]:()=>st(),[ht.THIS_YEAR]:()=>it(),[ht.LAST_3_MONTHS]:()=>st(),[ht.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ut(at(e.getFullYear(),e.getMonth()-3,1))}(),[ht.THIS_QUARTER]:()=>ut(/* @__PURE__ */new Date)},yt=e=>bt[e](),wt=e=>{return gt(e)?{beginDate:ft(e),endDate:yt(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:rt((t=e).beginDate),endDate:rt(t.endDate)};var t},Ct=["SUN","MON","TUE","WED","THU","FRI","SAT"],xt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Tt({yearsBack:e=10,startYear:t}){const n=t??/* @__PURE__ */(new Date).getFullYear(),r=[n];for(let a=n-1;a>=n-e;a--)r.push(a);return r}function kt(e,t){return e.toDateString()===t.toDateString()}function Et(e){return kt(e,/* @__PURE__ */new Date)}function At(e,t){const n=at(e.getFullYear(),e.getMonth(),e.getDate()),r=at(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function St(e){return e&&e instanceof Date&&!isNaN(e.getTime())?`${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getDate()).padStart(2,"0")}/${e.getFullYear()}`:""}function It(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=at(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Nt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return It(o,i,l)?at(l,o-1,i):null}function Rt(e){if(!e.trim())return null;const t=e.match(/^(\d{1,4})-(\d{1,2})-(\d{1,2})/);if(!t)return null;const[,n,r,a]=t,o=parseInt(n,10),i=parseInt(r,10),l=parseInt(a,10);return It(i,l,o)?at(o,i-1,l):null}function Pt(e){if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getDate()).padStart(2,"0");return`${t}-${String(e.getMonth()+1).padStart(2,"0")}-${n}`}function Dt(e,t){return At(e,t)?t:e}function Mt(e,t){return At(t,e)?t:e}const Lt=(e,t)=>{const n={month:t.abbreviateMonth?"short":"long",year:t.abbreviateYear?"2-digit":"numeric"},r=e.toLocaleString("default",n);let a=r;if(t.abbreviateYear){const e=r.length-2;a=r.slice(0,e)+"'"+r.slice(e)}return a},Ft=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return Et(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Lt(t,{abbreviateMonth:!0,abbreviateYear:!1})},Ot=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Vt(e,t){return at(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Ut(e){const{month:t,year:n}=e;return{beginDate:at(n,t-1,1),endDate:at(n,t+1,0)}}const Bt="date",Ht=Object.values(ht).map(e=>{return{name:pt[t=e],value:{date:{name:pt[t],value:t}}};var t}),Wt=et({key:Bt,name:"Date",possibleValues:()=>({values:Ht}),singleSelect:!0,hideInFilterListOnDesktop:!0});function _t(e){return"OWNER"===e||"READ_ONLY"===e}function zt(e){if(0===e.length)return e;const t=function(e,t){if(0===e.length)return-1;let n=e.length-1;for(;n>-1;){if(t(e[n]))return n;n--}return-1}(e,e=>e.modelKey===tt);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==tt)}const jt=Wt.createFilter({name:pt[ht.LAST_12_MONTHS],value:{date:{name:pt[ht.LAST_12_MONTHS],value:ht.LAST_12_MONTHS}}});function qt(e,t){return zt([...t.some(e=>e.modelKey===Bt)?function(e){const t=e.findIndex(e=>e.modelKey===Bt);return-1!==t?Je(e,t):e}(e.filters):e.filters,...t])}function Kt(e,t){const n=e.filters[t];return n&&n.modelKey===Bt?function(e,t){const n=[...e];return n[t]=jt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Yt(e){return zt(e.some(e=>e.modelKey===Bt)?e:[...e,jt])}function Zt(e,t){if(e.hasInitialized)return e;const n=[];return _t(t.userRole)&&t.hasNonReconciledTransactions&&t.needsReviewStatuses.length>0&&n.push({modelKey:"reviewStatus",id:E(),name:"Needs Review",value:{reviewStatus:{name:"Needs Review",value:{in:t.needsReviewStatuses}}}}),n.push(jt),{filters:n,hasInitialized:!0}}const Gt="transactionsDashboardFilters",Qt=e=>({transactionsDashboardFilters:[jt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:qt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Be(Gt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:Kt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Be(Gt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Yt(t)}),void 0,Be(Gt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Zt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,Be(Gt,"initialize"))}),Xt="expenseDashboardFilters",Jt=e=>({expenseDashboardFilters:[jt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:qt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Be(Xt,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:Kt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Be(Xt,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Yt(t)}),void 0,Be(Xt,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Zt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,Be(Xt,"initialize"))}),$t="incomeDashboardFilters",en=e=>({incomeDashboardFilters:[jt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:qt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Be($t,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:Kt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Be($t,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Yt(t)}),void 0,Be($t,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Zt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,Be($t,"initialize"))}),tn="generalLedgerFilters",nn="ACCRUAL";function rn(){const e=wt(ht.LAST_6_MONTHS);return{start:e.beginDate,end:e.endDate}}const an={generalLedgerGlAccountId:void 0,generalLedgerDateRange:rn(),generalLedgerAccountingMethod:nn},on=e=>({...an,setGeneralLedgerGlAccountId:t=>e(e=>({...e,generalLedgerGlAccountId:t}),void 0,Be(tn,"setGlAccountId")),setGeneralLedgerDateRange:t=>e(e=>({...e,generalLedgerDateRange:t}),void 0,Be(tn,"setDateRange")),setGeneralLedgerAccountingMethod:t=>e(e=>({...e,generalLedgerAccountingMethod:t}),void 0,Be(tn,"setAccountingMethod")),setGeneralLedgerFilters:t=>e(e=>({...e,generalLedgerGlAccountId:t.glAccountId,generalLedgerDateRange:t.dateRange,generalLedgerAccountingMethod:t.accountingMethod}),void 0,Be(tn,"setFilters")),resetGeneralLedgerFilters:()=>e(e=>({...e,...an}),void 0,Be(tn,"reset"))}),ln={label:"Connected Accounts",value:"connected"},sn="banksAndIntegrationsState",cn=e=>({banksAndIntegrationsSelectedTab:ln,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,Be(sn,"setBanksAndIntegrationsSelectedTab")),toggleExpandedIntegration:(t,n)=>e(e=>({expandedPlaidItems:e.expandedPlaidItems.includes(t)||n&&!e.hasExpandedUpdated?e.expandedPlaidItems.filter(e=>e!==t):[...e.expandedPlaidItems,t],hasExpandedUpdated:!0}),void 0,Be(sn,"toggleExpandedIntegration"))}),dn={plaidLink:null,plaidLinkEvent:null,plaidLinkError:null,gusto:null,payroll:null,bITile:null,conversations:null,bill:null,invoice:null,transactionForm:null,customer:null},un=e=>({events:dn,setEvents:t=>e(e=>({events:{...e.events,...t}}),void 0,Be("events","setEvents"))}),hn=e()(t(n((...e)=>({...He(...e),...Qe(...e),...Xe(...e),...Qt(...e),...Jt(...e),...en(...e),...on(...e),...cn(...e),...un(...e)}),{name:"tight-featureflag-storage",partialize:e=>{const t=Object.entries(e).filter(([e])=>e.startsWith("FEATUREFLAG"));return Object.fromEntries(t)}}),{name:"globalStore",store:"globalStore",enabled:!1})),pn={SELECT:"select",EXPAND:"expand"},gn={...pn,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},mn=[gn.COMMENTS,gn.DATE,gn.DESCRIPTION,gn.AMOUNT,gn.CATEGORY,gn.DIMENSION_VALUE,gn.REVIEW_STATUS],vn=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(mn)))}),fn=e=>{const t=vn.safeParse(e);return t.success?t.data:void 0},bn=A.optional(A.string().trim()),yn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,wn=A.optional(A.array(A.string().trim())),Cn=A.object({integrations:A.optional(A.array(A.enum(["UNIT","STRIPE","GUSTO","SHOPIFY","SQUARE","RUTTER","UBER","MOOV","QUALPAY","MANUAL_ENTRY","PARTNER_IMPLEMENTATION","QBO","XERO","FRESHBOOKS"]))),useOnPlaidLink:A.optional(A.boolean()),hideManualBanks:A.optional(A.boolean())}),xn={transactionsDashboard:fn,incomeDashboard:fn,expenseDashboard:fn,accessToken:e=>{const t=bn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=wn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>yn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=Cn.safeParse(e);return t.success?t.data:void 0}},Tn=(e,t)=>{if(void 0!==xn[e])return(0,xn[e])(t)};function kn(e){const t=a(!1),n=hn(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=Tn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=hn(e=>e.externalOptions);return{options:o(()=>b(r),[r]),setOptions:n}}const En=l(null);function An(){return i(En)}function Sn(e){const t=a(!1),n=hn(e=>e.setEvents);return s(()=>{e&&!t.current&&(n(e),t.current=!0)},[e,n]),[hn(e=>e.events),n]}function In(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Nn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function Rn(e){return String.fromCharCode(e+(e>25?39:97))}function Pn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Rn(t%52)+n;return Rn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var Dn=/\s*!(important)?/i;function Mn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var Ln=e=>{const t=/* @__PURE__ */new Map;return(...n)=>{const r=JSON.stringify(n);if(t.has(r))return t.get(r);const a=e(...n);return t.set(r,a),a}},Fn=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function On(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(Fn.has(n))return;const r=e[n],a=t[n];In(r)&&In(a)?e[n]=On(r,a):e[n]=a}),e):e,{})}var Vn=e=>null!=e;function Un(e,t,n={}){const{stop:r,getKey:a}=n;return function e(n,o=[]){if("object"==typeof(i=n)&&null!==i){const i={};for(const[l,s]of Object.entries(n)){const c=a?.(l,s)??l,d=[...o,c];if(r?.(n,d))return t(n,o);const u=e(s,d);Vn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Bn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return Un(e,e=>{return Array.isArray(e)?(t=e,n=a.breakpoints.keys,t.reduce((e,t,r)=>{const a=n[r];return null!=t&&(e[a]=t),e},{})):e;var t,n},{stop:e=>Array.isArray(e),getKey:n?e=>o?i(e):e:void 0})}var Hn={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Wn=/([A-Z])/g,_n=/^ms-/,zn=Ln(e=>e.startsWith("--")?e:e.replace(Wn,"-$1").replace(_n,"-ms-").toLowerCase()),jn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),qn=`(?:${"cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%".split(",").join("|")})`,Kn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${qn}$`),Yn={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):In(e)?Un(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&jn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&Kn.test(e)},Zn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Nn(t))};const Gn=new Set("_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,_supportHover,_notDisabled,_scrolledX,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,1_5xl,1_5xlOnly,1_5xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo1_5xl,smTo2xl,mdToLg,mdToXl,mdTo1_5xl,mdTo2xl,lgToXl,lgTo1_5xl,lgTo2xl,xlTo1_5xl,xlTo2xl,1_5xlTo2xl,@/md,@/lg,@/xl,@tight-component/md,@tight-component/lg,@tight-component/xl,@page/md,@page/lg,@page/xl,@report-table-container/md,@report-table-container/lg,@report-table-container/xl,_themeBizhub,base".split(",")),Qn=/^@|&|&$/;function Xn(e){return Gn.has(e)||Qn.test(e)}const Jn=/^_/,$n=/&|@/,er=/* @__PURE__ */new Map;"aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos,top:top,left:left,inset:inset,insetInline:inset-x,insetBlock:inset-y,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e,insetInlineStart:inset-s,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p,paddingLeft:pl,paddingRight:pr,paddingTop:pt,paddingBottom:pb,paddingBlock:py,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px,paddingInlineEnd:pe,paddingInlineStart:ps,marginLeft:ml,marginRight:mr,marginTop:mt,marginBottom:mb,margin:m,marginBlock:my,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx,marginInlineEnd:me,marginInlineStart:ms,spaceX:sx,spaceY:sy,outlineWidth:ring-w,outlineColor:ring-c,outline:ring,outlineOffset:ring-o,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w,inlineSize:w-is,minWidth:min-w,minInlineSize:min-w-is,maxWidth:max-w,maxInlineSize:max-w-is,height:h,blockSize:h-bs,minHeight:min-h,minBlockSize:min-h-bs,maxHeight:max-h,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p,backgroundPositionX:bg-p-x,backgroundPositionY:bg-p-y,backgroundAttachment:bg-a,backgroundClip:bg-cp,background:bg,backgroundColor:bg-c,backgroundOrigin:bg-o,backgroundImage:bg-i,backgroundRepeat:bg-r,backgroundBlendMode:bg-bm,backgroundSize:bg-s,backgroundGradient:bg-grad,backgroundLinear:bg-linear,backgroundRadial:bg-radial,backgroundConic:bg-conic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr,borderTopLeftRadius:bdr-tl,borderTopRightRadius:bdr-tr,borderBottomRightRadius:bdr-br,borderBottomLeftRadius:bdr-bl,borderTopRadius:bdr-t,borderRightRadius:bdr-r,borderBottomRadius:bdr-b,borderLeftRadius:bdr-l,borderStartStartRadius:bdr-ss,borderStartEndRadius:bdr-se,borderStartRadius:bdr-s,borderEndStartRadius:bdr-es,borderEndEndRadius:bdr-ee,borderEndRadius:bdr-e,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x,borderInlineWidth:bd-x-w,borderInlineColor:bd-x-c,borderBlock:bd-y,borderBlockWidth:bd-y-w,borderBlockColor:bd-y-c,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s,borderInlineStartWidth:bd-s-w,borderInlineStartColor:bd-s-c,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e,borderInlineEndWidth:bd-e-w,borderInlineEndColor:bd-e-c,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh,boxShadowColor:bx-sh-c,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x,translateY:translate-y,translateZ:translate-z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor".split(",").forEach(e=>{const[t,n]=e.split(":");er.set(t,n)});const tr={conditions:{shift:function(e){return e.sort((e,t)=>{const n=Xn(e),r=Xn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Gn.has(e)?e.replace(Jn,""):$n.test(e)?`[${Mn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${er.get(e)||zn(e)}_${Mn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},nr=function(e){const{utility:t,hash:n,conditions:r=Hn}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return Ln(({base:o,...i}={})=>{const l=Bn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return Un(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&Dn.test(u),[l,...c]=r.shift(o),d=c.slice().filter(e=>!/* @__PURE__ */(e=>"base"===e)(e));var u;const h=t.transform(l,function(e){return"string"==typeof e?e.replace(Dn,"").trim():e}((e=>"string"==typeof e?e.replaceAll(/[\n\s]+/g," "):e)(e)));let p=((e,o)=>{let i;if(n){const n=[...r.finalize(e),o];i=a(t.toHash(n,Pn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(tr),rr=(...e)=>nr(ar(...e));rr.raw=(...e)=>ar(...e);const{mergeCss:ar}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>In(e)&&Object.keys(Nn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Bn(t,e))}return{mergeCss:Ln(function(...e){return On(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(tr);function or(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const ir=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function lr(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=ir(e),o=e=>({...r,...Nn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=ar(i,n[t][a]));const l=function(e,t){let n={};return e.forEach(e=>{Object.entries(e).every(([e,n])=>"css"===e||(Array.isArray(n)?n:[n]).some(n=>t[e]===n))&&(n=ar(n,e.css))}),n}(a,r);return ar(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(Ln(function(e){return rr(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=ir(e.config),i=((...e)=>{const t=e.reduce((e,t)=>(t&&t.forEach(t=>e.add(t)),e),/* @__PURE__ */new Set([]));return Array.from(t)})(e.variantKeys,Object.keys(n));return lr({base:ar(t,o.base),variants:Object.fromEntries(i.map(e=>[e,ar(n[e],o.variants[e])])),defaultVariants:On(r,o.defaultVariants),compoundVariants:[...a,...o.compoundVariants]})},splitVariantProps:function(e){return function(e,...t){const n=Object.getOwnPropertyDescriptors(e),r=Object.keys(n),a=e=>{const t={};for(let r=0;r<e.length;r++){const a=e[r];n[a]&&(Object.defineProperty(t,a,n[a]),delete n[a])}return t};return t.map(e=>a(Array.isArray(e)?e:r.filter(e))).concat(a(r))}(e,l)},getVariantProps:o})}var sr,cr=((sr=cr||{}).component="component",sr["dashboard-placeholder-table"]="dashboard-placeholder-table",sr["dashboard-header"]="dashboard-header",sr["dashboard-table"]="dashboard-table",sr["dashboard-table-body"]="dashboard-table-body",sr["dashboard-table-cell"]="dashboard-table-cell",sr["dashboard-table-column-header"]="dashboard-table-column-header",sr["dashboard-table-header"]="dashboard-table-header",sr.label="label",sr.popup="popup",sr["popup-sort-row"]="popup-sort-row",sr["progress-bar"]="progress-bar",sr["progress-bar-fill"]="progress-bar-fill",sr.drawer="drawer",sr.summation="summation",sr["table-parent-row"]="table-parent-row",sr["table-row"]="table-row",sr["table-sub-row"]="table-sub-row",sr.tile="tile",sr["tile-bar-label"]="tile-bar-label",sr["tile-bar-label-outer"]="tile-bar-label-outer",sr["tile-body"]="tile-body",sr["tile-filter-button"]="tile-filter-button",sr["tile-filter-list"]="tile-filter-list",sr["tile-filter-row"]="tile-filter-row",sr["tile-header"]="tile-header",sr["business-owner-dashboard"]="business-owner-dashboard",sr["business-owner-dashboard-header"]="business-owner-dashboard-header",sr["transaction-type-label"]="transaction-type-label",sr["transaction-date-cell-container"]="transaction-date-cell-container",sr["selector-row"]="selector-row",sr["popup-list"]="popup-list",sr.badge="badge",sr["badge-chip"]="badge-chip",sr["date-cell"]="date-cell",sr["vertical-divider"]="vertical-divider",sr["horizontal-divider"]="horizontal-divider",sr["checkbox-input"]="checkbox-input",sr["bulk-select"]="bulk-select",sr["button-base"]="button-base",sr["button-discreet-small"]="button-discreet-small",sr["button-primary"]="button-primary",sr["button-secondary"]="button-secondary",sr["button-success"]="button-success",sr["button-danger"]="button-danger",sr["button-warning"]="button-warning",sr["button-action"]="button-action",sr["button-table-header"]="button-table-header",sr["button-inline"]="button-inline",sr["small-square-button"]="small-square-button",sr.card="card",sr["card-button"]="card-button",sr["card-button-icon-container"]="card-button-icon-container",sr["pagination-button"]="pagination-button",sr.text="text",sr["cell-button"]="cell-button",sr["selector-button"]="selector-button",sr["review-status-selector-button"]="review-status-selector-button",sr["review-status-dropdown-arrow"]="review-status-dropdown-arrow",sr["financial-summary-layout"]="financial-summary-layout",sr["financial-summary-chatbox"]="financial-summary-chatbox",sr["financial-summary-chatbox-header"]="financial-summary-chatbox-header",sr["month-picker"]="month-picker",sr["month-picker-left-button"]="month-picker-left-button",sr["month-picker-right-button"]="month-picker-right-button",sr["month-picker-label"]="month-picker-label",sr["filter-bar"]="filter-bar",sr["filter-search-bar"]="filter-search-bar",sr.pill="pill",sr["filter-pill"]="filter-pill",sr["email-pill"]="email-pill",sr["discreet-form-input"]="discreet-form-input",sr["editable-form-input"]="editable-form-input",sr["amount-input"]="amount-input",sr["modal-popup"]="modal-popup",sr["drawer-header"]="drawer-header",sr["form-body"]="form-body",sr.body="body",sr.heading="heading",sr["sub-label"]="sub-label",sr["strong-label"]="strong-label",sr["strong-sub-label"]="strong-sub-label",sr["weak-label"]="weak-label",sr["metric-xl"]="metric-xl",sr["metric-md"]="metric-md",sr["large-icon"]="large-icon",sr["medium-icon"]="medium-icon",sr["small-icon"]="small-icon",sr["tiny-icon"]="tiny-icon",sr["x-large-icon"]="x-large-icon",sr["xx-large-icon"]="xx-large-icon",sr["category-icon"]="category-icon",sr["card-header"]="card-header",sr.icon="icon",sr["neutral-badge"]="neutral-badge",sr["highlight-badge"]="highlight-badge",sr["success-badge"]="success-badge",sr["warning-badge"]="warning-badge",sr["danger-badge"]="danger-badge",sr["critical-badge"]="critical-badge",sr["button-group"]="button-group",sr["alert-dialog"]="alert-dialog",sr["alert-header"]="alert-header",sr["emphasis-label"]="emphasis-label",sr["profit-loss-graph"]="profit-loss-graph",sr.banner="banner",sr["banner-high"]="banner-high",sr["banner-medium"]="banner-medium",sr["banner-low"]="banner-low",sr["banner-urgent"]="banner-urgent",sr["banner-default"]="banner-default",sr["banner-button"]="banner-button",sr["banner-button-text"]="banner-button-text",sr["banner-button-icon"]="banner-button-icon",sr["banner-icon"]="banner-icon",sr["banner-title"]="banner-title",sr["empty-dashboard-layout"]="empty-dashboard-layout",sr["emphasis-sub-label"]="emphasis-sub-label",sr["bar-transactions-positive"]="bar-transactions-positive",sr["bar-transactions-negative"]="bar-transactions-negative",sr["message-sent"]="message-sent",sr["message-received"]="message-received",sr["date-amount-header"]="date-amount-header",sr["close-button"]="close-button",sr["start-date-form-section"]="start-date-form-section",sr["beginning-balance-form-section"]="beginning-balance-form-section",sr["date-picker-nav-button"]="date-picker-nav-button",sr["date-picker-day-button"]="date-picker-day-button",sr["dropdown-selector-button"]="dropdown-selector-button",sr.chip="chip",sr["attachment-dropzone"]="attachment-dropzone",sr["list-body"]="list-body",sr["loading-skeleton"]="loading-skeleton",sr["line-item-card"]="line-item-card",sr["linked-entity-row"]="linked-entity-row",sr["drawer-search-bar"]="drawer-search-bar",sr["value-comparison-summary"]="value-comparison-summary",sr["category-selector-table-cell"]="category-selector-table-cell",sr["zero-state-button"]="zero-state-button",sr.toast="toast",sr["toast-dismiss"]="toast-dismiss",sr["radio-group"]="radio-group",sr);const dr=e=>null==e,ur=e=>!dr(e),hr="Tight-",pr=e=>`${hr}${e}`;function gr(e){return e in cr}function mr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===hr&&r in cr}function vr(e){return!gr(e)&&!mr(e)}const fr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(pr(e)),t.forEach(e=>{dr(e)||(vr(e)?r.push(e):gr(e)?n.push(pr(e)):mr(e)&&n.push(e))}),{className:or(...n,...r)}},br=rr.raw({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}),yr=fr(cr["business-owner-dashboard-header"],rr(br));function wr({children:e}){return I("div",{...yr,children:e})}function Cr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(mr(t)&&e.push(t),e),[])],[])}function xr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(vr(t)&&e.push(t),e),[])],[])}function Tr(e){const t=Array.isArray(e)?e:[e];return{className:or(...Cr(t),...xr(t))}}const kr=lr({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:"template"}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:"template"},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:"template"},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"template",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"template"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:"template"},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:"template"},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:"template"}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"template"}},metric:{sm:{fontWeight:"metric.sm",fontSize:"metric.sm",fontFamily:"metric",color:"typography.metric.sm"},md:{fontWeight:"metric.md",fontSize:"metric.md",fontFamily:"metric",color:"typography.metric.md"},lg:{fontWeight:"metric.lg",fontSize:"metric.lg",fontFamily:"metric",color:"typography.metric.lg"},xl:{fontWeight:"metric.xl",fontSize:"metric.xl",fontFamily:"metric",color:"typography.metric.xl"}}}}),Er=fr(cr.heading,kr({heading:"default"}));function Ar({children:e,stylists:t=[]}){const n=Tr([Er,...t]);return I("div",{...n,children:e})}function Sr(e,t,n){return[...e,{accessToken:t,environment:n}]}function Ir(e,t){return[...e,t]}function Nr(e){return""===e.trim()}function Rr(e){return dr(e)||Nr(e)}function Pr(e){return!Rr(e)}const Dr=l({activeToken:void 0,accountantToken:void 0});function Mr(){const{activeToken:e}=i(Dr);return e}const Lr=()=>{throw new Error("No access token provided")},Fr=72e5,Or=new P({defaultOptions:{queries:{gcTime:Fr,staleTime:3e4,refetchInterval:6e4}}}),Vr=l("SANDBOX");function Ur(){return i(Vr)}function Br({queryKey:e,queryFn:t,...n}){const r=Mr(),a=Ur(),o=Pr(r),i=Sr(e,r??"",a),l=D(),s=M({...n,queryKey:i,queryFn:o?t:Lr,...o?{}:{retry:!1,staleTime:1/0}},Or);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Hr{constructor(e){this.client=e}async sendEvent({apiKey:e,events:t,notifier:n,payloadVersion:r}){const a=/* @__PURE__ */(new Date).toISOString(),o=JSON.stringify({apiKey:e,payloadVersion:r,notifier:n,events:t});await fetch(this.client.endpoints.notify,{method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":r,"Bugsnag-Sent-At":a},referrerPolicy:"no-referrer",body:o})}}const Wr=Symbol("Circular"),_r=Symbol("AccessError");function zr(e,t,n){return jr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function jr({key:e,value:t,replacer:n,seen:r,depthLimit:a=1/0,depth:o,edgeIndex:i,edgesLimit:l=1/0}){let s=t;if(r.includes(s)&&(s=Wr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=qr(()=>s.toJSON(String(e)))),null===s||"object"!=typeof s)return s;var c;if(o>a||i+1>l)return"[...]";if(r.push(t),Array.isArray(s)){const e=[],t=Math.min(s.length,l);for(let i=0;i<t;i++){const t=qr(()=>s[i]);e.push(jr({key:i,value:t,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l}))}t<s.length&&e.push("[...]"),s=e}else{const e={},t=Object.keys(s);for(let i=0;i<t.length;i++){const c=t[i],d=qr(()=>s[c]);e[c]=jr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function qr(e){try{return e()}catch{return _r}}const Kr=Object.prototype.toString,Yr=Object.getPrototypeOf;function Zr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Gr=/^\s*at .*(\S+:\d+|\(native\))/m,Qr=/^(eval@)?(\[native code])?$/;function Xr(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)return[e];const n=t[2]?parseInt(t[2],10):void 0,r=t[3]?parseInt(t[3],10):void 0;return[t[1],n,r]}function Jr(e,t){const n=$r(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Zr(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[ea(n)];return a.push(...ra(n).map(e=>ea(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function $r(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===Kr.call(t))return!0;t=Yr(t)}return!1}(e))return e;let n=function(e){if(!Zr(e))return null;const t=t=>{const n=e[t];if("string"==typeof n&&e[t.length])return n},n=t("name")||t("errorClass"),r=t("message")||t("errorMessage");if(!n||!r)return null;const a=new Error(r);return a.name=n,a}(e);if(n)return n;switch(typeof n){case"string":case"number":case"boolean":return new Error(String(e));default:return n=new Error(`${t} received a non-error. See "${t}" tab for more detail.`),n.name="InvalidError",n}}function ea(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:ta(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function ta(e,{backtrace:t}){const n=function(e){let t=e.stack;return void 0===t&&(t=e.stacktrace),"string"==typeof t&&t.length&&t!==`${e.name}: ${e.message}`?t:void 0}(e);return n?function(e){return(e.match(Gr)?e.split("\n").filter(e=>!!e.match(Gr)).map(e=>{e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),a=Xr(n?n[1]:r.pop()||"(no location)"),o=r.join(" ")||void 0;return{file:["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0],lineNumber:a[1],columnNumber:a[2],method:o}}):(t=e,t.split("\n").filter(e=>!e.match(Qr)).map(e=>{if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return{method:e};{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=Xr(e.replace(t,""));return{file:a[0],lineNumber:a[1],columnNumber:a[2],method:r}}}))).reduce((e,t)=>{if("{}"===JSON.stringify(t))return e;let n=t.file||t.method||"number"!=typeof t.lineNumber?t.file||"(unknown file)":"global code";n=n.replace(/\?.*$/,"").replace(/#.*$/,"");let r=t.method||"(unknown function)";return r=/^global code$/i.test(r)?"global code":r,e.concat([{file:n,lineNumber:t.lineNumber,columnNumber:t.columnNumber,method:r}])},[]);var t}(n):t?function(){const e=[];let t;try{t=arguments.callee}catch{return[]}for(;t&&e.length<na;){t.name?e.push({method:t.name,file:"(unknown file)"}):/function(?:\s+([\w$]+))+\s*\(/.test(t.toString())&&e.push({method:RegExp.$1,file:"(unknown file)"});try{t=t.caller}catch{break}}return e}():[]}const na=20;function ra(e){const t=e;if(t.cause){const e=$r(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(ra(e))}return[]}function aa(...e){console.warn}function oa(...e){console.error}const ia={name:"errorBreadcrumbs",load(e){e.addOnPostError(t=>{e.leaveBreadcrumb(t.exceptions[0].errorClass,{errorClass:t.exceptions[0].errorClass,errorMessage:t.exceptions[0].message,severity:t.severity},"error")})}};let la=Date.now();const sa=()=>{la=Date.now()},ca={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-la,!0}),{reset:sa})},da=[["Edge (EdgeHTML)",/Edge\/([0-9._]+)/],["Edge (iOS)",/EdgiOS\/([0-9._]+)/],["Yandex",/YaBrowser\/([0-9._]+)/],["KakaoTalk",/KAKAOTALK\s([0-9.]+)/],["Samsung",/SamsungBrowser\/([0-9.]+)/],["Silk",/\bSilk\/([0-9._-]+)\b/],["MIUI",/MiuiBrowser\/([0-9.]+)$/],["Beaker",/BeakerBrowser\/([0-9.]+)/],["Edge (Chromium)",/EdgA?\/([0-9.]+)/],["Chromium WebView",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9.]+)(:?\s|$)/],["Chrome (iOS)",/CriOS\/([0-9.]+)(:?\s|$)/],["Firefox",/Firefox\/([0-9.]+)(?:\s|$)/],["Firefox (iOS)",/FxiOS\/([0-9.]+)/],["Opera Mini",/Opera Mini.*Version\/([0-9.]+)/],["Opera",/Opera\/([0-9.]+)(?:\s|$)/],["Opera",/OPR\/([0-9.]+)(:?\s|$)/],["Internet Explorer",/Trident\/7\.0.*rv:([0-9.]+).*\).*Gecko$/],["Internet Explorer",/MSIE\s([0-9.]+);.*Trident\/[4-7].0/],["Internet Explorer",/MSIE\s(7\.0)/],["Blackberry",/BB10;\sTouch.*Version\/([0-9.]+)/],["Android",/Android\s([0-9.]+)/],["Safari (iOS)",/Version\/([0-9._]+).*Mobile.*Safari.*/],["Safari",/Version\/([0-9._]+).*Safari/],["Facebook",/FB[AS]V\/([0-9.]+)/],["Instagram",/Instagram\s([0-9.]+)/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Mobile/],["iOS WebView",/AppleWebKit\/([0-9.]+).*Gecko\)$/]],ua=[["iOS",void 0,/iP(hone|od|ad)/],["Android",void 0,/Android/],["BlackBerry",void 0,/BlackBerry|BB10/],["Windows Mobile",void 0,/IEMobile/],["Kindle",void 0,/Kindle/],["Windows","3.11",/Win16/],["Windows","95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows","98",/(Windows 98)|(Win98)/],["Windows","2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows","XP",/(Windows NT 5.1)|(Windows XP)/],["Windows","Server 2003",/(Windows NT 5.2)/],["Windows","Vista",/(Windows NT 6.0)/],["Windows","7",/(Windows NT 6.1)/],["Windows","8",/(Windows NT 6.2)/],["Windows","8.1",/(Windows NT 6.3)/],["Windows","10+",/(Windows NT 10.0)/],["Windows","ME",/Windows ME/],["Open BSD",void 0,/OpenBSD/],["Sun OS",void 0,/SunOS/],["Chrome OS",void 0,/CrOS/],["Linux",void 0,/(Linux)|(X11)/],["Mac OS",void 0,/(Mac_PowerPC)|(Macintosh)/],["QNX",void 0,/QNX/],["BeOS",void 0,/BeOS/],["OS/2",void 0,/OS\/2/]],ha=(pa=function(e){const t=""!==(n=e)&&da.reduce((e,[t,r])=>{if(e)return e;const a=r.exec(n);return!!a&&[t,a]},!1);var n;if(!t)return{};const[r,a]=t,o=function(e){for(const[t,n,r]of ua)if(r.exec(e))return{osName:t,osVersion:n};return null}(e),i="iOS"===o?.osName?function(e){const t=/iPad|iPhone|iPod/.exec(e);return t?{manufacturer:"Apple",model:t[0]}:/MacIntel/.test(e)&&self.navigator&&self.navigator.maxTouchPoints&&self.navigator.maxTouchPoints>2?{manufacturer:"Apple",model:"iPad"}:null}(e):{};return{browserName:r,browserVersion:a[1],osName:o?.osName,osVersion:o?.osVersion,manufacturer:i?.manufacturer,model:i?.model}},{name:"browserContext",load(e){e.addOnError(e=>{e.request={...e.request,url:self.location.href},e.context=e.context||self.location.pathname,e.device={...e.device,...pa(self.navigator.userAgent),locale:self.navigator.language,userAgent:self.navigator.userAgent};let t=["n/a"];try{t=self.navigator.languages}catch{}return e.metaData={...e.metaData,language:{language:self.navigator.language,languages:t}},!0})}});var pa;class ga{limit;period;events;constructor(e,t){this.limit=e,this.period=t,this.events=new B}reset(){this.events.clear()}increment(){const e=/* @__PURE__ */(new Date).getTime();if(void 0!==this.period){let t=this.events.peek();for(;void 0!==t&&e-this.period>t;)this.events.dequeue(),t=this.events.peek()}const t=this.events.size+1<=this.limit;return t&&this.events.enqueue(e),t}get size(){return this.events.size}}class ma extends c{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}handleClearError(){this.setState({error:void 0,errorInfo:void 0})}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){const{exceptions:n,metadata:r}=Jr(e,"notify");t&&t.componentStack&&(t.componentStack=function(e){const t=e.split(/\s*\n\s*/g);let n="";for(let r=0,a=t.length;r<a;r++)t[r].length&&(n+=`${n.length?"\n":""}${t[r]}`);return n}(t.componentStack));const{onError:a,client:o}=this.props;o.notifyEvent({exceptions:n,unhandled:!0,severity:"error",severityReason:{type:"unhandledException"},metadata:{...r,react:t},onError:a},e),this.setState({errorInfo:t})}render(){const{error:e}=this.state;if(e){const{FallbackComponent:e}=this.props;if(e)return I(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return I(N,{children:this.props.children})}}const va={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(ma,{client:e,onError:t,FallbackComponent:n,children:r})})},fa=new class{breadcrumbs=[];config;delivery=new Hr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return oa(),this;let t;this.config=e,this.config.onError&&(t=Array.isArray(this.config.onError)?this.config.onError:[this.config.onError]),this.errorCallbacks=new Set(t);for(const n of this.config.plugins||[])this.plugins.push({name:n.name||"unknown",plugin:n.load(this)});return this}get endpoints(){return{notify:this.config?.endpoints?.notify||"https://notify.bugsnag.com/"}}notify(e,t={}){const{exceptions:n,metadata:r}=Jr(e,"notify");let a,o,i=r;return"function"==typeof t?a=t:(o=t.severity,t.metadata&&(i={...r,...t.metadata})),this.notifyEvent({exceptions:n,metadata:i,severity:o,onError:a},e)}leaveBreadcrumb(e,t,n){if(!this.config)return;if("string"!=typeof e)try{e=String(e)}catch{e="Unable to stringify breadcrumb message"}if(!e.length)return;this.breadcrumbs.push({name:e,metaData:t,type:n||"manual",timestamp:/* @__PURE__ */(new Date).toISOString()});const{maxBreadcrumbs:r=25}=this.config;this.breadcrumbs.length>r&&this.breadcrumbs.splice(0,this.breadcrumbs.length-r)}async notifyEvent({exceptions:e,unhandled:t,severity:n,severityReason:r,metadata:a,onError:o},i){if(!this.config)return;const l=this.config.releaseStage||"production";if(this.config.enabledReleaseStages&&!this.config.enabledReleaseStages.includes(l))return;const s={exceptions:e,breadcrumbs:this.breadcrumbs.length?this.breadcrumbs:void 0,originalError:i,unhandled:"boolean"==typeof t&&t,severity:n||"warning",severityReason:r,user:this.config.user||void 0,app:{releaseStage:l,version:this.config.appVersion,type:this.config.appType||("object"==typeof window?"browser":"node")},device:{time:/* @__PURE__ */(new Date).toISOString()},metaData:a||{}},c=[...this.errorCallbacks];o&&c.push(o);const d=["stringifyValues","redact"];c.sort((e,t)=>d.includes(e.name)&&d.includes(t.name)?0:d.includes(e.name)?1:d.includes(t.name)?-1:0);for(const m of c){const e=await m(s);if("boolean"==typeof e&&!e)return}const u=zr(s,(e,t)=>{if("originalError"!==e)return t},{depthLimit:20,edgesLimit:500});let h;const p={apiKey:this.config.apiKey,payloadVersion:"5",notifier:{name:"Tight Components",version:"1",url:"https://github.com/tight-embedded/TraxComponents/tree/dev/packages/react/src/bugsnag/README.md"},events:[u]};try{h=JSON.stringify(p)}catch{u.metaData={notifier:"Unable to serialize metadata"},h=JSON.stringify(p)}if(h.length>1e6&&(u.metaData={notifier:`Payload was ${h.length/1e6}Mb. Metadata removed.`},h=JSON.stringify(p),h.length>1e6))throw new Error("Payload exceeded 1Mb limit");for(const m of this.postErrorCallbacks)m(s);try{await this.delivery.sendEvent(p)}catch(g){oa()}}getUser(){return this.config?.user||{}}setUser(e,t,n){this.config&&(this.config.user={id:e,email:t,name:n})}setProperties(e){this.config&&(this.config.releaseStage=e)}addOnError(e){this.errorCallbacks.add(e)}removeOnError(e){this.errorCallbacks.delete(e)}addOnPostError(e){this.postErrorCallbacks.add(e)}removeOnPostError(e){this.postErrorCallbacks.delete(e)}getPlugin(e){return this.plugins.find(t=>t.name===e)?.plugin}setDelivery(e){this.delivery=e}};let ba="",ya="";const wa="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",Ca=fa.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.10.0",appType:"browser",releaseStage:wa,enabledReleaseStages:["prod"],plugins:[ca,ha,ia,(()=>{const e=new ga(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),va]}),xa=(e,t)=>{try{fa.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?Ta({error:n,severity:"error"}):Ta({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},Ta=async e=>{try{await fa.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:ba,environment:ya}},!0)),aa(e.error,e.error.message,e.extraData)}catch(t){t instanceof Error?await Ta({error:t,severity:"error"}):await Ta({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},ka=Ca.getPlugin("react"),Ea=ka?.BugsnagErrorBoundary,Aa=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,Sa=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},Ia=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},Na={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function Ra(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...w(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?Na:{}}});return{url:(n=e.endpointManager.getUrl(e.path),r=e.pathParams,void 0!==r&&Object.entries(r).forEach(([e,t])=>{n=n.replace(`{${e}}`,t)}),n),headers:t};var n,r}async function Pa({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=Sa({extraHeaders:t,authorization:e});xa("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return xa("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),Ia(e)}catch(l){return Promise.reject(l)}}async function Da(e){const{url:t,headers:n}=Ra(e);return Pa({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function Ma(e){return Da(e)}async function La(e){return Da(e)}const Fa=(e,t)=>({getUrl:t=>((e,t)=>{let n=t;for(;n.length>0&&"/"===n.charAt(0);)n=n.slice(1);return`${e}/${n}`})(e,t),baseUrl:e,apiVersion:t}),Oa={DEVELOPMENT:"https://dev.hurdlr.com/rest",PRODUCTION:"https://prod.hurdlr.com/rest",SANDBOX:"https://sandbox.hurdlr.com/rest",LOCAL:"http://localhost:8081/TraxAngular/rest",DEVELOPMENT_RC:"https://dev.hurdlr.com/rest",SANDBOX_RC:"https://sandbox.hurdlr.com/rest",PRODUCTION_RC:"https://prod.hurdlr.com/rest"},Va={DEVELOPMENT:"https://dev.tight.com",PRODUCTION:"https://prod.tight.com",SANDBOX:"https://sandbox.tight.com",LOCAL:"http://localhost:8080",DEVELOPMENT_RC:"https://qa.dev.tight.com",SANDBOX_RC:"https://qa.sandbox.tight.com",PRODUCTION_RC:"https://qa.prod.tight.com"},Ua={...Va,LOCAL:"http://localhost:8082"};function Ba(e){return Fa(`${t=e,Oa[t]}/v5`,"v5");var t}const Ha=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Wa=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...wt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Ba(a)};return await La(o)};function _a({filter:e,grouping:t,select:n,accountingMethod:r}){return Br({queryKey:Ha({filter:e,grouping:t,accountingMethod:r}),queryFn:Wa,select:n})}const za="noDataHeight";function ja(e){const t=Rt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function qa(e){const t=ja(e.period?.beginDate),n=e.netIncome??0,{profit:r,remainingIncome:a,loss:o,remainingExpenses:i}=function(e,t,n){const r=e>0?e:0,a=e<0?e:0;return{profit:r,remainingIncome:void 0!==t?H(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?H(n).plus(a).toNumber():0}}(n,e.income?.total,e.expenses?.total);return{month:{month:t,income:a,expenses:-i,profit:r,loss:o,netIncome:n,hasNoData:/* @__PURE__ */function(e,t,n){return 0===e&&0===t&&0===n}(n,a,i)},netIncome:n}}function Ka(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(dr(n))return t;for(const i of n){const{month:e,netIncome:n}=qa(i);t.total=H(n).plus(t.total).toNumber(),t.months.push(e)}const{domainMin:r,domainMax:a}=n.reduce((e,t)=>({domainMin:Math.min(e.domainMin,-(t.expenses?.total??0)),domainMax:Math.max(e.domainMax,t.income?.total??0)}),{domainMin:0,domainMax:0});t.domain=[r,a],t.hasAnyData=t.months.some(e=>!e.hasNoData);const o=function(e,t){const n=t-e;return n>0?.03*n:3}(r,a);return t.months=t.months.map(e=>e.hasNoData?{...e,noDataHeight:o}:e),t}const Ya="MONTHLY",Za=fr(cr["tile-header"],rr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Ga({title:e}){return I("div",{...Za,children:I(Ar,{children:e})})}const Qa=fr(cr["tile-body"],rr({display:"flex",justifyContent:"start",alignItems:"start",flexDirection:"column",gap:"20px",height:"100%",padding:"20px 15px",backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderBottomRadius:"lg",borderTop:"hidden"}));function Xa({children:e}){return I("div",{...Qa,children:e})}const Ja=lr({base:{display:"flex",flexDirection:"column",transition:"height 0.5s, width 0.5s",position:"relative",borderRadius:"lg",overflow:"hidden"},variants:{type:{default:{minWidth:"295px",maxWidth:"426px",width:"100%",height:"295px"},chart:{minWidth:"900px",maxWidth:"1440px",height:"481px"}},isSample:{true:{pointerEvents:"none"},false:{}}},defaultVariants:{type:"default"}});function $a({children:e,type:t,isSample:n=!1}){const r=fr(cr.tile,Ja({type:t,isSample:n}));return I("div",{...r,children:e})}const eo=rr({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),to=rr.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),no=rr.raw({whiteSpace:"normal",overflowWrap:"break-word"}),ro=rr.raw({overflow:"visible",whiteSpace:"nowrap"}),ao=rr({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),oo=rr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),io=rr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"template"});rr.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"});const lo=fr(cr.text,kr({label:"default"}),rr({maxWidth:"100%"}),eo);function so({children:e,stylists:t=[]}){const n=Tr([lo,...t]);return I("div",{...n,children:e})}const co=fr(cr["metric-xl"],kr({metric:"xl"}));function uo(e){return I("div",{...co,children:e.children})}const ho=fr(cr.summation,rr({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function po({title:e,label:t}){return R("div",{...ho,children:[I(uo,{children:e}),I(so,{children:t})]})}const go=fr(null,rr({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function mo({children:e}){return I("div",{...go,children:e})}const vo=(e,t=0)=>{const n=Math.abs(e);let r;if(t<=0)r=Math.round(n);else{const e=n.toFixed(t);r=parseFloat(e)}return Math.sign(e)*r},fo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),bo=1e9;function yo(e,t={}){const{cents:n="default",condense:r=!1,dollarSign:a=!1,decorator:o,signage:i="default"}=t,l="string"==typeof e?parseFloat(e):e;if(Number.isNaN(l))return"";let s;const c=Math.abs(l);let d;if(r&&c>99999)d=Math.sign(l)<0,s=function(e){const t=Math.floor((n=e,Math.log(n)/Math.log(1e3)))-1;var n;const r=Math.pow(1e3,t),a=Math.round(e/r),o=a*r;let i,l=a/1e3;return e<bo&&l>=1e3&&(l/=1e3),o>=bo?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${fo(l,0,1)}${i}`}(c);else{const{minPrecision:e,precision:t,roundedValue:r}=function(e,t){if("floor"===t)return{precision:0,minPrecision:0,roundedValue:(n=e,Math.sign(n)*Math.floor(Math.abs(n)))};if("round"===t){const t=0;return{precision:t,minPrecision:0,roundedValue:vo(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:vo(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:vo(e,t)}}{const t=2,n=vo(e,t);return{precision:t,roundedValue:n,minPrecision:n%1==0?0:2}}var n}(l,n);d=Math.sign(r)<0;const a=Math.abs(r);s=fo(a,e,t)}if(a)return function(e,t,n,r){let a=e;const o=n?"$":"";return void 0===r||"off"===r?a=`${o}${e}`:"parens"===r?a=`${o}${t?`(${e})`:e}`:"always"===r?a=`${t?"-":"+"}${o}${e}`:"default"===r&&(a=`${t?"-":""}${o}${e}`),a}(s,d,a,i);const u=(h=s,"$"===(p=o)?`${p}${h}`:"%"===p?`${h}${p}`:h);var h,p;return"off"===i?u:"parens"===i?d?`(${u})`:u:"always"===i?`${d?"-":"+"}${u}`:"default"===i?`${d?"-":""}${u}`:u}function wo(e){return yo(e,{condense:!0,dollarSign:!0})}function Co(e){return yo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function xo(e){return yo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function To(e,t){return yo(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const ko=lr({variants:{wrap:{ellipsis:to,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function Eo({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Rr(n))return null;const a=Tr([fr(cr["strong-label"],cr.text,kr({label:"strongLabel"}),ko({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const Ao=lr({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"label.sub"}},variants:{intent:{weak:{color:"typography.base.weak"},normal:{color:"typography.label.sub"},action:{color:"typography.intent.action"},primary:{color:"typography.intent.primary"},danger:{color:"typography.accent.danger"}},accent:{action:{_supportHover:{color:"typography.accent.action",transition:"color 100ms ease-out"},transition:"color 300ms ease-out"},active:{color:"typography.accent.action"},strongest:{color:"brand.action.strongest"}},wrap:{ellipsis:to,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:to,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function So({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=fr(cr["sub-label"],cr.text,Ao({intent:e,wrap:t,accent:r}),eo);return Rr(n)?null:I("div",{...a,children:n})}const Io=fr(null,rr({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"10px",width:"fit-content",height:"fit-content"}));function No({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===za)return null;let n=t[0].value??0;return"expenses"===t[0].dataKey?n+=t[0].payload.loss:"income"===t[0].dataKey&&(n+=t[0].payload.profit),R("div",{...Io,children:[I(Eo,{children:t[0].name??""}),I(So,{children:wo(Number(n))})]})}const Ro={"colors.white100":{value:"#FFFFFF",variable:"var(--Tight-colors-white100)"},"colors.white200":{value:"#F9F9F9",variable:"var(--Tight-colors-white200)"},"colors.white300":{value:"#EDEDED",variable:"var(--Tight-colors-white300)"},"colors.white600":{value:"#E7E8E9",variable:"var(--Tight-colors-white600)"},"colors.white700":{value:"#E0E2E3",variable:"var(--Tight-colors-white700)"},"colors.black100":{value:"#CED1D2",variable:"var(--Tight-colors-black100)"},"colors.black200":{value:"#A7ACAD",variable:"var(--Tight-colors-black200)"},"colors.black300":{value:"#A4A9AB",variable:"var(--Tight-colors-black300)"},"colors.black400":{value:"#6F7576",variable:"var(--Tight-colors-black400)"},"colors.black600":{value:"#50595C",variable:"var(--Tight-colors-black600)"},"colors.black700":{value:"#182428",variable:"var(--Tight-colors-black700)"},"colors.black800":{value:"#030506",variable:"var(--Tight-colors-black800)"},"colors.blue200":{value:"#EDFAFC",variable:"var(--Tight-colors-blue200)"},"colors.blue300":{value:"#DAF4FA",variable:"var(--Tight-colors-blue300)"},"colors.blue400":{value:"#CAECF3",variable:"var(--Tight-colors-blue400)"},"colors.blue500":{value:"#94D8E8",variable:"var(--Tight-colors-blue500)"},"colors.blue700":{value:"#2AB2D1",variable:"var(--Tight-colors-blue700)"},"colors.blue900":{value:"#177F96",variable:"var(--Tight-colors-blue900)"},"colors.green100":{value:"#EDFAF4",variable:"var(--Tight-colors-green100)"},"colors.green200":{value:"#DBF9EA",variable:"var(--Tight-colors-green200)"},"colors.green300":{value:"#B8F3D5",variable:"var(--Tight-colors-green300)"},"colors.green400":{value:"#94E8BD",variable:"var(--Tight-colors-green400)"},"colors.green500":{value:"#5FDD9C",variable:"var(--Tight-colors-green500)"},"colors.green700":{value:"#009C75",variable:"var(--Tight-colors-green700)"},"colors.green900":{value:"#067559",variable:"var(--Tight-colors-green900)"},"colors.yellow200":{value:"#FFF3C3",variable:"var(--Tight-colors-yellow200)"},"colors.yellow300":{value:"#FFE787",variable:"var(--Tight-colors-yellow300)"},"colors.yellow400":{value:"#FCD34D",variable:"var(--Tight-colors-yellow400)"},"colors.yellow500":{value:"#FBBF24",variable:"var(--Tight-colors-yellow500)"},"colors.yellow700":{value:"#F59E0B",variable:"var(--Tight-colors-yellow700)"},"colors.yellow800":{value:"#B35F00",variable:"var(--Tight-colors-yellow800)"},"colors.red200":{value:"#FFCBCB",variable:"var(--Tight-colors-red200)"},"colors.red300":{value:"#FF9797",variable:"var(--Tight-colors-red300)"},"colors.red400":{value:"#F45C5C",variable:"var(--Tight-colors-red400)"},"colors.red500":{value:"#E84747",variable:"var(--Tight-colors-red500)"},"colors.red700":{value:"#E42525",variable:"var(--Tight-colors-red700)"},"colors.template.background":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-template-background)"},"colors.template.background.weak":{value:"hsl(from var(--Tight-colors-surface-background) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-background-weak)"},"colors.template.appBackground":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-template-appBackground)"},"colors.template.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-template-foreground)"},"colors.template.foreground.weak":{value:"hsl(from var(--Tight-colors-template-foreground) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-foreground-weak)"},"colors.template.typography":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-template-typography)"},"colors.template.typography.weak":{value:"hsl(from var(--Tight-colors-template-typography) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-typography-weak)"},"colors.template.brand":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-template-brand)"},"colors.template.brand.weak":{value:"hsl(from var(--Tight-colors-template-brand) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weak)"},"colors.template.brand.strong":{value:"hsl(from var(--Tight-colors-template-brand) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strong)"},"colors.template.brand.weaker":{value:"hsl(from var(--Tight-colors-template-brand-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weaker)"},"colors.template.brand.stronger":{value:"hsl(from var(--Tight-colors-template-brand-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-stronger)"},"colors.template.brand.weakest":{value:"hsl(from var(--Tight-colors-template-brand-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weakest)"},"colors.template.brand.strongest":{value:"hsl(from var(--Tight-colors-template-brand-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strongest)"},"colors.template.neutral":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-template-neutral)"},"colors.template.neutral.weak":{value:"hsl(from var(--Tight-colors-template-neutral) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weak)"},"colors.template.neutral.strong":{value:"hsl(from var(--Tight-colors-template-neutral) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strong)"},"colors.template.neutral.weaker":{value:"hsl(from var(--Tight-colors-template-neutral-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weaker)"},"colors.template.neutral.stronger":{value:"hsl(from var(--Tight-colors-template-neutral-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-stronger)"},"colors.template.neutral.weakest":{value:"hsl(from var(--Tight-colors-template-neutral-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weakest)"},"colors.template.neutral.strongest":{value:"hsl(from var(--Tight-colors-template-neutral-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strongest)"},"colors.template.accent":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-template-accent)"},"colors.template.accent.weak":{value:"hsl(from var(--Tight-colors-template-accent) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weak)"},"colors.template.accent.strong":{value:"hsl(from var(--Tight-colors-template-accent) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strong)"},"colors.template.accent.weaker":{value:"hsl(from var(--Tight-colors-template-accent-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weaker)"},"colors.template.accent.stronger":{value:"hsl(from var(--Tight-colors-template-accent-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-stronger)"},"colors.template.accent.weakest":{value:"hsl(from var(--Tight-colors-template-accent-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weakest)"},"colors.template.accent.strongest":{value:"hsl(from var(--Tight-colors-template-accent-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strongest)"},"colors.template.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-template-success)"},"colors.template.success.weak":{value:"hsl(from var(--Tight-colors-template-success) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weak)"},"colors.template.success.strong":{value:"hsl(from var(--Tight-colors-template-success) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strong)"},"colors.template.success.weaker":{value:"hsl(from var(--Tight-colors-template-success-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weaker)"},"colors.template.success.stronger":{value:"hsl(from var(--Tight-colors-template-success-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-stronger)"},"colors.template.success.weakest":{value:"hsl(from var(--Tight-colors-template-success-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weakest)"},"colors.template.success.strongest":{value:"hsl(from var(--Tight-colors-template-success-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strongest)"},"colors.template.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-template-warning)"},"colors.template.warning.weak":{value:"hsl(from var(--Tight-colors-template-warning) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weak)"},"colors.template.warning.strong":{value:"hsl(from var(--Tight-colors-template-warning) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strong)"},"colors.template.warning.weaker":{value:"hsl(from var(--Tight-colors-template-warning-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weaker)"},"colors.template.warning.stronger":{value:"hsl(from var(--Tight-colors-template-warning-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-stronger)"},"colors.template.warning.weakest":{value:"hsl(from var(--Tight-colors-template-warning-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weakest)"},"colors.template.warning.strongest":{value:"hsl(from var(--Tight-colors-template-warning-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strongest)"},"colors.template.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-template-danger)"},"colors.template.danger.weak":{value:"hsl(from var(--Tight-colors-template-danger) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weak)"},"colors.template.danger.strong":{value:"hsl(from var(--Tight-colors-template-danger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strong)"},"colors.template.danger.weaker":{value:"hsl(from var(--Tight-colors-template-danger-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weaker)"},"colors.template.danger.stronger":{value:"hsl(from var(--Tight-colors-template-danger-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-stronger)"},"colors.template.danger.weakest":{value:"hsl(from var(--Tight-colors-template-danger-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weakest)"},"colors.template.danger.strongest":{value:"hsl(from var(--Tight-colors-template-danger-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strongest)"},"lineHeights.template":{value:"normal",variable:"var(--Tight-lineHeights-template)"},"letterSpacings.template":{value:"normal",variable:"var(--Tight-letterSpacings-template)"},"fonts.template":{value:"Duplet Regular, sans-serif",variable:"var(--Tight-fonts-template)"},"fonts.base":{value:"var(--Tight-fonts-template)",variable:"var(--Tight-fonts-base)"},"fontSizes.template":{value:"16px",variable:"var(--Tight-fontSizes-template)"},"fontSizes.template.xs":{value:"calc(calc(var(--Tight-fontSizes-template) - 2px) - 2px)",variable:"var(--Tight-fontSizes-template-xs)"},"fontSizes.template.sm":{value:"calc(var(--Tight-fontSizes-template) - 2px)",variable:"var(--Tight-fontSizes-template-sm)"},"fontSizes.template.lg":{value:"calc(var(--Tight-fontSizes-template) + 4px)",variable:"var(--Tight-fontSizes-template-lg)"},"fontSizes.template.xl":{value:"calc(var(--Tight-fontSizes-template-lg) + 4px)",variable:"var(--Tight-fontSizes-template-xl)"},"fontSizes.sm":{value:"var(--Tight-fontSizes-template-xs)",variable:"var(--Tight-fontSizes-sm)"},"fontSizes.md":{value:"var(--Tight-fontSizes-template-sm)",variable:"var(--Tight-fontSizes-md)"},"fontSizes.lg":{value:"var(--Tight-fontSizes-template)",variable:"var(--Tight-fontSizes-lg)"},"fontSizes.xl":{value:"var(--Tight-fontSizes-template-lg)",variable:"var(--Tight-fontSizes-xl)"},"fontSizes.2xl":{value:"var(--Tight-fontSizes-template-xl)",variable:"var(--Tight-fontSizes-2xl)"},"fontWeights.template.sm":{value:"400",variable:"var(--Tight-fontWeights-template-sm)"},"fontWeights.template.md":{value:"600",variable:"var(--Tight-fontWeights-template-md)"},"fontWeights.template.lg":{value:"900",variable:"var(--Tight-fontWeights-template-lg)"},"fontWeights.sm":{value:"var(--Tight-fontWeights-template-sm)",variable:"var(--Tight-fontWeights-sm)"},"fontWeights.md":{value:"var(--Tight-fontWeights-template-md)",variable:"var(--Tight-fontWeights-md)"},"fontWeights.lg":{value:"var(--Tight-fontWeights-template-lg)",variable:"var(--Tight-fontWeights-lg)"},"radii.zero":{value:"0",variable:"var(--Tight-radii-zero)"},"radii.full":{value:"9999px",variable:"var(--Tight-radii-full)"},"radii.template":{value:"4px",variable:"var(--Tight-radii-template)"},"radii.template.sm":{value:"var(--Tight-radii-template-sm)",variable:"var(--Tight-radii-template-sm)"},"radii.template.md":{value:"var(--Tight-radii-template-md)",variable:"var(--Tight-radii-template-md)"},"radii.template.lg":{value:"var(--Tight-radii-template-lg)",variable:"var(--Tight-radii-template-lg)"},"radii.sm":{value:"var(--Tight-radii-template-sm)",variable:"var(--Tight-radii-sm)"},"radii.md":{value:"var(--Tight-radii-template-md)",variable:"var(--Tight-radii-md)"},"radii.lg":{value:"var(--Tight-radii-template-lg)",variable:"var(--Tight-radii-lg)"},"borderWidths.template":{value:"1px",variable:"var(--Tight-borderWidths-template)"},"borderWidths.template.sm":{value:"var(--Tight-borderWidths-template-sm)",variable:"var(--Tight-borderWidths-template-sm)"},"borderWidths.template.md":{value:"var(--Tight-borderWidths-template-md)",variable:"var(--Tight-borderWidths-template-md)"},"borderWidths.template.lg":{value:"var(--Tight-borderWidths-template-lg)",variable:"var(--Tight-borderWidths-template-lg)"},"borderWidths.template.xl":{value:"var(--Tight-borderWidths-template-xl)",variable:"var(--Tight-borderWidths-template-xl)"},"borderWidths.sm":{value:"var(--Tight-borderWidths-template-sm)",variable:"var(--Tight-borderWidths-sm)"},"borderWidths.md":{value:"var(--Tight-borderWidths-template-md)",variable:"var(--Tight-borderWidths-md)"},"borderWidths.lg":{value:"var(--Tight-borderWidths-template-lg)",variable:"var(--Tight-borderWidths-lg)"},"borderWidths.xl":{value:"var(--Tight-borderWidths-template-xl)",variable:"var(--Tight-borderWidths-xl)"},"animations.appear.instant":{value:"0.25s linear fade-in",variable:"var(--Tight-animations-appear-instant)"},"animations.appear.delay":{value:"0.25s linear both 1.5s fade-in",variable:"var(--Tight-animations-appear-delay)"},"animations.shimmer":{value:"2s ease-in-out infinite shimmer",variable:"var(--Tight-animations-shimmer)"},"animations.spin":{value:"1.5s ease-in-out 0.1s spin infinite",variable:"var(--Tight-animations-spin)"},"shadows.box-shadow":{value:"0px 10px 30px 0px rgba(0, 0, 0, 0.05), 0px 4px 12px 0px rgba(0, 0, 0, 0.15) ",variable:"var(--Tight-shadows-box-shadow)"},"durations.toast.enter":{value:"250ms",variable:"var(--Tight-durations-toast-enter)"},"durations.toast.exit":{value:"200ms",variable:"var(--Tight-durations-toast-exit)"},"easings.toast.enter":{value:"ease-out",variable:"var(--Tight-easings-toast-enter)"},"easings.toast.exit":{value:"ease-in",variable:"var(--Tight-easings-toast-exit)"},"breakpoints.sm":{value:"640px",variable:"var(--Tight-breakpoints-sm)"},"breakpoints.md":{value:"850px",variable:"var(--Tight-breakpoints-md)"},"breakpoints.lg":{value:"1024px",variable:"var(--Tight-breakpoints-lg)"},"breakpoints.xl":{value:"1280px",variable:"var(--Tight-breakpoints-xl)"},"breakpoints.1_5xl":{value:"1400px",variable:"var(--Tight-breakpoints-1_5xl)"},"breakpoints.2xl":{value:"1536px",variable:"var(--Tight-breakpoints-2xl)"},"sizes.breakpoint-sm":{value:"640px",variable:"var(--Tight-sizes-breakpoint-sm)"},"sizes.breakpoint-md":{value:"850px",variable:"var(--Tight-sizes-breakpoint-md)"},"sizes.breakpoint-lg":{value:"1024px",variable:"var(--Tight-sizes-breakpoint-lg)"},"sizes.breakpoint-xl":{value:"1280px",variable:"var(--Tight-sizes-breakpoint-xl)"},"sizes.breakpoint-1_5xl":{value:"1400px",variable:"var(--Tight-sizes-breakpoint-1_5xl)"},"sizes.breakpoint-2xl":{value:"1536px",variable:"var(--Tight-sizes-breakpoint-2xl)"},"colors.brand.primary.weaker":{value:"var(--Tight-colors-brand-primary-weaker)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-brand-primary-weak)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-brand-primary)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-brand-secondary-weaker)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-brand-secondary)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-brand-action-stronger)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-brand-success-stronger)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-brand-success-strongest)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-brand-warning-stronger)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-brand-warning-strongest)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-brand-danger-stronger)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-surface-background-hover)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-surface-foreground-hover)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-surface-elevated)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-surface-elevated-hover)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-surface-intent-primary)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-surface-intent-primary-hover)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-surface-intent-primary-active)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-intent-primary-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-surface-intent-secondary)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-surface-intent-secondary-hover)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-surface-intent-secondary-active)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-intent-secondary-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-surface-intent-action)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-surface-intent-action-hover)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-surface-intent-action-active)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-intent-action-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"var(--Tight-colors-surface-intent-action-discreet)",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-surface-intent-action-discreet-hover)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-surface-intent-action-discreet-active)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-surface-intent-action-highlight)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-surface-intent-success)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-surface-intent-success-hover)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-surface-intent-success-active)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-intent-success-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-surface-intent-success-highlight)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-surface-intent-warning)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-surface-intent-warning-hover)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-surface-intent-warning-active)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-intent-warning-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-surface-intent-warning-highlight)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-surface-intent-danger)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-surface-intent-danger-hover)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-surface-intent-danger-active)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-intent-danger-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-surface-intent-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-surface-intent-danger-highlight)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.intent.notification":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-intent-notification)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-surface-reports-alternateRows)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.intent.notification":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-notification)"},"colors.typography.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-typography-accent-action)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-body)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-label)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-label-sub)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-label-strong)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-label-strongSub)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-label-emphasisSub)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-heading)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-metric-sm)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-metric-md)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-metric-lg)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-metric-xl)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-icon-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-icon-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-icon-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-icon-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-icon-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-icon-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-icon-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-icon-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-icon-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-icon-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-icon-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-icon-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-icon-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-icon-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-icon-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-icon-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-icon-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-icon-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-icon-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-icon-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-icon-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-icon-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-icon-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-icon-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-icon-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-border-layout-weak)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-border-layout-strong)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-border-intent-primary-hover)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-border-intent-primary)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-border-intent-primary-active)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-intent-primary-disabled)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-border-intent-secondary-hover)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-border-intent-secondary)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-border-intent-secondary-active)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-intent-secondary-disabled)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-border-intent-danger-hover)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-border-intent-danger)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-border-intent-danger-active)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-intent-danger-disabled)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-border-intent-warning-hover)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-border-intent-warning)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-border-intent-warning-active)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-intent-warning-disabled)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-border-intent-success-hover)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-border-intent-success)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-border-intent-success-active)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-intent-success-disabled)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-border-intent-action-hover)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-border-intent-action)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-border-intent-action-active)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-intent-action-disabled)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-money)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-money-positive)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-money-positive-weak)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-money-positive-strong)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-money-negative)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-money-negative-weak)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-money-negative-strong)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"var(--Tight-colors-overlay)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"var(--Tight-colors-transparent)",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"var(--Tight-colors-none)",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"var(--Tight-colors-currentColor)",variable:"var(--Tight-colors-currentColor)"},"fonts.body":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-body)"},"fonts.label":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-label)"},"fonts.heading":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-heading)"},"fonts.metric":{value:"var(--Tight-fonts-base)",variable:"var(--Tight-fonts-metric)"},"fontWeights.global":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-global)"},"fontWeights.body":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-body)"},"fontWeights.label":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label)"},"fontWeights.label.strong":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strong)"},"fontWeights.label.sub":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-label-sub)"},"fontWeights.label.strongSub":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-label-strongSub)"},"fontWeights.label.emphasisSub":{value:"var(--Tight-fontWeights-lg)",variable:"var(--Tight-fontWeights-label-emphasisSub)"},"fontWeights.heading":{value:"var(--Tight-fontWeights-md)",variable:"var(--Tight-fontWeights-heading)"},"fontWeights.title":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-title)"},"fontWeights.metric.sm":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-sm)"},"fontWeights.metric.md":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-md)"},"fontWeights.metric.lg":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-lg)"},"fontWeights.metric.xl":{value:"var(--Tight-fontWeights-sm)",variable:"var(--Tight-fontWeights-metric-xl)"},"fontSizes.title":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-title)"},"fontSizes.body":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-body)"},"fontSizes.label":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label)"},"fontSizes.label.strong":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-label-strong)"},"fontSizes.label.sub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-sub)"},"fontSizes.label.strongSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-strongSub)"},"fontSizes.label.emphasisSub":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-label-emphasisSub)"},"fontSizes.heading":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-heading)"},"fontSizes.metric.sm":{value:"var(--Tight-fontSizes-sm)",variable:"var(--Tight-fontSizes-metric-sm)"},"fontSizes.metric.md":{value:"var(--Tight-fontSizes-md)",variable:"var(--Tight-fontSizes-metric-md)"},"fontSizes.metric.lg":{value:"var(--Tight-fontSizes-xl)",variable:"var(--Tight-fontSizes-metric-lg)"},"fontSizes.metric.xl":{value:"var(--Tight-fontSizes-2xl)",variable:"var(--Tight-fontSizes-metric-xl)"},"colors.colorPalette":{value:"var(--Tight-colors-colorPalette)",variable:"var(--Tight-colors-colorPalette)"},"colors.colorPalette.background":{value:"var(--Tight-colors-colorPalette-background)",variable:"var(--Tight-colors-colorPalette-background)"},"colors.colorPalette.background.weak":{value:"var(--Tight-colors-colorPalette-background-weak)",variable:"var(--Tight-colors-colorPalette-background-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-weak)"},"colors.colorPalette.appBackground":{value:"var(--Tight-colors-colorPalette-appBackground)",variable:"var(--Tight-colors-colorPalette-appBackground)"},"colors.colorPalette.foreground":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"colors.colorPalette.foreground.weak":{value:"var(--Tight-colors-colorPalette-foreground-weak)",variable:"var(--Tight-colors-colorPalette-foreground-weak)"},"colors.colorPalette.typography":{value:"var(--Tight-colors-colorPalette-typography)",variable:"var(--Tight-colors-colorPalette-typography)"},"colors.colorPalette.typography.weak":{value:"var(--Tight-colors-colorPalette-typography-weak)",variable:"var(--Tight-colors-colorPalette-typography-weak)"},"colors.colorPalette.brand":{value:"var(--Tight-colors-colorPalette-brand)",variable:"var(--Tight-colors-colorPalette-brand)"},"colors.colorPalette.brand.weak":{value:"var(--Tight-colors-colorPalette-brand-weak)",variable:"var(--Tight-colors-colorPalette-brand-weak)"},"colors.colorPalette.brand.strong":{value:"var(--Tight-colors-colorPalette-brand-strong)",variable:"var(--Tight-colors-colorPalette-brand-strong)"},"colors.colorPalette.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.brand.weaker":{value:"var(--Tight-colors-colorPalette-brand-weaker)",variable:"var(--Tight-colors-colorPalette-brand-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.brand.stronger":{value:"var(--Tight-colors-colorPalette-brand-stronger)",variable:"var(--Tight-colors-colorPalette-brand-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-stronger)"},"colors.colorPalette.brand.weakest":{value:"var(--Tight-colors-colorPalette-brand-weakest)",variable:"var(--Tight-colors-colorPalette-brand-weakest)"},"colors.colorPalette.weakest":{value:"var(--Tight-colors-colorPalette-weakest)",variable:"var(--Tight-colors-colorPalette-weakest)"},"colors.colorPalette.brand.strongest":{value:"var(--Tight-colors-colorPalette-brand-strongest)",variable:"var(--Tight-colors-colorPalette-brand-strongest)"},"colors.colorPalette.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.neutral":{value:"var(--Tight-colors-colorPalette-neutral)",variable:"var(--Tight-colors-colorPalette-neutral)"},"colors.colorPalette.neutral.weak":{value:"var(--Tight-colors-colorPalette-neutral-weak)",variable:"var(--Tight-colors-colorPalette-neutral-weak)"},"colors.colorPalette.neutral.strong":{value:"var(--Tight-colors-colorPalette-neutral-strong)",variable:"var(--Tight-colors-colorPalette-neutral-strong)"},"colors.colorPalette.neutral.weaker":{value:"var(--Tight-colors-colorPalette-neutral-weaker)",variable:"var(--Tight-colors-colorPalette-neutral-weaker)"},"colors.colorPalette.neutral.stronger":{value:"var(--Tight-colors-colorPalette-neutral-stronger)",variable:"var(--Tight-colors-colorPalette-neutral-stronger)"},"colors.colorPalette.neutral.weakest":{value:"var(--Tight-colors-colorPalette-neutral-weakest)",variable:"var(--Tight-colors-colorPalette-neutral-weakest)"},"colors.colorPalette.neutral.strongest":{value:"var(--Tight-colors-colorPalette-neutral-strongest)",variable:"var(--Tight-colors-colorPalette-neutral-strongest)"},"colors.colorPalette.accent":{value:"var(--Tight-colors-colorPalette-accent)",variable:"var(--Tight-colors-colorPalette-accent)"},"colors.colorPalette.accent.weak":{value:"var(--Tight-colors-colorPalette-accent-weak)",variable:"var(--Tight-colors-colorPalette-accent-weak)"},"colors.colorPalette.accent.strong":{value:"var(--Tight-colors-colorPalette-accent-strong)",variable:"var(--Tight-colors-colorPalette-accent-strong)"},"colors.colorPalette.accent.weaker":{value:"var(--Tight-colors-colorPalette-accent-weaker)",variable:"var(--Tight-colors-colorPalette-accent-weaker)"},"colors.colorPalette.accent.stronger":{value:"var(--Tight-colors-colorPalette-accent-stronger)",variable:"var(--Tight-colors-colorPalette-accent-stronger)"},"colors.colorPalette.accent.weakest":{value:"var(--Tight-colors-colorPalette-accent-weakest)",variable:"var(--Tight-colors-colorPalette-accent-weakest)"},"colors.colorPalette.accent.strongest":{value:"var(--Tight-colors-colorPalette-accent-strongest)",variable:"var(--Tight-colors-colorPalette-accent-strongest)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.weakest":{value:"var(--Tight-colors-colorPalette-success-weakest)",variable:"var(--Tight-colors-colorPalette-success-weakest)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.weakest":{value:"var(--Tight-colors-colorPalette-warning-weakest)",variable:"var(--Tight-colors-colorPalette-warning-weakest)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.danger.weakest":{value:"var(--Tight-colors-colorPalette-danger-weakest)",variable:"var(--Tight-colors-colorPalette-danger-weakest)"},"colors.colorPalette.danger.strongest":{value:"var(--Tight-colors-colorPalette-danger-strongest)",variable:"var(--Tight-colors-colorPalette-danger-strongest)"},"colors.colorPalette.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-weak)"},"colors.colorPalette.primary":{value:"var(--Tight-colors-colorPalette-primary)",variable:"var(--Tight-colors-colorPalette-primary)"},"colors.colorPalette.primary.strong":{value:"var(--Tight-colors-colorPalette-primary-strong)",variable:"var(--Tight-colors-colorPalette-primary-strong)"},"colors.colorPalette.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-stronger)"},"colors.colorPalette.secondary.weaker":{value:"var(--Tight-colors-colorPalette-secondary-weaker)",variable:"var(--Tight-colors-colorPalette-secondary-weaker)"},"colors.colorPalette.secondary.weak":{value:"var(--Tight-colors-colorPalette-secondary-weak)",variable:"var(--Tight-colors-colorPalette-secondary-weak)"},"colors.colorPalette.secondary":{value:"var(--Tight-colors-colorPalette-secondary)",variable:"var(--Tight-colors-colorPalette-secondary)"},"colors.colorPalette.secondary.strong":{value:"var(--Tight-colors-colorPalette-secondary-strong)",variable:"var(--Tight-colors-colorPalette-secondary-strong)"},"colors.colorPalette.action.opaque":{value:"var(--Tight-colors-colorPalette-action-opaque)",variable:"var(--Tight-colors-colorPalette-action-opaque)"},"colors.colorPalette.opaque":{value:"var(--Tight-colors-colorPalette-opaque)",variable:"var(--Tight-colors-colorPalette-opaque)"},"colors.colorPalette.action.weaker":{value:"var(--Tight-colors-colorPalette-action-weaker)",variable:"var(--Tight-colors-colorPalette-action-weaker)"},"colors.colorPalette.action.weak":{value:"var(--Tight-colors-colorPalette-action-weak)",variable:"var(--Tight-colors-colorPalette-action-weak)"},"colors.colorPalette.action":{value:"var(--Tight-colors-colorPalette-action)",variable:"var(--Tight-colors-colorPalette-action)"},"colors.colorPalette.action.strong":{value:"var(--Tight-colors-colorPalette-action-strong)",variable:"var(--Tight-colors-colorPalette-action-strong)"},"colors.colorPalette.action.stronger":{value:"var(--Tight-colors-colorPalette-action-stronger)",variable:"var(--Tight-colors-colorPalette-action-stronger)"},"colors.colorPalette.action.strongest":{value:"var(--Tight-colors-colorPalette-action-strongest)",variable:"var(--Tight-colors-colorPalette-action-strongest)"},"colors.colorPalette.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"colors.colorPalette.background.hover":{value:"var(--Tight-colors-colorPalette-background-hover)",variable:"var(--Tight-colors-colorPalette-background-hover)"},"colors.colorPalette.hover":{value:"var(--Tight-colors-colorPalette-hover)",variable:"var(--Tight-colors-colorPalette-hover)"},"colors.colorPalette.foreground.hover":{value:"var(--Tight-colors-colorPalette-foreground-hover)",variable:"var(--Tight-colors-colorPalette-foreground-hover)"},"colors.colorPalette.foreground.disabled":{value:"var(--Tight-colors-colorPalette-foreground-disabled)",variable:"var(--Tight-colors-colorPalette-foreground-disabled)"},"colors.colorPalette.disabled":{value:"var(--Tight-colors-colorPalette-disabled)",variable:"var(--Tight-colors-colorPalette-disabled)"},"colors.colorPalette.elevated":{value:"var(--Tight-colors-colorPalette-elevated)",variable:"var(--Tight-colors-colorPalette-elevated)"},"colors.colorPalette.elevated.hover":{value:"var(--Tight-colors-colorPalette-elevated-hover)",variable:"var(--Tight-colors-colorPalette-elevated-hover)"},"colors.colorPalette.intent.primary":{value:"var(--Tight-colors-colorPalette-intent-primary)",variable:"var(--Tight-colors-colorPalette-intent-primary)"},"colors.colorPalette.intent.primary.hover":{value:"var(--Tight-colors-colorPalette-intent-primary-hover)",variable:"var(--Tight-colors-colorPalette-intent-primary-hover)"},"colors.colorPalette.primary.hover":{value:"var(--Tight-colors-colorPalette-primary-hover)",variable:"var(--Tight-colors-colorPalette-primary-hover)"},"colors.colorPalette.intent.primary.active":{value:"var(--Tight-colors-colorPalette-intent-primary-active)",variable:"var(--Tight-colors-colorPalette-intent-primary-active)"},"colors.colorPalette.primary.active":{value:"var(--Tight-colors-colorPalette-primary-active)",variable:"var(--Tight-colors-colorPalette-primary-active)"},"colors.colorPalette.active":{value:"var(--Tight-colors-colorPalette-active)",variable:"var(--Tight-colors-colorPalette-active)"},"colors.colorPalette.intent.primary.disabled":{value:"var(--Tight-colors-colorPalette-intent-primary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-primary-disabled)"},"colors.colorPalette.primary.disabled":{value:"var(--Tight-colors-colorPalette-primary-disabled)",variable:"var(--Tight-colors-colorPalette-primary-disabled)"},"colors.colorPalette.intent.secondary":{value:"var(--Tight-colors-colorPalette-intent-secondary)",variable:"var(--Tight-colors-colorPalette-intent-secondary)"},"colors.colorPalette.intent.secondary.hover":{value:"var(--Tight-colors-colorPalette-intent-secondary-hover)",variable:"var(--Tight-colors-colorPalette-intent-secondary-hover)"},"colors.colorPalette.secondary.hover":{value:"var(--Tight-colors-colorPalette-secondary-hover)",variable:"var(--Tight-colors-colorPalette-secondary-hover)"},"colors.colorPalette.intent.secondary.active":{value:"var(--Tight-colors-colorPalette-intent-secondary-active)",variable:"var(--Tight-colors-colorPalette-intent-secondary-active)"},"colors.colorPalette.secondary.active":{value:"var(--Tight-colors-colorPalette-secondary-active)",variable:"var(--Tight-colors-colorPalette-secondary-active)"},"colors.colorPalette.intent.secondary.disabled":{value:"var(--Tight-colors-colorPalette-intent-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-intent-secondary-disabled)"},"colors.colorPalette.secondary.disabled":{value:"var(--Tight-colors-colorPalette-secondary-disabled)",variable:"var(--Tight-colors-colorPalette-secondary-disabled)"},"colors.colorPalette.intent.action":{value:"var(--Tight-colors-colorPalette-intent-action)",variable:"var(--Tight-colors-colorPalette-intent-action)"},"colors.colorPalette.intent.action.hover":{value:"var(--Tight-colors-colorPalette-intent-action-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-hover)"},"colors.colorPalette.action.hover":{value:"var(--Tight-colors-colorPalette-action-hover)",variable:"var(--Tight-colors-colorPalette-action-hover)"},"colors.colorPalette.intent.action.active":{value:"var(--Tight-colors-colorPalette-intent-action-active)",variable:"var(--Tight-colors-colorPalette-intent-action-active)"},"colors.colorPalette.action.active":{value:"var(--Tight-colors-colorPalette-action-active)",variable:"var(--Tight-colors-colorPalette-action-active)"},"colors.colorPalette.intent.action.disabled":{value:"var(--Tight-colors-colorPalette-intent-action-disabled)",variable:"var(--Tight-colors-colorPalette-intent-action-disabled)"},"colors.colorPalette.action.disabled":{value:"var(--Tight-colors-colorPalette-action-disabled)",variable:"var(--Tight-colors-colorPalette-action-disabled)"},"colors.colorPalette.intent.action.discreet":{value:"var(--Tight-colors-colorPalette-intent-action-discreet)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet)"},"colors.colorPalette.action.discreet":{value:"var(--Tight-colors-colorPalette-action-discreet)",variable:"var(--Tight-colors-colorPalette-action-discreet)"},"colors.colorPalette.discreet":{value:"var(--Tight-colors-colorPalette-discreet)",variable:"var(--Tight-colors-colorPalette-discreet)"},"colors.colorPalette.intent.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-hover)"},"colors.colorPalette.action.discreet.hover":{value:"var(--Tight-colors-colorPalette-action-discreet-hover)",variable:"var(--Tight-colors-colorPalette-action-discreet-hover)"},"colors.colorPalette.discreet.hover":{value:"var(--Tight-colors-colorPalette-discreet-hover)",variable:"var(--Tight-colors-colorPalette-discreet-hover)"},"colors.colorPalette.intent.action.discreet.active":{value:"var(--Tight-colors-colorPalette-intent-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-intent-action-discreet-active)"},"colors.colorPalette.action.discreet.active":{value:"var(--Tight-colors-colorPalette-action-discreet-active)",variable:"var(--Tight-colors-colorPalette-action-discreet-active)"},"colors.colorPalette.discreet.active":{value:"var(--Tight-colors-colorPalette-discreet-active)",variable:"var(--Tight-colors-colorPalette-discreet-active)"},"colors.colorPalette.intent.action.highlight":{value:"var(--Tight-colors-colorPalette-intent-action-highlight)",variable:"var(--Tight-colors-colorPalette-intent-action-highlight)"},"colors.colorPalette.action.highlight":{value:"var(--Tight-colors-colorPalette-action-highlight)",variable:"var(--Tight-colors-colorPalette-action-highlight)"},"colors.colorPalette.highlight":{value:"var(--Tight-colors-colorPalette-highlight)",variable:"var(--Tight-colors-colorPalette-highlight)"},"colors.colorPalette.intent.success":{value:"var(--Tight-colors-colorPalette-intent-success)",variable:"var(--Tight-colors-colorPalette-intent-success)"},"colors.colorPalette.intent.success.hover":{value:"var(--Tight-colors-colorPalette-intent-success-hover)",variable:"var(--Tight-colors-colorPalette-intent-success-hover)"},"colors.colorPalette.success.hover":{value:"var(--Tight-colors-colorPalette-success-hover)",variable:"var(--Tight-colors-colorPalette-success-hover)"},"colors.colorPalette.intent.success.active":{value:"var(--Tight-colors-colorPalette-intent-success-active)",variable:"var(--Tight-colors-colorPalette-intent-success-active)"},"colors.colorPalette.success.active":{value:"var(--Tight-colors-colorPalette-success-active)",variable:"var(--Tight-colors-colorPalette-success-active)"},"colors.colorPalette.intent.success.disabled":{value:"var(--Tight-colors-colorPalette-intent-success-disabled)",variable:"var(--Tight-colors-colorPalette-intent-success-disabled)"},"colors.colorPalette.success.disabled":{value:"var(--Tight-colors-colorPalette-success-disabled)",variable:"var(--Tight-colors-colorPalette-success-disabled)"},"colors.colorPalette.intent.success.highlight":{value:"var(--Tight-colors-colorPalette-intent-success-highlight)",variable:"var(--Tight-colors-colorPalette-intent-success-highlight)"},"colors.colorPalette.success.highlight":{value:"var(--Tight-colors-colorPalette-success-highlight)",variable:"var(--Tight-colors-colorPalette-success-highlight)"},"colors.colorPalette.intent.warning":{value:"var(--Tight-colors-colorPalette-intent-warning)",variable:"var(--Tight-colors-colorPalette-intent-warning)"},"colors.colorPalette.intent.warning.hover":{value:"var(--Tight-colors-colorPalette-intent-warning-hover)",variable:"var(--Tight-colors-colorPalette-intent-warning-hover)"},"colors.colorPalette.warning.hover":{value:"var(--Tight-colors-colorPalette-warning-hover)",variable:"var(--Tight-colors-colorPalette-warning-hover)"},"colors.colorPalette.intent.warning.active":{value:"var(--Tight-colors-colorPalette-intent-warning-active)",variable:"var(--Tight-colors-colorPalette-intent-warning-active)"},"colors.colorPalette.warning.active":{value:"var(--Tight-colors-colorPalette-warning-active)",variable:"var(--Tight-colors-colorPalette-warning-active)"},"colors.colorPalette.intent.warning.disabled":{value:"var(--Tight-colors-colorPalette-intent-warning-disabled)",variable:"var(--Tight-colors-colorPalette-intent-warning-disabled)"},"colors.colorPalette.warning.disabled":{value:"var(--Tight-colors-colorPalette-warning-disabled)",variable:"var(--Tight-colors-colorPalette-warning-disabled)"},"colors.colorPalette.intent.warning.highlight":{value:"var(--Tight-colors-colorPalette-intent-warning-highlight)",variable:"var(--Tight-colors-colorPalette-intent-warning-highlight)"},"colors.colorPalette.warning.highlight":{value:"var(--Tight-colors-colorPalette-warning-highlight)",variable:"var(--Tight-colors-colorPalette-warning-highlight)"},"colors.colorPalette.intent.danger":{value:"var(--Tight-colors-colorPalette-intent-danger)",variable:"var(--Tight-colors-colorPalette-intent-danger)"},"colors.colorPalette.intent.danger.hover":{value:"var(--Tight-colors-colorPalette-intent-danger-hover)",variable:"var(--Tight-colors-colorPalette-intent-danger-hover)"},"colors.colorPalette.danger.hover":{value:"var(--Tight-colors-colorPalette-danger-hover)",variable:"var(--Tight-colors-colorPalette-danger-hover)"},"colors.colorPalette.intent.danger.active":{value:"var(--Tight-colors-colorPalette-intent-danger-active)",variable:"var(--Tight-colors-colorPalette-intent-danger-active)"},"colors.colorPalette.danger.active":{value:"var(--Tight-colors-colorPalette-danger-active)",variable:"var(--Tight-colors-colorPalette-danger-active)"},"colors.colorPalette.intent.danger.disabled":{value:"var(--Tight-colors-colorPalette-intent-danger-disabled)",variable:"var(--Tight-colors-colorPalette-intent-danger-disabled)"},"colors.colorPalette.danger.disabled":{value:"var(--Tight-colors-colorPalette-danger-disabled)",variable:"var(--Tight-colors-colorPalette-danger-disabled)"},"colors.colorPalette.intent.danger.weak":{value:"var(--Tight-colors-colorPalette-intent-danger-weak)",variable:"var(--Tight-colors-colorPalette-intent-danger-weak)"},"colors.colorPalette.intent.danger.highlight":{value:"var(--Tight-colors-colorPalette-intent-danger-highlight)",variable:"var(--Tight-colors-colorPalette-intent-danger-highlight)"},"colors.colorPalette.danger.highlight":{value:"var(--Tight-colors-colorPalette-danger-highlight)",variable:"var(--Tight-colors-colorPalette-danger-highlight)"},"colors.colorPalette.intent.notification":{value:"var(--Tight-colors-colorPalette-intent-notification)",variable:"var(--Tight-colors-colorPalette-intent-notification)"},"colors.colorPalette.notification":{value:"var(--Tight-colors-colorPalette-notification)",variable:"var(--Tight-colors-colorPalette-notification)"},"colors.colorPalette.reports.alternateRows":{value:"var(--Tight-colors-colorPalette-reports-alternateRows)",variable:"var(--Tight-colors-colorPalette-reports-alternateRows)"},"colors.colorPalette.alternateRows":{value:"var(--Tight-colors-colorPalette-alternateRows)",variable:"var(--Tight-colors-colorPalette-alternateRows)"},"colors.colorPalette.base":{value:"var(--Tight-colors-colorPalette-base)",variable:"var(--Tight-colors-colorPalette-base)"},"colors.colorPalette.base.weak":{value:"var(--Tight-colors-colorPalette-base-weak)",variable:"var(--Tight-colors-colorPalette-base-weak)"},"colors.colorPalette.contrast":{value:"var(--Tight-colors-colorPalette-contrast)",variable:"var(--Tight-colors-colorPalette-contrast)"},"colors.colorPalette.contrast.weak":{value:"var(--Tight-colors-colorPalette-contrast-weak)",variable:"var(--Tight-colors-colorPalette-contrast-weak)"},"colors.colorPalette.accent.success":{value:"var(--Tight-colors-colorPalette-accent-success)",variable:"var(--Tight-colors-colorPalette-accent-success)"},"colors.colorPalette.accent.warning":{value:"var(--Tight-colors-colorPalette-accent-warning)",variable:"var(--Tight-colors-colorPalette-accent-warning)"},"colors.colorPalette.accent.danger":{value:"var(--Tight-colors-colorPalette-accent-danger)",variable:"var(--Tight-colors-colorPalette-accent-danger)"},"colors.colorPalette.accent.action":{value:"var(--Tight-colors-colorPalette-accent-action)",variable:"var(--Tight-colors-colorPalette-accent-action)"},"colors.colorPalette.body":{value:"var(--Tight-colors-colorPalette-body)",variable:"var(--Tight-colors-colorPalette-body)"},"colors.colorPalette.label":{value:"var(--Tight-colors-colorPalette-label)",variable:"var(--Tight-colors-colorPalette-label)"},"colors.colorPalette.label.sub":{value:"var(--Tight-colors-colorPalette-label-sub)",variable:"var(--Tight-colors-colorPalette-label-sub)"},"colors.colorPalette.sub":{value:"var(--Tight-colors-colorPalette-sub)",variable:"var(--Tight-colors-colorPalette-sub)"},"colors.colorPalette.label.strong":{value:"var(--Tight-colors-colorPalette-label-strong)",variable:"var(--Tight-colors-colorPalette-label-strong)"},"colors.colorPalette.label.strongSub":{value:"var(--Tight-colors-colorPalette-label-strongSub)",variable:"var(--Tight-colors-colorPalette-label-strongSub)"},"colors.colorPalette.strongSub":{value:"var(--Tight-colors-colorPalette-strongSub)",variable:"var(--Tight-colors-colorPalette-strongSub)"},"colors.colorPalette.label.emphasisSub":{value:"var(--Tight-colors-colorPalette-label-emphasisSub)",variable:"var(--Tight-colors-colorPalette-label-emphasisSub)"},"colors.colorPalette.emphasisSub":{value:"var(--Tight-colors-colorPalette-emphasisSub)",variable:"var(--Tight-colors-colorPalette-emphasisSub)"},"colors.colorPalette.heading":{value:"var(--Tight-colors-colorPalette-heading)",variable:"var(--Tight-colors-colorPalette-heading)"},"colors.colorPalette.metric.sm":{value:"var(--Tight-colors-colorPalette-metric-sm)",variable:"var(--Tight-colors-colorPalette-metric-sm)"},"colors.colorPalette.sm":{value:"var(--Tight-colors-colorPalette-sm)",variable:"var(--Tight-colors-colorPalette-sm)"},"colors.colorPalette.metric.md":{value:"var(--Tight-colors-colorPalette-metric-md)",variable:"var(--Tight-colors-colorPalette-metric-md)"},"colors.colorPalette.md":{value:"var(--Tight-colors-colorPalette-md)",variable:"var(--Tight-colors-colorPalette-md)"},"colors.colorPalette.metric.lg":{value:"var(--Tight-colors-colorPalette-metric-lg)",variable:"var(--Tight-colors-colorPalette-metric-lg)"},"colors.colorPalette.lg":{value:"var(--Tight-colors-colorPalette-lg)",variable:"var(--Tight-colors-colorPalette-lg)"},"colors.colorPalette.metric.xl":{value:"var(--Tight-colors-colorPalette-metric-xl)",variable:"var(--Tight-colors-colorPalette-metric-xl)"},"colors.colorPalette.xl":{value:"var(--Tight-colors-colorPalette-xl)",variable:"var(--Tight-colors-colorPalette-xl)"},"colors.colorPalette.layout.weak":{value:"var(--Tight-colors-colorPalette-layout-weak)",variable:"var(--Tight-colors-colorPalette-layout-weak)"},"colors.colorPalette.layout":{value:"var(--Tight-colors-colorPalette-layout)",variable:"var(--Tight-colors-colorPalette-layout)"},"colors.colorPalette.layout.strong":{value:"var(--Tight-colors-colorPalette-layout-strong)",variable:"var(--Tight-colors-colorPalette-layout-strong)"},"colors.colorPalette.positive":{value:"var(--Tight-colors-colorPalette-positive)",variable:"var(--Tight-colors-colorPalette-positive)"},"colors.colorPalette.positive.weak":{value:"var(--Tight-colors-colorPalette-positive-weak)",variable:"var(--Tight-colors-colorPalette-positive-weak)"},"colors.colorPalette.positive.strong":{value:"var(--Tight-colors-colorPalette-positive-strong)",variable:"var(--Tight-colors-colorPalette-positive-strong)"},"colors.colorPalette.negative":{value:"var(--Tight-colors-colorPalette-negative)",variable:"var(--Tight-colors-colorPalette-negative)"},"colors.colorPalette.negative.weak":{value:"var(--Tight-colors-colorPalette-negative-weak)",variable:"var(--Tight-colors-colorPalette-negative-weak)"},"colors.colorPalette.negative.strong":{value:"var(--Tight-colors-colorPalette-negative-strong)",variable:"var(--Tight-colors-colorPalette-negative-strong)"}};function Po(e,t){return Ro[e]?.value||t}Po.var=function(e,t){return Ro[e]?.variable||t};const Do=fr(null,rr({borderRadius:"50%",flexShrink:0})),Mo=fr(null,rr({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Lo=Po.var("colors.surface.foreground.disabled");function Fo({color:e=Lo,diameter:t=17,label:n}){return R("div",{...Mo,"data-testid":"bullet-row",children:[I("div",{...Do,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(So,{children:n})]})}const Oo=fr(null,rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function Vo({payload:e}){return void 0===e?null:I("div",{...Oo,children:e.map((e,t)=>"none"!==e.type&&I(Fo,{color:e.color,label:e.value,diameter:17},t))})}const Uo={right:20,left:20},Bo=["income","profit","expenses","loss"],Ho=e=>Bo.findIndex(t=>t===e.dataKey),Wo={paddingBottom:"20px",marginLeft:"-20px"},_o={stackId:"stack",isAnimationActive:!1},zo=fr(cr["profit-loss-graph"],rr({"& .recharts-surface":{outline:"none"}})),jo=Po.var("colors.money"),qo=Po.var("colors.border.layout"),Ko=Po.var("colors.border.layout.strong"),Yo={fill:Po.var("colors.typography.base"),fontSize:Po.var("fontSizes.metric.sm")},Zo={profit:Po.var("colors.money.positive.strong"),income:Po.var("colors.money.positive.weak"),loss:Po.var("colors.money.negative.strong"),expenses:Po.var("colors.money.negative.weak")},Go=[0,100],Qo=["auto","auto"];function Xo({data:e}){const[t,n]=d(!0);if(void 0===e)return null;const r=e.hasAnyData?Qo:Go;return I(W,{width:"100%",height:"100%",...zo,children:R(_,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:Uo,children:[I(z,{verticalAlign:"top",itemSorter:Ho,wrapperStyle:Wo,content:({payload:e})=>I(Vo,{payload:e})}),I(j,{strokeDasharray:"0",vertical:!1,stroke:qo}),I(q,{dataKey:"month",interval:0,tickLine:!1,stroke:qo,tick:Yo}),I(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:qo,tick:Yo,tickFormatter:e=>wo(e)}),I(Y,{content:({active:e,payload:t})=>I(No,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(Z,{name:"Profit",dataKey:"profit",fill:Zo.profit,..._o}),I(Z,{name:"Income",dataKey:"income",fill:Zo.income,..._o}),I(Z,{name:"Loss",dataKey:"loss",fill:Zo.loss,..._o}),I(Z,{name:"Expenses",dataKey:"expenses",fill:Zo.expenses,..._o}),I(Z,{dataKey:za,fill:qo,legendType:"none",..._o}),I(G,{y:0,stroke:Ko}),I(Q,{dataKey:"netIncome",fill:jo,stroke:jo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const Jo=rr({backgroundColor:"surface.elevated",borderRadius:"sm",backgroundImage:"linear-gradient(90deg, {colors.surface.elevated} 30%, {colors.surface.foreground} 50%, {colors.surface.elevated} 70%)",backgroundSize:"400%",backgroundPosition:"100% 0",animation:"shimmer"});function $o({styles:e}){const t=or(pr(cr["loading-skeleton"]),Jo,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const ei=rr({width:"40%",minHeight:65});function ti({children:e}){return R(N,{children:[I($o,{styles:ei}),I(mo,{children:e})]})}const ni=fr(null,rr({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),ri=rr({width:"80px",height:"17px",marginBottom:"10px"}),ai=rr({width:"100%",height:"100%"});function oi(){return R(N,{children:[R("div",{...ni,children:[I($o,{styles:ri}),I($o,{styles:ri}),I($o,{styles:ri}),I($o,{styles:ri})]}),I($o,{styles:ai})]})}const ii=lr({base:{color:"typography.base.weak",boxSizing:"border-box",position:"absolute",bottom:"0",left:"0",right:"0",top:"0",display:"flex",justifyContent:"center",alignItems:"center",pointerEvents:"none",margin:"0 auto",transform:"rotate(-20deg)",opacity:"80%"},variants:{size:{sm:{fontSize:"4em"},lg:{fontSize:"7em"},xl:{fontSize:"10em"}}}});function li({size:e}){const t=ii({size:e});return I("div",{className:t,children:"Sample"})}const si=20200,ci=5043,di=Object.freeze({income:si,expenses:ci,netIncome:15157,absoluteSum:Math.abs(si)+Math.abs(ci)}),ui=Object.freeze({total:ci,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),hi=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),pi=[{income:1247,expenses:7434},{income:2103,expenses:8672},{income:1876,expenses:7656},{income:3291,expenses:6623},{income:5647,expenses:7034},{income:8923,expenses:6456},{income:11547,expenses:5892},{income:9834,expenses:6721},{income:15283,expenses:5347},{income:18467,expenses:4923},{income:17924,expenses:4534},{income:20200,expenses:5043}];function gi({filter:e=ht.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return _a({filter:e,grouping:t,select:Ka})}({filter:e,grouping:Ya}),a=t?function(){const e=[],t=/* @__PURE__ */new Date;let n=0,r=0,a=0;for(let o=11;o>=0;o--){const i=new Date(t.getFullYear(),t.getMonth()-o,1),l=Lt(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=pi[11-o],c=s.income-s.expenses,d=c>0?c:0,u=c<0?c:0,h=s.income-d,p=s.expenses+u;e.push({month:l,income:h,expenses:-p,profit:d,loss:u,netIncome:c,hasNoData:!1}),n+=c,r=Math.max(r,s.income),a=Math.max(a,s.expenses)}return{total:n,domain:[-a,r],months:e,hasAnyData:!0}}():n;return R($a,{type:"chart",children:[I(Ga,{title:"Profit + Loss"}),I(Xa,{children:r?I(ti,{children:I(oi,{})}):R(N,{children:[I(po,{title:wo(a?.total??0),label:"Profit"}),I(mo,{children:I(Xo,{data:a})})]})}),t&&I(li,{size:"xl"})]})}const mi={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},vi=l({}),fi=lr({base:{stroke:"currentColor"},variants:{primary:{DEFAULT:{stroke:"icon.intent.primary"},hover:{stroke:"icon.intent.primary.hover"},active:{stroke:"icon.intent.primary.active"}},secondary:{DEFAULT:{stroke:"icon.intent.secondary"},hover:{stroke:"icon.intent.secondary.hover"},active:{stroke:"icon.intent.secondary.active"}},success:{DEFAULT:{stroke:"icon.intent.success"},hover:{stroke:"icon.intent.success.hover"},active:{stroke:"icon.intent.success.active"}},warning:{DEFAULT:{stroke:"icon.intent.warning"},hover:{stroke:"icon.intent.warning.hover"},active:{stroke:"icon.intent.warning.active"}},danger:{DEFAULT:{stroke:"icon.intent.danger"},hover:{stroke:"icon.intent.danger.hover"},active:{stroke:"icon.intent.danger.active"}},action:{DEFAULT:{stroke:"icon.intent.action"},hover:{stroke:"icon.intent.action.hover"},active:{stroke:"icon.intent.action.active"}}}});function bi(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:l}=i(vi),s=n?.styleIconKey?l?.[n.styleIconKey]:void 0,c=Tr([fr(null,fi()),...o]);return s?I("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:rr({objectFit:"contain"})}):I(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const yi=bi(e=>r.createElement("svg",{width:13,height:15,stroke:"currentColor",viewBox:"0 0 13 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.743464 14.9687V0.96875H11.6465L9.22218 4.59886L11.6465 8.24166H0.743464",strokeMiterlimit:10})),"Flag",{styleIconKey:"flag"}),wi=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.08708 2.34833H7.91602C7.75004 2.34808 7.58676 2.39026 7.44167 2.47087C7.29657 2.55147 7.1745 2.66783 7.08702 2.80888L1.24458 12.1581C1.14602 12.3136 1.09355 12.4938 1.09325 12.6779C1.09324 12.8069 1.11886 12.9346 1.16861 13.0536C1.21837 13.1726 1.29127 13.2805 1.38309 13.3711C1.47491 13.4617 1.58381 13.5332 1.70348 13.5813C1.82314 13.6295 1.95118 13.6534 2.08015 13.6516H13.9229C14.1812 13.6516 14.4289 13.549 14.6115 13.3664C14.7941 13.1838 14.8967 12.9361 14.8967 12.6779C14.8964 12.4938 14.8439 12.3136 14.7454 12.1581L8.91608 2.80888C8.8286 2.66783 8.70652 2.55147 8.56143 2.47087C8.41634 2.39026 8.25306 2.34808 8.08708 2.34833Z",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 5.48663V9.25659",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",strokeMiterlimit:10})),"Attention"),Ci=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.81985 0.464722V3.49919",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M7.81985 12.0008V15.0353",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M15.1051 7.75H12.0706",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M3.56907 7.75H0.534607",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 2.59967L10.8227 4.74724",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 10.7528L2.66949 12.9004",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9702 12.9004L10.8227 10.7528",stroke:"black",strokeMiterlimit:10}),r.createElement("path",{d:"M4.81706 4.74724L2.66949 2.59967",stroke:"black",strokeMiterlimit:10})),"Processing"),xi=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"CircleCheck",{styleIconKey:"checkmark"}),Ti=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.21065 9.68766C6.15485 9.47136 6.04211 9.27397 5.88416 9.11602C5.72621 8.95807 5.52882 8.84533 5.31252 8.78953L1.47815 7.80078C1.41273 7.78221 1.35515 7.74281 1.31416 7.68856C1.27316 7.6343 1.25098 7.56816 1.25098 7.50016C1.25098 7.43215 1.27316 7.36601 1.31416 7.31175C1.35515 7.2575 1.41273 7.2181 1.47815 7.19953L5.31252 6.21016C5.52874 6.15441 5.72608 6.04176 5.88402 5.88393C6.04197 5.7261 6.15475 5.52884 6.21065 5.31266L7.1994 1.47828C7.21778 1.4126 7.25714 1.35474 7.31147 1.31353C7.36581 1.27231 7.43214 1.25 7.50034 1.25C7.56854 1.25 7.63486 1.27231 7.6892 1.31353C7.74353 1.35474 7.78289 1.4126 7.80127 1.47828L8.7894 5.31266C8.8452 5.52895 8.95794 5.72634 9.11589 5.88429C9.27384 6.04224 9.47123 6.15498 9.68752 6.21078L13.5219 7.19891C13.5878 7.21709 13.646 7.25641 13.6874 7.31083C13.7289 7.36525 13.7513 7.43176 13.7513 7.50016C13.7513 7.56855 13.7289 7.63507 13.6874 7.68948C13.646 7.7439 13.5878 7.78322 13.5219 7.80141L9.68752 8.78953C9.47123 8.84533 9.27384 8.95807 9.11589 9.11602C8.95794 9.27397 8.8452 9.47136 8.7894 9.68766L7.80065 13.522C7.78227 13.5877 7.74291 13.6456 7.68857 13.6868C7.63424 13.728 7.56791 13.7503 7.49971 13.7503C7.43151 13.7503 7.36518 13.728 7.31085 13.6868C7.25651 13.6456 7.21715 13.5877 7.19877 13.522L6.21065 9.68766Z",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M12.5 1.875V4.375",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M13.75 3.125H11.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M2.5 10.625V11.875",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M3.125 11.25H1.875",strokeLinecap:"round",strokeLinejoin:"round"})),"AiStar");function ki(e){return Fa(`${t=e,Va[t]}`,"v6");var t}async function Ei({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=Sa({extraHeaders:t,authorization:e}),l=(({url:e,params:t})=>{let n=e;const r=null==(a=t)?"":Object.entries(a).map(([e,t])=>{let n;return n=Array.isArray(t)?t.map(t=>Aa(e,t)).join("&"):Aa(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});xa("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return xa("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),Ia(e)}catch(s){return Promise.reject(s)}}async function Ai(e){const{url:t,headers:n}=Ra(e);return Ei({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function Si(e){return Ai({...e,endpointManager:ki(e.environment)})}async function Ii(e){return Ai({...e,endpointManager:Ba(e.environment)})}const Ni=l(void 0);function Ri(){return i(Ni)}const Pi=e=>["introspect",e];function Di(e){return async t=>{const n=t.queryKey;return async function(e,t,n){const r={path:"/sdk/introspect",accessToken:e,environment:t,params:n?{theme:n}:void 0};return await Ii(r)}(n[2].accessToken,n[2].environment,e)}}function Mi(){const e=Ri();return Br({queryKey:Pi(e),queryFn:Di(e)})}const Li={RECONCILIATION_DISCREPANCY:"RECONCILIATION_DISCREPANCY",USER_REVIEW_REQUIRED:"USER_REVIEW_REQUIRED",AWAITING_MATCH:"AWAITING_MATCH",ACCOUNTANT_REVIEW_REQUIRED:"ACCOUNTANT_REVIEW_REQUIRED",STAGED:"STAGED",RECONCILED:"RECONCILED",PARTNER_REVIEW_REQUIRED:"PARTNER_REVIEW_REQUIRED"},Fi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Oi={DISCREPANCY:{text:"Discrepancy",Icon:wi,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:Ci,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:yi,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:Ci,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:Ci,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:yi,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:Ti,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:xi,variant:"success"}},Vi={DISCREPANCY:["RECONCILIATION_DISCREPANCY"],CLIENT_REVIEW:["USER_REVIEW_REQUIRED"],NEEDS_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:[],ADDITIONAL_REVIEW:["PARTNER_REVIEW_REQUIRED"],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Ui={DISCREPANCY:[],CLIENT_REVIEW:[],NEEDS_REVIEW:["RECONCILIATION_DISCREPANCY","USER_REVIEW_REQUIRED"],AWAITING_MATCH:["AWAITING_MATCH"],IN_REVIEW:["ACCOUNTANT_REVIEW_REQUIRED","PARTNER_REVIEW_REQUIRED"],ADDITIONAL_REVIEW:[],NEEDS_APPROVAL:["STAGED"],RECONCILED:["RECONCILED"]},Bi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Hi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Wi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],_i=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],zi=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],ji=[{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"RECONCILIATION_DISCREPANCY",displayName:"Discrepancy"},{status:"USER_REVIEW_REQUIRED",displayName:"Flag to User"},{status:"RECONCILED",displayName:"Reconciled"}];function qi(){return Zi()?ji:zi}function Ki(e,t){return{...Oi[e],key:e,value:(t?Vi:Ui)[e]}}function Yi(e){const t=Zi()?Vi:Ui,n=Fi.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Oi[n]}function Zi(){const{query:{data:e}}=Mi();return"ACCOUNTANT"===e?.userRole}function Gi(){return Ki("NEEDS_REVIEW",Zi())}function Qi(e){return e in Li}const{CONVERSATIONS:Xi,TRANSACTIONS:Ji}=mi.FinancialOverview,$i={MESSAGE_REVIEW:Xi,TRANSACTION_REVIEW:Ji,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},el={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},tl={resolutionStatus:{in:["OPEN"]}},nl=[],rl=[],al=bi(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10,transform:"scale(-1, 1) translate(-13, 0)"})),"ArrowLeft"),ol=bi(e=>r.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10})),"ArrowRight"),il=rr.raw({transition:"background 300ms ease-out, background-color 300ms ease-out, border-color 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, background-color 100ms ease-out, border-color 100ms ease-out, box-shadow 0ms"}}),ll=rr(il),sl=rr.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),cl=rr(sl);rr({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}),rr({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),rr({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const dl=l({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function ul({Component:e,stylists:t}){return I(e,{stylists:[fr(cr["small-icon"],cr.icon),...t??[]],size:12})}const hl=fr(cr["pagination-button"],rr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderRadius:"md",borderColor:"border.layout",color:"typography.base",display:"inline-flex",alignItems:"center",justifyContent:"center",height:{xl:"35px",base:"44px"},overflow:"hidden",gap:0})),pl=fr(null,rr({border:"none",borderRadius:"sm",backgroundColor:"surface.intent.action.discreet",padding:{xl:"4px",base:"12px"},margin:0,overflow:"hidden",color:"icon.base",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",outline:"none",boxShadow:"0 0 0 0 transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{opacity:.6,pointerEvents:"none"},_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}}),cl),gl=fr(null,rr({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),ml=fr(null,rr({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function vl(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=i(dl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...hl,children:[I("div",{...gl,children:I("button",{...pl,onClick:r,disabled:!t,children:I(ul,{Component:al,stylists:[ml]})})}),I("div",{...gl,children:I("button",{...pl,onClick:n,disabled:!e,children:I(ul,{Component:ol,stylists:[ml]})})})]})}const fl=rr({width:"100%",height:"50px"});function bl(){return I($o,{styles:fl})}const yl=fr(cr["dashboard-placeholder-table"],rr({display:"flex",flexDirection:"column",gap:"4px"})),wl=fr(null,rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),Cl=rr({width:"100px",height:"20px"});function xl({numColumns:e=6}){return R("div",{...yl,children:[I("div",{...wl,children:Array.from({length:e},(e,t)=>I($o,{styles:Cl},t))}),I(bl,{}),I(bl,{}),I(bl,{}),I(bl,{}),I(bl,{}),I(bl,{})]})}function Tl(e,t){const n=Mr(),r=Ur();return u(a=>{const o=Pr(n),i=o?{}:{retry:!1,staleTime:1/0};return Or.prefetchQuery({queryKey:Sr(e(a),n??"",r),queryFn:o?t:Lr,...i})},[e,t,n,r])}const kl=Object.freeze({}),El=Object.freeze({cursor:"FINAL_PAGE"});function Al({queryKey:e,queryFn:t,...n}){const[r,i]=d(kl),l=a(e);C(l.current,e)||(l.current=e,i(kl));const c=n.select,h=ur(c)?e=>({...c(e),cursor:e.cursor}):void 0,p=Ir(e,r),g=Br({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),m=o(()=>{return e=g.query.data?.cursor,t=i,{getFirstPage:()=>t(kl),getLastPage:()=>t(El),hasNextPage:ur(e?.after),hasPreviousPage:ur(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[g.query.data?.cursor]),v=Tl(u(t=>Ir(e,t),[e]),t),f=Tl(u(t=>Ir(e,t),[e]),t);return s(()=>{const e=g.query.data?.cursor;!g.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{Ta({error:e,severity:"error"})}),e.before&&f({cursor:e.before}).catch(e=>{Ta({error:e,severity:"error"})}))},[g.query.data?.cursor,g.query.isFetching,v,f]),{...g,paginationControls:m}}function Sl({delay:e,callback:t}){const n=o(()=>function({delay:e,callback:t}){let n;const r=()=>{n&&(clearTimeout(n),n=void 0)};return{startCallback:a=>{r(),n=setTimeout(()=>{t(a)},e)},cancelCallback:()=>r()}}({delay:e,callback:t}),[e,t]);return s(()=>()=>{n.cancelCallback()},[n]),{startCallback:u(e=>{n.startCallback(e)},[n]),cancelCallback:u(()=>{n.cancelCallback()},[n])}}function Il({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=Sl({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Nl={CREATED_DATE_TIME:"CREATED_DATE_TIME",SUBJECT:"SUBJECT",EMAIL:"EMAIL",LAST_MESSAGE_CREATED_DATE_TIME:"LAST_MESSAGE_CREATED_DATE_TIME",LAST_MESSAGE_TEXT:"LAST_MESSAGE_TEXT"},Rl={ASC:"ASC",DESC:"DESC"},Pl=e=>["conversations",e??{}],Dl=e=>["conversations","conversation",e],Ml=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Ll(e){return Al({queryKey:e?Pl(e):["conversations",{}],queryFn:Ml})}const Fl=async e=>{const t=e.queryKey,{id:n}=t[2],r={path:"/v6/conversations/{id}",pathParams:{id:n},accessToken:t[3].accessToken,environment:t[3].environment},a=await Si(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Ol(e){const t=ur(e);return Br({queryKey:Dl({id:e??""}),queryFn:Fl,enabled:t})}const Vl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:ki(n)};return await Ma(r)};function Ul(){return Il({prefetchFn:Tl(Dl,Fl)})}function Bl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Hl({header:e}){const t=Bl(e.column);return I("div",{...fr(cr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:X(e.column.columnDef.header,e.getContext())})}const Wl=fr(cr["dashboard-table-header"],rr({display:"flex",flexDirection:"row",alignItems:"center",minHeight:"32px"}));function _l({headerGroups:e}){return I("div",{children:e.map(e=>h("div",{...Wl,key:e.id},e.headers.map(e=>I(Hl,{header:e},e.id))))})}const zl=fr(cr["dashboard-table-body"],rr({display:"flex",flexDirection:"column"}));function jl({children:e}){return I("div",{...zl,children:e})}function ql(e){if("object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id)return e.id}const Kl=/* @__PURE__ */new Set;const Yl=l(void 0);function Zl({editMutationKey:e,children:t}){const n=function(e){const t=F({filters:{mutationKey:e,status:"pending"},select:e=>e.state.variables},Or);return o(()=>0===t.length?Kl:function(e){const t=/* @__PURE__ */new Set;for(const n of e){const e=Array.isArray(n)?n:[n];for(const n of e){const e=ql(n);void 0!==e&&t.add(e)}}return t}(t),[t])}(e);return I(Yl.Provider,{value:n,children:t})}const Gl=fr(cr["dashboard-table-cell"],rr({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),Ql=rr({display:"flex",flexDirection:"row",height:"100%"});function Xl({cell:e,onCellClick:t,isMutating:n}){const r=Bl(e.column);return I("div",{className:Ql,style:r,onClick:()=>{!n&&t&&t(e)},children:I("div",{style:r,...Gl,children:X(e.column.columnDef.cell,{...e.getContext(),isMutating:n})})})}const Jl=fr(cr["table-sub-row"],rr({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function $l({rowData:e,onCellClick:t,shouldDisplayDivider:n,isMutating:r}){const a=e.getVisibleCells(),o=e.getIsExpanded();return R(N,{children:[I("div",{...Jl,children:a.map(e=>I(Xl,{cell:e,onCellClick:t,isMutating:r,isChild:!0},e.id))}),o&&e.subRows.map(e=>I($l,{rowData:e,onCellClick:t,shouldDisplayDivider:n,isMutating:r},e.id))]})}const es=rr.raw({display:"flex",flexDirection:"column",borderRadius:"zero",minWidth:"fit-content",overflow:"hidden",position:"relative",isolation:"isolate"}),ts=rr(es),ns=rr({background:"surface.background"}),rs=rr({position:"absolute",inset:"0",backgroundColor:"surface.foreground",opacity:"80%",pointerEvents:"all",cursor:"default"}),as=lr({base:{display:"flex",alignItems:"center",justifyContent:"flex-start",minWidth:"fit-content"},variants:{interactive:{true:{_hover:{backgroundColor:"brand.action.weaker"},cursor:"pointer","&:focus-visible":{outlineColor:"brand.action.strong",outlineStyle:"solid",outlineWidth:"borderWidths.md",outlineOffset:"calc(-1 * {borderWidths.md})",zIndex:1,backgroundColor:"brand.action.weaker"}}},height:{responsive:{height:{base:"85px",xl:"60px"}},fixed:{height:"60px"}}},defaultVariants:{height:"responsive"}});function os({rowData:e,onMouseEnter:t,onMouseLeave:n,onRowClick:r,onCellClick:o,shouldDisplayDivider:l,mutatingRowId:c}){const d=function(e){const t=i(Yl);return t?.has(e)??!1}(c??e.id),u=e.getIsExpanded(),h=fr(cr["table-parent-row"],ts,e.index%2==0?ns:void 0),p=void 0!==o||void 0!==r,g=fr(cr["table-row"],as({interactive:p})),m=e.getVisibleCells(),v=function(e){const t=a(null);return s(()=>{const n=t.current;n&&(n.inert=e)},[e]),t}(d),{onKeyDownCapture:f,ref:b,role:y,tabIndex:w}=function(e){const t=a(null);return{role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDownCapture:n=>{"Enter"!==n.key&&"Space"!==n.code||n.target!==t.current||(n.preventDefault(),n.stopPropagation(),e?.())},ref:t}}(r);return R("div",{...h,onMouseEnter:t,onMouseLeave:n,ref:v,children:[I("div",{...g,onKeyDownCapture:f,ref:b,role:y,tabIndex:w,children:m.map(e=>I(Xl,{cell:e,onCellClick:o,isMutating:d},e.id))}),d&&I("div",{className:rs}),u&&I("div",{children:e.subRows.map(e=>I($l,{rowData:e,onCellClick:o,shouldDisplayDivider:l,isMutating:d},e.id))})]})}const is=(e,t={})=>{hn.getState().openDrawer(e,t)},ls=()=>{hn.getState().requestCloseDrawer()},ss=()=>hn(e=>e.drawerHistory),cs={COMPANY:"co",EMPLOYEE:"emp",DIMENSION_VALUE:"cls",DIMENSION:"tcll",CUSTOMER:"cus",BANK_ACCOUNT:"bka",GL_ACCOUNT:"gla",TRANSACTION_CATEGORY:"ctg",BANK_TRANSACTION:"btxn",PROCESSOR_TRANSACTION:"ptxn",TRANSACTION_LINE_ITEM:"tli",VENDOR:"vnd",TRANSACTION_RULE:"trl",INVOICE:"inv",INVOICE_LINE_ITEM:"ili",BILL:"bll",BILL_LINE_ITEM:"bli",PAYROLL:"prl",PAYROLL_LINE_ITEM:"pli",FINANCIAL_SUMMARY:"fsm",TASK:"tsk",CONVERSATION:"cnv",MESSAGE:"msg",REACTION:"rct",BUSINESS_TYPE:"bzt",TEMPLATE_CLASS_LABEL:"tcll",TEMPLATE_COA:"tcoa",TEMPLATE_GL_ACCOUNT:"tgla",TEMPLATE_TRANSACTION_RULES:"ttrl",MANUAL_JOURNAL_ENTRY:"mje",ASSET:"ast",ASSET_DEPRECIATION:"asd",EXPENSE_AMORTIZATION:"exa",REVENUE_RECOGNITION:"rvr",GL_TRANSACTION:"glt",ATTACHMENT:"att",CAR:"car",MILEAGE:"mlg",INTEGRATION:"int",TIME:"tme",TIME_TYPE:"tmt",TAX_RETURN:"txr"};function ds(e,t){return!Rr(e)&&e.startsWith(t)}function us({id:e,prefix:t}){return void 0!==e?`${cs[t]}_${e}`:""}function hs(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}function ps(e,t,n){ur(e)&&(e.listener(t),e.preventDefault)||n?.()}function gs(e,t){const{events:n}=hn.getState();null!==e?ds(e.id,cs.BANK_TRANSACTION)?ps(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>is("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ps(n.transactionForm,{type:"OPEN_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>is("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ps(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:null,error:null},()=>is("BankTransactionForm",{routeProps:{transactionId:t?.transactionId,initialTab:t?.initialTab,initialType:t?.initialType}}))}function ms({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Sr(e,n,r);return Or.fetchQuery({queryKey:a,queryFn:t})}function vs({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Sr(e,n,r);return Or.prefetchQuery({queryKey:a,queryFn:t})}const fs=[{name:"One-Time Expense",value:"ONE_TIME"},{name:"Weekly Recurring Expense",value:"WEEKLY"},{name:"Monthly Recurring Expense",value:"MONTHLY"},{name:"Yearly Recurring Expense",value:"YEARLY"}],bs={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},ys={ASC:"ASC",DESC:"DESC"},ws=e=>["banks/transactions",e??{}],Cs=e=>["banks/transactions",e.id],xs=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Ts(e,t){return Al({queryKey:ws(e),queryFn:xs,...t})}const ks=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await Si(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Es({id:e,enabled:t=!0}){return Br({queryKey:Cs({id:e??""}),queryFn:ks,enabled:t})}function As(){return Il({prefetchFn:Tl(Cs,ks)})}function Ss(){const{query:{data:e}}=Ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!dr(t)&&t.length>0}const Is=e=>["conversations/messages",e];function Ns(e){if(dr(e)||0===e.length)return null;const t=[[e[0]]];for(let n=1;n<e.length;n++){const r=e[n],a=t[t.length-1],o=a[0].author.userId;r.author.userId===o?a.push(r):t.push([r])}return t}const Rs=async e=>{const t=e.queryKey,{id:n}=t[1],r={path:"/v6/conversations/{id}/messages",pathParams:{id:n},accessToken:t[2].accessToken,environment:t[2].environment},a=await Si(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},Ps=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:ki(n),accessToken:t};return await Ma(r)};function Ds(){return Il({prefetchFn:Tl(Is,Rs)})}const Ms=e=>["summaries",e??{}],Ls=e=>["summaries",e.id],Fs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:ki(t[2].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const Os=async e=>{const t=e.queryKey,n={path:"/v6/summaries/{id}",pathParams:{id:t[1]},accessToken:t[2].accessToken,environment:t[2].environment},r=await Si(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Vs(){return hn(e=>e.events.conversations)}function Us({rowData:e,isMobile:t}){const n=Vs(),{startPrefetch:r,cancelPrefetch:a}=Ul(),{startPrefetch:o,cancelPrefetch:i}=Ds(),{startPrefetch:l,cancelPrefetch:s}=As(),{startPrefetch:c,cancelPrefetch:d}=Il({prefetchFn:Tl(Ls,Os)}),h=u(()=>{ur(e.original.attachedEntityId)&&ds(e.original.attachedEntityId,cs.BANK_TRANSACTION)?l({id:e.original.attachedEntityId}):ur(e.original.attachedEntityId)&&ds(e.original.attachedEntityId,cs.FINANCIAL_SUMMARY)&&c({id:e.original.attachedEntityId}),o({id:e.original.id}),r({id:e.original.id})},[e.original.attachedEntityId,e.original.id,o,r,l,c]),p=u(()=>{ur(e.original.attachedEntityId)&&ds(e.original.attachedEntityId,cs.BANK_TRANSACTION)?s():ur(e.original.attachedEntityId)&&ds(e.original.attachedEntityId,cs.FINANCIAL_SUMMARY)&&d(),i(),a()},[s,d,a,i,e.original.attachedEntityId]);return I(os,{rowData:e,onMouseEnter:h,onMouseLeave:p,shouldDisplayDivider:e=>0!==e,onCellClick:()=>{ps(n,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:e.original,error:null},()=>((e,t,n)=>{n?is("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):ur(t)?ds(t,cs.BANK_TRANSACTION)?gs(null,{transactionId:t,initialTab:"conversation"}):ds(t,cs.FINANCIAL_SUMMARY)&&(r=e,a=t,is("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){is("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t))}})}const Bs=bi(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M0.328064 7.5H14.6719",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.328064V14.6719",strokeMiterlimit:10})),"Plus"),Hs=rr.raw({display:"flex",alignItems:"center",justifyContent:"center",outline:"none",cursor:"pointer",borderRadius:"md","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout",outlineOffset:"-1px"},"&:disabled":{cursor:"not-allowed",opacity:.6}}),Ws=rr(Hs),_s=rr.raw({color:"typography.intent.primary",border:"{borderWidths.md} solid",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.primary.active",borderColor:"border.intent.primary.active","& .Tight-text":{color:"typography.intent.primary.active"}},"& .Tight-text":{color:"typography.intent.primary"}});rr(_s);const zs=rr.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),js=rr(zs),qs=rr.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});rr(qs);const Ks=rr.raw({display:"flex",alignItems:"center",gap:"5px",backgroundColor:"surface.intent.action.discreet",borderRadius:"md",border:"{borderWidths.md} solid transparent",outline:"none",boxShadow:"0 0 0 0 transparent",position:"relative",cursor:"pointer",color:"icon.base","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"default"},_supportHover:{_enabled:{borderColor:"border.intent.action.hover",backgroundColor:"surface.intent.action.discreet.hover",color:"icon.intent.action.hover",fill:"icon.intent.action.hover"}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"transparent",color:"icon.intent.action.active",fill:"icon.intent.action.active"}}),Ys=rr.raw({color:"typography.intent.danger",border:"{borderWidths.md} solid",borderColor:"border.intent.danger",backgroundColor:"surface.intent.danger",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-text":{color:"typography.intent.danger.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.danger.active",borderColor:"border.intent.danger.active","& .Tight-text":{color:"typography.intent.danger.active"}},"& .Tight-text":{color:"typography.intent.danger"}}),Zs=rr.raw({color:"typography.intent.success",border:"{borderWidths.md} solid",borderColor:"border.intent.success",backgroundColor:"surface.intent.success","& .Tight-text":{color:"typography.intent.success"},"& path":{stroke:"icon.intent.success"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-text":{color:"typography.intent.success.hover"},"& path":{stroke:"icon.intent.success.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.success.active",borderColor:"border.intent.success.active","& .Tight-text":{color:"typography.intent.success.active"},"& path":{stroke:"icon.intent.success.active"}}}),Gs=rr.raw({color:"typography.intent.warning",border:"1px solid {colors.border.intent.warning}",backgroundColor:"surface.intent.warning",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-text":{color:"typography.intent.warning.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.warning.active",borderColor:"border.intent.warning.active","& .Tight-text":{color:"typography.intent.warning.active"}},"& .Tight-text":{color:"typography.intent.warning"}}),Qs=rr.raw({color:"typography.intent.secondary",border:"{borderWidths.md} solid",borderColor:"border.layout",backgroundColor:"surface.intent.secondary","& .Tight-text":{color:"typography.intent.secondary"},"& path":{stroke:"icon.intent.secondary"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-text":{color:"typography.intent.secondary.hover"},"& path":{stroke:"icon.intent.secondary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.secondary.active","& .Tight-text":{color:"typography.intent.secondary.active"},"& path":{stroke:"icon.intent.secondary.active"}}}),Xs=rr.raw({color:"typography.intent.action",border:"1px solid {colors.border.intent.action}",backgroundColor:"surface.intent.action",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-text":{color:"typography.intent.action.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.active",borderColor:"border.intent.action.active","& .Tight-text":{color:"typography.intent.action.active"}},"& .Tight-text":{color:"typography.intent.action"}}),Js=lr({base:rr.raw(Hs,zs,il),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:zs,small:qs},intent:{default:{},danger:Ys,primary:_s,secondary:Qs,success:Zs,warning:Gs,action:Xs}}}),$s=p(function({children:e,stylists:t=[],styles:n,className:r,type:a="button",onClick:o,disabled:i,size:l="default",width:s="default",intent:c="default",active:d=!1,onMouseEnter:u,onMouseLeave:h,popupTriggerProps:p,eventSource:g},m){const v=function(e){switch(e){case"danger":return cr["button-danger"];case"primary":return cr["button-primary"];case"secondary":return cr["button-secondary"];case"success":return cr["button-success"];case"warning":return cr["button-warning"];case"action":return cr["button-action"];case"default":return null}}(c),f=Tr([fr(cr["button-base"],v,r,rr(Js.raw({width:s,size:l,intent:c}),n)),...t]);return I("button",{ref:m,...f,type:a,onClick:o,disabled:i,"data-active":d,"data-event-name":g,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function ec({children:e,stylists:t=[],...n}){return I($s,{intent:"secondary",stylists:t,...n,children:e})}const tc=fr(cr["small-square-button"],void 0),nc=rr({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function rc(){const e=Vs();return I("div",{className:nc,children:I(ec,{stylists:[tc],onClick:()=>{ps(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation",{routeProps:{conversationId:null}}))},width:"fill-parent",children:I(ul,{Component:Bs})})})}const ac=lr({base:{display:"flex",flexDirection:"column",flexGrow:1,animation:"appear.instant",overflow:"hidden"},variants:{dashboard:{transactionDashboard:{border:"none"},financialOverviewDashboard:{marginTop:"16px",borderWidth:"lg",borderStyle:"solid",borderColor:"border.layout",borderRadius:"lg",background:"surface.foreground"},generalLedger:{border:"none"},chartOfAccounts:{border:"none"}}}});function oc({children:e,dashboard:t}){const n=fr(cr["dashboard-table"],ac({dashboard:t}));return I("div",{...n,children:e})}const ic=l(null),lc="mobile",sc=lr({base:{padding:"0 25px",height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",width:"100%"},variants:{alignVariant:{flexStart:{alignItems:"flex-start"},center:{alignItems:"center"},flexEnd:{alignItems:"flex-end"}}},defaultVariants:{alignVariant:"flexStart"}});function cc({children:e,alignVariant:t="flexStart"}){const n=fr(null,sc({alignVariant:t}));return I("div",{...n,children:e})}const dc=lr({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"template",maxWidth:"100%",xl:{lineHeight:"template",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"},notification:{color:"typography.intent.notification"}},wrap:{ellipsis:to,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:ro},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function uc({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=fr(cr.label,cr.text,rr(dc.raw({intent:t,wrap:n,alignment:r}),a));return Rr(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const hc={"sm-sm":fr(cr.text,rr({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo),"sm-med":fr(cr.text,rr({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo),"sm-lg":fr(cr.text,rr({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo),"med-sm":fr(cr.text,rr({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo),"med-med":fr(cr.text,rr({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo),"med-lg":fr(cr.text,rr({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo)};function pc({children:e,size:t,weight:n,stylists:r=[]}){const a=Tr([hc[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const gc=fr(cr["emphasis-label"],rr({lineHeight:"template"}));function mc({children:e}){return I(pc,{size:"med",weight:"lg",stylists:[gc],children:e})}function vc({text:e,isRead:t}){return I(t?uc:mc,{children:e})}function fc({date:e,isRead:t=!1}){const n=Ft(e);return I(vc,{text:n,isRead:t})}const bc=fr(cr["strong-sub-label"],kr({label:"strongSubLabel"}));function yc({children:e,stylists:t=[]}){return Rr(e)?null:I(pc,{size:"sm",weight:"med",stylists:[bc,...t],children:e})}const wc=l(null),Cc=rr({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),xc=rr.raw({display:"flex",alignItems:"center",gap:"9px",cursor:"pointer",borderRadius:"zero",width:"100%",padding:{sm:"10px",base:"16px"},border:"none",backgroundColor:"surface.foreground",color:"icon.base",minWidth:{base:"100%"},boxShadow:{sm:"none"},minHeight:{sm:"35px"},height:{sm:"fit-content"},flexShrink:{sm:0},textAlign:{sm:"start"},"&[data-focused='true']":{boxShadow:"none",outline:"none",backgroundColor:"surface.intent.action.discreet.hover"}}),Tc=fr(cr["selector-row"],rr(xc));function kc(e,t,n){const[r,a]=d(e);return[t??r,n??a]}function Ec({children:e}){return null===pe()?I(ge,{children:e}):e}function Ac({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const c=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=d(),[c,h]=d(),[p,g]=kc(e,r,a),m=ne(),v=re({placement:t,open:p,nodeId:m,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||g(e)},whileElementsMounted:se,middleware:[ae(n),oe({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),ie({padding:8}),le({apply({availableHeight:e,elements:t}){let n=e;if(e<314){const t=37*Math.floor(e/37)-18.5;n=Math.max(t,55.5)}Object.assign(t.floating.style,{maxHeight:`${n}px`,overflowY:"auto"})},padding:8})]}),f=v.context,b=ce(f,{enabled:i}),y=de(f,{bubbles:{escapeKey:!0}}),w=ue(f),C=he([b,y,w]),x=u(()=>g(!1),[g]);return o(()=>({open:p,setOpen:g,close:x,...C,...v,modal:!0,labelId:l,descriptionId:c,setLabelId:s,setDescriptionId:h,nodeId:m}),[p,g,x,C,v,l,c,m])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=pe(),p=l&&null===h,g=c.nodeId;return I(Ec,{children:I(me,{id:g,children:I(wc.Provider,{value:{...c,popupParentNodeId:h,blockInteraction:p},children:e})})})}function Sc(){const e=i(wc);if(dr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function Ic({children:e}){const t=Sc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const Nc=bi(e=>r.createElement("svg",{stroke:"currentColor",width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.23712 1.23718L8.76283 8.76289",strokeWidth:.8,strokeMiterlimit:10}),r.createElement("path",{d:"M8.76288 1.23718L1.23717 8.76289",strokeWidth:.8,strokeMiterlimit:10})),"Cross");function Rc({Component:e,stylists:t}){return I(e,{stylists:[fr(cr["tiny-icon"],cr.icon),...t??[]],size:9})}const Pc=bi(e=>r.createElement("svg",{stroke:"currentColor",width:11,height:10,viewBox:"0 0 11 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1.03625 2.20312H9.96378"}),r.createElement("path",{d:"M1.03625 5H9.96378"}),r.createElement("path",{d:"M1.03625 7.79688H7.24223"})),"Sort"),Dc=fr(cr["button-discreet-small"],rr(Ks,{maxWidth:"fit-content",justifyContent:"center","&[data-active='true']":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"border.intent.action.active"},"&:has(button:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),ll),Mc=fr(null,rr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),Lc=fr(null,rr({display:"flex",color:"icon.base",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",padding:"0 6px 0 0",border:"none",outline:"none",position:"relative",cursor:"pointer","&::before":{content:"''",position:"absolute",top:"-9px",right:"-7px",bottom:"-9px",left:"-5px"},_focusVisible:{borderRadius:"sm",outline:"4px solid",outlineColor:"border.layout"}})),Fc=fr(null,rr({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function Oc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...Dc,"data-active":a,children:[R("button",{...Mc,...r,children:[I(yc,{children:t}),!a&&I("div",{...Fc,children:I(Rc,{Component:Pc})})]}),a&&I("button",{...Lc,onClick:e,children:I(Rc,{Component:Nc})})]})}const Vc=lr({base:{borderColor:"border.layout",background:"surface.foreground",borderRadius:"zero",boxShadow:"box-shadow",animation:"appear.instant",display:"flex",flexShrink:1,width:"max-content",position:"absolute",top:0,left:0,"& *":{boxSizing:"border-box"}},variants:{type:{reaction:{borderRadius:"sm"}}}});function Uc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=Sc(),d=ve([c.refs.setFloating,n]),u=fr(cr.popup,Vc({type:r}));return a||l.open?R(fe,{children:[s&&I(be,{lockScroll:!0}),I(ye,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:I("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Bc=fr(cr["popup-sort-row"],rr({border:"none",background:"none",paddingLeft:"10px",paddingRight:"10px",paddingTop:"4px",paddingBottom:"4px",margin:0,cursor:"pointer",display:"flex",alignItems:"center",width:"100%",outline:"none",_focusVisible:{outline:"4px solid",outlineOffset:"-2px",outlineColor:"border.layout"}}));function Hc({onClick:e,children:t,active:n}){return I("button",{onClick:e,...Bc,children:I(So,{accent:n?"active":"action",children:t})})}const Wc=fr(null,rr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),_c=fr(null,rr({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function zc({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=Sc(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return R("div",{...Wc,children:[I(yc,{stylists:[_c],children:"Sort by:"}),I(Hc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Hc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const jc=rr.raw(Ks,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function qc({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=d(!1),u=fr(cr["button-discreet-small"],rr(jc,e),ll),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return I("button",{type:"button",...u,onClick:e=>{void 0===h&&c(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}function Kc({columnName:e}){return I(qc,{disabled:!0,children:I(yc,{children:e})})}const Yc={minWidth:"140px"};function Zc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=i(ic);if(!a)return null;const{sortInstance:o,setSortInstance:l}=a,s=o?.orderBy===t,c=()=>{l(void 0)};return t&&n&&r?R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>I(Oc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),I(Uc,{style:Yc,children:I(zc,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{l(e)},sortInstance:o})})]}):I(Kc,{columnName:e})}const Gc=lr({base:{display:"flex",width:"100%"},variants:{align:{left:{justifyContent:"flex-start"},center:{justifyContent:"center"},right:{justifyContent:"flex-end"}},padding:{none:{},default:{},large:{}}},compoundVariants:[{align:"left",padding:"none",css:{paddingLeft:"0"}},{align:"left",padding:"default",css:{paddingLeft:"19px"}},{align:"left",padding:"large",css:{paddingLeft:"33px"}},{align:"right",padding:"none",css:{paddingRight:"0"}},{align:"right",padding:"default",css:{paddingRight:"19px"}},{align:"right",padding:"large",css:{paddingRight:"33px"}}],defaultVariants:{align:"left",padding:"default"}});function Qc({children:e,align:t="left",padding:n="default"}){return I("div",{className:Gc({align:t,padding:n}),children:e})}function Xc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I(Qc,{align:a,padding:o,children:I(Zc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Jc="Oldest to Newest",$c="Newest to Oldest";const ed=l({userId:void 0,userRole:void 0,userEmail:void 0,companyId:void 0,customerPartnerId:void 0,apiPartnerName:void 0,clientId:void 0,unitIntegrationBankName:null,supportedIntegrations:[],isDfy:!1,hasBookkeeper:!1});function td({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=i(ed);let a="";return e===r?a="Me":_t(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),I(vc,{text:a,isRead:t})}const nd=bi(e=>r.createElement("svg",{width:15,height:15,stroke:"currentColor",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.77996 13.5774L13.2416 7.78614C13.9666 6.84449 14.288 5.65345 14.1351 4.47491C13.9821 3.29638 13.3674 2.22682 12.4261 1.5014C11.969 1.12033 11.4381 0.83785 10.8667 0.671702C10.2952 0.505554 9.69563 0.459321 9.10548 0.535904C8.51534 0.612488 7.9474 0.810234 7.43731 1.11673C6.92722 1.42323 6.48599 1.83186 6.14132 2.31698L1.10393 8.82104C-0.191398 10.3699 0.829788 12.2478 1.98119 13.1525C2.59811 13.6529 3.38756 13.8897 4.17805 13.8114C4.96854 13.7331 5.69621 13.3461 6.20301 12.7344L11.213 6.23038C11.3671 6.03065 11.4803 5.8025 11.5461 5.55898C11.612 5.31546 11.6291 5.06134 11.5967 4.81118C11.5642 4.56101 11.4827 4.3197 11.3569 4.10105C11.2311 3.88239 11.0634 3.6907 10.8635 3.53692C10.4594 3.22747 9.94931 3.09053 9.44461 3.15603C8.93992 3.22152 8.48166 3.48412 8.16999 3.88645L3.94132 9.36933",strokeMiterlimit:10})),"Attachment"),rd=fr(cr.text,rr({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"template",maxWidth:"100%",fontFamily:"label"}),eo);function ad({children:e,stylists:t=[]}){const n=Tr([rd,...t]);return I("div",{...n,children:e})}const od=lr({base:{display:"flex",gap:8,border:"none",borderBottom:"1px solid",borderBottomColor:"border.layout.weak",borderRadius:0,padding:0,width:"100%",height:"100%",cursor:"pointer",alignItems:"stretch"},variants:{isRead:{true:{backgroundColor:"transparent"},false:{backgroundColor:"surface.background"}}}}),id=or(rr({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),eo),ld=rr({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),sd=rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),cd=rr({display:"flex",alignItems:"center",gap:8}),dd=rr({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),ud=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),hd=rr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),pd=rr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function gd({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:od({isRead:a}),onTouchEnd:o,children:R("div",{className:id,children:[R("div",{className:ud,children:[!a&&I("div",{className:pd}),I(vc,{text:t,isRead:a})]}),R("div",{className:ld,children:[I("div",{className:hd,children:I(td,{authorUserId:e,isRead:a})}),R("div",{className:cd,children:[I("div",{className:sd,children:I(fc,{date:n,isRead:a})}),a?I(ul,{Component:ol}):I(ad,{children:I(ul,{Component:ol})})]})]}),I("div",{className:dd,children:Rr(r)?R(N,{children:[I(ul,{Component:nd}),I(uc,{children:"Shared a file"})]}):I(uc,{children:r})})]})})}const md=rr({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),vd=rr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function fd({text:e,isRead:t}){return t?I(uc,{children:e}):R("div",{className:md,children:[I("div",{className:vd}),I(mc,{children:e})]})}const bd=J(),yd=fr(null,rr({paddingLeft:"25px"})),wd=[bd.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(cc,{children:I(td,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(yc,{stylists:[yd],children:"From"}),size:160,maxSize:160}),bd.accessor("subject",{id:"subject",cell:({row:e})=>R(cc,{children:[I(fd,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(uc,{children:e.original.latestMessage.text})]}),header:()=>I(yc,{stylists:[yd],children:"Subject"}),size:200}),bd.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(cc,{children:I(fc,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(Xc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:$c,sortAscDisplay:Jc}),size:150,maxSize:150}),bd.display({id:lc,cell:({row:e})=>I(gd,{sender:e.original.latestMessage.author.userId,subject:e.original.subject,date:e.original.lastUpdatedDateTime,message:e.original.latestMessage.text,isRead:"READ"===e.original.readStatus,handleFormOpen:()=>{}})})];function Cd(e){return e?wd.filter(e=>e.id===lc):wd.filter(e=>e.id!==lc)}const xd=[],Td=rr({display:"flex",flexDirection:"column",height:"250px",paddingBottom:"20px",alignItems:"center",justifyContent:"center",boxSizing:"border-box",textAlign:"center",backgroundColor:"surface.background",gap:"10px",color:"icon.base"}),kd=fr(cr["empty-dashboard-layout"],Td);function Ed({children:e}){return I("div",{...kd,"data-testid":"empty-dashboard-layout",children:e})}const Ad=rr({width:"25px",height:"25px",borderRadius:"sm"});function Sd({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return ur(e)?R(N,{children:[!r&&I($o,{styles:Ad}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[fr(cr["large-icon"],cr.icon),...n??[]],size:25})}const Id=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I($s,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),Nd=bi(e=>r.createElement("svg",{stroke:"currentColor",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M12 1.47998C6.2 1.47998 1.5 5.74998 1.5 11C1.52866 13.0153 2.23294 14.9626 3.5 16.53L2.5 21.53L9.16 20.2C10.1031 20.4499 11.0744 20.5776 12.05 20.58C17.85 20.58 22.55 16.3 22.55 11.03C22.55 5.75998 17.8 1.47998 12 1.47998Z",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M11.05 11.02H12.95",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M15.82 11.02H17.73",strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M6.27 11.02H8.18",strokeWidth:1.5,strokeMiterlimit:10})),"Comment",{styleIconKey:"comment"}),Rd=rr({width:"15px",height:"15px",borderRadius:"sm"});function Pd({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return ur(e)?R(N,{children:[!r&&I($o,{styles:Rd}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[fr(cr["medium-icon"],cr.icon),...n??[]],size:15})}function Dd(){const e=Vs();return R(N,{children:[I(Sd,{Component:Nd}),I(Eo,{wrap:"wrap",children:"Need help with your financials?"}),R(Id,{...fr(cr["zero-state-button"]),onClick:()=>{ps(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation",{routeProps:{conversationId:null}}))},children:[I(Eo,{children:"Message Bookkeeper"}),I(Pd,{Component:ol})]})]})}const Md=bi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.0625 2.14374L1.5625 6.90624L11.6813 12.8562L14.0625 2.14374Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M8.25624 10.8375L5.73124 12.8562L5.33749 9.12499L13.4687 2.73749",strokeWidth:.9375,strokeMiterlimit:10})),"Paperplane",{styleIconKey:"send"});function Ld(){return R(N,{children:[I(Sd,{Component:Md}),I(Eo,{wrap:"wrap",children:"All caught up"}),I(So,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const Fd=l({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function Od(e){const{registerAnchor:t}=i(Fd);g(()=>{t(e)},[e,t])}const Vd=fr(null,rr({display:"flex",flexDirection:"row",gap:"5px"}));function Ud({children:e}){return I("div",{...Vd,children:e})}const Bd=lr({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Hd(e){return I(e?Ld:Dd,{})}function Wd({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){Od(Xi);const i=function({conversations:e,isMobile:t}){return $({data:e??xd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??xd.length,columns:Cd(t),getCoreRowModel:ee(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Ll({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!dr(l?.data?.[0])&&!s;return R("div",{className:Bd({isMobile:o}),children:[I("div",{id:Xi}),R(dl.Provider,{value:r,children:[R(wr,{children:[I(Ar,{children:"Conversations"}),R(Ud,{children:[I(vl,{}),I(rc,{})]})]}),I(oc,{dashboard:"financialOverviewDashboard",children:a?I(xl,{numColumns:4}):R(N,{children:[!o&&I(ic.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(_l,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(Zl,{editMutationKey:i.options.meta?.editMutationKey,children:I(jl,{children:i.getRowModel().rows.map(e=>I(Us,{rowData:e,isMobile:o},e.id))})}):I(Ed,{children:Hd(c)})]})})]})]})}const _d=fr(cr.body,kr({body:"default"}));function zd({children:e,stylists:t=[]}){if(Rr(e))return null;const n=Tr([_d,...t]);return I("div",{...n,children:e})}const jd=fr(null,rr({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),qd=lr({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),Kd=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Yd(){return I("div",{...jd,children:Kd.map((e,t)=>I($o,{styles:qd({width:e?.width})},t))})}const Zd=rr({position:"absolute",top:"-1",right:"-1",width:"10",height:"10",borderRadius:"999px",backgroundColor:"surface.intent.warning",boxShadow:"0 0 0 1px {colors.border.intent.warning}"}),Gd=rr({position:"relative",width:"25px",height:"25px"});function Qd({hasUnread:e}){return R("div",{className:Gd,children:[I(Sd,{Component:Nd}),e&&I("div",{"data-testid":"unread-comment-badge",className:Zd,"aria-hidden":"true"})]})}const Xd=fr(cr["financial-summary-chatbox-header"],rr({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Jd({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Xd,children:[I(Eo,{children:"Message Bookkeeper"}),t&&I(Qd,{hasUnread:e})]})}const $d=rr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function eu(){const e=Vs();return R("div",{className:$d,children:[I(Sd,{Component:Md}),I(Eo,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(So,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(Id,{...fr(cr["zero-state-button"]),onClick:()=>{ps(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation"))},children:[I(Eo,{children:"Send a Message"}),I(Pd,{Component:ol})]})]})}const tu=rr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function nu({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Ul(),{startPrefetch:a,cancelPrefetch:o}=Ds(),i=u(()=>{a({id:t}),n({id:t})},[t,a,n]),l=u(()=>{o(),r()},[o,r]);return R("div",{className:tu,children:[I(Sd,{Component:Md}),I(Eo,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(So,{wrap:"wrap",children:"Pick up where you left off."}),I(ec,{onClick:()=>is("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(Eo,{children:"Continue conversation"})})]})}const ru=rr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function au({summaryId:e}){return R("div",{className:ru,children:[I(Sd,{Component:Md}),I(Eo,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(So,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(ec,{...fr(cr["zero-state-button"]),onClick:()=>is("FinancialSummary",{routeProps:{summaryId:e}}),children:I(Eo,{children:"Talk to a bookkeeper"})})]})}function ou({summaryId:e,conversationId:t}){const n=ur(t);return dr(e)?I(eu,{}):n?I(nu,{conversationId:t,summaryId:e}):I(au,{summaryId:e})}const iu=rr({display:"flex",flexDirection:"column",flex:{base:"1 1 100%",xl:"0 0 342px"},maxHeight:"247px",minHeight:"247px",width:{base:"100%",xl:"342px"},maxWidth:{base:"100%",xl:"342px"},background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",alignItems:"center",overflow:"hidden",boxSizing:"border-box"}),lu=fr(cr["financial-summary-chatbox"],rr({display:"flex",flexDirection:"column",flex:"1 1 0",minHeight:0,width:"100%",backgroundColor:"surface.background",padding:"10px",gap:"10px",alignItems:"flex-start",boxSizing:"border-box"}));function su({summaryData:e}){const t=ur(e?.summary),n=ur(e?.conversation);return R("div",{className:iu,children:[I(Jd,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...lu,children:I(ou,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const cu=bi(e=>r.createElement("svg",{stroke:"currentColor",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("circle",{cx:12,cy:12,r:10,strokeWidth:1.5,strokeMiterlimit:10}),r.createElement("path",{d:"M12 6V12L15.5 15.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),"Clock"),du=rr({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function uu(){return R("div",{className:du,children:[I(Sd,{Component:cu}),I(Eo,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const hu=rr({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),pu=lr({base:{display:"flex",flex:{base:"1 1 100%",xl:"1 1 0"},minWidth:{base:"100%",xl:"450px"},maxHeight:"247px",minHeight:"247px",background:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"lg",gap:"10px",alignItems:"flex-start",boxSizing:"border-box",position:"relative",marginBottom:10,overflow:"auto"},variants:{isSample:{true:{pointerEvents:"none",overflow:"hidden"},false:{}},isZeroState:{true:{alignItems:"center",justifyContent:"center",padding:"16px"},false:{}}}}),gu=fr(null,rr({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),mu=rr({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function vu({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Br({queryKey:(t={limit:1,filter:{date:{equal:lt(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Ms(t):["summaries",{}],queryFn:Fs,...n});var t,n}(t),a=e?function(){const e=/* @__PURE__ */new Date;return`In ${e.toLocaleString("en-US",{month:"long"})} ${e.getFullYear()}, your total income increased significantly to $${si.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${ci.toLocaleString()}, compared to $${4534..toLocaleString()} last month, which slightly narrowed your net profit margin despite a healthy $${15157..toLocaleString()} net profit. \n\nA key area for improvement is transaction categorization; with one transaction remaining uncategorized and only two user-categorized, enhancing categorization accuracy will improve financial tracking and insights. To maintain positive momentum, consider reviewing variable expenses to identify any controllable cost increases.\n\nGoing forward, continue focusing on revenue growth while keeping a close eye on expense management, and aim to fully categorize all transactions to gain more precise financial visibility.`}():n?.summary,o=!e&&!r&&!a,i=fr(cr["financial-summary-layout"],pu({isSample:e,isZeroState:o}));return R("div",{className:mu,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(Yd,{}):o?I(uu,{}):R("div",{className:hu,children:[I(zd,{stylists:[gu],children:a}),e&&I(li,{size:"lg"})]})}),I(su,{summaryData:n})]})}const fu=fr(cr["month-picker"],rr({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),bu=fr(cr["month-picker-left-button"],rr({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),yu=fr(cr["month-picker-right-button"],rr({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),wu=fr(cr["month-picker-label"],rr({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function Cu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=at(e.year,e.month,1),o=Lt(a,{abbreviateMonth:!0});return R("div",{...fu,children:[I(ec,{stylists:[bu],onClick:()=>{return t(0===(n=e).month?{month:11,year:n.year-1}:{month:n.month-1,year:n.year});var n},disabled:r,children:I(ul,{Component:al})}),I("div",{...wu,children:I(Eo,{children:o})}),I(ec,{stylists:[yu],onClick:()=>{return t(11===(n=e).month?{month:0,year:n.year+1}:{month:n.month+1,year:n.year});var n},disabled:n,children:I(ul,{Component:ol})})]})}const xu=rr({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function Tu({children:e}){return I("div",{className:xu,children:e})}function ku(){return hn(e=>e.events.bITile)}const Eu=lr({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),Au=fr(cr["progress-bar"],rr({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),Su=fr(cr["progress-bar-fill"],rr({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),Iu=fr(cr["tile-bar-label"],rr({paddingLeft:"10px"})),Nu=fr(cr["tile-bar-label-outer"],rr({paddingLeft:"10px"}));function Ru({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?cr["bar-transactions-positive"]:cr["bar-transactions-negative"],l=fr(i,Eu({color:n})),s=Tr([Su,l]);return R("div",{...Au,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...Iu,children:I(uc,{children:e})})}),!o&&I("div",{...Nu,children:I(uc,{children:e})})]})}const Pu=fr(cr["metric-md"],rr(kr.raw({metric:"md"}),ro));function Du(e){return I("div",{...Pu,children:e.children})}const Mu=rr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),Lu=rr({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function Fu({label:e,amount:t,total:n,color:r}){const a=n>0?function(e,t,n,r=0,a=100){return r+(e-t)*(a-r)/(n-t)}(t,0,n):0;return R("div",{className:Mu,children:[I(Ru,{label:e,percentage:a,color:r}),I("div",{className:Lu,children:I(Du,{children:wo(t)})})]})}const Ou=bi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.3131 0.489685V4.15097H9.65182",strokeMiterlimit:10}),r.createElement("path",{d:"M2.32925 15.1348V11.4735H5.99054",strokeMiterlimit:10}),r.createElement("path",{d:"M1.34228 9.57602C1.18256 9.00181 1.10327 8.40823 1.10669 7.81223C1.1074 6.38654 1.56211 4.99811 2.4049 3.8482C3.2477 2.69828 4.4348 1.84664 5.79412 1.41671C7.15345 0.986775 8.61437 1.00089 9.96513 1.45702C11.3159 1.91314 12.4863 2.78757 13.3067 3.95356",strokeMiterlimit:10}),r.createElement("path",{d:"M14.2937 6.04849C14.4534 6.6227 14.5327 7.21628 14.5293 7.81228C14.5286 9.23797 14.0739 10.6264 13.2311 11.7763C12.3883 12.9262 11.2012 13.7779 9.84185 14.2078C8.48253 14.6377 7.02161 14.6236 5.67085 14.1675C4.32008 13.7114 3.14967 12.8369 2.32925 11.671",strokeMiterlimit:10})),"Sync"),Vu={},Uu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return Vu[e]={loading:!1,error:null,scriptEl:t}},Bu="undefined"!=typeof window&&void 0!==window.document;function Hu({src:e,checkForExisting:t=!1,...n}){let r=Vu[e];!r&&t&&e&&Bu&&(r=Uu(e));const[a,o]=d(r?r.loading:Boolean(e)),[i,l]=d(r?r.error:null),[c,u]=d(!1);return s(()=>{if(!Bu||!e||c||i)return;let a;r=Vu[e],!r&&t&&(r=Uu(e)),r?a=r.scriptEl:(a=document.createElement("script"),a.src=e,Object.keys(n).forEach(e=>{void 0===a[e]?a.setAttribute(e,n[e]):a[e]=n[e]}),r=Vu[e]={loading:!0,error:null,scriptEl:a});const s=()=>{r&&(r.loading=!1),o(!1),u(!0)},d=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",s),a.addEventListener("error",d),document.body.appendChild(a),()=>{a.removeEventListener("load",s),a.removeEventListener("error",d),r&&r.loading&&(a.remove(),delete Vu[e])}},[e]),[a,i]}const Wu=e=>["integrations",e??{}],_u=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function zu(e,t){return Al({...t,queryKey:Wu(e),queryFn:_u})}function ju(e){return zu({filter:{apiName:{equal:"PLAID"}}},e)}function qu(e){return Fa(`${t=e,Oa[t]}/v1`,"v1");var t}async function Ku({institutionId:e,accessToken:t,environment:n}){if(!t)throw new Error("Access token is required to get Plaid item institution");const r={path:"/banks2/bankUrl",accessToken:t,endpointManager:qu(n)},{url:a,headers:o}=Ra(r);return await Ei({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const Yu="cancel",Zu="danger",Gu="success",Qu=rr({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Xu=rr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Ju=lr({base:{background:"surface.background",borderRadius:"md",display:"flex",flexDirection:"column",gap:"16px"},variants:{size:{sm:{maxWidth:"360px",minWidth:"0",margin:"32px"},md:{maxWidth:"600px",minWidth:"400px",margin:"32px"},lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"},margin:{sm:"32px",base:"0"},height:{sm:"auto",base:"100dvh"}}},padding:{none:{padding:"0"},sm:{padding:"8px"},md:{padding:"16px"},lg:{padding:"24px"}}},defaultVariants:{size:"sm",padding:"md"}}),$u={transform:"none",willChange:"auto"};function eh({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=re({open:e,strategy:"fixed"}),s=de(l,{outsidePress:o,escapeKey:i}),c=ue(l,{role:t}),{getFloatingProps:d}=he([s,c]),u="alertdialog"===t?cr["alert-dialog"]:null,{className:h}=fr(u,Ju({size:r,padding:a}));return e?I(fe,{children:I(be,{lockScroll:!0,className:Qu,children:I(ye,{context:l,modal:!0,returnFocus:!0,children:I("div",{...d(),className:h,style:$u,children:n})})})}):null}const th=fr(cr["close-button"],rr({display:"flex",backgroundColor:"surface.intent.action.discreet",border:"none",padding:"6px",color:"icon.base",margin:0,borderRadius:"sm",outline:"none",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),cl),nh=()=>ls();function rh({Icon:e=Nc,handleClose:t=nh}={}){return I("button",{...th,onClick:t,type:"button",children:I(Pd,{Component:e,...th})})}const ah=fr(cr["alert-header"],rr({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"template"},no));function oh({children:e}){return I("div",{...ah,children:e})}const ih=rr({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),lh=rr.raw({width:"100%"}),sh=e=>{switch(e){case ch.DANGER:return"danger";case ch.SUCCESS:return"success";case ch.ACTION:return"primary";default:return"secondary"}},ch={SUCCESS:"success",DANGER:"danger",ACTION:"action"},dh=we.createConfirmation(Ce(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(eh,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[R("div",{className:Xu,children:[I(oh,{children:r}),o&&I(rh,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(uc,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:ih,children:i.map(e=>I($s,{intent:sh(e.type),styles:lh,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(Eo,{children:e.label})},e.key))})]})}));function uh(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function hh(e){return new H(e).div(100).toNumber()}function ph(e){return new H(e).times(100).toNumber()}function gh(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function mh(e,t){return t?e?`${e} ${gh(t)}`:gh(t):e??""}const vh=e=>{ps(hn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:{defaultValues:e},error:null},()=>is("Conversation",{routeProps:{conversationId:null,defaultValues:e}}))},fh=rr({display:"flex",flexDirection:"column",gap:"12px"});async function bh(e){await dh({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Yu,label:"Cancel"},{key:Gu,label:"Chat",type:ch.SUCCESS}]})===Gu&&vh({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const yh=e=>["banks/accounts",e??{}],wh={integration:{expand:!0},status:{notIn:["REMOVED"]}},Ch=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment,i={path:"/v6/banks/accounts/query",bodyParams:{...n,filter:{...n.filter},cursor:r},accessToken:a,endpointManager:ki(o)},l=await Ma(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function xh(e){return Al({queryKey:yh({...e?.params,filter:{...wh,...e?.params?.filter}}),queryFn:Ch,enabled:e?.enabled,select:e?.select})}function Th(e,t){return ms({queryKey:Ir(yh({filter:wh}),{}),queryFn:Ch,accessToken:e,environment:t})}const kh={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},Eh={short:{credentialsChanged:e=>`${e} Credentials Changed`,accountLocked:e=>`${e} Account Locked`,supportChanged:e=>`${e} Support Changed`,updateNeeded:e=>`${e} Update Needed`,noAccountsAvailable:e=>`No ${e} Accounts Available`,connectionError:e=>`${e} Connection Error`,serverError:e=>`${e} Server Error`,temporarilyDown:e=>`${e} Temporarily Down`,serverDown:e=>`${e} Server Down`,requestError:e=>`${e} Request Error`,inputError:e=>`${e} Input Error`,volumeDown:e=>`${e} Down Due to Volume`,credentialsExpiring:e=>`${e} Credentials Expiring`,relinkNeeded:e=>`${e} Relink Needed`,generic:()=>"Bank Connection Error"},long:{relinkCredentials:()=>"Please relink your account using your latest credentials.",invalidUpdatedUsername:({isMobile:e})=>`Your bank account has an updated username and needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,accountLocked:({isMobile:e})=>`Your bank account has been locked. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" and ask your financial institution to unlock your account. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,supportChanged:({apiPartnerName:e})=>`Unfortunately, your bank has added restrictions that block services like ${e||"ours"} from linking with it. Please chat with support to resolve this issue.`,updateNeeded:({isMobile:e})=>`Your bank requires you to take some action. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to log in and perform the requested action. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,mfaUpdateNeeded:({isMobile:e})=>`You have an unsupported "Multi-Factor Authentication" enabled. To fix: 1. ${e?"Tap":"Click"} "Go to my Bank" to disable it on your banking site. 2. After doing so, ${e?"tap":"click"} "Relink". If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,noAccountsUnlink:()=>"It seems that you have no active accounts with this bank. Please unlink this bank.",connectionError:()=>"Your bank connection encountered an error. Please chat with support to resolve the issue.",productNotReady:()=>"Your institution was not ready for transactions to be pulled. Please chat with support to resolve the issue.",permissionRevoked:({apiInstitutionName:e})=>`Access to your accounts with ${e} has been revoked. Please unlink and relink your account using your latest credentials.`,bankMaintenance:()=>"Your bank's server is down for maintenance, so it may take a little longer than normal to receive new transactions.",serverDown:()=>"Your bank's server is unexpectedly down. Please chat with support to resolve the issue.",bankConnectionMaintenance:()=>"Your bank connection is down for maintenance, so it may take a little longer than normal to receive new transactions.",partnerCredsChange:({isMobile:e})=>`Your bank account needs to the be relinked. To fix it, ${e?"tap":"click"} "Unlink." This will unlink your old account, so you can relink it. If you need any assistance, ${e?"tap":"click"} "Chat" to reach out to support.`,credentialsExpiring:({apiInstitutionName:e})=>`Your authorization for ${e} will expire soon. Please relink your bank with your latest credentials.`,relinkForStatements:()=>"Please relink your account using your latest credentials to enable automatic retrieval of bank statements.",generic:()=>"There was an error with your bank connection. Please chat with our team so they can resolve it."}},Ah={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:Eh.short.credentialsChanged,longMessage:Eh.long.relinkCredentials,buttonType:kh.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:Eh.short.credentialsChanged,longMessage:Eh.long.relinkCredentials,buttonType:kh.RELINK},INVALID_MFA:{shortMessage:Eh.short.credentialsChanged,longMessage:Eh.long.relinkCredentials,buttonType:kh.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:Eh.short.credentialsChanged,longMessage:Eh.long.invalidUpdatedUsername,buttonType:kh.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:Eh.short.accountLocked,longMessage:Eh.long.accountLocked,buttonType:kh.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:Eh.short.credentialsChanged,longMessage:Eh.long.relinkCredentials,buttonType:kh.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:Eh.short.supportChanged,longMessage:Eh.long.supportChanged,buttonType:kh.CHAT},USER_SETUP_REQUIRED:{shortMessage:Eh.short.updateNeeded,longMessage:Eh.long.updateNeeded,buttonType:kh.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:Eh.short.supportChanged,longMessage:Eh.long.mfaUpdateNeeded,buttonType:kh.OPEN_BANK},NO_ACCOUNTS:{shortMessage:Eh.short.noAccountsAvailable,longMessage:Eh.long.noAccountsUnlink,buttonType:kh.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:Eh.short.noAccountsAvailable,longMessage:Eh.long.noAccountsUnlink,buttonType:kh.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:Eh.short.connectionError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},ITEM_NOT_FOUND:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},PRODUCT_NOT_READY:{shortMessage:Eh.short.serverError,longMessage:Eh.long.productNotReady,buttonType:kh.CHAT},USER_PERMISSION_REVOKED:{shortMessage:Eh.short.connectionError,longMessage:Eh.long.permissionRevoked,buttonType:kh.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:Eh.short.temporarilyDown,longMessage:Eh.long.bankMaintenance,buttonType:kh.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:Eh.short.serverDown,longMessage:Eh.long.serverDown,buttonType:kh.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:Eh.short.temporarilyDown,longMessage:Eh.long.bankMaintenance,buttonType:kh.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:Eh.short.supportChanged,longMessage:Eh.long.supportChanged,buttonType:kh.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:Eh.short.connectionError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT},PLANNED_MAINTENANCE:{shortMessage:Eh.short.temporarilyDown,longMessage:Eh.long.bankConnectionMaintenance,buttonType:kh.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:Eh.short.requestError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:Eh.short.inputError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:Eh.short.volumeDown,longMessage:Eh.long.bankMaintenance,buttonType:kh.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:Eh.short.serverError,longMessage:Eh.long.connectionError,buttonType:kh.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:Eh.short.updateNeeded,longMessage:Eh.long.partnerCredsChange,buttonType:kh.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:Eh.short.credentialsExpiring,longMessage:Eh.long.credentialsExpiring,buttonType:kh.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:Eh.short.relinkNeeded,longMessage:Eh.long.relinkForStatements,buttonType:kh.RELINK}},DEFAULT:{DEFAULT:{shortMessage:Eh.short.connectionError,longMessage:Eh.long.connectionError,buttonType:kh.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:Eh.short.generic,longMessage:Eh.long.generic,buttonType:kh.CHAT}}};function Sh({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=Ah[e];if(!n)return Ta({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),Ah.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(Ta({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),Ah.DEFAULT.DEFAULT)}function Ih(e){return!0===e?.additionalConsentRequired}const Nh=e=>{const t=e?.status?"DELETED"===e.status?"REMOVED":e.status:"ACTIVE",n="MORTGAGE"!==e?.apiType&&"BROKERAGE"!==e?.apiType&&e?.apiType?e.apiType:"OTHER";return{iconUrl:"",...e,id:e.id??"",status:"DELETED"===e.status?"REMOVED":t,name:e.apiName??"",apiName:"PLAID",glAccountId:us({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:us({id:e.plaidItemId||e.oauthAccountId,prefix:"INTEGRATION"}),apiInstitutionId:e.apiInstitutionId??null},mask:e.apiMask??"",beginningBalanceData:{},isSupported:e.isSupported||!1,tranStartDate:e.tranStartDate||null,tranMinStartDate:e.tranMinStartDate||null,latestTransactionDate:e.latestTransactionDate||null,accountBalance:e.apiCurrentBalance||null,subType:e.apiSubType||null}};function Rh({mutationFn:e,onMutateFn:t,onSuccess:n,onError:r,...a}){const o=Mr(),i=Ur(),l=!Rr(o);return O({...a,mutationFn:l?t=>e({data:t,accessToken:o,environment:i}):Lr,onMutate:l&&ur(t)?e=>t({data:e,accessToken:o,environment:i}):void 0,onSuccess:n,onError:r},Or)}const Ph=l({createToast:()=>null,dismiss:()=>{}});function Dh(){const{createToast:e,dismiss:t}=i(Ph);return o(()=>({success:(t,n)=>e("success",t,n),error:(t,n)=>e("error",t,n),dismiss:t}),[e,t])}function Mh({toast:e,responseErrorParser:t,toastOptions:n,onSuccess:r,onError:a}){return{onSuccess:r||n?(a,o,i)=>(n&&function(e,t,n,r,a){const o=n.defaultPartialMessage;if(ur(o)&&t.isPartialFailure(r)){const n=t.getErrorMessages(r),i="function"==typeof o?o(a):o;(n.length>0?n:[i]).forEach(t=>e.error(t))}else{const t=(i=n.defaultSuccessMessage,l=r,s=a,"function"==typeof i?i(l,s):i);ur(t)&&e.success(t)}var i,l,s}(e,t,n,a,o),r?.(a,o,i)):void 0,onError:a||n?.defaultErrorMessage?(r,o,i)=>(n&&function(e,t,n,r,a){(function(e,t,n,r){const a=t.defaultErrorMessage,o="function"==typeof a?a(r):a;if(dr(o))return[];const i=n.getErrorMessages(e);return i.length>0?i:[o]})(r,n,t,a).forEach(t=>e.error(t))}(e,t,n,r,o),a?.(r,o,i)):void 0}}function Lh(e){return"object"==typeof e&&null!==e}const Fh={isFailureResult:function(e){return Lh(e)&&"FAILURE"===e.result},isPartialFailure:function(){return!1},getErrorMessages:function(e){if(!Lh(e)||!ur(e.errors))return[];const t=[],{fieldErrors:n,globalErrors:r}=e.errors;if(ur(n))for(const a of Object.values(n))ur(a)&&Pr(a.errorMessage)&&t.push(a.errorMessage);if(Array.isArray(r))for(const a of r)ur(a)&&Pr(a.errorMessage)&&t.push(a.errorMessage);return t}};function Oh({mutationFn:e,onSuccess:t,onError:n,meta:r,...a}){const o=Dh(),{onSuccess:i,onError:l}=Mh({toast:o,responseErrorParser:Fh,toastOptions:r?.toastOptions,onSuccess:t,onError:n});return Rh({...a,mutationFn:async({data:t,accessToken:n,environment:r})=>{const a=await e({data:t,accessToken:n,environment:r});return Fh.isFailureResult(a)?Promise.reject(a):a},onSuccess:i,onError:l})}const Vh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Ba(n)};return await La(r)},Uh=async({data:e,accessToken:t,environment:n})=>Vh({data:e,accessToken:t,environment:n}),Bh=async({data:e,accessToken:t,environment:n})=>Vh({data:e,accessToken:t,environment:n}),Hh=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/accounts",bodyParams:{accounts:e.accounts},accessToken:t,endpointManager:Ba(n)};return await La(r)})({data:{accounts:e},accessToken:t,environment:n});function Wh(e){return Oh({onSuccess:async()=>{xa("mutation successful, invalidating bank account queries");try{return Or.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&Ta({error:e,severity:"error"})}},...e})}function _h(){return Wh({mutationFn:Bh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update account"}}})}function zh(){return Oh({onSuccess:async()=>{xa("mutation successful, invalidating bank account queries");try{return Or.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&Ta({error:e,severity:"error"})}},mutationFn:Hh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update accounts"}}})}const jh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,qh=e=>"PLAID"===e,Kh=e=>({id:hs(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),Yh=rr({display:"flex",flexDirection:"column",gap:"16px"}),Zh=async()=>dh({title:"Merge Accounts",body:R("div",{className:Yh,children:[I(uc,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(uc,{wrap:"wrap",children:"This action can't be undone."}),I(uc,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Continue",type:ch.DANGER}]}),Gh=()=>dh({title:"Merge Failed",body:I(uc,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Yu,label:"OK"}]}),{formContext:Qh,fieldContext:Xh,useFieldContext:Jh,useFormContext:$h}=xe(),ep=bi(e=>r.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{id:"icon/check"},r.createElement("path",{id:"Vector",d:"M0.986511 5L3.66217 7.67566L9.01349 2.32434",stroke:"currentColor",strokeWidth:1.25,strokeMiterlimit:10}))),"Check");function tp({children:e,stylists:t=[],...n}){return I($s,{intent:"success",stylists:t,...n,children:e})}function np({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(tp,{type:"submit",disabled:n,children:[e&&I(ul,{Component:ep}),I(Eo,{children:t})]})}const rp=rr({animation:"linear 1s spin infinite"}),ap=rr({background:"conic-gradient(from 90deg, transparent 0deg, {colors.icon.base.weak} 360deg)",height:"100%",width:"100%",opacity:1}),op=rr({position:"relative"});function ip({size:e}){const t=e??15;return I("div",{className:op,children:R("svg",{className:rp,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[I("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:I("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:I("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:I("div",{className:ap})})})}),I("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z","data-figma-gradient-fill":'{"type":"GRADIENT_ANGULAR","stops":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"stopsVar":[{"color":{"r":1.0,"g":1.0,"b":1.0,"a":0.0},"position":0.0},{"color":{"r":0.68932884931564331,"g":0.88676470518112183,"b":0.93322020769119263,"a":0.74038463830947876},"position":0.69711536169052124},{"color":{"r":0.58039218187332153,"g":0.84705883264541626,"b":0.90980392694473267,"a":1.0},"position":1.0}],"transform":{"m00":-9.1848822316819949e-16,"m01":-14.999998092651367,"m02":15.999998092651367,"m10":14.999998092651367,"m11":-9.1848822316819949e-16,"m12":1.0},"opacity":1.0,"blendMode":"NORMAL","visible":true}'}),I("defs",{children:I("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:I("path",{d:"M15.4291 11.3701L14.5052 10.9874L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052L11.3701 15.4291ZM8.5 16V15V16ZM5.62987 15.4291L6.01256 14.5052L5.62987 15.4291ZM3.1967 13.8033L2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874L1.5709 11.3701ZM1 8.5H2H1ZM1.5709 5.62987L2.49478 6.01256L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478L5.62987 1.5709ZM8.5 1V2V1ZM11.3701 1.5709L10.9874 2.49478L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256L15.4291 5.62987ZM16 8.5H15C15 9.35359 14.8319 10.1988 14.5052 10.9874L15.4291 11.3701L16.353 11.7528C16.7801 10.7215 17 9.61623 17 8.5H16ZM15.4291 11.3701L14.5052 10.9874C14.1786 11.7761 13.6998 12.4926 13.0962 13.0962L13.8033 13.8033L14.5104 14.5104C15.2997 13.7211 15.9258 12.7841 16.353 11.7528L15.4291 11.3701ZM13.8033 13.8033L13.0962 13.0962C12.4926 13.6998 11.7761 14.1786 10.9874 14.5052L11.3701 15.4291L11.7528 16.353C12.7841 15.9258 13.7211 15.2997 14.5104 14.5104L13.8033 13.8033ZM11.3701 15.4291L10.9874 14.5052C10.1988 14.8319 9.35359 15 8.5 15V16V17C9.61623 17 10.7215 16.7801 11.7528 16.353L11.3701 15.4291ZM8.5 16V15C7.64641 15 6.80117 14.8319 6.01256 14.5052L5.62987 15.4291L5.24719 16.353C6.27846 16.7801 7.38376 17 8.5 17V16ZM5.62987 15.4291L6.01256 14.5052C5.22394 14.1786 4.50739 13.6998 3.90381 13.0962L3.1967 13.8033L2.48959 14.5104C3.27889 15.2997 4.21592 15.9258 5.24719 16.353L5.62987 15.4291ZM3.1967 13.8033L3.90381 13.0962C3.30022 12.4926 2.82144 11.7761 2.49478 10.9874L1.5709 11.3701L0.647024 11.7528C1.07419 12.7841 1.70029 13.7211 2.48959 14.5104L3.1967 13.8033ZM1.5709 11.3701L2.49478 10.9874C2.16813 10.1988 2 9.35359 2 8.5H1L0 8.5C-1.19209e-07 9.61623 0.219859 10.7215 0.647024 11.7528L1.5709 11.3701ZM1 8.5H2C2 7.64641 2.16813 6.80117 2.49478 6.01256L1.5709 5.62987L0.647024 5.24719C0.219859 6.27846 1.19209e-07 7.38376 0 8.5L1 8.5ZM1.5709 5.62987L2.49478 6.01256C2.82144 5.22394 3.30023 4.50739 3.90381 3.90381L3.1967 3.1967L2.48959 2.48959C1.70029 3.27889 1.07419 4.21592 0.647024 5.24719L1.5709 5.62987ZM3.1967 3.1967L3.90381 3.90381C4.50739 3.30022 5.22394 2.82144 6.01256 2.49478L5.62987 1.5709L5.24719 0.647023C4.21592 1.07419 3.27889 1.70029 2.48959 2.48959L3.1967 3.1967ZM5.62987 1.5709L6.01256 2.49478C6.80117 2.16813 7.64641 2 8.5 2V1V0C7.38376 -1.19209e-07 6.27846 0.219859 5.24719 0.647023L5.62987 1.5709ZM8.5 1V2C9.35359 2 10.1988 2.16813 10.9874 2.49478L11.3701 1.5709L11.7528 0.647024C10.7215 0.219859 9.61624 1.19209e-07 8.5 0V1ZM11.3701 1.5709L10.9874 2.49478C11.7761 2.82144 12.4926 3.30023 13.0962 3.90381L13.8033 3.1967L14.5104 2.48959C13.7211 1.70029 12.7841 1.07419 11.7528 0.647024L11.3701 1.5709ZM13.8033 3.1967L13.0962 3.90381C13.6998 4.50739 14.1786 5.22394 14.5052 6.01256L15.4291 5.62987L16.353 5.24719C15.9258 4.21592 15.2997 3.27889 14.5104 2.48959L13.8033 3.1967ZM15.4291 5.62987L14.5052 6.01256C14.8319 6.80117 15 7.64641 15 8.5L16 8.5H17C17 7.38376 16.7801 6.27846 16.353 5.24719L15.4291 5.62987ZM16 8.5H17V8.5H16H15V8.5H16Z"})})})]})})}const lp=fr(null,rr({display:"flex",width:"100%"}));function sp({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r,isSubmitting:a}){let o;return o=a&&e?R(N,{children:[I(ip,{size:12}),I(Eo,{children:t})]}):a&&!e?I(ip,{size:12}):!a&&e?R(N,{children:[I(ul,{Component:ep}),I(Eo,{children:t})]}):I(Eo,{children:t}),I(Id,{type:"submit",disabled:n||a,stylists:[lp],onClick:r,children:o})}const cp=lr({base:{},variants:{alignment:{vertical:{width:"{borderWidths.md}",minWidth:"{borderWidths.md}",alignItems:"stretch"},horizontal:{width:"100%",height:"{borderWidths.md}",minHeight:"{borderWidths.md}"}},color:{weak:{backgroundColor:"border.layout.weak"},normal:{backgroundColor:"border.layout"},strong:{backgroundColor:"border.layout.strong"},active:{backgroundColor:"border.intent.secondary"}}}});function dp({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=fr("vertical"===e?cr["vertical-divider"]:cr["horizontal-divider"],n,cp({alignment:e,color:t}));return I("div",{...r})}const up=rr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),hp=[fr(null,rr({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],pp=fr(null,rr({display:"flex",alignItems:"center",gap:"4px"}));function gp({errorMessage:e}){return R("div",{...pp,children:[I(Pd,{Component:wi,stylists:hp}),I(So,{intent:"danger",wrap:"wrap",children:e})]})}const mp=rr({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function vp({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o,isSubmitting:i}){return R(N,{children:[I(dp,{alignment:"horizontal",color:"normal"}),R("div",{className:up,children:[e,o&&I("div",{className:mp,children:I(gp,{errorMessage:o})}),I(sp,{showIcon:t,disabled:r,onClick:a,textContent:n,isSubmitting:i})]})]})}const fp=rr.raw({_notDisabled:{"&[data-state='closed'][data-disablehover='false']":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:not([data-state])[data-disablehover='false']:not(:focus-within)":{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},"&[data-state='open']":{backgroundColor:"surface.intent.action.discreet.active"},"&[data-active='false']:has(:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}},_disabled:{backgroundColor:"surface.foreground.disabled",color:"typography.base.weak",pointerEvents:"none",borderColor:"border.layout"}}),bp=rr.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function yp({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1,disabled:l=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i,"data-disabled":l||void 0}}}const wp=rr({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},fp),Cp=rr(bp),xp=rr({display:"flex",flexDirection:"column",gap:"8px"}),Tp=rr({display:"flex",justifyContent:"space-between",alignItems:"center"});function kp({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:c,errorMessage:u,disableHover:h=!1,type:p,remainingChars:g,hasErrorStyles:m,disabled:v=!1}){const f=fr(i||null,wp,l,Cp,cl),[b,y]=d(!0),{dataAttributes:w}=yp({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:m,disableHover:h,disabled:v});return R("div",{className:xp,children:[R("div",{className:Tp,children:[void 0!==r&&I(uc,{children:r}),ur(g)&&I(uc,{children:`${g}`})]}),I("div",{...f,onClick:s,...n,onMouseDown:e=>{y(!0),t&&t.current&&e.target!==t.current&&(e.preventDefault(),t.current.focus())},onFocus:()=>{t&&t.current&&function(e,t){if("setSelectionRange"in e&&"number"!==t){const t=e.value.length;e.setSelectionRange(t,t)}}(t.current,p)},onBlur:()=>{y(!1),c?.()},...w,children:e}),o&&"open"!==n?.["data-state"]&&u&&I(gp,{errorMessage:u})]})}function Ep({disabled:e=!1,...t}){const n=Jh(),r=Te(n.form.store,e=>e.isSubmitting);return I(kp,{...t,disabled:r||e})}const Ap=rr({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled",_notDisabled:{"&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}}});function Sp({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a,disabled:o}){const i=Jh(),l=Te(i.store,e=>e.meta.errors[0]?.message),s=Te(i.store,e=>e.meta.isDefaultValue),c=Te(i.store,e=>e.meta.isTouched);return I(Ep,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:s,isTouched:c,className:cr["discreet-form-input"],additionalStyles:Ap,errorMessage:l,onClick:a,onBlur:i.handleBlur,disabled:o,children:e})}function Ip(e){((navigator.userAgent?navigator.userAgent.toLowerCase().includes("mac"):navigator.platform.toLowerCase().includes("mac"))?e.metaKey:e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),e.currentTarget.requestSubmit())}function Np(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Rp(e){"Enter"===e.key&&e.currentTarget.blur()}const Pp=fr(cr["amount-input"],kr({metric:"md"}),rr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),Dp=fr(null,rr({display:"flex",alignItems:"center",gap:"2px"}));function Mp({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=d(!1);return R("div",{...Dp,children:[dr(e)&&I(Du,{children:"$"}),I(Ee,{...Pp,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:dr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Rp,autoFocus:o})]})}const Lp=lr({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",_disabled:{backgroundColor:"surface.foreground.disabled"}},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function Fp({kind:e,label:t,children:n,inputRef:r,disabled:a,popupTriggerProps:o,onClick:i,disableHover:l=!1,type:s,maxLength:c,hasErrorStyles:d}){const u=Jh(),h=Te(u.store,e=>e.meta.errors[0]?.message),p=Te(u.store,e=>e.meta.isTouched),g="string"==typeof u.state.value?u.state.value.length:0,m=ur(c)?c-g:void 0;return I(Ep,{label:t,inputRef:r,popupTriggerProps:o,className:cr["editable-form-input"],additionalStyles:Lp({kind:e}),errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:m,hasErrorStyles:d,disabled:a,children:n})}const Op=fr(null,rr({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function Vp({options:e,onSelect:t,selectedLabel:n}){const r=Sc();return I("div",{...Op,children:e.map(e=>I(Hc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const Up=bi(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2922)"},r.createElement("path",{d:"M0.714706 3.99996L6.31472 9.59998L11.9147 3.99996",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2922"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowDown"),Bp=fr(cr["dropdown-selector-button"],rr({cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderRadius:"sm",gap:"7px",backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}}),ll);function Hp({selectedLabel:e,options:t,onSelect:n}){return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>R("button",{...Bp,...t,children:[I(Eo,{children:e}),I(Rc,{Component:Up})]})}),I(Uc,{children:I(Vp,{options:t,onSelect:n,selectedLabel:e})})]})}const Wp=fr(null,rr({display:"flex",alignItems:"center",gap:"15px"})),_p=xt.map((e,t)=>({value:t,label:e})),zp=Tt({}).map(e=>({value:e,label:String(e)}));function jp({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return R("div",{...Wp,children:[I(Hp,{selectedLabel:xt[r],options:_p,onSelect:e=>a(n,e)}),I(Hp,{selectedLabel:String(n),options:zp,onSelect:e=>a(e,r)})]})}const qp=fr(null,rr({background:"surface.foreground",padding:"25px",gap:"15px"})),Kp=fr(null,rr({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),Yp=fr(cr["date-picker-nav-button"],rr({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"8px",borderRadius:"sm",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"icon.base",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"},"&:disabled":{opacity:.6,pointerEvents:"none"}}),ll),Zp=fr(null,rr({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),Gp=fr(null,rr({padding:"8px",textAlign:"center"})),Qp=fr(cr["date-picker-day-button"],rr({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"6px",width:"36px",height:"36px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"sm",cursor:"pointer",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}},"&[data-selected='true']":{backgroundColor:"surface.intent.action.discreet.active",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.active"},"&[data-today='true']::after":{content:"''",position:"absolute",bottom:"3px",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:"brand.primary"},"&:disabled":{cursor:"default"}}),ll),Xp=fr(null,rr({color:"typography.base"}));function Jp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&kt(e,t),l=Et(e),s=e.getMonth()!==n,c=!!a&&At(e,a),d=!!o&&At(o,e);return I("button",{...Qp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(Eo,{stylists:s||c||d?[Xp]:[],children:e.getDate().toString()})})}function $p({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=Sc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=at(e,t,1),r=new Date(n);return r.setDate(r.getDate()-n.getDay()),Array.from({length:42},(e,t)=>{const n=new Date(r);return n.setDate(r.getDate()+t),n})}(s,c),u=(h=d)[h.length-1];var h;const p=void 0===a||u&&At(a,u),g=dr(o)||d.length>0&&At(d[0],o),m=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return R("div",{...qp,children:[R("div",{...Kp,children:[I("button",{...Yp,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:I(ul,{Component:al})}),I(jp,{currentMonthYear:l,onMonthYearChange:r}),I("button",{...Yp,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:I(ul,{Component:ol})})]}),R("div",{...Zp,children:[Ct.map(e=>I("div",{...Gp,children:I(So,{children:e})},e)),d.map(t=>I(Jp,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const eg=fr(null,kr({label:"default"}),rr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),tg=fr(null,kr({label:"default"}),rr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",cursor:"text",overflowWrap:"break-word",minWidth:"100%",maxWidth:"100%","&::placeholder":{color:"typography.base.weak"},"&:focus":{outline:"none"}}));function ng(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant",block:"end"}),e.current.setAttribute("data-hasscrolled","true"))}async function rg(e){const t=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}const ag=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),og=[...ag].map(e=>`.${e}`).join(","),ig=/* @__PURE__ */new Set(["xls","xlsx","csv"]),lg={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...ag].map(e=>e.toUpperCase()).join(", ")} file.`,fileTooLarge:"File exceeds the 50MB size limit.",fileTooLargeSpreadsheet:"File exceeds the 50MB size limit. Try splitting it into smaller parts.",duplicate:"File has already been attached. To replace it, delete the existing file first.",maxAttachmentsReached:"Maximum of 3 attachments allowed per transaction. Remove an existing attachment to add more."},sg={"image/jpeg":[".jpg",".jpeg",".jfif"],"image/png":[".png"],"image/gif":[".gif"],"image/heic":[".heic"],"image/tiff":[".tif",".tiff"],"image/svg+xml":[".svg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"application/vnd.ms-excel":[".xls"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"text/csv":[".csv"],"text/plain":[".txt"]};function cg(e,t,n,r,a,o,i=crypto.randomUUID(),l=null,s=null,c=null){return{localId:i,id:t,file:e,displayText:r,displayFileName:n,isPending:a,hasError:o,fileSize:l,iconUrl:s,publicFileUrl:c}}function dg(e,t,n){return cg(e,null,e.name,t,!1,!0,n)}async function ug(e,t){const n=await async function(e,t){const n=e.name.split("."),r=n.length>=2?n[n.length-1].toLowerCase():void 0;if(!r||!ag.has(r))return lg.unsupportedFileType;if(e.size>52428800)return ig.has(r)?lg.fileTooLargeSpreadsheet:lg.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await rg(e);for(const e of a)if(await rg(e.file)===t)return lg.duplicate}return null}(e,t);return n?dg(e,n):cg(e,null,e.name,lg.pendingUpload,!0,!1)}const hg=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Ba(n).getUrl(`/files/upload/${a}`),s=Rr(o)?"att_"+i:o,c=new FormData;return c.append("file",r),c.append("caption",s),c.append("entityId",String(i)),(await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`},credentials:"include",body:c})).json()};function pg(){return Rh({mutationFn:hg,onSuccess:async()=>Or.invalidateQueries({queryKey:["files/attachments"]})})}const gg=async({data:e,accessToken:t,environment:n})=>{const r=Ba(n).getUrl("/files/attachment");return(await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:e.id})})).json()};const mg=rr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),vg=rr({display:"none"}),fg=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=pg();return{mutateAsync:u(async t=>{const n=t.map(({file:t})=>e({file:t,entity:"message",caption:t.name,entityId:null})),r=await Promise.allSettled(n);return t.map((e,t)=>function(e,t){if("fulfilled"===t.status&&"SUCCESS"===t.value.result){const n=t.value?.attachment?.id??null,r=t.value?.attachment?.caption??e.file.name,a=t.value?.attachment?.fileSize??null,o=t.value?.attachment?.iconUrl??null,i=t.value?.attachment?.publicFileUrl??null;return cg(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return dg(e.file,lg.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=u(()=>{r.current?.click()},[]),l=u(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>ug(e,n))),s=l.filter(e=>!e.hasError);e?.(l);try{const e=await o(s);t?.(e)}finally{r.current&&(r.current.value="")}},[n,e,t,o]);return R("div",{children:[I("input",{className:vg,type:"file",multiple:!0,accept:og,ref:r,onChange:l}),I(ec,{type:"button",onClick:i,children:I("span",{className:mg,children:I(Pd,{Component:nd})})})]})},bg=S.custom(),yg=S.object({message:S.object({text:S.string(),attachments:S.array(bg)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),wg=rr.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),Cg=rr.raw({visibility:"hidden",fontSizeAdjust:"none",fontSize:"100%",fontStyle:"normal",letterSpacing:"normal",fontStretch:"normal",fontVariant:"normal",fontWeight:"normal",textAlign:"left",textAlignLast:"initial",textDecoration:"none",textEmphasis:"none",textIndent:"0px",textJustify:"auto",textShadow:"none",textTransform:"none"}),xg=rr(Cg,wg),Tg=rr.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),kg=rr(Tg,wg,kr.raw({body:"default"})),Eg=rr({display:"block",width:"100%"}),Ag=rr({position:"relative"}),Sg=rr({display:"flex",justifyContent:"flex-end",gap:"15px"}),Ig=rr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Ng=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Jh(),c=a(null),{startCallback:d}=Sl({delay:50,callback:e=>n(e)});m(l,()=>c.current);const u=!e&&yg.safeParse(s.form.state.values).success;return I(Fp,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(ng(t),void d(!0)),children:R("div",{className:Eg,children:[R("div",{className:Ag,children:[R("pre",{className:xg,children:[s.state.value.text,I("br",{})]}),I("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:kg,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),R("div",{className:Sg,children:[!i&&I(fg,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),I(ec,{disabled:!u,type:"submit",children:I("span",{className:Ig,children:I(Pd,{Component:Md})})})]})]})})}),Rg=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,Pg=l(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function Dg(e,t){switch(t.type){case"increment":return((e,t)=>{let n;if(null===e.focusedIndex)n=0;else{const r=e.focusedIndex+1;n=!t.repeat&&r>e.maxIndex?0:Math.min(r,e.maxIndex)}return{...e,focusedIndex:n}})(e,t);case"decrement":return((e,t)=>{let n;if(null===e.focusedIndex)n=e.maxIndex;else{const r=e.focusedIndex-1;n=!t.repeat&&r<0?e.maxIndex:Math.max(r,0)}return{...e,focusedIndex:n}})(e,t);case"set":return{...e,focusedIndex:Math.min(t.focusedIndex,e.maxIndex)};case"max":return{...e,maxIndex:t.max}}}function Mg(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function Lg(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return r.top>=n.top&&r.bottom<=n.bottom&&r.left>=n.left&&r.right<=n.right}function Fg(e,t,n){if(null===e)return{node:void 0,metadata:void 0};const r=t[e];return{node:r,metadata:n.get(r)}}function Og(e){const[t,n]=d(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:l,isMousing:c,isScrolling:h}=function(e,t){const n=a(null),[r,o]=d(!0),[l,c]=d(!1),u=i(Pg),[h,p]=v(Dg,{focusedIndex:null,maxIndex:e});s(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&dr(h.focusedIndex)&&void 0!==u?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,u?.popupNodeId,t.forceRootCascade]);const g=a(null);return s(()=>{p({type:"max",max:e})},[e]),s(()=>{const e=n.current;if(null!==e){const n=e=>{c(!1);const n=e.target instanceof HTMLElement&&e.target.getAttribute("data-listitem");if(!n)return;const r=Number(e.target.getAttribute("data-index"));h.focusedIndex===r&&g.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(o(!0),g.current=e.target,p({type:"set",focusedIndex:r}),t.setCascadeState(!0,r))},r=e=>{const t="ArrowDown"===e.key||"Tab"===e.key&&!e.shiftKey,n="ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey;o(!1),c(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>c(!0);return e.addEventListener("mousemove",n),e.addEventListener("keydown",r),e.addEventListener("scroll",a),()=>{e.removeEventListener("mousemove",n),e.removeEventListener("keydown",r),e.removeEventListener("scroll",a)}}},[t,h.focusedIndex]),{listRef:n,focusedState:h,isMousing:r,isScrolling:l}}(t.size-1,e),p=Sc(),g=u((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),m=u(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:f,sortedMap:b}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(Mg)),n},[e,t]),r=o(()=>{const t=/* @__PURE__ */new Map;return n.forEach((n,r)=>{const a=e.get(n)??{};t.set(n,{...a,index:r})}),t},[n,e]);return{sortedNodes:n,sortedMap:r}}(t,r);!function(e,t,n,r,a,o){s(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=Fg(r,t,n),{shouldOpenCascade:c,shouldCloseCascade:d}=function(e,t,n,r){const a=e.placement.includes("left"),o=e?.popupParentNodeId&&!r.forceRootCascade,i=o&&n?.hasCascading&&a?"ArrowLeft":"ArrowRight",l=a?"ArrowRight":"ArrowLeft";return{shouldOpenCascade:n?.hasCascading&&t.key===i,shouldCloseCascade:o&&t.key===l}}(a,e,s,o),u=!(e.target instanceof HTMLInputElement&&""!==e.target.value)&&" "===e.key;var h,p,g,m,v;c||"Enter"===e.key||u?(p=r,g=l,m=i,v=o,!(!(h=s)||!h.hasCascading||null===p||g&&m&&Lg(g,m)&&(v.setCascadeState(!0,p),v.setFocus(!0),0))||function(e){const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});e?.dispatchEvent(t)}(l),e.preventDefault()):d&&(e.preventDefault(),a.close())};return i.addEventListener("keydown",l),()=>{i.removeEventListener("keydown",l)}},[e,t,r,n,a,o])}(r,f,b,l.focusedIndex,p,e);const{startCallback:y,cancelCallback:w}=Sl({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&Lg(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return C=l.focusedIndex,s(()=>{const e=E.current;if(null===C||x)return;const{node:t,metadata:n}=Fg(C,T,k);return A.lastOpenedIndex!==C&&n?.hasCascading&&(A.closeCurrentCascade(),S({focusedIndex:C,node:t,listElement:e})),()=>I()},[C,x=c,E=r,A=e,I=w,T=f,k=b,S=y]),function(e,t,n,r){s(()=>{const{metadata:a}=Fg(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(l.focusedIndex,f,b,e),o(()=>({register:g,unregister:m,map:b,focusedIndex:l.focusedIndex,listRef:r,isMousing:c,isScrolling:h,popupNodeId:p?.nodeId}),[g,m,b,l.focusedIndex,r,c,h,p?.nodeId]);var C,x,T,k,E,A,S,I}const Vg=l(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function Ug({style:e,children:t,forceNewCascade:n}){const r=fr(cr["popup-list"],Cc,e),a=function(e){const[t,n]=d(null),[r,a]=d(!1),[o,i]=d(null),l=u((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=u(()=>{n(null),i(null),a(!1)},[n,i,a]),c=u(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:c,forceRootCascade:e}}(n),o=Og(a);return I("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:I(Pg.Provider,{value:o,children:I(Vg.Provider,{value:a,children:t})})})}function Bg({searchTerm:e,setSearchTerm:t,onClick:n,placeholder:r,SearchInput:a,SearchList:o,DefaultList:i,extraProps:l,listLength:s,forceSearchVisible:c}){const d=c||s>=5,u=Pr(e),h=e=>{n?.(e)};return R(N,{children:[d&&I(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?I(o,{...l??{},onClick:h,searchTerm:e}):I(i,{...l??{},onClick:h})]})}const Hg=or(kr({body:"default"}),rr({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function Wg({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return s(()=>{r.current?.focus({preventScroll:!0});const e=e=>{const t=document.activeElement,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement;!r.current||document.activeElement===r.current||n||(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)&&"Backspace"!==e.key||r.current.focus()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[]),I("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Hg})}function _g({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=Sc(),[c,u]=d(""),h=Pr(c),p=l?.(h);return I(Uc,{children:I(Ug,{style:p,children:I(Bg,{searchTerm:c,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:Wg,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function zg({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:l,focusedIndex:s,isMousing:c,listRef:d}=i(Pg);g(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const h=o(()=>void 0!==l&&null!==t.current?l.get(t.current)?.index??-1:-1,[l]),p=h===s;g(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const m=u(()=>{d?.current?.focus()},[d]),v=o(()=>({onFocus:m,"data-focused":p}),[m,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const jg=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...Tc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),qg=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=zg(),l=ve([i,r]);return I(jg,{...Tc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),Kg=rr({display:"flex",gap:"8px",alignItems:"center"});function Yg({promptText:e}){return R("div",{className:Kg,children:[I(ul,{Component:Bs}),I(uc,{children:e})]})}function Zg({text:e}){return I("div",{...Tc,children:e?I(uc,{children:e}):I($o,{styles:rr({width:"100%",height:"16px"})})})}const Gg=fr(cr["popup-list"],Cc),Qg=()=>R("div",{...Gg,children:[I(Zg,{}),I(Zg,{}),I(Zg,{}),I(Zg,{}),I(Zg,{})]});function Xg({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(Qg,{}):R(N,{children:[r&&I(qg,{onClick:()=>is("BankAccountForm"),children:I(Yg,{promptText:"Add bank account"})}),e?.map(e=>I(qg,{onClick:()=>t(e),children:I(uc,{wrap:"wrap",children:mh(e?.name,e?.mask)})},e?.id))]})}const Jg={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},$g={...Jg,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function em({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ae(e??[],$g),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(Qg,{}):R(N,{children:[a&&I(qg,{onClick:()=>is("BanksAndIntegrations"),children:I(Yg,{promptText:"Add bank account"})}),0===l.length?I(Zg,{text:"No results found"}):l.map(e=>I(qg,{onClick:()=>n(e),children:I(uc,{wrap:"wrap",children:mh(e?.name,e?.mask)})},e?.id))]})}function tm({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(_g,{onClick:e,placeholder:"Search bank accounts...",SearchList:em,DefaultList:Xg,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const nm=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function rm({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=mh(n?.name??"",n?.mask??"");return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:r=>I(Fp,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:nm,type:"button",disabled:t,children:ur(n)?I(uc,{children:i}):I(uc,{intent:"weak",children:"Select bank account"})})})}),I(tm,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const am=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),om=e=>{if(dr(e))return!1;const t=e.filter(e=>qh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||ur(e.lastSyncedDate))},im=()=>{const e=xh({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function lm(){return xh({select:e=>{return{...e,plaidItemAccountsReadyToSync:om(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>qh(e.apiName)))};var t}})}function sm(e){return e?.filter(e=>jh(e.apiName)&&"ACTIVE"===e.status)}function cm(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function dm(e){return xh({select:t=>({...t,data:cm(t?.data,e)})})}const um=e=>{const{query:t}=xh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data};function hm({options:e,onClick:t}){const n=Sc();return I(Uc,{children:I(Ug,{children:e.map((e,r)=>I(qg,{onClick:()=>(t(e),void n.close()),children:I(uc,{children:e.label})},`${e.label}_${r}`))})})}const pm=fr(null,rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),gm=rr.raw({color:"typography.base.weak"}),mm=(e,t)=>e===t;function vm({options:e,label:t,isEqual:n=mm,isEmpty:r,disabled:a}){const o=Jh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!dr(o.state.value)&&!r?.(o.state.value);return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:n=>I(Fp,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...pm,type:"button",children:I(uc,l?{children:i(e,o.state.value)}:{extraClassNames:[gm],children:`Select ${t.toLowerCase()}...`})})})}),I(hm,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const fm=rr({border:"none",outline:"none",backgroundColor:"transparent"},kr.raw({label:"default"})),bm=e=>r.createElement("svg",{width:16,height:16,stroke:"currentColor",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.9092 4.60259V6.39635H1.78418V4.60259L8.34669 1.62134L14.9092 4.60259Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M14.9092 12.3589H1.78418V14.7464H14.9092V12.3589Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.97803 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.55908 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.1343 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M13.7153 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"})),ym=bi(bm,"Bank",{styleIconKey:"bank"}),wm=lr({base:{display:"flex",flexDirection:{base:"row",sm:"column"},alignItems:{base:"center",sm:"start"},justifyContent:"flex-start",textAlign:"start",gap:"4px",maxWidth:"100%",flexWrap:"wrap",minWidth:0},variants:{active:{true:{flexDirection:"column-reverse",alignItems:"start"},false:{flexDirection:{base:"column"},alignItems:{base:"start"}}}}});function Cm({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?mh(e,t):e;return R("div",{className:wm({active:r}),children:[n&&I(So,{intent:r?"normal":"weak",children:n}),I(uc,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const xm=e=>["plaidInstitutionLogo",e??{}],Tm=fr(cr["category-icon"],rr({objectFit:"contain"})),km=fr(cr["category-icon"],rr({objectFit:"contain",color:"icon.base"}));function Em(e,t,n){const r=({size:n=24})=>{const{icons:r}=i(vi),a=e;return Pr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?I(Se,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...km}):I("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...Tm});var o};return r.displayName=t,r}const Am=rr({display:"flex",gap:"10px",maxWidth:"100%"});function Sm({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=Mr(),n=Ur();return M({queryKey:xm({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Ku({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?Em(i,"Logo"):void 0;return R("div",{className:Am,children:[I(Sd,{Component:l&&o?l:ym}),I(Cm,{accountName:e,accountNo:t,active:a,syncText:r})]})}const Im=fr(cr.text,kr({label:"strongLabel"}),rr({maxWidth:"100%"}),eo);function Nm({children:e,stylists:t=[]}){const n=Tr([Im,...t]);return I("div",{...n,children:e})}const Rm=rr({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Pm({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(ec,{popupTriggerProps:r,disabled:n,width:"fill-parent",children:I(Nm,{children:e?mh(e.name,e.mask):R("div",{className:Rm,children:[I(uc,{children:t}),I(ul,{Component:Bs})]})})})}const Dm="TRIGGER_ACCOUNT",Mm="FORM_SELECTABLE_ACCOUNT",Lm=rr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Fm({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Lm,children:[R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>I(Pm,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Dm?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(tm,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I(gp,{errorMessage:o})]})}const Om=(e,t,n)=>{if(!n)return;const r=e===Mm?t:n,a=e===Mm?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,qh(c)&&jh(d));var c,d;const u=(h=r?.status,p=a?.status,"ACTIVE"===h&&"INACTIVE"===p);var h,p;return o?"Selected account number does not match destination account number":s?"Merging a linked account into a manually tracked account may result in duplicate transactions":u?"You selected an active account to be merged into an archived account":void 0},Vm=rr({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Um=rr({display:{base:"block",sm:"none"}}),Bm=rr({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Hm=rr({display:"flex",justifyContent:"center",alignItems:"center"}),Wm=rr({display:{base:"none",sm:"block"}}),_m=rr({display:{base:"block",sm:"none"}});function zm({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return R("div",{className:Vm,children:[R("div",{className:Bm,children:[o?I(Fm,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Dm,bankAccounts:n,isFilling:r,warningMessage:Om(Dm,e,t??null)}):I(Pm,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Hm,children:[I("div",{className:Wm,children:I(Pd,{Component:ol})}),I("div",{className:_m,children:I(Pd,{Component:Up})})]}),I(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:Um,children:I(dp,{alignment:"horizontal"})})]})}function jm({queryKey:e,queryFn:t,...n}){const r=Mr(),a=Ur(),o=Pr(r),i=Sr(e,r??"",a),l=D(),s=U({...n,queryKey:i,queryFn:o?t:Lr,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Or);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const qm=e=>["vendors",e??{}],Km=e=>["vendors","infinite",e??{}],Ym=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:ki(r)},o=await Ma(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Zm=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return Ym({queryParams:n,cursor:r,accessToken:a,environment:o})};function Gm(e={},t){return Al({queryKey:qm(e),queryFn:Zm,...t})}const Qm=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return Ym({queryParams:n,cursor:o,accessToken:r,environment:a})},Xm="FAILURE";function Jm(e){return"object"==typeof e&&null!==e}function $m(e){return!!Jm(e)&&(e.result===Xm||Array.isArray(e.data)&&e.data.some($m))}const ev={isFailureResult:function(e){return Jm(e)&&e.result===Xm},isPartialFailure:function(e){return!(!Jm(e)||e.result===Xm)&&Array.isArray(e.data)&&e.data.some($m)},getErrorMessages:function e(t){if(!Jm(t))return[];const n=[];if(Array.isArray(t.error))for(const r of t.error)ur(r)&&Pr(r.message)&&n.push(r.message);if(Array.isArray(t.data))for(const r of t.data)n.push(...e(r));return n}};function tv({onSuccess:e,onError:t,meta:n,...r}){const a=Dh(),{onSuccess:o,onError:i}=Mh({toast:a,responseErrorParser:ev,toastOptions:n?.toastOptions,onSuccess:e,onError:t});return Rh({...r,onSuccess:o,onError:i})}async function nv(e){const{url:t,headers:n}=Ra(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=Sa({extraHeaders:n,authorization:t});xa("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return xa("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),Ia(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function rv(e){return nv(e)}const av=async({data:e,accessToken:t,environment:n})=>Ma({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:ki(n)}),ov=async({data:e,accessToken:t,environment:n})=>rv({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:ki(n)}),iv=async({data:e,accessToken:t,environment:n})=>Ma({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:ki(n)}),lv=async()=>await Or.invalidateQueries({queryKey:["vendors"]});function sv(){return tv({mutationFn:av,onSuccess:lv,meta:{toastOptions:{defaultSuccessMessage:"Vendor saved",defaultErrorMessage:"Couldn't save vendor"}}})}const cv=or(kr({body:"default"}),rr({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),dv=rr({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),uv=fr(cr["button-inline"],rr({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function hv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:dv,children:[I("input",{ref:o,type:"text",placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r()):"Escape"===e.key&&(e.preventDefault(),a())},onFocus:e=>{e.stopPropagation()},className:cv}),I("button",{type:"button",onClick:r,...uv,children:I(So,{children:"Add"})})]})}function pv({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=d(!1),[i,l]=d(""),c=a(null);return s(()=>{r&&c.current&&c.current.focus({preventScroll:!0})},[r]),I(qg,{onClick:r?void 0:()=>{o(!0)},children:r?I(hv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:c}):I(Yg,{promptText:e})})}function gv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ae(e??[],Jg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(Qg,{}):R(N,{children:[I(pv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?I(Zg,{text:"No results found"}):l.map(e=>I(qg,{onClick:()=>n(e),children:I(uc,{children:e.name})},e.id))]})}function mv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(Qg,{}):R(N,{children:[I(pv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(qg,{onClick:()=>t(e),children:I(uc,{children:e.name})},e.id))]})}function vv({onClick:e}){const{query:{data:t,isLoading:n}}=Gm({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=sv(),a=t?.data??[];return I(_g,{onClick:e,placeholder:"Search vendors...",SearchList:gv,DefaultList:mv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}const fv=rr({all:"unset"});function bv({children:e}){return I("div",{tabIndex:0,role:"button",className:fv,children:e})}function yv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const wv=e=>["customers",e??{}],Cv=e=>["customers","infinite",e??{}],xv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:ki(r)},o=await Ma(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Tv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return xv({queryParams:n,cursor:r,accessToken:a,environment:o})};function kv(e={},t){return Al({queryKey:wv(e),queryFn:Tv,...t})}const Ev=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return xv({queryParams:n,cursor:o,accessToken:r,environment:a})},Av=async({data:e,accessToken:t,environment:n})=>Ma({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:ki(n)}),Sv=async({data:e,accessToken:t,environment:n})=>rv({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:ki(n)}),Iv=async()=>await Or.invalidateQueries({queryKey:["customers"]});function Nv(){return tv({mutationFn:Av,onSuccess:Iv,meta:{toastOptions:{defaultSuccessMessage:"Customer saved",defaultErrorMessage:"Couldn't save customer"}}})}const Rv={left:"-100%",right:"100%"},Pv={type:"tween",duration:.3},Dv={x:0},Mv=e=>({x:Rv[e]}),Lv=e=>({x:Rv[e]});function Fv({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(Uc,{style:r,modal:!0,forceMount:t,children:e})}const Ov=rr({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Vv=fr(null,Ov);function Uv({children:e,clickHandler:t}){const n=Sc();return t||(t=()=>{n.close()}),I(be,{lockScroll:!0,...Vv,onClick:t,children:e})}const Bv=rr({display:"flex",flexDirection:"column",position:"fixed",right:0,top:0,left:{base:0,sm:"auto"},bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},backgroundColor:"surface.background"});function Hv({children:e,overlay:t=!1}){const n=Sc(),r=u(e=>{e.stopPropagation()},[]);return I(Ie,{children:n.context.open&&R(Fv,{fadeIn:!1,forceMount:!0,children:[t&&I(Uv,{}),I(Ne.div,{transition:Pv,initial:Mv("right"),animate:Dv,exit:Lv("right"),className:Bv,onAnimationEnd:r,children:e})]})})}const Wv=rr.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),_v=rr.raw({display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",flex:"1 1 0",alignSelf:"stretch",overflowY:"auto",width:"100%",maxWidth:{base:"none",sm:"512px"},scrollbar:"hidden"}),zv=fr(cr["drawer-header"],rr(Wv));function jv({hideDivider:e=!1,children:t}){return R(N,{children:[I("header",{...zv,children:t}),!e&&I(dp,{alignment:"horizontal",color:"normal"})]})}const qv=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Kv({children:e}){return I("div",{className:qv,children:e})}const Yv=rr({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),Zv=lr({base:_v,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function Gv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=Sc();return R(N,{children:[I(jv,{children:R(Kv,{children:[I(rh,{Icon:al,handleClose:()=>{r?.(),i.close()}}),I(Eo,{children:o}),!dr(t)&&I("div",{className:Yv,children:t})]})}),I("div",{className:Zv({padChildren:a}),children:n}),e]})}function Qv({overlay:e=!1,...t}){return I(Hv,{overlay:e,children:I(Gv,{...t})})}const Xv=bi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.19899 11.5105C8.9944 11.5105 11.2605 9.2444 11.2605 6.44899C11.2605 3.65358 8.9944 1.38745 6.19899 1.38745C3.40358 1.38745 1.13745 3.65358 1.13745 6.44899C1.13745 9.2444 3.40358 11.5105 6.19899 11.5105Z",strokeMiterlimit:10}),r.createElement("path",{d:"M15.05 15.3L9.67714 9.92712",strokeMiterlimit:10})),"Search",{styleIconKey:"search"}),Jv=rr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),$v=fr(cr["drawer-search-bar"],rr({display:"flex",padding:"16px",flexDirection:"row",alignItems:"center",gap:"8px",flex:"1 0 0",borderRadius:"sm",border:"1px solid {colors.border.layout}",backgroundColor:"surface.foreground",maxHeight:"49px",minWidth:"fit-content"})),ef=or(rr({display:"flex",flexDirection:"column",alignItems:"flex-start",backgroundColor:"surface.foreground",gap:"8px",flex:"1 0 0",border:"none",outline:"none",_placeholder:{color:"typography.label.sub"}}),kr({label:"strongLabel"})),tf=fr(null,rr({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function nf({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:Jv,children:[I(Eo,{children:"Search"}),R("div",{...$v,children:[I(Pd,{Component:Xv}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:ef}),Pr(e)&&I(ec,{stylists:[tf],onClick:()=>t(""),children:I(Pd,{Component:Nc})})]})]})}function rf({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=d("");return I(Bg,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:nf,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function af({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:d}){const[h,p]=kc({},a?.selected,i),[g,m]=kc({},a?.expanded,l),v=u((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),f=u((e,t)=>{const n=t??!g[e],r={[e]:n};m({...g,...r})},[g,m]),b=o(()=>e.map((e,a)=>({key:r({rows:e,groupIndex:a,originalGroup:t?.[a]}),index:a,original:t?.[a]??void 0,getRows:()=>e.map((e,t)=>{const r=n(e,t);return{key:r,value:e,expanded:g[r]??!1,getCanSelect:()=>c?.(e)??!0,getIsSelected:()=>h[r]??!1,toggleSelected:e=>v(r,e),getCanExpand:()=>d?.(e)??!0,getIsExpanded:()=>g[r]??!1,toggleExpanded:()=>f(r,!g[r])}})})),[e,r,t,n,h,v,g,f,c,d]);return o(()=>{const e={selected:h,expanded:g};return{groups:b,toggleSelected:v,toggleExpanded:f,getState:()=>e}},[b,v,f,g,h])}const of=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2768)"},r.createElement("path",{d:"M2.70654 9.12132C3.60197 9.12132 4.32787 8.39543 4.32787 7.49999C4.32787 6.60456 3.60197 5.87866 2.70654 5.87866C1.8111 5.87866 1.08521 6.60456 1.08521 7.49999C1.08521 8.39543 1.8111 9.12132 2.70654 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M8.32496 9.12132C9.22039 9.12132 9.94629 8.39543 9.94629 7.49999C9.94629 6.60456 9.22039 5.87866 8.32496 5.87866C7.42952 5.87866 6.70363 6.60456 6.70363 7.49999C6.70363 8.39543 7.42952 9.12132 8.32496 9.12132Z",fill:"currentColor"}),r.createElement("path",{d:"M13.9434 9.12132C14.8388 9.12132 15.5647 8.39543 15.5647 7.49999C15.5647 6.60456 14.8388 5.87866 13.9434 5.87866C13.048 5.87866 12.3221 6.60456 12.3221 7.49999C12.3221 8.39543 13.048 9.12132 13.9434 9.12132Z",fill:"currentColor"}))),"Dots"),lf=rr({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function sf({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:lf,children:[I(Pd,{Component:of}),I(Eo,{wrap:"wrap",children:`No ${t} found`}),n&&I(So,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const cf=rr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function df({children:e}){return I("div",{className:cf,children:e})}const uf=fr(cr["list-body"],null);function hf({title:e,children:t}){return R(df,{children:[e,I("div",{...uf,children:t})]})}const pf=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z",strokeMiterlimit:10})),"Circle"),gf=fr(null,rr({fill:"surface.intent.action.active"}));function mf({selected:e,showEmptyIndicator:t}){return e?I(Pd,{Component:xi,stylists:[gf]}):t?I(Pd,{Component:pf}):null}const vf=lr({base:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"9px",cursor:"pointer",padding:"16px",color:"typography.intent.secondary",minHeight:"52px",width:"100%",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover"}},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}}}});function ff({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=fr(cr["selector-row"],vf({selected:r}),cl);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function bf({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(ff,{handleClick:t,selected:n,children:[e,I(mf,{selected:n,showEmptyIndicator:r})]})}const yf=rr.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function wf(){return I($o,{styles:rr(xc,yf)})}const Cf=rr({width:"70px",height:"24px"}),xf=rr({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function Tf(){return R("div",{className:xf,children:[I($o,{styles:Cf}),R(df,{children:[I(wf,{}),I(wf,{}),I(wf,{})]}),I($o,{styles:Cf}),R(df,{children:[I(wf,{}),I(wf,{}),I(wf,{})]})]})}function kf({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ae(e,Jg),[e]),s=af({data:o(()=>l.search(t).map(e=>e.item),[l,t]).map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return n?I(Tf,{}):0===s.groups.length?I(sf,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):I(hf,{title:I(uc,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return I(bf,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:I(uc,{children:t.value.name})},t.key)})})}const Ef=rr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),Af=rr({width:"100%"});function Sf({promptText:e,placeholderText:t,onSubmit:n,onPromptClick:r,keepInlineCreateOnPromptClick:o=!1}){const[i,l]=d(!1),[c,u]=d(""),h=a(null);s(()=>{i&&h.current&&h.current.focus({preventScroll:!0})},[i]);const p=()=>{u(""),l(!1)};return R("div",{className:Af,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||p()},children:[I(dp,{alignment:"horizontal"}),I(ff,{handleClick:i?void 0:()=>{r&&(r(),!o)||l(!0)},children:i?I(hv,{placeholder:t,value:c,onChange:u,onSubmit:()=>{c.trim()&&(n(c.trim()),u(""),l(!1))},onCancel:p,inputRef:h}):I(Yg,{promptText:e})})]})}function If(){return hn(e=>e.events.customer)}function Nf({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=If(),l=af({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(Tf,{}):R(df,{children:[I(Sf,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n,onPromptClick:i?()=>i.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}):void 0,keepInlineCreateOnPromptClick:ur(i)&&!i.preventDefault}),R("div",{className:Ef,children:[I(uc,{children:"Customers"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I(bf,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(uc,{children:t.value.name})},t.key)})})]})]})}function Rf({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=kv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(yv)})}),{mutateAsync:a}=Nv(),o=Sc(),i=n?.data??[],[l,s]=d(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(Qv,{title:"Back",Footer:I(vp,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!c}),onClose:()=>s(t?{[t.id]:!0}:{}),children:I(rf,{placeholder:"Search customers...",onClick:e=>{dr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:kf,DefaultList:Nf,listLength:i.length,extraProps:{customers:i,isLoading:r,onCreateCustomer:async e=>{const t=await a({data:[{name:e}]}),n=t.data?.[0]?.data?.id;n&&s({[us({id:n,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function Pf({frequencies:e,onClick:t}){const n=Sc();return I(Uc,{children:I(Ug,{children:e.map(e=>I(qg,{onClick:()=>(t(e),void n.close()),children:I(uc,{children:e.name})},e.value))})})}const Df=lr({base:{minWidth:0,borderRadius:"zero",border:"1px solid",borderColor:"border.layout",_first:{borderRight:"none"},_last:{borderLeft:"none"},"&:not(:first-child):not(:last-child)":{borderLeft:"none",borderRight:"none"},_focus:{zIndex:2}},variants:{width:{full:{width:"100%"},fit:{width:"fit-content%",minWidth:"100px"}},backgroundColor:{foreground:{backgroundColor:"surface.foreground"}},active:{true:{borderColor:"border.intent.secondary",zIndex:1}},corners:{rounded:{_first:{borderTopLeftRadius:"sm",borderBottomLeftRadius:"sm"},_last:{borderTopRightRadius:"sm",borderBottomRightRadius:"sm"}}}}});function Mf({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=fr(cr["button-group"],or(Df({width:a,backgroundColor:o,active:t,corners:i}),js,Ws,rr(Qs),ll));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(Eo,{wrap:"wrap",textAlign:"center",children:e.label}):I(uc,{wrap:"wrap",alignment:"center",children:e.label})})}const Lf=lr({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"},fit:{width:"fit-content"}}}});function Ff({width:e,children:t}){return I("div",{className:Lf({width:e}),children:t})}function Of({width:e="full",options:t,handleClick:n,selectedIndex:r}){const[a,o]=d(null);return I(Ff,{width:e,children:t.map((t,i)=>R(f,{children:[0!==i&&I(dp,{color:i!==r&&i!==r+1||a===r?"normal":"active"}),I(Mf,{option:t,isActive:i===r,handleClick:()=>n(i),onHoverChange:e=>o(e?i:null),width:e,backgroundColor:"foreground",corners:"rounded"})]},t.value))})}const Vf=bi(e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.668689 4.04687L0.668689 0.650082L11.3313 0.650083L11.3313 4.04688",strokeMiterlimit:10}),r.createElement("path",{d:"M6.00008 3.55915L6.00008 11.7998",strokeMiterlimit:10}),r.createElement("path",{d:"M2.60834 6.46875L6.00005 3.07703L9.39177 6.46875",strokeMiterlimit:10})),"Upload"),Uf=rr({display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",alignSelf:"stretch",padding:"16px",gap:"8px",outline:"none",color:"icon.base",borderRadius:"2px",border:"{borderWidths.md} dashed {colors.border.layout}"},fp,bp,sl),Bf=fr(null,rr({color:"icon.base"})),Hf=fr(cr["attachment-dropzone"],Uf);function Wf({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return R("div",{...a,...e({className:Hf.className,onMouseDown:r,onBlur:n}),children:[I("input",{...t()}),I(Pd,{stylists:[Bf],Component:Vf}),I(uc,{children:"Add Files"})]})}const _f=rr({display:"flex",flexDirection:"column",gap:"8px"}),zf=rr({display:"flex",justifyContent:"space-between",alignItems:"center"});function jf({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return R("div",{className:_f,children:[o&&I("div",{className:zf,children:I(uc,{children:o})}),I(Wf,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&I(gp,{errorMessage:i})]})}const qf=rr({display:"flex",justifyContent:"start",width:"100%"}),Kf=rr({display:"flex",alignItems:"center",gap:"9px"}),Yf=rr({width:"100%"}),Zf=lr({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function Gf(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Qf({flatDimensionValues:e,dimensions:t,dimensionValueOptions:n,selectedRow:r,searchTerm:a,onClick:i}){const l=o(()=>e.filter(e=>{const n=t.find(t=>t.id===e.dimension?.id);return!n||!Gf(n)}),[e,t]),s=o(()=>new Ae(l,Jg),[l]),c=o(()=>new Set(s.search(a).map(e=>e.item.id)),[s,a]),d=o(()=>n.map(e=>e.filter(e=>c.has(e.id))).filter(e=>e.length>0),[c,n]);if(0===d.length)return I(sf,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return R(N,{children:[I("div",{className:qf,children:I(uc,{children:"Search Results"})}),I("div",{className:Zf({nested:u}),children:d.map(e=>I("div",{className:Yf,children:e.map(e=>I(ff,{handleClick:()=>i(e),selected:r[e.id],children:R("div",{className:Kf,children:[I(mf,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(uc,{children:e.name})]})},e.id))},e[0].id))})]})}const Xf=bi(e=>r.createElement("svg",{stroke:"currentColor",width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_9779_2940)"},r.createElement("path",{d:"M11.9147 7.99997L6.31472 2.39996L0.714716 7.99997",strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_9779_2940"},r.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowUp"),Jf=lr({base:{display:"flex",alignItems:"stretch",width:"100%",minHeight:"52px",borderRadius:"zero",borderInline:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"{borderWidths.md} solid {colors.border.layout}",borderTop:"none",_first:{borderTop:"{borderWidths.md} solid {colors.border.layout}"},borderColor:"border.layout",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},variants:{active:{true:{backgroundColor:"surface.intent.action.highlight"},false:{backgroundColor:"surface.foreground"}},expanded:{true:{borderBottom:"none"}}}}),$f=rr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",padding:"16px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent",color:"typography.intent.secondary","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),eb=rr({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:"16px",minWidth:"58px",cursor:"pointer",outline:"none",border:"none",backgroundColor:"transparent","&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}});function tb({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=fr(cr["selector-row"],Jf({active:r,expanded:a}),cl);return R("div",{...i,children:[o?R("button",{type:"button",className:$f,onClick:t,children:[I(mf,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:$f,children:e}),!dr(n)&&I("button",{type:"button",className:eb,onClick:n,children:I(Pd,{Component:a?Xf:Up})})]})}function nb({dimensionValueRows:e,onClick:t}){return e.map(e=>I(ff,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:Kf,children:[I(mf,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(uc,{children:e.value.name})]})},e.key))}function rb({fieldDimension:e,dimensionValueOptions:t,dimensions:n,selectedRow:r,setSelectedRow:a,allowMultiselect:o,onClick:i}){const l=t.map(e=>({id:e[0].id,displayName:e[0].name??""})),s=af({data:t,groups:l,getRowKey:e=>e.id,getGroupKey:({originalGroup:e,groupIndex:t})=>e?.id??t.toString(),state:{selected:r},onSelectedChange:e=>a(e),hasMultiSelect:o??!1,getCanSelect:e=>{const t=n.find(t=>t.id===e.dimension?.id);return!t||!Gf(t)}}),c=s.groups.some(e=>e.getRows().length>1);return R(N,{children:[I("div",{className:qf,children:I(uc,{children:e})}),I("div",{className:Zf({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return R("div",{className:Yf,children:[(c||0===t)&&I(dp,{alignment:"horizontal"}),I(tb,{onClick:n.getCanSelect()?()=>i(n.value):void 0,onExpandToggle:r.length>0?n.toggleExpanded:void 0,active:n.getIsSelected(),expanded:n.expanded,canSelect:n.getCanSelect(),children:I(uc,{children:n.value.name})}),n.expanded&&R(N,{children:[I(dp,{alignment:"horizontal"}),I(nb,{dimensionValueRows:r,onClick:i})]})]},e.key)}return I(nb,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function ab({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=u(t=>{if(n){const e=!a[t.id],n={...a,[t.id]:e};if(e){const e=r.find(e=>e.some(e=>e.id===t.id));e&&e.length>1&&(e[0].id===t.id?e.slice(1).forEach(e=>{n[e.id]=!1}):n[e[0].id]=!1)}o(n)}e?.(t)},[n,r,a,o,e]);return I(rf,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Qf,DefaultList:rb,listLength:t.flatDimensionValues.length,extraProps:t})}function ob({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){const i=o(()=>n.filter(([e,...t])=>{if(t.length>0)return!0;const n=r.find(t=>t.id===e.dimension?.id);return!n||!Gf(n)}),[n,r]),[l,s]=d(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),c=o(()=>i.flat(),[i]),u=Sc(),h=Object.values(l).some(Boolean);return I(Gv,{title:"Back",Footer:I(vp,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=c.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:I(ab,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:c,selectedRow:l,setSelectedRow:s})})}function ib(e){const t=Sc();return I(Hv,{children:t.open&&I(ob,{...e})})}const lb=rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),sb=rr.raw({color:"typography.base.weak"});function cb(e){const t=e.slice(0,10);return 0===t.length?"":t.length<=3?`(${t}`:t.length<=6?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`}const db=/\D/g,ub=rr({border:"none",outline:"none",backgroundColor:"transparent"},kr.raw({label:"default"})),hb=rr({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),pb=lr({base:{display:"inline-flex",height:"25px",padding:"5px 10px",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"md",border:"{borderWidths.lg} solid",borderColor:"border.intent.secondary",background:"surface.intent.secondary",fontSize:"sm",fontWeight:"sm",lineHeight:"template",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),gb=rr({border:"none",background:"none",padding:0,cursor:"pointer"}),mb=rr({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function vb({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return R("div",{...fr(cr.pill,n,pb({disabled:r})),children:[I("div",{className:mb,children:e}),I("button",{className:gb,onClick:t,disabled:r,children:I(Rc,{Component:Nc,stylists:[fr(null,hb)]})})]})}const fb=S.email(),bb=rr({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),yb=rr({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},kr.raw({label:"default"})),{useAppForm:wb,withForm:Cb,withFieldGroup:xb}=ke({formContext:Qh,fieldContext:Xh,formComponents:{SaveButton:np,FormSaveButton:sp,FormFooter:vp},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Jh();return I(Sp,{inputRef:t,label:e,children:I(Mp,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Jh();return I(Fp,{inputRef:r,label:e,hasErrorStyles:t,children:I(Mp,{value:o.state.value,onChange:o.handleChange,inputRef:r,autofocus:n})})},DateInput:function({label:e,maxDate:t,minDate:n,autofocus:r=!1,editable:o=!1,hasErrorStyles:i}){const l=Jh(),s=Te(l.store,e=>e.meta.isDefaultValue),c=a(null),[u,h]=d(()=>l.state.value?Rt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Rt(l.state.value):null,[g,m]=d(""),v=e=>{const r=function(e){const t=e.replace(/\D/g,"");return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4,8)}`}(e.target.value);m(r);const a=Nt(r);if(a){let e=a;t&&n?e=Mt(Dt(a,t),n):t?e=Dt(a,t):n&&(e=Mt(a,n)),l.handleChange(Pt(e)),h(e)}else l.handleChange("")},f=g||(p?St(p):""),[b,y]=d(!1),w=e=>{b&&(()=>{if(p&&!s){const e=Nt(g);(t&&e&&At(e,t)||n&&e&&At(n,e))&&m(St(p))}})(),y(e)},C=e=>{"Enter"===e.key&&(e.preventDefault(),w(!b))},x=o?Fp:Sp;return R(Ac,{placement:"bottom-start",onOpenChange:w,open:b,children:[I(Ic,{children:t=>I(x,{label:e,inputRef:c,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:I("input",{...eg,ref:c,type:"text",id:l.name,value:f,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:C,autoComplete:"off"})})}),I(Uc,{initialFocus:!1,children:I($p,{selectedDate:p,onDateSelect:e=>{l.handleChange(Pt(e)),m(St(e)),h(e)},viewDate:u,onViewDateChange:h,maxDate:t,minDate:n})})]})},TextAreaInput:function({label:e,placeholder:t,autofocus:n=!1,resizeable:r=!0}){const o=Jh(),i=a(null);return I(Fp,{label:e,inputRef:i,children:I("textarea",{...tg,ref:i,value:o.state.value||"",onChange:e=>o.handleChange(e.target.value),placeholder:t??"Add note...",rows:4,style:{resize:r?"both":"none"},autoFocus:n})})},MessageAreaInput:Ng,ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Jh(),a=um(t?.id??""),{query:{data:o},isFilling:i}=xh({select:e=>({...e,data:sm(e?.data)})}),l=o?.data,s=ur(e)&&!Rg(e);return I(rm,{label:"Bank Account",disabled:s,onClick:e=>{var t;n({id:(t=e).id,name:t.name}),r()},bankAccount:a,bankAccountOptions:l,isFilling:i})},ButtonGroupField:function({label:e,options:t}){const n=Jh(),r=t.findIndex(e=>e.value===n.state.value);return I(Fp,{label:e,disableHover:!0,children:I(Of,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:vm,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Jh(),l=a(null);return I(Fp,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:I("input",{className:fm,value:i.state.value,onChange:e=>i.handleChange(e.target.value),type:t,maxLength:n,ref:l,placeholder:o})})},BulkMergeAccountRowField:zm,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const o=a(null),i=r?Fp:Sp,{handleBlur:l}=Jh();return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(bv,{children:I(uc,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})})}),I(vv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?Fp:Sp;return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(bv,{children:I(uc,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})})}),I(Rf,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??fs[0].name}`;return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>I(Fp,{inputRef:r,label:e,popupTriggerProps:t,children:I(Eo,{children:o})})}),I(Pf,{frequencies:fs,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=sg,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Jh(),c=Te(s.form.store,e=>e.isSubmitting),{mutateAsync:u}=pg(),[h,p]=d(!0),{dataAttributes:g}=yp({isActive:h,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l,disabled:n||c}),{getRootProps:m,getInputProps:v}=Re({maxFiles:e,accept:t,disabled:n||c,onDrop:async t=>{const n=s.state.value??[],r=n.filter(e=>!e.hasError).length,a=e-r,o=t.slice(0,a),i=t.slice(a),l=[...await Promise.all(o.map(e=>ug(e,n))),...i.map(e=>dg(e,lg.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const d=c.map(async e=>{try{const t=await u({file:e.file,entity:"glSource",caption:e.file.name,entityId:null}),n=t?.attachment;return{localId:e.localId,success:!0,id:n?.id??null,iconUrl:n?.iconUrl??null,publicFileUrl:n?.publicFileUrl??null,fileSize:n?.fileSize??null}}catch{return{localId:e.localId,success:!1,id:null,iconUrl:null,publicFileUrl:null,fileSize:null}}}),h=await Promise.allSettled(d);s.setValue(e=>(e??[]).map(e=>{if(e.hasError)return e;const t=c.findIndex(t=>t.localId===e.localId);if(-1===t)return e;const n=h[t];return"fulfilled"===n?.status&&n.value.success?{...e,isPending:!1,hasError:!1,displayText:"",id:n.value.id,iconUrl:n.value.iconUrl,publicFileUrl:n.value.publicFileUrl,fileSize:n.value.fileSize}:{...e,isPending:!1,hasError:!0,displayText:"Upload failed. Please try again."}}))}});return I(jf,{getRootProps:m,getInputProps:v,dataAttrs:g,onMouseDown:()=>p(!0),onBlur:()=>p(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return R(Ac,{children:[I(Ic,{children:n=>I(Fp,{label:e,popupTriggerProps:n,children:I("button",{className:lb,type:"button",children:I(uc,t?{children:t.name}:{extraClassNames:[sb],children:`Select ${e.toLowerCase()}...`})})})}),I(ib,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Jh(),o=a(null),i=a(null);return g(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),I(Fp,{label:e,disabled:t,inputRef:o,kind:"text",children:I("input",{className:ub,value:cb(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace(db,"").length,o=t.value.replace(db,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=cb(o);i.current=function(e,t){let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e[r])){if(n===t)return r;n++}return e.length}(l,a)},onBlur:function(){const e=r.state.value;e.length>0&&e.length<10&&r.setErrorMap({onBlur:{message:"Phone number is incomplete"}})},type:"text",inputMode:"numeric",ref:o,placeholder:n})})},MultiEmailField:function({label:e,disabled:t,placeholder:n="Add email address"}){const r=Jh(),[o,i]=d(""),l=a(null),s=r.state.value,c=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=fb.safeParse(e);return t.success?!s.some(t=>t.toLowerCase()===e.toLowerCase())||(r.handleBlur(),r.setErrorMap({onChange:{message:"Email already added"}}),!1):(r.handleBlur(),r.setErrorMap({onChange:{message:t.error.issues[0].message}}),!1)})(e)&&(r.handleChange([...s,e]),r.setErrorMap({onChange:void 0}),i(""))};return I(Fp,{label:e,disabled:t,inputRef:l,kind:"container",children:R("div",{className:bb,children:[s.map(e=>I(vb,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:cr["email-pill"],disabled:t},e)),I("input",{ref:l,className:yb,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:c,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),c()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const Tb=[fr(null,rr({"& path":{stroke:"icon.base"}}))];function kb({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(ec,{type:"button",onClick:n,children:[e&&I(ul,{Component:Nc,stylists:Tb}),I(Eo,{children:t})]})}const Eb=rr({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),Ab=rr({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),Sb=rr({maxWidth:"600px"}),Ib=rr({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),Nb=rr({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Rb=rr({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Pb=rr({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Db=rr({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),Mb=rr({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),Lb=e=>{Ip(e),Np(e)};function Fb({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=xh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=zh(),a=Mr(),o=Ur(),i=ur(n),l=i?{selectedAccounts:n}:e;return i&&a&&n.forEach(({duplicateAccount:e})=>{var t,n,r;e&&(t=e.id,n=a,r=o,vs({queryKey:Ir(ws({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:xs,accessToken:n,environment:r}))}),wb({defaultValues:l,onSubmit:async e=>{if(await Zh()===Zu){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await Gh());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=Ir(ws({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await ms({queryKey:r,queryFn:xs,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Rt(e.tranStartDate||""),l=Rt(n||""),s=Rt(e.tranMinStartDate||""),dr(l)?i:ur(s)?Mt(l,s):(ur(i)&&Mt(l,i),i));var i,l,s;return dr(r)?null:Pt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...Kh(t),duplicateBankAccountIds:[hs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await Gh()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:Eb,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:Lb,children:[R("div",{className:Ab,children:[I(Eo,{children:"Merge Accounts"}),I("div",{className:Sb,children:I(uc,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:Ib,children:[R("div",{className:Nb,children:[I("div",{className:Rb,children:I(Eo,{children:"Duplicate Account"})}),I("div",{className:Pb,children:I(Eo,{children:"Into"})}),I("div",{className:Db,children:I(Eo,{children:"Destination Account"})})]}),I(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>I(i.AppField,{name:`selectedAccounts[${n}]`,children:t=>{const n=t.state.value.duplicateAccount?.id,o=function(e,t,n,r){const a=function(e,t,n){const r=new Set(e.map(e=>e.id));return t.forEach(({duplicateAccount:e})=>{e&&e.id!==n&&r.add(e.id)}),Array.from(r)}(e,t,n);return r?.filter(e=>!a.includes(e.id)&&jh(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return I(zm,{destinationAccount:t.state.value.destinationAccount,selectedDuplicate:t.state.value.duplicateAccount,availableAccounts:o,isFilling:a,onSelectionChange:e=>{const n={duplicateAccount:e,destinationAccount:t.state.value.destinationAccount};t.handleChange(n)}},t.state.value.destinationAccount.id)}},n))})]}),I("div",{className:Mb,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[I(kb,{showIcon:!1,onClick:()=>n()}),I(Id,{onClick:()=>i.reset(o),disabled:!t,children:I(Eo,{children:"Clear Selections"})}),I(np,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Ob=rr({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",width:"100%",maxWidth:"100%",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative",overflow:"hidden",boxSizing:"border-box"}),Vb=we.createConfirmation(Ce(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I(eh,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:Ob,children:I(Fb,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Ub({plaidItemAccounts:e,matchingAccountPairs:t}){await Vb({matchingAccountPairs:t,plaidItemAccounts:e})}const Bb=rr({display:"flex",flexDirection:"column",gap:"12px"}),Hb=async(e,t,n)=>{try{const r=await async function({accessToken:e,plaidItemId:t,environment:n}){if(!e)throw new Error("Access token is required to create Plaid link token");const r={path:"/banks2/createPlaidLinkToken",accessToken:e,endpointManager:qu(n)},{url:a,headers:o}=Ra(r);return Ei({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(xa("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(Ta({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),bh("NO_LINK_TOKEN"))}catch(r){return Ta({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),bh("LINK_TOKEN_FAILED")}};async function Wb(e,t,n){const r=await async function(e,t){const n=Ir(Wu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await ms({queryKey:n,queryFn:_u,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function _b(e,t,n,r){xa("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||xa("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,vs({queryKey:Ir(yh({filter:wh}),{}),queryFn:Ch,accessToken:r,environment:a});const o=await Wb(e,t,n);if(o){const e=await Th(t,n);return e?.data?.filter(e=>e.integration?.id===o.id)||[]}}var r,a;return[]}(t?.institution?.institution_id,n,r),{plaidItem:i}=await async function({publicToken:e,metadata:t,accessToken:n,environment:r}){if(!n)throw new Error("Access token is required to create Plaid link token");const a={path:"/banks2/webPlaidPublicToken",accessToken:n,endpointManager:qu(r)},{url:o,headers:i}=Ra(a);return await Pa({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(xa("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Or.invalidateQueries({queryKey:["integrations"]}),Or.invalidateQueries({queryKey:["banks/accounts",{}]}),Or.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===Sh({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return Ta({error:new Error("Plaid Item requires relink, plaid reopened automatically"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),{relinkPlaidItemId:i.id};const l=await Th(n,r),s=l?.data?.filter(e=>jh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=x(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(Ta({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await dh({title:"Uh Oh!",body:"It appears something went wrong fetching the accounts from your bank. Please chat with the support or try again later.",buttons:[{key:Yu,label:"Cancel"},{key:Gu,label:"Chat",type:ch.SUCCESS}]})===Gu&&vh({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void Ta({error:new Error("No new accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}});if(!i.some(e=>"ACTIVE"===e.status))return Ta({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),dh({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Yu,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return Ta({error:new Error("Accounts saved successfully with unsupported accounts"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),function(e,t,n){const r=e.length;return dh({title:"All set! Ready to track your transactions?",body:R("div",{className:fh,children:[I(uc,{wrap:"wrap",children:`Your ${n} ${t} ${uh("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(uc,{wrap:"wrap",children:`The following linked ${r>1?"accounts are":"account is"} not supported at this time, so ${r>1?"they":"it"} will remain unsynced.`}),I("ul",{children:e.map(e=>I("li",{children:I(uc,{wrap:"wrap",children:mh(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:Gu,label:"Get Started",type:ch.SUCCESS}]})}(l,o,e.plaidItemAccounts.length);const s=function(e,t){const n=[];for(const r of e){if(!r.apiMask)continue;const e=t.find(e=>e.mask===r.apiMask&&r.isSupported);e&&n.push({destinationAccount:Nh(r),duplicateAccount:e})}return n}(i,a);return s.length>0?async function({institutionName:e,matchingAccountPairs:t,plaidItemAccounts:n}){const r=t.slice(0,3),a=t.length>3;await dh({title:"Your transactions are being categorized",body:R("div",{className:Bb,children:[I(uc,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(uc,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),R("ul",{children:[r.map(({duplicateAccount:e})=>I("li",{children:I(uc,{wrap:"wrap",children:mh(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(uc,{wrap:"wrap",children:"and more..."})})]}),I(uc,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Yu,label:"No thanks"},{key:Gu,label:"Review",type:ch.SUCCESS}]})===Gu&&await Ub({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(Ta({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>dh({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${uh("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:Gu,label:"Get started",type:ch.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return Ta({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await dh({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Yu,label:"Cancel"},{key:Gu,label:"Chat",type:ch.SUCCESS}]})===Gu&&vh({message:{text:`I tried to link with ${e} and it failed (CODE: BANK_POST_FAILURE).`,attachments:[]}})}(t.institution?.name||"my bank"),{}}var a}async function zb(e,t,n){return dr(e)?(xa("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(xa("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(Ta({error:new Error("Plaid Item sync failed, refreshing Plaid Items"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),!0):("INVALID_UPDATED_USERNAME"===e.error_code&&(Ta({error:new Error("Plaid Item sync failed due to invalid updated username"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),await async function(e){const t=await dh({title:e,body:'Your bank account has an updated username. To fix it, tap "Banks & Integrations", and unlink your old account, so you can relink it with your new username. If you need any assistance, tap "Chat" to chat with a member of our team.',buttons:[{key:Yu,label:"Cancel"},{key:"chat",label:"Chat"},{key:Gu,label:"Banks & Integrations",type:ch.SUCCESS}]});"chat"===t?vh({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==Gu||(e=>{const t=hn.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||is("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const jb=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Ft(t.lastSyncedDate)}`},qb=e=>{let t;return e.isSupported?"ACTIVE"!==e.status?t="Archived":!e.lastSyncedDate&&e.syncTransactions?t="Processing":e.syncTransactions||(t="Not Synced"):t="Not Supported",t},Kb="PLAID_LINK_NEW",Yb="PLAID_LINK_UNLINK_RELINK",Zb="PLAID_LINK_UPDATE",Gb="PLAID_LINK_UNLINK";function Qb({plaidEvent:e,apiAccessToken:t,apiErrorCode:n}){const r=t?{plaidAccessToken:t}:null,a=null!=n;switch(e){case Kb:return{type:"PLAID_LINK_NEW",result:"SUCCESS",data:null,error:null};case Zb:return a?{type:"PLAID_LINK_RESET",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RESET",result:"SUCCESS",data:r,error:null};case Yb:return a?{type:"PLAID_LINK_RELINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RELINK",result:"SUCCESS",data:r,error:null};case Gb:return a?{type:"PLAID_LINK_UNLINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_UNLINK",result:"SUCCESS",data:r,error:null};default:return null}}function Xb({plaidEvent:e,plaidItemId:t,apiAccessToken:n,apiErrorCode:r,message:a}){return{eventType:"onPlaidLink",message:a,defaultPrevented:!0,data:{plaidEvent:e,integrationId:t,apiAccessToken:n,apiErrorCode:r}}}function Jb(){return hn(e=>e.events.plaidLink)}function $b(){return hn(e=>e.events.plaidLinkEvent)}function ey(){return hn(e=>e.events.plaidLinkError)}const ty=l({});function ny({onPlaidLink:e,children:t}){return I(ty.Provider,{value:{onPlaidLink:e},children:t})}function ry(){return i(ty)}const ay=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Ba(n)};return await La(r)};function oy(){return Rh({mutationFn:ay,onSuccess:()=>{const e=["integrations"];return Or.invalidateQueries({queryKey:e})}})}const iy=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Ba(t)};return await La(n)};function ly(){return Rh({mutationFn:iy,onSuccess:()=>{const e=["integrations"];return Or.invalidateQueries({queryKey:e})}})}const sy=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(hs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Ba(n)};return await async function(e){return nv(e)}(r)};function cy(){const{mutate:e}=ly();return Rh({mutationFn:sy,onSuccess:()=>{const e=["integrations"];return Or.invalidateQueries({queryKey:e})},onError:async t=>{Ta({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await dh({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Yu,label:"Cancel"},{key:Gu,label:"Try Again",type:ch.SUCCESS}]})===Gu&&e()}})}function dy(e,t){return new Promise(n=>{window.Plaid.create({token:e,onSuccess:(e,t)=>n({status:"success",public_token:e,metadata:t}),onExit:(e,t)=>n({status:"exit",metadata:t,error:e}),onEvent:(e,n)=>{xa(`Plaid event: ${e}`,{metadata:n,eventName:e}),t?.listener({type:"PLAID_LINK_EVENT",result:"SUCCESS",data:{eventName:e,metadata:n},error:null})}}).open()})}async function uy(e,t,n,r,a,o){const i=await Hb(e,t,n);if(!i)return;const l=await dy(i,a);if("success"===l?.status){const{public_token:e,metadata:i}=l;xa("Plaid link successful",{public_token:e,metadata:i});const s=await _b(e,i,t,n);if(s.relinkPlaidItemId)return uy(s.relinkPlaidItemId,t,n,r,a,o)}else if("exit"===l?.status){const{metadata:e,error:t}=l;xa("Plaid link exited",{metadata:e,error:t}),t&&o?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await zb(t,e,i)&&r()}else Ta({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:l,token:i}})}function hy(){const[e,t]=Hu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Mr(),r=Ur(),{mutate:a}=ly(),{onPlaidLink:o}=ry(),i=Jb(),l=$b(),s=ey();return{linkPlaid:e=>{if(ur(i)){const t=Qb(e);if(ur(t)&&i.listener(t),i.preventDefault)return}if(ur(o)){const t=Xb(e);o(t)}else uy(e.plaidItemId?hs(e.plaidItemId):void 0,n,r,a,l,s)},loading:e||ur(t),hasOnPlaidLinkOverride:ur(i)||ur(o)}}function py(){const[e,t]=Hu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Mr(),r=Ur(),{mutate:a}=ly(),{apiPartnerName:o}=i(ed),{onPlaidLink:l}=ry(),s=Jb(),c=$b(),d=ey();return{linkPlaid:e=>{if(ur(s)){const t=Qb(e);if(ur(t)&&s.listener(t),s.preventDefault)return}if(ur(l)){const t=Xb(e);l(t)}else!async function(e,t,n,r,a,o,i){const l=await Hb(e,t,n);if(!l)return;const s=await dy(l,o);if("success"===s?.status){const{public_token:e,metadata:l}=s;xa("Plaid link from search successful",{public_token:e,metadata:l});const c=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Wb(t.institution.institution_id,n,r);if(i)return Ta({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,dh({title:"Already Linked",body:`It seems that this bank is already linked${o?` with ${o}`:""}. Please tap "Relink" to update the existing linked institution.`,buttons:[{key:Yu,label:"Cancel"},{key:Gu,label:"Relink",type:ch.SUCCESS}]}))===Gu?{relinkPlaidItemId:hs(i.id)}:{}}var o;return xa("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),_b(e,t,n,r)}(e,l,t,n,r);c.relinkPlaidItemId&&uy(c.relinkPlaidItemId,t,n,a,o,i)}else if("exit"===s?.status){const{metadata:e,error:t}=s;xa("Plaid link from search exited",{metadata:e,error:t}),t&&i?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await zb(t,e,l)&&a()}}(e.plaidItemId?hs(e.plaidItemId):void 0,n,r,o,a,c,d)},loading:e||ur(t),hasOnPlaidLinkOverride:ur(s)||ur(l)}}const gy=fr(null,Ws,rr({position:"absolute",left:1,right:1,bottom:1,width:"calc(100% - 2)",height:"44px",background:"surface.intent.primary",border:"none",borderRadius:0,gap:9,color:"icon.intent.primary",pointerEvents:"all",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"}}}}),ll);function my({onPress:e,preventDefault:t,eventSource:n}){const{linkPlaid:r,loading:a}=hy();return R("button",{onClick:()=>{e?.(),t||r({plaidEvent:Kb,message:"Tile Plaid Link button pressed"})},...gy,disabled:a,"data-event-name":n,children:[I(Pd,{Component:Ou}),I(uc,{intent:"primary",children:"Link Account"})]})}const vy=rr({width:266,minHeight:32});function fy(){return I($o,{styles:vy})}const by=fr(cr.text,rr({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo);function yy({children:e}){return I("div",{...by,children:e})}const wy={SUCCESS:rr({backgroundColor:"surface.intent.success.highlight"}),DANGER:rr({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:rr({backgroundColor:"surface.intent.secondary"})},Cy=fr(cr.chip,rr({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function xy({variant:e,children:t}){return I("div",{className:or(Cy.className,wy[e]),children:I(yy,{children:t})})}const Ty=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function ky({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${yo(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return I(xy,{variant:Ty(r,n,t),children:a})}const Ey=rr({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function Ay({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:Ey,children:[I(po,{title:e,label:t}),ur(n)&&I(ky,{difference:n,invertDirection:r})]})}const Sy={netIncome:0,income:0,expenses:0,absoluteSum:0},Iy=e=>{if(dr(e))return Sy;const t=e.income?.total??0,n=e.expenses?.total??0,r=H(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},Ny=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Iy):[]},Ry=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function Py({defaultRange:e=ht.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=ku(),i=u(()=>{a?.listener?.({type:"PROFIT_AND_LOSS_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Ut(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return _a({filter:e,grouping:t,select:Ny})}({filter:l,grouping:t?Ya:void 0}),{profitLossData:d,profitDifference:h}=o(()=>{if(n)return{profitLossData:di,profitDifference:null};if(!s||0===s.length)return{profitLossData:Ry,profitDifference:null};if(2===s.length){const[e,t]=s;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:s[0],profitDifference:null}},[s,n]);return R($a,{isSample:n,children:[I(Ga,{title:"Profit + Loss"}),I(Xa,{children:c?R(ti,{children:[I(fy,{}),I(fy,{})]}):R(N,{children:[I(Ay,{title:wo(d.netIncome),label:"Profit",comparison:h}),R(mo,{children:[I(Fu,{amount:d.income,total:d.absoluteSum,color:"positive",label:"Income"}),I(Fu,{amount:d.expenses,total:d.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(li,{size:"sm"}),r&&I(my,{onPress:i,preventDefault:a?.preventDefault})]})}const Dy=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],My=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...wt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Ba(a)};return await La(o)},Ly={moneyIn:0,moneyOut:0,netMoneyIn:0},Fy=e=>{if(dr(e)||dr(e.operatingActivities)||!e.operatingActivities.children)return Ly;let t=new H(0),n=new H(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(H(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Oy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Fy):[]};const Vy=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function Uy({defaultRange:e=ht.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=ku(),i=u(()=>{a?.listener?.({type:"CASH_FLOW_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Ut(t):e,{query:{data:s,isFetched:c},isFilling:d}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Br({queryKey:Dy({filter:e,grouping:t}),queryFn:My,select:n})}({filter:e,grouping:t,select:Oy})}({filter:l,grouping:t?Ya:void 0}),{cashFlowData:h,difference:p}=o(()=>{if(n)return{cashFlowData:hi,difference:null};if(!s||0===s.length)return{cashFlowData:Vy,difference:null};if(2===s.length){const[e,t]=s;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:s[0],difference:null}},[s,n]),g=n||c?Math.abs(h.moneyIn)+Math.abs(h.moneyOut):0;return R($a,{isSample:n,children:[I(Ga,{title:"Cash Flow"}),I(Xa,{children:d?R(ti,{children:[I(fy,{}),I(fy,{})]}):R(N,{children:[I(Ay,{title:wo(h.netMoneyIn),label:"Change in Cash",comparison:p}),R(mo,{children:[I(Fu,{amount:h.moneyIn,total:g,color:"positive",label:"Money In"}),I(Fu,{amount:h.moneyOut,total:g,color:"negative",label:"Money Out"})]})]})}),n&&I(li,{size:"sm"}),r&&I(my,{onPress:i,preventDefault:a?.preventDefault})]})}const By=rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Hy=rr({display:"flex",justifyContent:"end"});function Wy({color:e,bulletLabel:t,moneySummary:n}){return R("div",{className:By,children:[I(Fo,{color:e,label:t}),I("div",{className:Hy,children:I(uc,{children:n})})]})}const _y=fr(null,rr({display:"flex",gap:"10px",alignItems:"center"})),zy=rr({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),jy=fr(null,zy);function qy({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>R("div",{..._y,children:[I(Fo,{color:Po.var("colors.brand.secondary")}),t?I($o,{styles:zy}):I("div",{...jy})]},n))})}const Ky={total:0,children:[]},Yy=e=>{return dr(e)||dr(e.expenses)||!e.expenses.children?Ky:{total:e.expenses.total??0,children:(t=e.expenses.children,t.sort((e,t)=>(t.total??0)-(e.total??0)).slice(0,3).map(e=>({name:e.name??"",total:e.total??0})))};var t},Zy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Yy):[]},Gy=[Po.var("colors.brand.primary"),Po.var("colors.brand.success"),Po.var("colors.brand.action")],Qy=Object.freeze({total:0,children:[]});function Xy({defaultRange:e=ht.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=hn(e=>e.externalOptions),l=ku(),s=u(()=>{l?.listener?.({type:"EXPENSE_TILE",result:"SUCCESS",data:null,error:null})},[l]),c=i.dataVisualizationColors??Gy,d=t?Ut(t):e,{query:{data:h},isFilling:p}=function({filter:e,grouping:t}){return _a({filter:e,grouping:t,select:Zy})}({filter:d,grouping:t?Ya:void 0}),{expenseData:g,expensesDifference:m}=o(()=>{if(r)return{expenseData:ui,expensesDifference:null};if(!h||0===h.length)return{expenseData:Qy,expensesDifference:null};if(2===h.length){const[e,t]=h;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:h[0],expensesDifference:null}},[h,r]),v=void 0===n?"Total Expenses":`${xt[n]} Total`,f=g.children.length>0;return R($a,{isSample:r,children:[I(Ga,{title:"Expenses"}),I(Xa,{children:p?I(ti,{children:I(qy,{shimmer:!0})}):R(N,{children:[I(Ay,{title:wo(g.total),label:v,comparison:m,invertDirection:!0}),I(mo,{children:f?g.children.map((e,t)=>I(Wy,{color:c[t],bulletLabel:e.name,moneySummary:wo(e.total)},t)):I(qy,{})})]})}),r&&I(li,{size:"sm"}),a&&I(my,{onPress:s,preventDefault:l?.preventDefault})]})}const Jy=fr(null,rr({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function $y({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:at(l=e.year,i,1),endDate:at(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Jy,children:[R(wr,{children:[I(Ar,{children:"Monthly Review"}),I(Cu,{period:e,setPeriod:t,disableNext:r||(s=e,c=n,h=s.month,p=c.month,h===p&&(d=s.year,u=c.year,d===u)),disablePrev:r})]}),R(Tu,{children:[I(Py,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(Uy,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(Xy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const ew="Oldest to Newest",tw="Newest to Oldest",nw="A-Z",rw="Z-A",aw="Lowest to Highest",ow="Highest to Lowest",iw="A-Z",lw="Z-A";function sw(){const[e,t]=d(void 0),n=o(()=>{if(e&&(e.orderBy||e.direction))return e},[e]);return{sortInstance:e,setSortInstance:e=>{(function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in bs)??!1,n=(e.direction&&e.direction in ys)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const cw=lr({base:{width:"15px",height:"15px",borderRadius:"sm",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,position:"relative","&::before":{content:"''",position:"absolute",top:"-10px",left:"-10px",right:"-10px",bottom:"-10px"},_supportHover:{"&[data-is-checked='false']":{backgroundColor:"surface.background.hover"}}},variants:{checked:{true:{background:"brand.primary.strong",border:"none",color:"icon.contrast"},false:{border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}},disabled:{true:{background:"surface.foreground.disabled",borderColor:"border.layout",cursor:"not-allowed",_supportHover:{"&[data-is-checked='false']":{backgroundColor:"surface.foreground.disabled"}}}}}});function dw({checked:e,onClick:t,Icon:n=ep,disabled:r=!1}){const[a,o]=d(e??!1),i=void 0===e?a:e;return I("button",{...fr(cr["checkbox-input"],cw({checked:i,disabled:r}),cl),type:"button",onClick:n=>{void 0===e&&o(!a),t&&t(n)},disabled:r,"data-is-checked":i,children:i&&I(Rc,{Component:n})})}const uw=fr(null,rr({paddingLeft:"20px",paddingRight:"5px"}));function hw({checked:e,onClick:t,Icon:n=ep,disabled:r}){return I("div",{...uw,children:I(dw,{checked:e,onClick:t,Icon:n,disabled:r})})}const pw=fr(cr["date-cell"],rr({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function gw({date:e,annotation:t}){const n=St(Rt(e));return R("div",{...pw,children:[t&&I(yy,{children:t}),I(uc,{children:n})]})}const mw="Income",vw={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},fw={EXPENSE:"Expense",REVENUE:mw,TRANSFER_IN:"Bank Transfer In",TRANSFER_OUT:"Bank Transfer Out"},bw={Expense:[{name:fw.EXPENSE,value:vw.EXPENSE}],Income:[{name:fw.REVENUE,value:vw.REVENUE}],Transfer:[{name:fw.TRANSFER_IN,value:vw.TRANSFER_IN},{name:fw.TRANSFER_OUT,value:vw.TRANSFER_OUT}]},yw={EXPENSE:"Expense",REVENUE:mw,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},ww=Object.fromEntries(Object.entries(yw).map(([e,t])=>[e,`Add ${t}`])),Cw=Object.fromEntries(Object.entries(yw).map(([e,t])=>[e,`Edit ${t}`])),xw=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},Tw=e=>e===vw.TRANSFER_IN||e===vw.TRANSFER_OUT,kw=rr({color:"money.negative"}),Ew=rr({color:"money.positive"}),Aw=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>Nr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),Sw=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!dr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:kw};const t=e.amount>0;let n;return n=t?"Expense Refund":e.children?.length>0?"Split Expense":"Expense",{type:"EXPENSE",displayName:n,css:t?Ew:kw}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":mw,css:t?kw:Ew}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?kw:Ew};break;default:t=(e=>({type:e.type,displayName:Aw(e.type),css:e.amount<0?kw:Ew}))(e)}var n;return t},Iw=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 10.625H7.5C5.8424 10.625 4.25269 9.96652 3.08058 8.79442C1.90848 7.62231 1.25 6.0326 1.25 4.375V0.625",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M10 14.375L13.75 10.625L10 6.875",stroke:"currentColor",strokeMiterlimit:10})),"ChildRow"),Nw=fr(cr["transaction-date-cell-container"],rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function Rw({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=Sw(e),a=fr(cr["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?R("div",{...Nw,children:[I(Pd,{Component:Iw}),I(gw,{date:e.date,annotation:o})]}):I(gw,{date:e.date,annotation:o})}const Pw=rr({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),Dw=rr({display:"flex",flexDirection:"column",width:"100%"}),Mw=rr({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function Lw({iconUrl:e,iconSpacing:t}){return void 0!==e?I("img",{src:e,className:Mw,alt:void 0,width:24,height:24}):t?I("span",{className:Mw}):null}function Fw({label:e,subLabel:t,iconUrl:n,iconSpacing:r=!0}){return R("div",{className:Pw,children:[I(Lw,{iconUrl:n,iconSpacing:r}),R("div",{className:Dw,children:[I(uc,{children:e}),I(So,{children:t})]})]})}function Ow({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:rr({paddingLeft:"25px"}),children:I(Fw,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I(Fw,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}const Vw=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.10632H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.69366H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.28131H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8687H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.71875 10.4749L3.33125 12.8686L0.9375 10.4749",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 1.50635V12.8688",stroke:"currentColor",strokeMiterlimit:10})),"NestedRows"),Uw=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.9187 2.13135H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 5.71851H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 9.30682H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M6.9187 12.8934H14.6875",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M0.9375 4.5251L3.33125 2.13135L5.71875 4.5251",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M3.33118 13.4938V2.13135",stroke:"currentColor",strokeMiterlimit:10})),"NestedRowsExpanded"),Bw=rr({display:"flex",alignItems:"center",gap:"8px"}),Hw=rr({padding:"6px"});function Ww({amount:e,canExpand:t=!1,isExpanded:n=!1}){return t?I(qc,{ariaLabel:n?"Collapse children":"Expand children",ariaExpanded:n,children:R("div",{className:Bw,children:[I(Pd,{Component:n?Uw:Vw}),I(Du,{children:e})]})}):I("div",{className:Hw,children:I(Du,{children:e})})}const _w=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 1.25L1.25 13.75",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M13.75 9.84375V1.25H5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Withdraw"),zw=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.75 13.75L1.25 1.25",stroke:"currentColor",strokeMiterlimit:10}),r.createElement("path",{d:"M5.15625 13.75H13.75V5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Deposit"),jw=rr({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),qw=rr({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function Kw({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return _w;case"Deposited to":return zw;default:return null}})(e);return R("div",{className:jw,children:[n&&I(Pd,{Component:n}),R("div",{className:qw,children:[e&&I(So,{children:e}),t&&I(uc,{children:t})]})]})}const Yw={id:"mock_task_link_bank",priority:"HIGH",name:"Link your bank account",description:"Effortlessly track every dollar by linking your bank account",shortDescription:"Link your bank to track every dollar",type:"LINK_BANK",dismissable:"DISMISSABLE",status:"ACTIVE"};function Zw(e,t=!0){const n=Sh({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return{id:`${e.apiInstitutionName??"unknown"}_${e.id}_${e.apiErrorCode}_bank_error_task`,priority:"URGENT",name:n?.shortMessage(e.apiInstitutionName??"your bank")||"",description:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!1,apiPartnerName:""})||"",shortDescription:t&&"RELINK"===n?.buttonType&&n?.longMessage({apiInstitutionName:e.apiInstitutionName??"your bank",isMobile:!0,apiPartnerName:""})||"",type:n?.buttonType||"CHAT",dismissable:"DISMISSABLE",status:"ACTIVE",meta:{plaidItem:e}}}function Gw(){return zu({filter:{status:{equal:"ACTIVE"}}},{select:e=>({multiAccountIntegrations:e.data?.filter(e=>["PLAID","UNIT"].includes(e.apiName))||[],integrations:e.data?.filter(e=>!["PLAID","UNIT"].includes(e.apiName))||[],cursor:e.cursor})})}const Qw={LINK_BANK:"LINK_BANK",RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT",MESSAGE_REVIEW:"MESSAGE_REVIEW",TRANSACTION_REVIEW:"TRANSACTION_REVIEW",BANK_ERROR:"BANK_ERROR",RULE_REVIEW:"RULE_REVIEW",CSV_IMPORT_REVIEW:"CSV_IMPORT_REVIEW"},Xw=e=>["tasks",e??{}],Jw={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},$w={filter:{status:{in:["ACTIVE"]}}},eC=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:ki(t[2].environment)},a=await Ma(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function tC(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=dr(r=e)||dr(r.data)?[]:[...r.data].sort((e,t)=>Jw[e.priority]-Jw[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=$w,Br({...r,queryKey:a?Xw(a):["tasks",{}],queryFn:eC}));var r,a;const{query:{data:i},isFilling:l}=lm(),{query:{data:s},isFilling:c}=ju({select:e=>({...e,data:e?.data?.filter(({status:e,apiErrorType:t,apiErrorCode:n})=>"ACTIVE"===e&&t&&n)})});return{taskBanners:o(()=>{let e=[];const n=s?.data;n&&(e=n.map(e=>Zw(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[Yw]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const nC=e=>{const t=$i[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},rC=e=>["banks/transactions/summary",e],aC=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:ki(t[2].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},oC=(e,t)=>["generalLedger",e,t],iC=async e=>{const t=e.queryKey,n={path:"/v6/accounting/glAccounts/{id}/generalLedger",pathParams:{id:t[1]},bodyParams:{...t[2],cursor:t[3].cursor},accessToken:t[4].accessToken,endpointManager:ki(t[4].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor,beginningBalance:r.beginningBalance}:{data:void 0,cursor:void 0,beginningBalance:void 0}},lC=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>dC({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),sC=async({data:e,accessToken:t,environment:n})=>dC({data:{data:e},accessToken:t,environment:n}),cC=async({data:e,accessToken:t,environment:n})=>sC({data:[e],accessToken:t,environment:n}),dC=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:ki(n)};return await Ma(r)};function uC(){return xa("mutation successful, invalidating BT queries"),Promise.all([Or.invalidateQueries({queryKey:["banks/transactions"]}),Or.invalidateQueries({queryKey:["banks/transactions/summary"]}),Or.invalidateQueries({queryKey:["tasks"]}),Or.invalidateQueries({queryKey:["reports"]}),Or.invalidateQueries({queryKey:["generalLedger"]})]).catch(e=>Ta({error:e,severity:"error"}))}function hC(){return gC({mutationFn:cC,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}})}function pC({mutationKey:e=["banks/transactions"],...t}){return tv({onSuccess:()=>uC(),mutationKey:e,...t})}function gC({mutationKey:e=["banks/transactions"],...t}){return tv({onSuccess:()=>uC(),mutationKey:e,...t})}function mC(){return pC({mutationFn:sC,meta:{toastOptions:{defaultSuccessMessage:(e,t)=>1===t.length?"Transaction deleted":`${t.length} transactions deleted`,defaultErrorMessage:e=>1===e.length?"Couldn't delete transaction":"Couldn't delete transactions",defaultPartialMessage:"Some transactions couldn't be deleted"}}})}function vC(){return pC({mutationFn:sC,meta:{toastOptions:{defaultErrorMessage:"Couldn't update categories"}}})}const fC=()=>["accounting/glAccounts"],bC=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await Ii(n);return xC(r)};function yC(e){return Br({...e,queryKey:["accounting/glAccounts"],queryFn:bC})}function wC(e){return e.filter(e=>"ACTIVE"===e.status)}function CC(e){return yC({select:t=>AC(e?wC(t):t).flatMap(e=>[e,...e.children])})}const xC=e=>e.map(e=>({...e,id:us({id:e.id,prefix:"GL_ACCOUNT"})}));function TC(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentAccountNo){const e=t.get(n.parentAccountNo)??[];e.push(n),t.set(n.parentAccountNo,e)}return t}function kC(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>kC(e,t))}const EC=e=>!e.parentAccountNo;function AC(e){const t=TC(e);return e.filter(EC).map(e=>({...e,children:kC(e,t)}))}function SC(e,t){return(t.get(e)??[]).map(e=>{const n=SC(e.accountNo,t);return{...e,children:n}})}function IC(e){const t=TC(e);return e.filter(EC).map(e=>({...e,children:SC(e.accountNo,t)}))}function NC(){return yC({select:IC})}const RC=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function PC(e,t){return o(()=>void 0===t?e??[]:e?.filter(e=>t.includes(e.type))??[],[e,t])}const DC=rr({maxWidth:"100%",width:"fit-content",display:"inline-flex",justifyContent:"center",alignItems:"center",gap:"5px",borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.layout",background:"surface.background","& .Tight-sub-label":{color:"typography.base"},"& .Tight-icon > path":{stroke:"icon.base"}}),MC=or(DC,rr({padding:"2.5px"})),LC=or(DC,rr({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),FC=rr({background:"surface.intent.secondary",border:"{borderWidths.sm} solid",borderColor:"border.intent.secondary","& .Tight-sub-label":{color:"typography.intent.secondary"},"& .Tight-label":{color:"typography.intent.secondary"},"& .Tight-icon > path":{stroke:"icon.intent.secondary"}}),OC=or(FC,rr({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),VC=rr({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.action",background:"surface.intent.action","& .Tight-sub-label":{color:"typography.intent.action"},"& .Tight-label":{color:"typography.intent.action"},"& .Tight-icon > path":{stroke:"icon.intent.action"},_supportHover:{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.action.hover",borderColor:"border.intent.action.hover","& .Tight-sub-label":{color:"typography.intent.action.hover"},"& .Tight-label":{color:"typography.intent.action.hover"},"& .Tight-icon > path":{stroke:"icon.intent.action.hover"}}}),UC=or(VC,rr({_supportHover:{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.secondary.hover",borderColor:"border.intent.secondary.hover","& .Tight-sub-label":{color:"typography.intent.secondary.hover"},"& .Tight-label":{color:"typography.intent.secondary.hover"},"& .Tight-icon > path":{stroke:"icon.intent.secondary.hover"}}})),BC=rr({borderRadius:"sm",border:"{borderWidths.md} solid",borderColor:"border.intent.success",background:"surface.intent.success","& .Tight-sub-label":{color:"typography.intent.success"},"& .Tight-label":{color:"typography.intent.success"},"& .Tight-icon > path":{stroke:"icon.intent.success"}}),HC=or(BC,rr({_supportHover:{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.success.hover",borderColor:"border.intent.success.hover","& .Tight-sub-label":{color:"typography.intent.success.hover"},"& .Tight-label":{color:"typography.intent.success.hover"},"& .Tight-icon > path":{stroke:"icon.intent.success.hover"}}})),WC=rr({background:"surface.intent.warning",border:"{borderWidths.sm} solid",borderColor:"border.intent.warning","& .Tight-sub-label":{color:"typography.intent.warning"},"& .Tight-label":{color:"typography.intent.warning"},"& .Tight-icon > path":{stroke:"icon.intent.warning"}}),_C=or(WC,rr({_supportHover:{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.warning.hover",borderColor:"border.intent.warning.hover","& .Tight-sub-label":{color:"typography.intent.warning.hover"},"& .Tight-label":{color:"typography.intent.warning.hover"},"& .Tight-icon > path":{stroke:"icon.intent.warning.hover"}}})),zC=rr({background:"surface.intent.danger",border:"{borderWidths.sm} solid",borderColor:"border.intent.danger","& .Tight-sub-label":{color:"typography.intent.danger"},"& .Tight-label":{color:"typography.intent.danger"},"& .Tight-icon > path":{stroke:"icon.intent.danger"}}),jC=or(zC,rr({_supportHover:{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}},"&:focus-visible, &[data-state='open']":{background:"surface.intent.danger.hover",borderColor:"border.intent.danger.hover","& .Tight-sub-label":{color:"typography.intent.danger.hover"},"& .Tight-label":{color:"typography.intent.danger.hover"},"& .Tight-icon > path":{stroke:"icon.intent.danger.hover"}}})),qC=rr({display:"flex",alignItems:"center",gap:"8px",height:"37px",margin:"0 8px",padding:"10px",borderRadius:"sm",cursor:"pointer",minWidth:0,outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}}),KC={default:OC,neutral:OC,warning:_C,success:HC,danger:jC,highlight:UC},YC=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=Tr([fr(cr["selector-button"],or(qC,KC[e]),cl),...n]);return I("button",{ref:a,...o,...r,children:t})}),ZC={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function GC(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function QC(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.accountNo===l.accountNo))),o=!a&&r.children?.length>0,i=!(a||r.children&&0!==r.children.length);var l;o?function(e,t){e.children.forEach(n=>{GC(e,n,t)})}(r,n):a?GC(a,r,n):i&&GC(r,r,n)}),n}const XC=[fr(null,rr({marginLeft:"6px",marginRight:"6px"}))],JC=fr(null,rr({whiteSpace:"normal"}));function $C({types:e,activeOnly:t,onClick:n,searchTerm:r}){const{query:{data:a},isFilling:i}=CC(t),l=PC(a,e),s=o(()=>new Ae(l,ZC),[l]),c=o(()=>QC(s.search(r),l),[l,r,s]);return i?I(Qg,{}):c.map(({parent:e,child:t})=>I(qg,{onClick:()=>n(t),children:R(so,{stylists:[JC],children:[e.name,I(ul,{Component:ol,stylists:XC}),t.name]})},`${t.accountNo}`))}const ex=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=ve([a,t?.ref]);return I(jg,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function tx({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=i(Vg),{itemRef:o,index:l,itemProps:s}=zg({hasCascading:!0}),{isScrolling:c}=i(Pg);return R(Ac,{open:n===l,onOpenChange:e=>{c||r(e,l)},placement:"right-start",children:[I(Ic,{children:t=>I(ex,{itemProps:s,index:l,ref:o,popupTriggerProps:t,children:e})}),I(Uc,{initialFocus:a,children:t})]})}const nx=rr({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),rx=rr({display:"flex",gap:"8px",color:"icon.base"});function ax({Icon:e,iconUrl:t,displayLabel:n}){const r=t?Em(t,"Icon"):void 0;return R("div",{className:nx,children:[R("div",{className:rx,children:[!dr(e)&&e,dr(e)&&r&&I(Pd,{Component:r}),I(uc,{wrap:"wrap",children:n})]}),I(ul,{Component:ol})]})}function ox({types:e,activeOnly:t,onClick:n}){const{query:{data:r,isFetching:a},isFilling:o}=(l=t,yC({select:e=>AC(l?wC(e):e)})),i=PC(r,e);var l;return o?I(Qg,{}):o||a||void 0!==r?i.map(e=>I(tx,{triggerChildren:I(ax,{displayLabel:e.name}),popupChildren:I(ix,{glAccount:e,onClick:n})},e.accountNo)):I(Zg,{text:"No data"})}function ix({glAccount:e,onClick:t}){return I(Ug,{children:e.children.map(e=>I(qg,{onClick:()=>t(e),children:I(uc,{children:e.name})},e.accountNo))})}const lx=rr({maxWidth:"420px",width:"fit-content"});function sx({onClick:e,types:t,activeOnly:n,placeholder:r="Search accounts..."}){return I(_g,{onClick:e,placeholder:r,getSearchActiveStyles:e=>e?lx:void 0,SearchList:$C,DefaultList:ox,extraProps:{types:t,activeOnly:n},listLength:0,forceSearchVisible:!0})}const cx=fr(cr["category-selector-table-cell"]);function dx({accountName:e,iconUrl:t,onChange:n,types:r,activeOnly:a,placeholder:o}){const{startPrefetch:i,cancelPrefetch:l}=Il({prefetchFn:Tl(fC,bC)}),s=dr(t)?void 0:Em(t,"");return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:t=>R(YC,{...t,stylists:[cx],onMouseEnter:i,onMouseLeave:l,children:[s&&I(Pd,{Component:s}),I(uc,{children:e})]})}),I(sx,{onClick:n,types:r,activeOnly:a,placeholder:o})]})}function ux({transaction:e,parentTransaction:t,accountName:n}){const{mutate:r}=hC(),a=void 0!==t;return I(dx,{accountName:n,iconUrl:e.glAccount?.iconUrl,onChange:a?n=>{if(n?.id&&a){const{id:a,children:o}=t,{id:i}=e,l=o.map(e=>e.id===i?{...e,glAccountId:n.id.toString()}:e);r({id:a,children:l})}}:t=>{r({id:e.id,glAccountId:t.id})},types:RC,placeholder:"Search revenue accounts..."})}const hx=e=>e>0?"Deposited to":"Withdrawn from",px=bi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.31676 1.37476L1.67926 4.01226L4.31676 6.64976",strokeMiterlimit:10}),r.createElement("path",{d:"M12.2292 6.64976L14.8667 4.01226L12.2292 1.37476",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 7.85619 5.91297 7.11425 5.17103C6.37231 4.42909 5.36602 4.01227 4.31676 4.01227H1.67926",strokeMiterlimit:10}),r.createElement("path",{d:"M8.27301 14.5623V7.96852C8.27301 6.91926 8.68983 5.91297 9.43177 5.17103C10.1737 4.42909 11.18 4.01227 12.2293 4.01227H14.8668",strokeMiterlimit:10})),"Split"),gx=e=>({id:e.id,name:e.name});function mx(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:uh("Category","Categories",n.size,!0),list:[...n].join(", ")}}const vx=fr(null,rr({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),fx=fr(null,rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function bx({transaction:e}){const{label:t,list:n}=mx(e.children);return I(cc,{children:R("div",{...fx,children:[I(Pd,{Component:px}),R("div",{...vx,children:[I(Eo,{children:t}),I(So,{children:n})]})]})})}const yx=()=>["expenses/categories"],wx=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await Ii(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:us({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?us({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function Cx(e){return Br({...e,queryKey:["expenses/categories"],queryFn:wx})}function xx(){return Cx({select:e=>({...e,data:e.data?Ix(e.data):void 0})})}function Tx(e,t){return(t.get(e)??[]).map(e=>{const n=Tx(e.id,t);return{...e,children:n.length>0?n:void 0}})}function kx(e){if(0===e.length)return[];const t=Ax(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=Tx(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Ex(){return Cx({select:e=>({...e,data:e.data?kx(e.data):void 0})})}function Ax(e){const t=/* @__PURE__ */new Map;for(const n of e)if(n.parentCategoryId){const e=t.get(n.parentCategoryId)??[];e.push(n),t.set(n.parentCategoryId,e)}return t}function Sx(e){if(0===e.length)return[];const t=Ax(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function Ix(e){if(0===e.length)return[];const t=Ax(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function Nx(){return Il({prefetchFn:Tl(yx,wx)})}const Rx={keys:[{name:"name"}],threshold:.1};function Px(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Dx(e,t){const n=[];return e.forEach(e=>{const r=e.item,a=(l=r,t.find(e=>e.children?.some(e=>e.id===l.id))),o=!(a||0!==r?.children?.length&&r.children),i=!a&&r.children&&r.children.length>0;var l;a?Px(a,r,n):o?Px(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Px(e,n,t)})}(r,n)}),n}const Mx=fr(null,rr({whiteSpace:"normal"})),Lx=[fr(null,rr({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function Fx({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=Cx({select:e=>({...e,data:e.data?Sx(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ae(i??[],Rx),[i]),c=o(()=>i?Dx(s.search(e),i):[],[i,e,s]);return a?I(Qg,{}):l?I(Zg,{text:"No data"}):0===c.length?I(Zg,{text:"No results found"}):I(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=Em(n.iconUrl,"Expense Icon");return R(qg,{onClick:()=>t(gx(n)),children:[I(Pd,{Component:a}),I(so,{stylists:[Mx],children:r?n.name:R(N,{children:[e.name,I(ul,{Component:ol,stylists:Lx}),n.name]})})]},`${e.id}_${n.id}`)})})}function Ox({category:e,handleCategoryChange:t}){return I(Ug,{children:e.children?.map(e=>{const n=Em(e.iconUrl,"Expense Icon");return R(qg,{onClick:()=>t(gx(e)),children:[I(Pd,{Component:n}),I(uc,{wrap:"wrap",children:e.name})]},e.id)})})}function Vx({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=xx(),a=t?.data,o=!r&&n&&void 0===a;return r?I(Qg,{}):o?I(Zg,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(tx,{triggerChildren:I(ax,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(Ox,{category:t,handleCategoryChange:e})},t.id);const n=Em(t.iconUrl,"Expense Category Icon");return R(qg,{onClick:()=>e(gx(t)),children:[I(Pd,{Component:n}),I(uc,{wrap:"wrap",children:t.name})]},t.id)})})}const Ux=({onClick:e})=>{const{query:{data:t}}=xx();return I(_g,{onClick:e,placeholder:"Search expense categories...",SearchList:Fx,DefaultList:Vx,listLength:(t?.data??[]).length})},Bx=fr(cr["category-selector-table-cell"]);function Hx({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=Nx(),a=e.category?.name??"",{mutate:o}=hC(),i=void 0!==t,l=dr(e.category?.iconUrl)?void 0:Em(e.category.iconUrl,"Expense Icon");return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>R(YC,{...e,stylists:[Bx],onMouseEnter:n,onMouseLeave:r,children:[l&&I(Pd,{Component:l}),I(uc,{children:a})]})}),I(Ux,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,categoryId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{t?.id&&o({id:e.id,categoryId:t.id.toString()})}})]})}function Wx({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(bx,{transaction:e});switch(xw(e.type)){case"EXPENSE_CATEGORY":return I(Hx,{transaction:e,parentTransaction:t});case"TRANSFER":return I(Kw,{annotation:hx(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return Ta({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(ux,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function _x({name:e}){return I(N,{children:e&&I(uc,{children:e})})}function zx({onClick:e}){const t=Sc(),n=qi();return I(Uc,{children:I(Ug,{children:n.map(({status:n,displayName:r})=>I(qg,{onClick:()=>(e(n),void t.close()),children:I(uc,{children:r})},n))})})}const jx=fr(cr["review-status-selector-button"],rr({width:"151px",justifyContent:"center"})),qx=fr(cr["review-status-dropdown-arrow"],rr({display:"none"}));function Kx({status:e,transactionId:t}){const[n,r]=d(!1),{mutate:a}=hC(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:c}=Yi(e);return t&&((u=t).startsWith(cs.TRANSACTION_LINE_ITEM)||u.startsWith(cs.PROCESSOR_TRANSACTION))?null:R(Ac,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(Ic,{children:e=>R(YC,{variant:s,...e,stylists:[jx],onClick:i,children:[I(Pd,{Component:c}),I(uc,{children:l}),I("div",{...qx,children:I(ul,{Component:Up})})]})}),I(zx,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function Yx({status:e,transactionId:t}){return I(Kx,{status:e,transactionId:t},t)}function Zx({isMutating:e}){return e?I(ip,{}):I(Pd,{Component:ol})}function Gx({isMutating:e}){return I(Zx,{isMutating:e})}const Qx=e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.495239 8.15601H14.7767",strokeMiterlimit:10})),Xx=bi(Qx,"Dash"),Jx=fr(null,rr({stroke:"icon.base.weak"}));function $x({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(Qd,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(Rc,{Component:Xx,stylists:[Jx]})})})}function eT({conversationId:e}){const{query:{data:t}}=Ol(e??null),{startPrefetch:n,cancelPrefetch:r}=Ul(),{startPrefetch:a,cancelPrefetch:o}=Ds(),i=ur(t),l=i&&"READ"===t?.readStatus,s=u(()=>{ur(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=u(()=>{ur(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I($x,{hasConversation:i,hasUnread:!l})})}function tT(e){return Co(hh(e.amount))}const nT=fr(cr["badge-chip"],MC),rT=fr(null,ao),aT=fr(null,cl),oT=fr(cr["neutral-badge"],FC),iT=fr(cr["highlight-badge"],VC),lT=fr(cr["success-badge"],BC),sT=fr(cr["warning-badge"],WC),cT=fr(cr["danger-badge"],cr["critical-badge"],zC);function dT({type:e,children:t}){let n;switch(e){case"danger":n=cT;break;case"warning":n=sT;break;case"neutral":n=oT;break;case"success":n=lT;break;case"highlight":n=iT}const r=Tr([nT,rT,n,aT]);return I("div",{...r,children:t})}function uT({reviewStatus:e}){const{variant:t,Icon:n}=Yi(e);return I(dT,{type:t,children:I(Pd,{Component:n})})}const hT=rr({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),pT=rr({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),gT=rr({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),mT=rr({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),vT=rr({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),fT=rr({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function bT({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=mx(e.children);return`${t}: ${n}`}switch(xw(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${hx(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void Ta({error:new Error("Should not get here. Payout without line items."),severity:"error"});default:return e.glAccount?.name}}(t),r=void 0!==e.getParentRow();return R("div",{className:hT,children:[r&&I(Pd,{Component:Iw}),R("div",{className:vT,children:[R("div",{className:gT,children:[t.iconUrl?I("img",{src:t.iconUrl,className:fT,alt:void 0,width:24,height:24}):I("span",{className:fT}),I(Eo,{children:t.description})]}),R("div",{className:mT,children:[I(uT,{reviewStatus:t.reviewStatus}),I(So,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:pT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(Ww,{amount:tT(e.original),canExpand:e.getCanExpand(),isExpanded:e.getIsExpanded()}),I(ul,{Component:ol})]})]})}const yT=bi(Qx,"Minus");function wT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(hw,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?yT:ep})}const CT=J(),xT=[CT.display({id:gn.SELECT,header:({table:e})=>I(wT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(hw,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),CT.accessor("date",{id:gn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(cc,{children:I(Rw,{transaction:e.row.original,isChild:t})})},header:()=>I(Xc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:ew,sortDescDisplay:tw}),size:130,maxSize:144}),CT.accessor("description",{id:gn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(cc,{children:I(Ow,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(Xc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:nw,sortDescDisplay:rw}),size:180}),CT.accessor("amount",{id:gn.AMOUNT,cell:e=>I(cc,{alignVariant:"flexEnd",children:I(Ww,{amount:tT(e.row.original),canExpand:e.row.getCanExpand(),isExpanded:e.row.getIsExpanded()})}),header:()=>I(Xc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:aw,sortDescDisplay:ow,align:"right"}),size:130,maxSize:130}),CT.accessor("category.id",{id:gn.CATEGORY,cell:({row:e})=>I(Wx,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(Xc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),CT.accessor(e=>e.dimensionValues[0]?.id,{id:gn.DIMENSION_VALUE,cell:e=>I(cc,{children:I(_x,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>I(Xc,{columnName:"Business"}),size:130}),CT.accessor("reviewStatus",{id:gn.REVIEW_STATUS,cell:e=>I(cc,{children:I(Yx,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(Xc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:iw,sortDescDisplay:lw,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),CT.display({id:gn.COMMENTS,cell:e=>{const t=e.row.original;return I(cc,{alignVariant:"center",children:I(eT,{conversationId:t.conversation?.id})})},header:()=>I(Xc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),CT.display({id:gn.EXPAND,cell:e=>I("div",{className:rr({paddingRight:"20px"}),children:I(Gx,{isMutating:e.isMutating})}),size:40,maxSize:60})],TT=CT.display({id:"MOBILE",cell:e=>I(bT,{row:e.row})}),kT=l(!0);function ET(){return i(kT)}const AT=[];function ST({transactions:e,columns:t}){const n=ET(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(gn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[TT]:(i=t)?xT.filter(e=>i.includes(e.id)):xT;var i;return $({data:e??AT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??AT.length,columns:o,getCoreRowModel:ee(),getRowCanExpand:e=>e.original.children.length>0,getSubRows:e=>e.children.map(e=>{return t=e,{...t,iconUrl:t.iconUrl??"",reconciliationMatch:null,tax:{paymentInfo:null},customData:null,children:[],attachments:[],suggestedCategories:[],conversation:null,status:"ACTIVE"};var t}),getExpandedRowModel:te(),paginateExpandedRows:!1,getRowId:e=>e.id,meta:{editMutationKey:["banks/transactions"]},state:{columnOrder:r,columnVisibility:a}})}const IT=[gn.COMMENTS,gn.DATE,gn.DESCRIPTION,gn.AMOUNT,gn.CATEGORY,gn.REVIEW_STATUS];function NT({Component:e,stylists:t}){return I(e,{stylists:[fr(cr["xx-large-icon"],cr.icon),...t??[]],size:50})}function RT(){return R(N,{children:[I(NT,{Component:xi}),I(Eo,{wrap:"wrap",children:"All caught up"}),I(So,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function PT({children:e,stylists:t=[],...n}){return I($s,{intent:"warning",stylists:t,...n,children:e})}function DT({eventSource:e}){const{linkPlaid:t,loading:n}=hy();return I(PT,{...fr(cr["zero-state-button"]),onClick:()=>t({plaidEvent:Kb,message:"Plaid Link button pressed"}),disabled:n,eventSource:e,children:I(Eo,{children:"Link your bank"})})}function MT({eventSource:e}){return R(N,{children:[I(NT,{Component:ym}),I(Ar,{children:"Link Bank Account"}),I(So,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(DT,{eventSource:e})]})}const LT=rr({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function FT(){return R(N,{children:[I("div",{className:LT,children:I(NT,{Component:Ci})}),I(Ar,{children:"Transactions are being processed"}),I(So,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}function OT(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,s(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const i=o(()=>{const a=T(e,t,n),o=(...e)=>a(...e);return o.cancel=()=>{a.cancel()},o.isPending=()=>!!r.current,o.flush=()=>a.flush(),o},[e,t,n]);return s(()=>{r.current=T(e,t,n)},[e,t,n]),i}function VT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=d(e),[a,o]=d(!1);s(()=>{r(e)},[e]);const i=OT(u(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const UT=fr(cr["filter-bar"],rr({display:"flex",padding:"16px",flexDirection:"column",alignItems:"flex-start",gap:"8px",flex:"1 0 0",borderRadius:"2px",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:0,xl:{display:"flex",flex:"1 0 0",flexDirection:"column",height:"35px",padding:"0 10px",justifyContent:"center",alignItems:"flex-start",gap:"10px",borderRadius:"sm",background:"surface.background"}})),BT=fr(cr["filter-search-bar"],rr({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),HT=fr(null,rr({color:"icon.base",flexShrink:0,marginRight:"15px"})),WT=fr(null,rr({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"template",display:"flex",flex:"1 0 0",flexDirection:"column",justifyContent:"center",height:"100%",minWidth:0,padding:0,fontFamily:"label",_placeholder:{color:"typography.base.weak"},xl:{fontSize:"14px",lineHeight:"template"}})),_T=rr({width:25});function zT({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=VT({debouncedValue:t,onChangeDebouncedValue:e});return I("div",{...UT,children:R("div",{...BT,children:[I("div",{className:_T,children:n||i?I(ip,{}):I(Pd,{stylists:[HT],Component:Xv})}),I("input",{...WT,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Np})]})})}const jT=fr(cr["date-amount-header"],rr({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function qT({formattedDate:e,formattedSum:t}){return R("div",{...jT,children:[I(Eo,{wrap:"wrap",children:e}),I(Du,{children:t})]})}function KT(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=Tw(e.row.original.type),o="category"===e.column.id&&(r||a),i="comments"===e.column.id,l="amount"===e.column.id;if(i){const e=t.getParentRow();gs(e?.original??t.original,{initialTab:"conversation"})}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();gs(e?.original??t.original)}}function YT({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=As(),a=u(()=>n({id:e.original.id}),[n,e.original]),o=u(()=>{gs(e.original)},[e.original]);return I(os,{rowData:e,onMouseEnter:a,onMouseLeave:r,onRowClick:o,onCellClick:KT,shouldDisplayDivider:n=>{return r=n,a=t,o=e.getVisibleCells().length,!(0===r||a&&1===r||r===o-1||a||1===r);var r,a,o}})}function ZT({rows:e}){const t=o(()=>function(e){return Array.from(function(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=n.original.date;if(t.has(e)){const r=t.get(e);r&&(r.netSumCents+=n.original.amount,r.formattedSumDollars=Co(hh(r.netSumCents)),r.rows.push(n))}else{const r=Rt(e);t.set(e,{date:e,formattedDate:r?St(r):e,netSumCents:n.original.amount,formattedSumDollars:Co(hh(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>R(f,{children:[I(qT,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(YT,{rowData:e},e.id))]},e.date))})}function GT({table:e,hasSelect:t}){const n=ET();return I(Zl,{editMutationKey:e.options.meta?.editMutationKey,children:I(jl,{children:n?I(ZT,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(YT,{rowData:e,hasSelect:t},e.id))})})}function QT(e){return e?"Search":"Search transactions..."}function XT(e,t){const n=/* @__PURE__ */new Map;return t.forEach(t=>{const r=t.selectedValues(e);r.length>0&&n.set(t.key,[...r])}),n}function JT(e,t){return e.get(t)??[]}function $T(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function ek(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function tk(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function nk({buttonText:e,onButtonClick:t}){return R(N,{children:[I(Sd,{Component:of}),I(Eo,{children:"No results"}),I(So,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(qc,{onClick:t,children:e})]})}const rk=rr({xl:{minWidth:"900px"}}),ak=rr({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function ok({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){Od(Ji);const c=function({transactions:e}){return function({transactions:e,columns:t}){return ST({transactions:e,columns:t?[...t,gn.EXPAND]:void 0})}({transactions:e,columns:IT})}({transactions:i}),{query:{data:d},isFilling:u}=Ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=ET(),p=!dr(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(nk,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(RT,{})):a=I(FT,{}):a=I(MT,{eventSource:"FinancialOverviewTransactionsTableZeroState"}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:rk,children:[I("div",{id:Ji}),R(dl.Provider,{value:o,children:[R(wr,{children:[I(Ar,{children:"Transactions for review"}),I(Ud,{children:I(vl,{})})]}),I(oc,{dashboard:"financialOverviewDashboard",children:r?I(xl,{}):R(N,{children:[!h&&I("div",{className:ak,children:I(zT,{placeholder:QT(h),searchTerm:l,onChange:s,isFetching:a})}),I(ic.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(_l,{headerGroups:c.getHeaderGroups()})}),dr(g)?I(GT,{table:c,hasSelect:!1}):I(Ed,{children:g})]})})]})]})}function ik(){const[e,t]=d(""),{sortInstance:n,setSortInstance:r,apiSort:a}=sw(),o={...(()=>{const e=Gi();return{...el,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=Ts({filter:o,sort:a,limit:10}),u=i?.data??nl,{hasPlaidLinkedBankAccount:h,isFilling:p}=im();return I(ok,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:c,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const lk=fr(null,rr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function sk({children:e}){return I("div",{...lk,children:e})}const ck=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:Nd,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:yi,buttonText:"Review"};case"LINK_BANK":return{Icon:ym,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:ym,buttonText:"Fix"};case"RELINK":return{Icon:ym,buttonText:"Relink"};case"CHAT":return{Icon:wi,buttonText:"Learn more"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:xi,buttonText:""};default:return{Icon:wi,buttonText:""}}},dk=fr(cr["banner-title"],rr({display:"flex",alignItems:"center",gap:"8px"})),uk=fr(cr["banner-icon"],rr({width:"20px",height:"20px"}));function hk({title:e,type:t}){const{Icon:n}=ck(t);return R("div",{...dk,children:[I(Pd,{Component:n,stylists:[uk]}),I(Eo,{wrap:"wrap",children:e})]})}const pk=fr(null,rr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",color:"icon.base",gap:{base:"4px",xl:"5px"},flex:{xl:"1 1 0"},minWidth:{xl:"200px"},width:"100%"}));function gk({title:e,description:t,type:n}){return R("div",{...pk,children:[I(hk,{title:e,type:n}),I(So,{wrap:"wrap",children:t})]})}const mk=cr["banner-button"],vk=rr.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),fk=fr(cr["banner-button-text"]),bk=fr(cr["banner-button-icon"]);function yk({priority:e,type:t,handleClick:n,eventSource:r}){const{buttonText:a}=ck(t),o=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return R($s,{onClick:n,intent:o,styles:vk,className:mk,eventSource:r,children:[I(Eo,{stylists:[fk],children:a}),I(ul,{stylists:[bk],Component:ol})]})}const wk=lr({base:{display:"flex",flexDirection:{base:"column",xl:"row"},padding:{base:"16px",xl:"15px"},gap:{base:"16px",xl:"0"},justifyContent:{xl:"space-between"},alignItems:{base:"flex-start",xl:"center"},alignSelf:"stretch",width:{base:"100%",xl:"auto"},minWidth:{xl:"350px"},borderRadius:{base:"sm",xl:"lg"},border:"1px solid",backgroundColor:"surface.foreground"},variants:{priority:{HIGH:{borderColor:"border.intent.warning"},MEDIUM:{borderColor:"border.intent.action"},LOW:{borderColor:"border.intent.success"},URGENT:{borderColor:"border.intent.danger"},DEFAULT:{borderColor:"border.intent.secondary"}}}}),Ck={HIGH:cr["banner-high"],MEDIUM:cr["banner-medium"],LOW:cr["banner-low"],URGENT:cr["banner-urgent"]};function xk({task:e,handleClick:t,eventSource:n}){const{name:r,description:a,shortDescription:o,type:i,priority:l}=e,s=ET()?o:a,c=fr(cr.banner,Ck[l],wk({priority:l}));return R("div",{...c,children:[I(gk,{title:r,description:s,type:i}),I(yk,{priority:l,type:i,handleClick:t,eventSource:n})]})}function Tk(e,t){ps(hn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation",{routeProps:{conversationId:null,defaultValues:{message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}}}}))}function kk(e,t,n,r,a){return()=>dh({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function Ek(e){const{mutateAsync:t}=cy(),n=Mr(),r=Ur(),{apiPartnerName:a}=i(ed),o=ET(),{linkPlaid:l,loading:s,hasOnPlaidLinkOverride:c}=hy(),{linkPlaid:d,loading:u}=hy(),h=Jb(),p=ur(e)?function(e){const t=Sh({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return ur(t)?t:Ih(e)?Ah.ADDITIONAL_CONSENT_REQUIRED.DEFAULT:null}(e):null;if(dr(p)||dr(e))return null;const g="ITEM_LOCKED"===e.apiErrorCode;switch(p.buttonType){case kh.DELETE_OR_RELINK:case kh.RELINK:return s?null:(v=l,f=a,b=o,{alert:kk(p,(m=e).apiInstitutionName,f,b,[{key:Yu,label:"Cancel"},{key:Gu,label:"Relink",type:ch.SUCCESS}]),actions:{success:()=>{v({plaidEvent:Zb,plaidItemId:m.id,apiAccessToken:m.apiAccessToken,apiErrorCode:m.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case kh.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:kk(e,t.apiInstitutionName,a,o,[{key:Yu,label:"Cancel"},{key:kh.CHAT,label:"Chat"},{key:Gu,label:"Unlink and Relink",type:ch.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:Yb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[kh.CHAT]:()=>Tk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,t,d,a,o,c);case kh.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l,s){return{alert:kk(e,t.apiInstitutionName,i,l,[{key:Yu,label:"Cancel"},{key:kh.CHAT,label:"Chat"},{key:kh.RELINK,label:"Relink"},{key:Gu,label:"Go To Bank",type:ch.SUCCESS}]),actions:{success:async()=>{const e=await Ku({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;ur(o)?ps(s,{type:"PLAID_LINK_ROUTE_TO_BANK",result:"SUCCESS",data:{bankUrl:o},error:null},()=>window.open(o,"_blank")):window.open(o,"_blank")},[kh.RELINK]:()=>{o({plaidEvent:Zb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[kh.CHAT]:()=>Tk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,g,n,r,l,a,o,h);case kh.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:kk(e,t.apiInstitutionName,a,o,[{key:Yu,label:"Cancel"},{key:Gu,label:"Unlink",type:ch.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:Gb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(p,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:kk(e,t,a,o,[{key:Yu,label:"Cancel"},{key:kh.CHAT,label:"Chat",type:ch.SUCCESS}]),actions:{[kh.CHAT]:()=>Tk(t,r)}}}(p,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var m,v,f,b}const Ak=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){Ta({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function Sk({task:e}){const{linkPlaid:t,loading:n}=hy(),{linkPlaid:r,loading:a}=py(),o=Ek(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&dr(o);if(i||l||s)return null;const c="LINK_BANK"===e.type?"FinancialOverviewLinkAccountBanner":"RELINK"===e.type?"FinancialOverviewRelinkAccountBanner":void 0;return I(xk,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:Zb,plaidItemId:e?.meta?.plaidItem?.id,apiAccessToken:e?.meta?.plaidItem?.apiAccessToken,apiErrorCode:e?.meta?.plaidItem?.apiErrorCode,message:"Fix Relink Bank Error button pressed"}):"LINK_BANK"===e.type?(xa("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Kb,message:"Plaid Banner Link Bank pressed"})):ur(o)&&(xa("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Ak(o))},eventSource:c})}const Ik=fr(cr.banner,cr["banner-default"],wk({priority:"DEFAULT"}));function Nk(){const e=ET()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...Ik,children:I(gk,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const Rk=fr(cr.banner,cr["banner-default"],wk({priority:"DEFAULT"}));function Pk(){const e=ET()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...Rk,children:I(gk,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Dk=rr({width:"100%",height:72,minWidth:"300px"});function Mk(){return R(N,{children:[I($o,{styles:Dk}),I($o,{styles:Dk}),I($o,{styles:Dk})]})}function Lk({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(Mk,{}):a?e.map(e=>void 0===Qw[e.type]?null:"LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(kh).includes(e.type)?I(Sk,{task:e},e.id):I(xk,{task:e,handleClick:()=>t(e.type)},e.id)):I(n?Pk:Nk,{})}const Fk=fr(cr["button-table-header"]),Ok=rr({height:{xl:"auto",base:"44px"}});function Vk(){const e=xh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:Ok,children:R(ec,{onClick:()=>{is(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[Fk],eventSource:"FinancialOverviewActionItemHeader",children:[I(ul,{Component:Ou}),I(yc,{children:"Banks & Integrations"})]})})}const Uk=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M1 3.5H14"}),r.createElement("path",{d:"M1 7.5H14"}),r.createElement("path",{d:"M1 11.5H14"})),"HamburgerNavMenu"),Bk=rr.raw({width:"44px",height:"44px"});function Hk(){return I(ec,{onClick:()=>is("NavMenu"),styles:Bk,children:I(Pd,{Component:Uk})})}const Wk=fr(cr["business-owner-dashboard-header"],rr(br,{flexDirection:{base:"column",xl:"row"},alignItems:{base:"stretch",xl:"center"},justifyContent:{base:"center",xl:"space-between"},height:{base:"auto",xl:"80px"},minHeight:"80px",gap:{base:"16px",xl:0}})),_k=rr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"});function zk(){return R("div",{...Wk,children:[R("div",{className:_k,children:[I(Hk,{}),I(Vk,{})]}),I(Ar,{children:"Action Items"})]})}const jk=()=>{const e=ET(),{isApp:t}=i(Fd);return e&&t};function qk({shouldFilterTasks:e=!1}){const t=jk(),{taskBanners:n,isFilling:r}=tC(e),a=Ss(),{query:{data:o}}=lm();return R(N,{children:[t?I(zk,{}):R(wr,{children:[I(Ar,{children:"Action Items"}),I(Vk,{})]}),I(sk,{children:I(Lk,{taskBanners:n,handleScrollAction:nC,isWaitingForPlaidItemAccountsSync:!a&&!0===o?.plaidItemAccountsReadyToSync,isFilling:r})})]})}const Kk=fr(cr["business-owner-dashboard"],rr({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),Yk=rr({display:"flex",width:"100%",justifyContent:"center"}),Zk={status:{in:["ACTIVE","INACTIVE"]}};function Gk({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=d(void 0);return{sortInstance:e,setSortInstance:u(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Nl)??!1,n=(e.direction&&e.direction in Rl)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:l,paginationControls:s}=Ll({limit:10,sort:a,filter:tl}),c=o?.data??rl,h=ET(),{hasBookkeeper:p}=i(ed),{initialPageProps:g}=i(Fd),{query:{data:m}}=lm(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=Ts({filter:Zk,limit:1});return(e?.data?.length??0)>0}(),m),f=/* @__PURE__ */new Date,b={month:f.getMonth(),year:f.getFullYear()};const[y,w]=kc(g?.period??b,e,t),C=(x=y.month,{beginDate:at((T=y.year)-1,x+1,1),endDate:at(T,x+1,0)});var x,T;return I("div",{className:Yk,children:R("div",{...Kk,children:[I(qk,{shouldFilterTasks:h}),!h&&R(N,{children:[I($y,{period:y,handleDateChange:e=>{var t,n;(t=b).year===(n=e).year&&n.month>t.month||n.year>t.year||w(e)},todayPeriod:b,showSamples:v,showLinkAccountButton:v&&!m?.plaidItemAccountsReadyToSync}),p&&R(N,{children:[I(wr,{children:I(Ar,{children:"Financial Summary"})}),I(vu,{isSample:v,period:y})]})]}),!h&&I(N,{children:I(gi,{filter:C,isSample:v})}),p&&I(Wd,{sortInstance:n,setSortInstance:r,conversations:c,paginationControls:s,isFilling:l,isMobile:h}),I(ik,{})]})})}function Qk(e){return I(Ea||N,{children:e.children})}function Xk({children:e}){return I(Qk,{children:I("div",{className:pr(cr.component),children:e})})}function Jk({source:e,children:t}){return I(En.Provider,{value:e,children:t})}function $k(e){return I(Xk,{children:I(Jk,{source:"FinancialOverview",children:I(Gk,{...e})})})}const eE=rr({display:"flex",flexDirection:"column"});function tE({task:e}){return I("div",{className:eE,children:I(Sk,{task:e})})}const nE=rr({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),rE=rr({width:"80px",height:"12px"}),aE=rr({width:"150px",height:"16px"}),oE=rr({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),iE=rr({userSelect:"none",cursor:"pointer"});function lE(){return R("div",{className:oE,children:[R("div",{className:iE,children:[R("div",{className:nE,children:[I($o,{styles:aE}),I($o,{styles:rE})]}),R("div",{className:nE,children:[I($o,{styles:aE}),I($o,{styles:rE})]})]}),I("div",{className:iE,children:R("div",{className:nE,children:[I($o,{styles:aE}),I($o,{styles:rE})]})})]})}const sE=rr.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function cE({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=ET(),a=n||r?qc:ec;return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(a,{extraClassNames:[sE],popupTriggerProps:e,children:I(ul,{Component:of,stylists:t})})}),I(Uc,{children:e})]})}const dE=bi(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M14.075 2.10645H0.924988V5.09395H14.075V2.10645Z",strokeMiterlimit:10}),r.createElement("path",{d:"M14.075 5.09375H0.924988V14.0625H14.075V5.09375Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 8.08105H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 8.08105H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 8.08105H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 8.08105H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4875 11.0752H11.6875",strokeMiterlimit:10}),r.createElement("path",{d:"M3.3125 11.0752H4.5125",strokeMiterlimit:10}),r.createElement("path",{d:"M5.70624 11.0752H6.89999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.10004 11.0752H9.29379",strokeMiterlimit:10}),r.createElement("path",{d:"M3.91254 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 0.3125V3.3",strokeMiterlimit:10}),r.createElement("path",{d:"M11.0875 0.3125V3.3",strokeMiterlimit:10})),"Date"),uE=lr({base:{display:"flex",justifyContent:"center",flexDirection:"column",minHeight:"200px",height:"fit-content",backgroundColor:"surface.background",borderRadius:"md",padding:"16px",position:"relative"},variants:{width:{lg:{minWidth:{sm:"600px",base:"100dvw"},maxWidth:{sm:"900px",base:"100dvw"}},sm:{minWidth:{sm:"360px",base:"100dvw"},maxWidth:{sm:"392px",base:"100dvw"}}}}});function hE({width:e="lg",children:t}){const n=fr(cr["modal-popup"],uE({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const pE=rr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),gE=rr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),mE=rr({display:"flex",flexDirection:"column",gap:"12px"}),vE=rr({display:"flex",flexDirection:"row",gap:"10px"}),fE=rr({display:"flex",flexDirection:"column",gap:"10px"}),bE=({acknowledged:e,setAcknowledged:t})=>R("div",{className:mE,children:[I(uc,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),R("div",{className:vE,children:[I(dw,{checked:e,onClick:()=>t(!e)}),I(uc,{wrap:"wrap",children:"I understand."})]})]});function yE({bankAccounts:e}){const{apiPartnerName:t}=i(ed),n=e.reduce((e,t)=>{const n=Rt(t.tranStartDate||""),r=Rt(e.tranStartDate||"");return n&&r&&At(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutateAsync:n}=zh(),r=Sc();return wb({defaultValues:{tranStartDate:t},onSubmit:async t=>{var a,o;await n((a=e,o=t.value.tranStartDate,a.map(e=>({id:hs(e.id),tranStartDate:o,duplicateBankAccountIds:[]})))),r.close(),dh({title:"Start Date Updated",body:R("div",{className:fE,children:[I(uc,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(uc,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:Gu,type:ch.SUCCESS}]})}})})(e,n),a=Sc(),o=()=>{a.close()},[l,s]=d(!1),{query:{data:c}}=ju(),u=c?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Rt(e.reduce((e,t)=>{const n=Rt(t.tranMinStartDate||""),r=Rt(e.tranMinStartDate||"");return n&&r&&At(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${mh(e[0]?.name,e[0]?.mask)} account dating back to ${Ot(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${Ot(h)}.`;return R("form",{className:pE,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit()},children:[I(Eo,{children:"Set Bank Transaction Start Date"}),I(uc,{wrap:"wrap",children:p}),I(uc,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),I(r.AppField,{name:"tranStartDate",children:e=>I(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),I(r.Subscribe,{selector:e=>e,children:e=>{const t=Rt(e.values.tranStartDate||""),r=Rt(n),a=t&&r&&At(t,r);return R(N,{children:[e.isDirty&&a&&I(bE,{acknowledged:l,setAcknowledged:s}),R("div",{className:gE,children:[I(kb,{showIcon:!1,onClick:o}),I(np,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!l})]})]})}})]})}function wE({bankAccounts:e}){return R(Ac,{placement:"right-start",children:[I(Ic,{children:e=>R(qg,{...e,children:[I(Pd,{Component:dE}),I(uc,{children:"Edit Start Date"})]})}),I(Fv,{children:I(Uv,{children:I(hE,{width:"sm",children:I(yE,{bankAccounts:e})})})})]})}const CE=bi(e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},r.createElement("path",{d:"M7.49998 14.4245C11.3242 14.4245 14.4244 11.3244 14.4244 7.50011C14.4244 3.67585 11.3242 0.575684 7.49998 0.575684C3.67573 0.575684 0.575562 3.67585 0.575562 7.50011C0.575562 11.3244 3.67573 14.4245 7.49998 14.4245Z",strokeMiterlimit:10}),r.createElement("path",{d:"M2.88599 12.625L12.6672 2.84375"})),"Stop"),xE=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M11.7346 14.5L11.7346 12.9152C11.7333 12.2895 11.5704 11.6747 11.2616 11.1305C10.9528 10.5863 10.5087 10.1311 9.97233 9.80895L7.43662 8.29386C6.90079 7.97055 6.45795 7.51384 6.1513 6.96831C5.84465 6.42279 5.68467 5.80708 5.68698 5.18127L5.68698 3.60913",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 1.1875L5.68701 14.5",strokeMiterlimit:10}),r.createElement("path",{d:"M3.26538 3.60911L5.68699 1.1875L8.10859 3.60911",strokeMiterlimit:10}),r.createElement("path",{d:"M5.68701 7.24146L5.68701 2.39825",strokeMiterlimit:10})),"Combine"),TE={QBO:"QuickBooks Online",XERO:"Xero",STRIPE:"Stripe",SHOPIFY:"Shopify",SQUARE:"Square",RUTTER:"Rutter",UBER:"Uber",MOOV:"Moov",QUALPAY:"Qualpay",BENCH:"Bench",WAVE:"Wave",MANUAL_ENTRY:"Manual Entry",CSV_IMPORT:"CSV Import",PARTNER_IMPLEMENTATION:"Partner Implementation",FRESHBOOKS:"FreshBooks",FRESHBOOKS2:"FreshBooks"};function kE(e){const{apiPartnerName:t,unitIntegrationBankName:n}=i(ed);return"UNIT"===e?n??t??"Unit":TE[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const EE=rr({display:"flex",flexDirection:"column",gap:"16px"}),AE=rr.raw({color:"brand.danger"}),SE=fr(null,rr(AE));function IE({integration:e,accounts:t}){const{mutate:n}=cy(),r=Sc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=hy(),{query:{data:l}}=(s=e.id,zu({},{select:e=>{return{...e,data:(t=e.data,n=s,t?.find(e=>e.id===n))};var t,n}}));var s;const c=l?.data,{query:{data:d}}=dm(e.id),u=d?.data,h=kE(e.apiName),p="PLAID"===e.apiName;return R(Ug,{children:[p&&!o&&R(qg,{onClick:()=>(a({plaidEvent:Zb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(Pd,{Component:Bs}),I(uc,{children:"Add Account"})]}),p&&u&&I(wE,{bankAccounts:u}),$e(t)&&R(qg,{onClick:()=>Ub({plaidItemAccounts:t}),children:[I(Pd,{Component:xE}),I(uc,{children:"Merge Accounts"})]}),p&&R(qg,{onClick:()=>(async()=>{let o;var l;o=$e(t)?await(async e=>dh({title:"Remove Institution",body:I("div",{className:EE,children:I(uc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether? If you unlink now and relink ${e} again in the future, you may see duplicate transactions.`})}),buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Remove",type:ch.DANGER}]}))(e.apiInstitutionName??h):await(async e=>dh({title:"Remove Institution",body:I("div",{className:EE,children:I(uc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Remove",type:ch.DANGER}]}))(h),r.close(),o===Zu&&(p&&i?a({plaidEvent:Gb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[I(Pd,{stylists:[SE],Component:CE}),I(uc,{extraClassNames:[AE],children:"Delete Connection"})]})]})}const NE=rr({userSelect:"none"});function RE({children:e}){return I("div",{className:NE,children:e})}const PE=rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"16px 12px 16px 16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"});function DE({children:e}){return I("div",{className:PE,children:e})}const ME=fr(cr.badge,LC),LE=fr(null,ao),FE=fr(null,cl),OE=fr(cr["neutral-badge"],OC),VE=fr(cr["highlight-badge"],UC),UE=fr(cr["success-badge"],HC),BE=fr(cr["warning-badge"],_C),HE=fr(cr["danger-badge"],cr["critical-badge"],jC);function WE({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=HE;break;case"warning":o=BE;break;case"neutral":o=OE;break;case"success":o=UE;break;case"highlight":o=VE}const i=Tr([ME,LE,o,FE]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function _E({plaidItem:e}){const t=Ek(e),n=dr(e.apiErrorCode)&&Ih(e);return R(WE,{type:n?"highlight":"danger",onClick:n=>{n.stopPropagation(),t&&(xa(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Ak(t))},disabled:dr(t),children:[I(Pd,{Component:n?Ou:wi}),I(So,{children:n?"Relink for Statements":"Fix Bank Error"}),I(ul,{Component:ol})]})}const zE=lr({base:{padding:"16px 16px 16px 24px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",color:"icon.base",display:"flex",borderTop:"none",borderLeft:"none",borderRight:"none",width:"100%",justifyContent:"space-between",alignItems:"center"},variants:{active:{true:{_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",cursor:"pointer"}}}}}),jE=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function qE({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=or(zE({active:a}),cl);return R("button",{className:l,onClick:t=>{t.stopPropagation(),is("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:jE,children:[I(Pd,{Component:i?Iw:ym}),I(Cm,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(Pd,{Component:ol})]})}const KE=rr({display:"flex",flexDirection:"column",gap:"4px"}),YE=rr({display:"flex",alignItems:"center",gap:"8px"}),ZE=fr(null,rr({color:"brand.primary.weak"})),GE=rr({overflow:"hidden"});function QE({integration:e,isCompact:t=!1}){const{query:{data:n}}=dm(e.id),r=n?.data,a="PLAID"===e.apiName,o=kE(e.apiName);if(!$e(r))return null;const i=e.iconUrl?Em(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(RE,{children:[R(DE,{children:[R(Kv,{children:[I(Sd,{Component:i??ym}),R("div",{className:KE,children:[I(uc,{children:e.apiInstitutionName??o}),I(So,{children:jb(r)})]})]}),R("div",{className:YE,children:[a&&(l=e,ur(l.apiErrorCode)||Ih(l))&&I(_E,{plaidItem:e}),I(cE,{stylists:[ZE],shouldUseButtonDiscreteStyles:t,children:I(IE,{integration:e,accounts:r})})]})]}),I("div",{className:GE,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(qE,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:qb(t),active:n,integration:e},t.id)})})]});var l}const XE=Em("data:image/png;base64,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","Stripe"),JE=Em("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAABGNJREFUeAHtnD1sEzEUx58vd72UpmUBJhYqZtQFIYG6ICiUsXxIwARDEUJiABZWQGIBBgZAlWBjKpQBUEVbIaEWWBFiRGJgLAP0K7nch/n7koaUJvWdk1zTnF0lufN7tt/7xXc5u/ZjJEm2be91AxoyiE6SwfYR5z0owiXF2lXMiLFlCvjXgOilZdCU4zjfNzKW1ROaZnaQDH6VMTYEnb56els8f4FzPkUBe+h5hdlavtQClLNs+y4RG0WBrlqFOjCviItizHWcm/Btqdq/NYBylNvp2O5zwDlarZSeYz5tO9b5JVqaX/W5GlCvZWcnIDiyKkzp54zrFEbg+6LwP7MKwbK77+H47Op5ij/7M6aVC3xvUjAIe5Bpdh9iGf4e52m558i+/yL32WHPy3/ErzdShq7hXcMJYYRvXWUm6EHZ7B6L0xdkd+pP+T+34x0tuIwGDMPnwxpOTXJ9go2Ba+x0TbHOJMGGmXZ2HnfqHZrHegIYT/0yymOr9VKdg4dr3mOCg+rA08ct/gX59C5g7DfqqX7obAe83OB8O36NjsPDUzCo8swXwzjOzC57GQPSbTEKCVUXOC67hcLTmOU2Rd3KZi8C0hM0bsUxAAPZldJzUJxSQpfTxFaBI8yFrc+EzeI4blIF9DZuQ5utH1DwRsUGJUC456yZElBpOPkymWWVNpUAoaF2uyFH8V3JZlVAUQzqCB0NSPI1akAakISARKx7kAYkISAR6x4kASQGq0mlbrMrex1PUAfRoNIzCcpx/H3yioX7OM4nYXhigADnBmN0q2GnGA2jLgZItxuuK0IFyV1ijAYj2BNNpZl1SVpMDhBh5qh5qZl1bWhVkoA2NKRdhRqQ5JvRgDQgCQGJWPcgDUhCQCLWPUgDkhCQiHUP0oAkBCRi3YM0IAkBiVj3oDYCpLK6op75zayrXhthfnI9iNPshpbEEXKai6PeiG5iM4qYAbyHmUDehCnXz+Up10b8jlw2MUCwKA/H7kS2rE0Uk7vE2sThuGZoQBJiGpAGJCEgEesepAFJCEjEuge1CJDq4nOJOS0VK9ms1IOwgj3XUldaUrkvtrPHTkqAMFw4EbulTS5gkKFksyqgESzvv7DJPkduPrSVITCCQlLdqyGa8rBWZxwvbGYJ/uBcdc2PgtmRimAzi9EHq47hdQYlYo87xV4NAWgFm1m6IzWZMiUAyhthLIuUOR7ZXcT5MBDo41vkAmlTBBsDUVDG0+Z3VH8FG70tvD6t0rZwKhR+YB50pr5eOiUhE7ApPQf59AAYECJGpzKBIlZUCialja5B4P1EQI9dOD9QVkj5B3vkufkxAaHy/yVEO5nLmOZ+5PWnnI4Ij3MJDMIrqnqosWg75jksZp9OLyARYEkwKMUOEhwqPUicFKm4Evj+q4yZQaATNvC/XOh0aEJv4Y8RomsUDEQMgEpaA6icWwSkSYOZH4jxXgxDdiPfrpTorAMR5O01grxd8VxH7KsPL6tqF6UDzLSHCfwLHN4iAPR6ZXwAAAAASUVORK5CYII=","Square"),$E=Em("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAD6NJREFUaAXVW1mMW9UZ/ryPPWtmD7NlGSaBBshWIILSUngBJChCBYkuAgQt6gNVpb5XfarEQxEVLwVa1IpWqIIiUKlYqlIgbA1RIXsCyWQm49ltj33ta/v62u73H9szHvte2zOZCPiTY1+fe+455zv/f/7tnnGgBuXz+UHevovlDpbtLJextLB8lSjOyUyznGV5jeUVh8Mxxe/GiUAvY3mGxWT5upHMWeYuzKkiR2UNG97JuudZWivvfc1+a5zvD8ntV8vnvQowwT7Gm0+wOMsbXcw1+0TaiCGUPI8l/QJyjhx6AmPobRuD07Fhw9hNMccbvyDo35UaLAMucvZl3tiwWaQMDZORQ/g0+AIiqQtwuxxwuTzIpYHrtj6Cka4D8Lmb4XE1leZzKb4F9N0lTivABCvyfoplw8R4SQ/i8OTzmEq8D6+rHZs8o+hoGkEocQ4XYh/D7fChv/0b6GoeRH/rbgxu2ncpgYt47yTo6RLgZ1jxMMuG0IL2Bd794klo2XEMth3A7s33o7t1K07OvI7jcy9jidzOcd2luJxOOJxZbOu4GTeM/owcv2RG4FkCfsRJ7orpeXBDkLITLTWPjyf+gJg5jq3tt+LA8E8V2M8u/B0fTT6NiD6JLW03oc0zjHw+h+uHf4ItnTdhIv4Ovph/B7l8dqOmUtnPg4JV9qvYWVfl3XX9poL67MJLWNRPoD+wH9dueQDNTd0E8i6OzP0N2ZyBfYMP4Kaxn2OwYw98TS7uaSeuHXoI3f4rcGT6RYTj59c1dAMPCca7BLA4FRtCwehJTGkfweNox/7hH6DJ3QbDjBPISzChYVff3dgzdC+8bj/a/X3wOH3c0+fRxutdvd9H1hnHudC7iCcXscj6BW1t/kMDIO5ws5F4UBdNhpnC+dB7MBDF7v4fY1NgBA6anZnoMe7l82h2juCawXtYVzAMfm8nueuFkUmqsZt9/I1mnF54E7PaKcxFPoemdeL2qx/DzqGrL3p+xQ62C2BLj2StI8xEj2NCe4/aeAzber9FZeRBOqNhPPIhRTmDfVvuh9/bsdyt2+kHuF3n46fw1snHoRnj0BILyCOHtBlFysxicj6KP779OO657iFct+O7y89exMVlAvii1WImm0Iw+gnFNo7R7u8g4OlQnNRSC+TwEbT7tmNz2y41z1D8HKaWPsO5xYOIJ2LI5iPQMjMQvmezWQKm9uZCmNk8UkYO0XQQL374eyUt12y9jtuhaVlKVIdr+2gRwBdNejpMcf4AHk87elt3cEIFHbiUCiKTXUKHbwgnZl7DdOwYluhxmXmdezulzJIgzWYIVJAKCXJe53N55Ak6azqwGJvHn/79W3S19CDga0FTUws6Wzqxf/u3ccXQXrUY6tkGPjYE8Hz8DHJuDb2+vQh4u5GiKIf181RA71A8M5gMHUIwdpgcNAnEqcR2GaCAs5koMfMehZwc19MxJFiUCuBHwO9nfzlcPnA1HRavTQ/V1RsCOEixNdIZgs7hSPBFTEb/h7A2Tm7l1KQEUZbiWaDSd/VkSjWyALIgNNOK4VIvToqQ3BPQ6VQGEXI+y9XwFARK3a/3sW7Asm+11BzNxzlMRz5FJm3gXPIgfAn6ymRNjhORyRU+6k2j+r4AFg5bkeI6+1/Sw9znOpo8VIAN0poAG6aO+cTnmA5/hjntOOLGDPfkPBnpoG6VlXcgnTbXDbJ8zoVFK68pu+ZCiDjH9CWWEDqau8pu1r5sGHA4PoFDk39GOH2G5iPEmIqj5h0EK4ZEros4+b0RRIVdmyjWeVcOIW0ewz1jtduW3W0YcJCmZFY7ShGKqf0kGnS94lo2vu2l2sMcQikpi1ZcapouE6HYnMVd+6qGAWvpBaVlRdSWNax9v1yL4j5mMEDjwpZkiTI5IgJOBv9uOJ0uVkllNSklJU2tb6sHcjkTi9olACxRTSq9xGlnqmdWUSOLYTLCdzjy8Ls7aDe70OzrhdcZYBjoRIb2N5lZQjQ5peyxpZSwD1FY0pcdh2VYk3Ifji3Ub1g2x4Y4bJgJ6JkwJyB8U2wq62LlMseFyeczDOavwWjPLehv24FA0yb4PW3kqEdxM5c3YWR1RPVpvHPmKSzETytur/RSYGpWJImVdgxWEkTAIXI4acTh9zWWu2gIcCoTp9tIJ7+GLGcpXl5GP3u3PIixzTejvanfcrouhxd+pxdpT5xeWKqgBypQicZXW6d8FSqvlRRQ8owElhLhhgE3lL9KGmFkJBFlQ8K1JnLxwOij2DNyD8FuZssKFBXPToQPIZaaoshaT4FWp7AYFc+V/xQJMPkvklgsr655bT1axSO6EaFHk6SIyRCrSYyS5Ke+ueVH2DVwO9zkcj2SrEYwcpSLmLIF3GjiQ3zyxdhsvSGX7zcIeIlxa4I+bdG/W35clIuJke4DuPKy26r2YlmzVZfioS1o3Lt5++HN6qFW9SE/JMAwjDQicSquBqmhPZygwsowPVOgMi5zTzcxI7ln6B76s6s5KwsxGTpMpXSOmllnci6A9sAAM5U7Ma+dQYxhn5MxsxXJCBIw1NLQ8px4dplsBqHonFKopeSCVZ+luoYApzIx9l4EWoY3S428uXUUnc3MbpSns6mtjwX/gUPn/0oTtEApyJH7zkK6tnlYJQSccNuKs+ycXA0FWZq8fOdosGPJJWpqnSawufyW5XVdwCY5mzYJ2GL/SoDQI28QnKu70U0Nx4P/hG4sEigTdcJJAjBYP8vIykGw4nTYkaypxe6xbC46RKemjhN0I4DtN1Gx+0xGR9ahr3C4fFiKVIe3X4Eqr3ay3l0UcdHC4k3JtyyMi0qtFlhZV2Gu7M9GSFqlmShsdB/XBWxkk8xN6UosKycge0YScZUk2cq9I/ehjbZ4Ze9Xtqr9uxEOC9g8RVpPE7AENA3Qalm0eMCk6ZAVzEmwUEEyWIr3OGzFHaZCe26Ei/7yJxMv0AQdJsf9SslUNbSoyDMKE1+a61mXxPtLpum5JSJ120qDuhxO8oVYhiUn6ZkKYCKmc7GTTMQxBragLd3X4/Zdv8JVA3fzSclbNWBr2E/NWLh8HKXYqKk5fjg+X37H9rou4LS5BJOpGquoxs03gUFmO0KMlUV5WFHAtwk3jj2q3kIUzEa1NFQ+JziEw42S7HctGWEwUT+4qQlYxCVlRDmuXbrGqYKKQ+N/oVmwFymvK4D9zEvvGb6P0lBjUssiLEFIo3ClXZ6amrlsaut6VBNwlv6zTg5LqGdH4jxMhD/Awc+fZsgnLp51WzFP+4bv5TulveQEg4YapDjMbhrZw9KN2PlEOqH2co1u1a2agE1GQLoZIQSObo2jYHL4kuTk3Bt4+9QTCCcm2bF1Yy9fhV418D0CkVStdRuZlaR31sJhcT60ZIxOzkVyWJx7PbWoUilEZkuyN90M+SbCH+L1Y7/GFJN81nvagZ7WMb4E38o9ai/aWQuLYDe4LJz4+ElyWNPFQapNNTmco5eVMJjpoIaupEIyYIVLotQ8ND0L9JM/Pv8cbWO48hH1W5LmLb4+7mXrLJ2sqyishjksU+CCi26IJevb4pqA03T6k5y42NtyERSwAk5SODn5V2ZuPDyzMRs7waDhrKUZEmmwCxpkRWiCOXm5WgMV20tcXE9T1wQsgX82zyipYrnFGRnYtBu3XvFLXNl/O3yuZpXHEmUkWQxxJl2gB2axDfL0v41swupWASEnr9I7awSdJVNCDBPTpn2iQgaw97QIUkyS8vsznHkZaNGevS2XY3PHVcxf7cFw536cnT/I90njXOE0X5fegL72ywmqej3FVY2lZuh/W4eGMqkygZGfDZHohAidD4OAm/nCzY5sAUtWImEscHus9gAkNepjDNzdup2BAKMeTnyU74O3E6SejlC8TbQ29XK8avbKtpiTWJgZS5fT+qiSMFY8rbVSJsMcdXReZUVrPVvNgmJrmVw8HaJ4rVYushBt/kF0MJiX3HKJhJvNTMm2NvWxqhqstBORPzXzphIWK8+t1Jd667AGzKJTVFysRxgmiqNkT7aAlTE3CFiNvtKBKB1xSCRoaNQ3LjydJ9i3MMWDavUOokmktAa8xckVNLVkMGuRLWA5caMTsLzOKCcX7W0kOYH3Tj+Fswvvc8/UN/bS15nZt/HR+HNkvgxpLQEyjtxdzx6WZ8X2yxtFSUzY0YpMVrTIULkk+WI7z2xavsK1lLBvllHSv07+BmN9t3AP34wOinnA28owMLDckyTcxR6fmHkDR6deLmjwGpkO9SC5y+Md6yIxkZLBVCklm5NYAlgC2iq1JseNcqXUrIV8uelAyGGVo1Ov4szcf6iVd2CTfxuBb4ZTzlMycokmgzzmcBTzsVNUUt7amY4iRBlK9uR6yDSZo9YKgG2ejwvgaZaq941xvjxzujmwmCQbrSlnOTw8cyV2WTKUk/iv2nsFhcRn+d9BjoqT0iiJTRDAYvrWRnkI4PnoLBkh23B1FrXY17QAPstSBVher8gBM7eDhtxrFJSIYCD4crPBKu47F7m6kpQTDV9LCxcHr/4qrNG6RFqEQnxqyXxIysfvtcxgnhXAcmz+tsrRR3u/jaFN+xnvLjBfNIkwbedSYoJKIYgkQ8a8M82J8VyHCgIKuk9JotKw4oqS1Edlz7V/yyPrkmhnQSTEsYkyv9XVKuaxil4TwK+wPMmywiL5Qaci4GtXpbtllDUFEv86kV4k8AmEeFA0kriARGqWJ/DidBnj6k2eTFoyl0KyG1Q+jKpXAZGbNuKqqtlIgod65BSA8r8IVLaBn2c9Oju6lLdl8byowlfctKtTbPwcfzxs0aiqSt4g+NzDTL4PY1vxrkHxjzOMjPLMhxyNiCanef5jjrmmBL21EEPMMPWB5Kcdan+Kryzip8yPLIBQcREErJTKPawAUpDUN5vLthIXsr2li4qykyfsBzDUsw0D3Vsx2l84BKf6Xfl4TrAWF3XjD4hn6FPLGwuDRaNEiP8cT0/zrHSQR4iDiCVm4PZy97udavJZk2k+LkIqlceJMwYVD7WAAJT7rHdkHejq6MNIzyg2d44weNmG7vY+enzdaA20qxN6K9iqrlYfEJfb5PKd/HqZpbAhpXKDSd7+i30vbYsYwcfSF7AYn+QL8ilKxQKdnRxOnE7Bnfejr2sAW/uuxFDXNgWyq6WPW4wn8bx+2nv74KNi2rJBVv8JQKkBQT/G6ydYLhno0lilb7HlUuSVjuI+jwzruosAt/GoYa/6GwkPwUlaaB0kYK3/yKPUWZHTz/N3Y2cISg9+9b5FjKv+jKdq2bixX2XDnSzPsqzTyeOTXx7JnGXu8kcdgmUVFXXjqrrlH+T2IH/cxXIHy3YWOVtd5Yay7sukNf0p3v8B6wxHdmdLODAAAAAASUVORK5CYII=","Shopify"),eA=Em("data:image/png;base64,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","Gusto"),tA=Em("data:image/png;base64,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","Freshbooks"),nA=Em("data:image/png;base64,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","Uber"),rA=Em("data:image/png;base64,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","Bank"),aA={GUSTO:eA,FRESHBOOKS:tA,FRESHBOOKS2:tA,SHOPIFY:$E,STRIPE:XE,SQUARE:JE,UBER:nA};function oA(e){return aA[e]??rA}const iA=rr({display:"flex",flexDirection:"column",gap:"4px"});function lA({integration:e,isCompact:t}){const n=kE(e.apiName),r=function(e){if(e)return`Last synced ${Ft(e)}`}(e.lastSyncedDate),a=oA(e.apiName);return I(RE,{children:R(DE,{children:[R(Kv,{children:[I(Sd,{Component:a}),R("div",{className:iA,children:[I(uc,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(So,{intent:"normal",children:r})]})]}),I(cE,{shouldUseButtonDiscreteStyles:t,children:I(IE,{integration:e})})]})})}const sA=rr({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),cA=rr.raw({color:"typography.base.weak"}),dA=rr({overflow:"hidden"});function uA({manualBankAccounts:e,isCompact:t=!1}){const n=ET(),r=t||n?qc:ec;return R(RE,{children:[R("div",{className:sA,children:[I(uc,{extraClassNames:[cA],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>is("BankAccountForm"),active:!1,children:I(ul,{Component:Bs})})]}),I("div",{className:dA,children:e.map(e=>I(qE,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const hA=fr(cr["selector-row"],or(rr(Ks,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),ll)),pA=rr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),gA=rr({display:"flex",alignItems:"center",gap:"8px"}),mA=rr({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),vA=fr(null,rr({width:"20px",height:"20px"}));function fA(){const{linkPlaid:e,loading:t}=py();return I("button",{...hA,disabled:t,onClick:()=>{xa("Add New Connection button pressed"),e({plaidEvent:Kb,message:"Add New Connection button pressed"})},children:R("div",{className:pA,children:[R("div",{className:gA,children:[I(Sd,{stylists:[vA],Component:ym}),R("div",{className:mA,children:[I(uc,{children:"Connect your bank"}),I(So,{children:"Find your banking institution with Plaid"})]})]}),I(Pd,{Component:ol})]})})}const bA=rr({paddingInline:"16px",paddingBottom:"8px"}),yA=rr.raw({color:"typography.base.weak",fontWeight:"label"});function wA({title:e,children:t}){return R("div",{children:[I("div",{className:bA,children:I(uc,{extraClassNames:[yA],children:e})}),t]})}const CA=rr({minWidth:"100%",height:"45px"});function xA(){return R(N,{children:[I($o,{styles:CA}),I($o,{styles:CA}),I($o,{styles:CA})]})}const TA=fr(cr["selector-row"],or(rr(Ks,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),ll)),kA=rr({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),EA=rr({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),AA=rr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function SA({integration:e}){const{linkPlaid:t,loading:n}=hy(),r="PLAID"===e.apiName,a=kE(e.apiName),o=e.iconUrl?Em(e.iconUrl,"Institution Icon"):ym;return I("button",{...TA,disabled:n||!r,onClick:()=>{xa(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:Zb,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:kA,children:[R("div",{className:EA,children:[I(Sd,{Component:o}),I(uc,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:AA,children:[I(ul,{Component:Ou}),I(uc,{children:"Relink"})]})]})})}const IA=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:224,height:64,viewBox:"0 0 224 64",...e},r.createElement("g",{fill:"none",fillRule:"nonzero"},r.createElement("path",{fill:"#95BF47",d:"M48.024 12.24a.567.567 0 0 0-.536-.495c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69c-.357-.36-1.073-.27-1.341-.18-.045 0-.716.225-1.878.585-1.118-3.285-3.086-6.255-6.529-6.255h-.313C27.768.585 26.517 0 25.487 0c-8.048 0-11.894 10.125-13.1 15.255-3.13.99-5.367 1.665-5.635 1.755-1.744.54-1.789.585-2.012 2.25C4.56 20.52 0 56.07 0 56.07l35.549 6.705L54.82 58.59c0-.045-6.752-46.035-6.797-46.35zm-14.443-3.6c-.894.27-1.922.585-2.996.945V8.91c0-1.98-.268-3.6-.715-4.905 1.789.27 2.951 2.295 3.711 4.635zm-5.947-4.185c.492 1.26.805 3.015.805 5.445v.36c-1.967.63-4.07 1.26-6.215 1.935 1.207-4.635 3.487-6.885 5.41-7.74zm-2.37-2.295c.358 0 .716.135 1.029.36-2.594 1.215-5.321 4.275-6.484 10.44-1.7.54-3.354 1.035-4.919 1.53 1.342-4.68 4.606-12.33 10.374-12.33z"}),r.createElement("path",{fill:"#5E8E3E",d:"M47.488 11.7c-.224 0-5.008-.36-5.008-.36s-3.31-3.33-3.712-3.69a.716.716 0 0 0-.492-.225l-2.683 55.35 19.273-4.185s-6.752-46.035-6.797-46.35a.776.776 0 0 0-.581-.54z"}),r.createElement("path",{fill:"#FFF",d:"M29.02 22.41l-2.37 7.11S24.55 28.395 22 28.395c-3.756 0-3.935 2.385-3.935 2.97 0 3.24 8.407 4.5 8.407 12.105 0 5.985-3.757 9.855-8.854 9.855-6.126 0-9.211-3.825-9.211-3.825l1.654-5.445s3.22 2.79 5.902 2.79c1.789 0 2.504-1.395 2.504-2.43 0-4.23-6.886-4.41-6.886-11.385 0-5.85 4.159-11.52 12.61-11.52 3.22-.045 4.83.9 4.83.9z"}),r.createElement("path",{fill:"#000",d:"M77.835 35.263c-1.938-1.032-2.93-1.93-2.93-3.141 0-1.526 1.398-2.513 3.56-2.513 2.524 0 4.777 1.032 4.777 1.032L85 25.256S83.378 24 78.6 24c-6.669 0-11.31 3.814-11.31 9.154 0 3.051 2.163 5.34 5.047 7 2.343 1.301 3.154 2.243 3.154 3.634 0 1.436-1.171 2.603-3.334 2.603-3.2 0-6.264-1.66-6.264-1.66L64 50.115S66.794 52 71.526 52c6.85 0 11.807-3.365 11.807-9.423-.045-3.32-2.524-5.61-5.498-7.314zM103.897 24.304c-3.316 0-5.925 1.62-7.914 4.053l-.089-.045L98.768 13h-7.472L84 52h7.473l2.476-13.33c.972-5.044 3.537-8.152 5.925-8.152 1.68 0 2.343 1.171 2.343 2.838 0 1.035-.088 2.341-.31 3.377L99.078 52h7.473l2.919-15.762c.31-1.666.53-3.648.53-4.999.045-4.368-2.166-6.935-6.102-6.935zM127.92 24C118.943 24 113 32.23 113 41.4c0 5.859 3.565 10.6 10.255 10.6C132.058 52 138 43.994 138 34.6c.044-5.456-3.081-10.6-10.08-10.6zm-3.653 22.185c-2.552 0-3.609-2.191-3.609-4.965 0-4.338 2.201-11.405 6.25-11.405 2.641 0 3.521 2.326 3.521 4.562 0 4.652-2.244 11.808-6.162 11.808zM157.168 24c-5.102 0-8.01 4.489-8.01 4.489h-.09l.447-4.045h-6.713c-.313 2.712-.94 6.89-1.521 10L136 62h7.563l2.104-11.156h.179s1.566.978 4.43.978c8.906 0 14.724-9.066 14.724-18.222 0-5.067-2.282-9.6-7.832-9.6zm-7.25 22.133c-1.969 0-3.133-1.11-3.133-1.11L148.04 38c.895-4.711 3.356-7.822 5.996-7.822 2.328 0 3.044 2.133 3.044 4.133 0 4.889-2.91 11.822-7.16 11.822zM176.287 14A4.25 4.25 0 0 0 172 18.284c0 2.186 1.414 3.716 3.536 3.716h.088c2.343 0 4.332-1.574 4.376-4.284 0-2.186-1.459-3.716-3.713-3.716zM166 52h7.736L179 25h-7.782zM198.487 25.574h-5.453l.277-1.276c.462-2.642 2.034-4.965 4.668-4.965 1.387 0 2.496.41 2.496.41l1.525-6.06S200.66 13 197.748 13c-2.773 0-5.546.774-7.672 2.551-2.681 2.233-3.929 5.467-4.53 8.747l-.23 1.276h-3.652l-1.156 5.831h3.652L180 53h7.81l4.16-21.595h5.408l1.11-5.831z"}),r.createElement("path",{fill:"#000",d:"M216.005 25s-4.788 11.928-6.912 18.45h-.09c-.135-2.1-1.897-18.45-1.897-18.45h-8.04l4.607 24.615c.09.536.045.894-.18 1.251-.904 1.698-2.395 3.35-4.157 4.557-1.445 1.027-3.071 1.697-4.336 2.144L197.123 64c1.536-.313 4.788-1.608 7.498-4.11 3.479-3.216 6.731-8.22 10.029-15.01L224 25h-7.995z"}))),NA=fr(cr["selector-row"],or(rr(Ks,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ll)),RA=rr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),PA=rr({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),DA=rr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),MA=rr({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",outline:"none",backgroundColor:"surface.foreground",fontWeight:"label.strong",fontSize:{sm:"label.strong",base:"lg"},fontFamily:"label",color:"typography.label.strong",lineHeight:"template",padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),LA=rr({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function FA(){const e=Sc(),{mutateAsync:t}=oy(),[n,r]=d("");return R("div",{className:PA,children:[I(Eo,{children:"Enter your shop name"}),I("div",{className:LA,children:I(IA,{})}),I(uc,{children:"Please enter the name of your shop below."}),I("input",{className:MA,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:DA,children:[I(kb,{showIcon:!1,onClick:()=>{e.close()}}),I(tp,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(Eo,{children:"Connect"})})]})]})}function OA(){const e=oA("SHOPIFY")??Ou;return R(Ac,{placement:"bottom",children:[I(Ic,{children:t=>R("button",{...NA,...t,children:[R("div",{className:RA,children:[I(Sd,{Component:e}),I(uc,{children:"Shopify"})]}),I(Pd,{Component:ol})]})}),I(Fv,{children:I(Uv,{children:I(hE,{width:"sm",children:I(FA,{})})})})]})}const VA=fr(cr["selector-row"],or(rr(Ks,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none",borderRadius:"zero"}),ll)),UA=rr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function BA({apiName:e}){const{mutateAsync:t}=oy(),n=kE(e),r=hn(e=>e.events.gusto);if("SHOPIFY"===e)return I(OA,{});const a=oA(e)??Ou;return R("button",{...VA,onClick:async()=>{if("GUSTO"===e){let e=!1;if(ur(r)&&(r.listener({type:"GUSTO_NEW",result:"SUCCESS",data:null,error:null}),e=r.preventDefault??!1),e)return}const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:UA,children:[I(Sd,{Component:a}),I(uc,{children:n})]}),I(Pd,{Component:ol})]})}const HA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function WA(e){return HA.includes(e)}const _A=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],zA=rr({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),jA=rr({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function qA(){const{query:{data:e},isFilling:t}=Gw(),n=e?.multiAccountIntegrations,r=e?.integrations,a=ur(n)&&n.length>0||ur(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=i(ed),n=hn(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(WA),a=e?.map(e=>e.apiName)||[];let o=r??_A;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:zA,children:[(t||a)&&I(wA,{title:"Already Connected",children:t?I(xA,{}):R(N,{children:[n?.map(e=>I(SA,{integration:e},e.id)),r?.map(e=>I(SA,{integration:e},e.id))]})}),I(wA,{title:"Available Banks",children:I(fA,{})}),o&&o.length>0&&I(wA,{title:"Integrations",children:I("div",{className:jA,children:o.map(e=>I(BA,{apiName:e},e))})})]})}const KA=rr({marginTop:"16px"}),YA=rr({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),ZA=rr.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function GA({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(qA,{}):t?R(N,{children:[R("div",{className:KA,children:[I(uc,{extraClassNames:[ZA],children:"Connected Accounts"}),r?.map(t=>I(QE,{integration:t,isCompact:e},t.id)),a?.map(t=>I(lA,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(uA,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(uA,{manualBankAccounts:o}):R("div",{className:YA,children:[I(Sd,{Component:ym}),I(Eo,{wrap:"wrap",textAlign:"center",children:"If you prefer to manually input your transactions as opposed to having them automatically tracked, you can add your Manually Tracked Bank Account(s) here."})]})}const QA=fr(null,rr({color:"typography.base.weak"})),XA=fr(cr["drawer-header"],rr({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Wv)),JA=rr({display:"flex",gap:"8px"}),$A=rr({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),eS=lr({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),tS=rr({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),nS=rr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),rS=fr(null,rr({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),aS=lr({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function oS({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=ET()||e,{query:{data:a},isFilling:o}=Gw(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=xh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>qh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:sm(e?.data)};var t}}),{mutate:c,isPending:d}=ly(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&Zw(p,!1),m="connected"===hn(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,f=m?"Add New Connection":"Add New Account",b=()=>{is(m?"NewConnection":"BankAccountForm")},y=r?qc:ec;return R(ny,{onPlaidLink:n,children:[R("div",{...XA,children:[R(Kv,{children:[t&&I(rh,{}),r?I(Eo,{children:"Banks & Integrations"}):I(Ar,{stylists:[QA],children:"Banks & Integrations"})]}),R("div",{className:JA,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(Pd,{Component:Ou,stylists:[fr(null,aS({refreshLoading:d}))]}),!r&&I(uc,{children:"Sync Accounts"})]}),R(y,{onClick:()=>b(),active:!1,children:[I(Pd,{Component:Bs}),!r&&I(uc,{children:"Add New Connection"})]})]})]}),g&&I("div",{className:nS,children:I(tE,{task:g})}),o?I(lE,{}):R(N,{children:[I("div",{className:eS({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:$A,children:I(GA,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&I("div",{className:tS,children:R(ec,{stylists:[rS],onClick:()=>b(),children:[I(Pd,{Component:Bs}),I(Eo,{children:f})]})})]})]})}const iS=rr({display:"flex",justifyContent:"center"}),lS=rr({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1150px",border:"{borderWidths.md} solid {colors.border.layout.weak}",borderRadius:"lg",backgroundColor:"surface.foreground",marginBottom:"42px",overflow:"hidden"});function sS({onPlaidLink:e}){return I(Xk,{children:I(Jk,{source:"BanksAndIntegrations",children:I("div",{className:iS,children:I("div",{className:lS,children:I(oS,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})})}function cS(e){return et({key:"customer",name:"Customer",possibleValues:e})}function dS(e,t){if(e?.id&&t.id){const n=t.id?.in?.filter(t=>!e.id?.in?.includes(t));return{...t,id:{in:[...e.id.in??[],...n??[]]}}}return e?.id&&!t.id?{...t,id:e.id}:t}const uS=rr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function hS({children:e}){return I("div",{className:uS,children:e})}function pS({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(Ac,{children:[I(Ic,{children:e=>R(ff,{popupTriggerChildrenProps:e,children:[R(hS,{children:[t&&I(Pd,{Component:Em(t,"")}),I(uc,{wrap:"wrap",children:i})]}),I(Pd,{Component:ol})]})}),I(Qv,{title:r,Footer:o??null,children:a})]})}function gS(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ae(i??[],r),[i,r]);return o(()=>{if(!i)return{};const t=l.search(e);return function(e){const t={};for(const{parent:n,child:r}of e){const e=n.id;n.id===r.id?t[e]={parent:n,children:[]}:t[e]?t[e].children.push(r):t[e]={parent:n,children:[r]}}return t}(a(t,i))},[i,l,e,a])}function mS({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return I(N,{children:e.map((e,o)=>I(r,{groupIndex:o,children:e.map((e,n)=>I(a,{item:e},t(e,n)))},n(e,o)))})}const vS=rr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),fS=fr(cr["list-body"],rr({display:"block"}));function bS({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return R("div",{className:vS,children:[e&&I(uc,{intent:"weak",children:e}),n?I(sf,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):I("div",{...fS,children:t})]})}const yS=rr({display:"flex",flexDirection:"column",gap:"16px"});function wS({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I(bf,{handleClick:t,selected:n,isMultiSelect:r,children:R(hS,{children:[e.iconUrl&&I(Pd,{Component:Em(e.iconUrl,"")}),I(uc,{wrap:"wrap",children:e.name??""})]})},e.id)}function CS({groupedResults:e,onItemClick:t,selectedIds:n,isMultiSelect:r}){const a=o(()=>Object.entries(e),[e]),i=o(()=>a.map(([,e])=>{const t=e.children;return t.length>0?t:[e.parent]}),[a]);return I(df,{children:I("div",{className:yS,children:I(mS,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>I(wS,{item:e,onItemClick:()=>t(e),selected:n.has(e.id),isMultiSelect:r}),GroupComponent:({children:e,groupIndex:t})=>{const n=a[t][1],r=n.children.length>0?n.parent.name:void 0;return I(bS,{label:r,children:e})}})})})}function xS({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=gS(e,{items:n,fuseOptions:Rx,processResults:Dx});return r?I(Tf,{}):0===Object.keys(i).length?I(sf,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(CS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function TS(e,t){return QC(e,t).map(e=>({parent:e.parent,child:e.child}))}function kS({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=gS(e,{items:n,fuseOptions:ZC,processResults:TS});return r?I(Tf,{}):0===Object.keys(i).length?I(sf,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(CS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function ES(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...ES(n));return t}function AS(e,t){return e.value?.[t]?.value?.id?.in??[]}function SS(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&AS(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{AS(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function IS(e,t){const n=[];return e.forEach(e=>AS(e,t).forEach(e=>n.push(e))),new Set(n)}function NS(e,t,n,r){return u(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!AS(t,e).some(e=>n.includes(e)));return $T(t,e,r)})},[t,r,e])}const RS=rr.raw({width:"100%",justifyContent:"center"}),PS=rr({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",padding:"16px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout}",marginTop:"auto",width:"100%"});function DS({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:PS,children:[R(Id,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[I(uc,{children:"Apply"}),I(ul,{Component:ep})]}),I(ec,{onClick:e,styles:RS,children:I(uc,{children:"Clear All"})})]})}function MS({onApply:e,onClearAll:t}){const n=Sc();return I(DS,{onApply:()=>{e(),n.close()},onClearAll:t})}function LS({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>ES(e),[e]),g=u(()=>{i(p)},[p,i]),m=u(()=>{if(p&&l&&s){const e=JT(s,"category"),t=SS(l,e,p,"category");d(t)}},[p,l,s,d]),v=I(MS,{onApply:m,onClearAll:g});return I(pS,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:I(rf,{placeholder:"Search expense categories...",onClick:a,SearchList:xS,DefaultList:FS,listLength:e.children?.length??0,extraProps:{categories:e.children??[],label:e.name??"",isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}})})}function FS({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(Tf,{}):I(hf,{title:I(Eo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=ES(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(LS,{categories:e.children??[],label:e.name??"",category:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return I(bf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(hS,{children:[e.iconUrl&&I(Pd,{Component:Em(e.iconUrl,e.name??"")}),I(uc,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const OS=[];function VS({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Ex(),s=i?.data??OS,c=IS(JT(t,"category"),"category"),d=u(e=>{const t=US(e);n(t)},[n]),h=NS("category",r,0,a);return a&&o?I(rf,{placeholder:"Search expense categories...",onClick:d,SearchList:xS,DefaultList:FS,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function US(e){const t=e.name??"",n=(e=>e.id?e.id.toString():"")(e);return{name:t,value:{category:{name:t,value:{id:{in:[n]}}}}}}function BS(){const{query:{data:e},isFilling:t}=Cx(),n=e?.data,r=o(()=>n?.map(US),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function HS(e){return et({key:"category",name:"Category",NestedListComponent:VS,possibleValues:e})}const WS=[{value:"in",label:"In"}];function _S(e){return et({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:WS})}function zS(){const e=function(){const e=Zi();return(e?Bi:Hi).map(t=>Ki(t,e))}(),t=o(()=>function(e){const t="in";return[...e].map(e=>({name:e.text,value:{reviewStatus:{name:e.text,value:{[t]:e.value}}}}))}(e),[e]);return u(()=>({values:t,isFilling:!1}),[t])}function jS(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const qS=S.object({minAmount:S.number().nullable(),maxAmount:S.number().nullable()}).refine(e=>null===e.minAmount||null===e.maxAmount||e.minAmount<=e.maxAmount,{message:"Minimum amount must be less than or equal to maximum amount",path:["amounts"]});function KS(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:ur((a=t).greaterThanEqual)?hh(a.greaterThanEqual):null,maxAmount:ur(a.lessThanEqual)?hh(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const YS=rr({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function ZS({children:e,title:t}){return I(Qv,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:YS,children:e})})}const GS=rr({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),QS=rr({display:"flex",flexDirection:"column",flex:1}),XS=rr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function JS({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(ZS,{title:"Amount",children:I($S,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function $S({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Sc();return wb({defaultValues:KS(0,r),validators:{onChange:qS},onSubmit:()=>{if(!r||!n)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:a,pendingFilters:n}),i=Te(o.store,e=>e.errorMap),l=i&&Object.values(i).some(e=>void 0!==e),s=()=>{if(!r)return;if(l)return void r([]);const t=function(e,t,n){const r=n.operators?.find(e=>"greaterThanEqual"===e.value),a=n.operators?.find(e=>"lessThanEqual"===e.value),o=[];if(null!==e&&r){const t=yo(e,{dollarSign:!0,signage:"default"}),a=ph(e),i=n.createFilter({name:`${t}${r.label}`,value:{[n.key]:{name:"",value:{[r.value]:a}}}});o.push(i)}if(null!==t&&a){const e=yo(t,{dollarSign:!0,signage:"default"}),r=ph(t),i=n.createFilter({name:`${a.label} ${e}`,value:{[n.key]:{name:"",value:{[a.value]:r}}}});o.push(i)}return o}(o.getFieldValue("minAmount"),o.getFieldValue("maxAmount"),e);r(t)};return R(N,{children:[I("div",{className:XS,children:R(df,{children:[R("div",{className:GS,children:[I("div",{className:QS,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(Eo,{children:"To"}),I("div",{className:QS,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I(gp,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(DS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const eI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"greaterThan",label:"Greater than"},{value:"greaterThanEqual",label:"+"},{value:"lessThan",label:"Less than"},{value:"lessThanEqual",label:"Up to"}];function tI(){return et({key:"amount",name:"Amount",operators:eI,ModalComponent:JS})}function nI(){const{query:{data:e},isFilling:t}=xh(),n=e?.data,r=function({institutionIds:e}){const t=Mr(),n=Ur(),r=[...new Set(e)],a=V({queries:r.map(e=>({queryKey:xm({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Ku({institutionId:e,accessToken:t,environment:n})}),staleTime:864e5}))}),o={};return a.forEach(e=>{e.data&&(o[e.data.institutionId]=e.data?.data?.map?.logo)}),o}({institutionIds:o(()=>n?.map(e=>e.integration?.apiInstitutionId).filter(e=>ur(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=mh(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return u(()=>({values:a??[],isFilling:t}),[a,t])}function rI(e){return et({key:"bankAccount",name:"Bank Account",possibleValues:e})}const aI=e=>e.value.bankAccount?.value.id?.in?e.value.bankAccount?.value.id?.in:e.value.bankAccount?.value.id?.notIn?e.value.bankAccount?.value.id?.notIn:[],oI=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:ki(t[1].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function iI(e){return Br({queryKey:["dimensionValues"],queryFn:oI,...e})}function lI(){const{query:{data:e},isFilling:t}=kv({filter:{status:{in:["ACTIVE"]}}}),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Customer";return{name:t,value:{customer:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function sI(e){return et({key:"vendor",name:"Vendor",possibleValues:e})}function cI(e){const t=e.map(({name:e,types:t})=>function(e,t){const n="in";return{name:t,value:{type:{name:t,value:{[n]:e.map(e=>e.value)}}}}}(t,e));return et({key:"type",name:"Type",possibleValues:()=>({values:t})})}const dI=bi(e=>r.createElement("svg",{stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",...e},r.createElement("path",{d:"M8 15.3859C12.0792 15.3859 15.3861 12.079 15.3861 7.99982C15.3861 3.92062 12.0792 0.61377 8 0.61377C3.9208 0.61377 0.613953 3.92062 0.613953 7.99982C0.613953 12.079 3.9208 15.3859 8 15.3859Z",strokeMiterlimit:10}),r.createElement("circle",{fill:"currentColor",cx:8,cy:8,r:3.2})),"CircleFilled"),uI=fr(null,rr({fill:"surface.intent.action.active"}));function hI({isSelected:e}){return I(Pd,e?{Component:dI,stylists:[uI]}:{Component:pf})}function pI({filters:e,model:t,setFilters:n}){if(!t||!n)return null;const r=t.possibleValues?.();if(!r)return null;const a=t.selectedValues(e);return I(hf,{title:I(So,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?fI(l.value.status?.value):a.some(e=>C(e.value,l.value)));var l;return R(ff,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[I(hS,{children:I(uc,{wrap:"wrap",children:r.name})}),I(hI,{isSelected:i})]},`${r.name}_${o}`)})})}const gI="status",mI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function vI(){const e="in";return{values:mI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function fI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function bI(e){return fI(e.value.status?.value)}function yI(){return et({key:gI,name:"Status",possibleValues:vI,singleSelect:!0,SimpleListComponent:pI})}const wI=(CI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(CI));var CI;function xI({onApply:e,onClearAll:t}){const n=Sc();return I(DS,{onApply:()=>{e(),n.close()},onClearAll:t})}function TI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>ES(e),[e]),g=u(()=>{i(p)},[p,i]),m=u(()=>{if(p&&l&&s){const e=JT(s,"glAccount"),t=SS(l,e,p,"glAccount");d(t)}},[p,l,s,d]),v=I(xI,{onApply:m,onClearAll:g});return I(pS,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:I(rf,{placeholder:"Search GL accounts...",onClick:a,SearchList:kS,DefaultList:kI,listLength:e.children?.length??0,extraProps:{glAccounts:e.children??[],label:e.name,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}})})}function kI({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(Tf,{}):I(hf,{title:I(Eo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=ES(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(TI,{glAccounts:e.children??[],label:e.name,glAccount:e,badge:h,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d},e.id)}const t=r.has(e.id);return I(bf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(hS,{children:I(uc,{wrap:"wrap",children:e.name})})},e.id)})})}const EI=[];function AI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=NC(),s=i??EI,c=IS(JT(t,"glAccount"),"glAccount"),d=u(e=>{const t=SI(e);n(t)},[n]),h=NS("glAccount",r,0,a);return a&&o?I(rf,{placeholder:"Search GL accounts...",onClick:d,SearchList:kS,DefaultList:kI,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function SI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function II(e){return et({key:"glAccount",name:"GL Account",NestedListComponent:AI,possibleValues:e})}function NI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(gt(e)){const t=wt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(vt(e)){const t={};return t.greaterThanEqual=e.beginDate,t.lessThanEqual=e.endDate,t}}(r.date.value)),r.amount&&(n.amount=(a=e.amount,o=r.amount.value,a?{...a,...o}:o)),r.description&&(n.description=r.description.value),r.category&&(n.category=(i=e.category,l=r.category.value,dS(i,l))),r.reviewStatus&&(n.reviewStatus=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.reviewStatus,r.reviewStatus.value)),r.bankAccount&&(n.bankAccount=function(e,t){return dS(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return dS(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return dS(e,t)}(e.glAccount,r.glAccount.value)),r.type&&(n.type=function(e,t){return e&&e.in?t.in?{...e,in:[.../* @__PURE__ */new Set([...e.in,...t.in])]}:e:t}(e.type,r.type.value)),r.search&&(n.search=r.search.value),r.status&&(n.status=function(e,t){return e?{...e,...t}:t}(e.status,r.status.value)),r.vendor&&(n.vendor=function(e,t){return dS(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return dS(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function RI(e,t){const n=e.reduce(NI,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return wI.forEach(e=>{const n=t[e];t[e]=k(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const PI=e=>{const t=hn(e=>e.transactionsDashboardFilters),n=hn(e=>e.expenseDashboardFilters),r=hn(e=>e.incomeDashboardFilters),a=hn(e=>e.setTransactionsDashboardFilters),o=hn(e=>e.addTransactionsDashboardFilters),i=hn(e=>e.removeTransactionsDashboardFilter),l=hn(e=>e.hasInitializedTransactionsDashboardFilters),s=hn(e=>e.setExpenseDashboardFilters),c=hn(e=>e.addExpenseDashboardFilters),d=hn(e=>e.removeExpenseDashboardFilter),u=hn(e=>e.hasInitializedExpenseDashboardFilters),h=hn(e=>e.setIncomeDashboardFilters),p=hn(e=>e.addIncomeDashboardFilters),g=hn(e=>e.removeIncomeDashboardFilter),m=hn(e=>e.hasInitializedIncomeDashboardFilters);switch(e){case"transactionsDashboard":return{filters:t,setFilters:a,addFilters:o,removeFilter:i,hasUserConfiguredFilters:l};case"expenseDashboard":return{filters:n,setFilters:s,addFilters:c,removeFilter:d,hasUserConfiguredFilters:u};case"incomeDashboard":return{filters:r,setFilters:h,addFilters:p,removeFilter:g,hasUserConfiguredFilters:m}}};function DI(){return{getCategories:BS(),getBankAccounts:nI(),getCustomers:lI(),getVendors:function(){const{query:{data:e},isFilling:t}=Gm(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Vendor";return{name:t,value:{vendor:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return u(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=iI(),n=e?.data,r=o(()=>n?.map(e=>{const t=e.name??"Unknown Dimension Value";return{name:t,value:{dimensionValues:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=CC(),n=o(()=>e?.map(e=>SI(e)),[e]);return u(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:zS()}}function MI(e,t,n){return n?function(e,t){let n;return e.forEach(e=>{const r=e.value[t]?.value?.contain;r&&(n=r)}),n||""}(n,e):""}const LI=rr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function FI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(ZS,{title:"Back",children:I(OI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function OI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Sc();return wb({defaultValues:{[e.key]:MI(e.key,0,r)},onSubmit:()=>{if(!n||!r)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:n,pendingFilters:a});return R(N,{children:[I("div",{className:LI,children:I(df,{children:I(o.AppField,{name:e.key,listeners:{onBlur:()=>{const t=function(e,t){const n=e.trim();if(!n)return null;const r=t.operators?.find(e=>"contain"===e.value);return r?t.createFilter({name:`${r.label} "${n}"`,value:{[t.key]:{name:"",value:{[r.value]:n}}}}):null}(o.getFieldValue(e.key),e);r(t?[t]:[])}},children:t=>I(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),I(DS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const VI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function UI(){return et({key:"description",name:"Description",operators:VI,ModalComponent:FI})}const BI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function HI(){return et({key:"notes",name:"Notes",operators:BI,ModalComponent:FI})}const WI=[{name:"Expense",types:bw.Expense},{name:"Income",types:bw.Income},{name:"Transfer",types:bw.Transfer}];function _I(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=PI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=DI(),p=o(()=>({reviewStatus:_S(h),amount:tI(),bankAccount:rI(l),category:HS(i),customer:cS(c),date:Wt,description:UI(),glAccount:II(d),notes:HI(),status:yI(),vendor:sI(s),type:cI(WI),search:nt}),[l,i,s,c,d,h]),g=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),m=/* @__PURE__ */(new Date).getDate(),v=o(()=>RI(e,void 0),[e,m]),f=u(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}function zI(e,t,n,r,a){const o=hn(e=>e.initializeTransactionsDashboardFilters),i=hn(e=>e.initializeExpenseDashboardFilters),l=hn(e=>e.initializeIncomeDashboardFilters),c=hn(e=>e.hasInitializedTransactionsDashboardFilters),d=hn(e=>e.hasInitializedExpenseDashboardFilters),u=hn(e=>e.hasInitializedIncomeDashboardFilters),h=Gi(),p="transactionsDashboard"===e?c:"expenseDashboard"===e?d:u;s(()=>{const s=h?.value??[];!p&&!r&&t&&a&&("transactionsDashboard"===e?o({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):"expenseDashboard"===e?i({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}):l({userRole:t,hasNonReconciledTransactions:n,needsReviewStatuses:s}))},[p,r,t,a,e,n,h,o,i,l])}const jI=l(void 0);function qI(){const e=i(jI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function KI({filters:e,removeFilter:t}){return function(e){const t=[];let n=null,r=null,a=null,o=null,i=null;for(let s=0;s<e.length;s++){const l=e[s];if(l.modelKey!==tt&&l.modelKey!==Bt&&(l.modelKey!==gI||!bI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(dr(n)&&ur(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(dr(r)&&ur(e?.lessThanEqual)){r=s,o=e.lessThanEqual;continue}}t.push({key:l.id,text:l.name,indicesToRemove:[s]})}}const l=function(e,t,n,r,a){if(null!==e&&null!==t&&null!==n&&null!==r){const o=yo(hh(n),{dollarSign:!0,signage:"default"}),i=yo(hh(r),{dollarSign:!0,signage:"default"});return{key:`${a[e].id}-${a[t].id}`,text:`${o} - ${i}`,indicesToRemove:[e,t].sort((e,t)=>t-e)}}return null!==e?{key:a[e].id,text:a[e].name,indicesToRemove:[e]}:null!==t?{key:a[t].id,text:a[t].name,indicesToRemove:[t]}:null}(n,r,a,o,e);return l&&t.splice(i??t.length,0,l),t}(e).map(e=>I(vb,{text:e.text,additionalValidClassName:cr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const YI=bi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_24404_41655)"},r.createElement("path",{d:"M1 1V3.366L6.317 9.866V14L8.683 12.817V9.866L14 3.366V1H1Z",strokeWidth:1,strokeMiterlimit:10}))),"Filter"),ZI=rr({width:"17px",height:"17px",borderRadius:"sm"});function GI({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return ur(e)?R(N,{children:[!r&&I($o,{styles:ZI}),I("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[fr(cr["medium-icon"],cr.icon),...n??[]],size:17})}const QI=rr.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),XI={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function JI(){const e=ET(),{dashboardKey:t}=qI();return I(ec,{onClick:()=>{is(XI[t],{routeProps:{}})},styles:QI,children:e?I(GI,{Component:YI}):R(N,{children:[I(ul,{Component:YI}),I(uc,{children:"Filters"})]})})}const $I=S.object({beginDate:S.string().nullable(),endDate:S.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Rt(e.beginDate),n=Rt(e.endDate);if(t&&n)return!At(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),eN=rr({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),tN=rr({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),nN=fr(null,rr({marginTop:"22px"}));function rN({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,wb({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:$I},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=Te(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return R("div",{className:eN,children:[R("div",{className:tN,children:[I(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),I(Sd,{Component:yT,stylists:[nN]}),I(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&I(gp,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const aN={width:"fit-content"};function oN({onDateRangeChange:e}){const{filters:t}=qI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Bt);if(void 0!==t){const e=t.value.date?.value;if(vt(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(tx,{triggerChildren:I(ax,{displayLabel:"Custom"}),popupChildren:I(Uc,{style:aN,children:I(rN,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const iN=rr({width:200,minWidth:200});function lN({dateFilter:e,addFilter:t}){return I(qg,{onClick:()=>t(e),children:I(uc,{children:pt[e]})})}function sN({getModel:e,addFilters:t}){const{setOpen:n}=Sc(),r=r=>{const a=e(Bt);if(void 0===a)return;const o=a.createFilter({name:pt[r],value:{[a.key]:{name:pt[r],value:r}}});t([o]),n(!1)};return I(Uc,{children:R(Ug,{style:iN,children:[I(lN,{dateFilter:ht.ALL_TIME,addFilter:r}),I(dp,{alignment:"horizontal"}),I(lN,{dateFilter:ht.THIS_MONTH,addFilter:r}),I(lN,{dateFilter:ht.LAST_MONTH,addFilter:r}),I(lN,{dateFilter:ht.LAST_3_MONTHS,addFilter:r}),I(lN,{dateFilter:ht.LAST_12_MONTHS,addFilter:r}),I(dp,{alignment:"horizontal"}),I(lN,{dateFilter:ht.THIS_QUARTER,addFilter:r}),I(lN,{dateFilter:ht.LAST_QUARTER,addFilter:r}),I(dp,{alignment:"horizontal"}),I(lN,{dateFilter:ht.THIS_YEAR,addFilter:r}),I(lN,{dateFilter:ht.LAST_YEAR,addFilter:r}),I(dp,{alignment:"horizontal"}),I(oN,{onDateRangeChange:n=>{const r=e(Bt);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}function cN({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Bt);let n=pt[ht.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=gt(e)?pt[e]:vt(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Rt(e.beginDate):null,n=e.endDate?Rt(e.endDate):null;return t&&!n?`After ${Ot(t)}`:!t&&n?`Before ${Ot(n)}`:t&&n?`${St(t)} - ${St(n)}`:"Custom"}(e):t.name}return n})(e);return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(ec,{styles:QI,popupTriggerProps:e,children:I(uc,{children:r})})}),I(sN,{getModel:t,addFilters:n})]})}const dN=rr({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),uN=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function hN({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=Sc();return I(qg,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:R("div",{className:dN,children:[R("span",{className:uN,children:[n&&I(Pd,{Component:n}),I(uc,{children:e})]}),o&&I(Pd,{Component:ol})]})})}const pN=[{label:yw[vw.EXPENSE],type:vw.EXPENSE},{label:yw[vw.REVENUE],type:vw.REVENUE},{label:yw.BANK_TRANSFER,type:"TRANSFER_IN"},{label:yw.BANK_TRANSFER,type:"TRANSFER_OUT"}];function gN({manualTransactionOptions:e}){const t=pN.filter(t=>e.includes(t.type));return I(Uc,{children:I(Ug,{children:t.map(({label:e,type:t})=>I(hN,{closeOnClick:!0,onClick:()=>gs(null,{initialType:t}),children:e},t))})})}function mN({manualTransactionOptions:e,intent:t="secondary"}){const n=ET(),r="primary"===t?Id:ec;return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(r,{styles:QI,popupTriggerProps:e,children:n?I(GI,{Component:Bs}):R(N,{children:[I(ul,{Component:Bs}),I(uc,{children:"Add New..."})]})})}),I(gN,{manualTransactionOptions:e})]})}const vN=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.2016 7.5C13.2023 7.15497 13.1694 6.81068 13.1034 6.47202L14.4718 5.68631L12.5926 2.4125L11.2307 3.19821C10.7043 2.75208 10.1007 2.40592 9.44979 2.17679V0.625H5.70455V2.20298C5.05363 2.43211 4.45006 2.77827 3.9236 3.2244L2.56169 2.43869L0.682526 5.7125L2.05098 6.49821C1.92 7.17727 1.92 7.87511 2.05098 8.55417L0.682526 9.33988L2.56169 12.6137L3.9236 11.828C4.45006 12.2741 5.05363 12.6203 5.70455 12.8494V14.375H9.44979V12.797C10.1007 12.5679 10.7043 12.2217 11.2307 11.7756L12.5926 12.5613L14.4718 9.2875L13.1034 8.50179C13.1677 8.17171 13.2006 7.83628 13.2016 7.5Z"}),r.createElement("path",{d:"M7.57716 10.0012C8.95853 10.0012 10.0784 8.88134 10.0784 7.49997C10.0784 6.1186 8.95853 4.99878 7.57716 4.99878C6.19579 4.99878 5.07597 6.1186 5.07597 7.49997C5.07597 8.88134 6.19579 10.0012 7.57716 10.0012Z"})),"Gear"),fN=rr.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function bN(){return I(ec,{styles:fN,onClick:()=>is("TransactionSettingsDrawer"),children:I(Pd,{Component:vN})})}const yN=rr.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function wN({children:e,styles:t}){return I("div",{className:rr(yN,t),children:e})}const CN=fr(cr["dashboard-header"],rr({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),xN=fr(null,rr({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),TN=rr.raw({paddingLeft:"15px",paddingRight:"15px"}),kN=rr({display:"none",xl:{display:"flex"}});function EN({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=qI(),l=ET(),s=o(()=>dr(n)?"":n.find(e=>e.modelKey===tt)?.value.search?.value??"",[n]);return R("div",{...CN,children:[R("div",{...xN,children:[I(zT,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(tt);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:QT(l)}),I(JI,{}),I(mN,{manualTransactionOptions:t}),!l&&I(cN,{filters:n,getModel:a,addFilters:i}),I(bN,{}),I("div",{className:kN,children:I(vl,{})})]}),n.length>0&&I(wN,{styles:TN,children:I(KI,{filters:n,removeFilter:r})})]})}const AN=mn.filter(e=>e!==gn.COMMENTS&&e!==gn.DIMENSION_VALUE),SN=fr(null,rr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function IN(){return I("div",{...SN,children:I(vl,{})})}const NN=fr(cr["bulk-select"],rr({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function RN({table:e,selectedCount:t,actions:n}){const r=()=>e.resetRowSelection(!0);return R("div",{...NN,children:[I(wT,{table:e}),I(Eo,{children:`${t} selected`}),n.filter(e=>e.isVisible).map(e=>I(f,{children:e.render({resetSelected:r})},e.id))]})}const PN=bi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M10.6196 14.2124H4.3803C4.06894 14.2128 3.7693 14.0937 3.54327 13.8795C3.31724 13.6654 3.18207 13.3726 3.16568 13.0617L2.61591 3.22968H12.384L11.8342 13.0617C11.8179 13.3726 11.6827 13.6654 11.4567 13.8795C11.2306 14.0937 10.931 14.2128 10.6196 14.2124Z",strokeMiterlimit:10}),r.createElement("path",{d:"M1.3949 3.22968H13.605",strokeMiterlimit:10}),r.createElement("path",{d:"M6.27894 0.787598H8.72097C9.0448 0.787598 9.35537 0.91624 9.58435 1.14522C9.81334 1.37421 9.94198 1.68478 9.94198 2.00861V3.22963H5.05792V2.00861C5.05792 1.68478 5.18656 1.37421 5.41555 1.14522C5.64453 0.91624 5.9551 0.787598 6.27894 0.787598Z",strokeMiterlimit:10}),r.createElement("path",{d:"M9.09821 5.05792V12.384",strokeMiterlimit:10}),r.createElement("path",{d:"M5.90167 5.05792V12.384",strokeMiterlimit:10})),"Delete"),DN=bi(e=>r.createElement("svg",{stroke:"currentColor",width:"16px",height:"16px",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.84644 15.0764C11.6751 15.0764 14.7788 11.9727 14.7788 8.14405C14.7788 4.3154 11.6751 1.21167 7.84644 1.21167C4.0178 1.21167 0.914062 4.3154 0.914062 8.14405C0.914062 11.9727 4.0178 15.0764 7.84644 15.0764Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.79217 9.6784V8.95116C7.79192 8.79114 7.82335 8.63265 7.88467 8.48484C7.94598 8.33703 8.03596 8.20282 8.14941 8.08996L8.65337 7.586C8.88132 7.35726 9.00972 7.04774 9.01061 6.7248V6.61636C9.00892 6.29431 8.8798 5.98603 8.65149 5.75891C8.42317 5.53179 8.11422 5.40429 7.79217 5.4043C7.47012 5.40429 7.16117 5.53179 6.93285 5.75891C6.70453 5.98603 6.57542 6.29431 6.57373 6.61636",strokeMiterlimit:10}),r.createElement("path",{d:"M7.18604 10.8838H8.39809",strokeMiterlimit:10})),"Uncategorized"),MN=rr.raw({gap:"6px"});function LN({Icon:e,label:t,children:n,onClick:r}){return n?R(Ac,{placement:"bottom-start",children:[I(Ic,{children:n=>R(qc,{popupTriggerProps:n,extraClassNames:[MN],children:[e&&I(ul,{Component:e}),I(uc,{children:t})]})}),n]}):R(qc,{onClick:r,extraClassNames:[MN],children:[e&&I(ul,{Component:e}),I(uc,{children:t})]})}const FN={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},ON=e=>e.map(e=>({id:e.id,status:FN.INACTIVE}));function VN({transactions:e,resetSelected:t,...n}){const{mutateAsync:r}=mC(),a=async()=>{const n=ON(e);await r(n),t&&t()};return I(LN,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&dh({title:"Delete transactions",body:`Are you sure you want to delete ${uh("transaction","transactions",t,!0)}?`,buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Delete",type:ch.DANGER}]}).then(e=>{e===Zu&&n()}));var t,n}})}const UN=(e,t)=>e.map(e=>({id:e.id,categoryId:t})),BN=(e,t)=>e.map(e=>({id:e.id,glAccountId:t}));function HN({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=vC();return I(LN,{label:t,...r,children:I(Ux,{onClick:async function(t){t?.id&&(await a(UN(e,t.id.toString())),n&&n())}})})}function WN({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=vC();return I(LN,{label:t,...r,children:I(sx,{onClick:async function(t){await a(BN(e,t.id)),n&&n()},types:RC,placeholder:"Search revenue accounts..."})})}function _N({subActionList:e}){return I(Ug,{children:e})}function zN({subActions:e,transactions:t,label:n,Icon:r,resetSelected:a}){const i=o(()=>e.map(e=>{const{component:n,id:r,filter:o,label:i}=e,l=t.filter(e=>!o||o(e));return l.length>0?I(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return I(LN,{label:n,Icon:r,children:I(Uc,{children:i.length>0?I(_N,{subActionList:i}):I(qg,{children:I(uc,{children:"No Actions Available for Selection"})},"no-actions")})})}function jN({transactions:e,id:t,label:n,resetSelected:r}){const{mutateAsync:a}=pC({mutationFn:sC,meta:{toastOptions:{defaultErrorMessage:"Couldn't update review statuses"}}}),o=Sc();return Qi(t)?I(qg,{onClick:()=>(async t=>{if(o.close(),e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));await a(r)}var n;r&&r()})(t),children:I(uc,{wrap:"wrap",children:n})}):null}function qN({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r,zeroStateEventName:i}){const l=ET(),s=function({transactions:e,columns:t}){const n=ET(),r=ST({transactions:e,columns:t?[gn.SELECT,...t,gn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!dr(t.getColumn(pn.SELECT)),o=a(r?e:null);if(r){if(o.current!==e&&void 0!==o.current){const e=t.getSelectedRowModel().rows.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{});t.setRowSelection(e)}o.current=e}}(e,r,!n),r}({transactions:e,columns:t}),c=function(e){const t=qi(),n=e.getSelectedRowModel().rows;return o(()=>{const e=n.map(e=>e.original),r=e.filter(e=>"EXPENSE"===e.type),a=e.filter(e=>"REVENUE"===e.type),o=t.map(({status:e,displayName:t})=>({id:e,label:t,component:jN})),i=[{id:"delete",isVisible:e.length>0,render:({resetSelected:t})=>I(VN,{label:"Delete",Icon:PN,transactions:e,resetSelected:t})},{id:"recategorize-expenses",isVisible:r.length>0,render:({resetSelected:e})=>I(HN,{label:`Recategorize ${uh("Expense","Expenses",r.length,!0)}`,Icon:DN,transactions:r,resetSelected:e})},{id:"recategorize-revenues",isVisible:a.length>0,render:({resetSelected:e})=>I(WN,{label:`Recategorize ${uh("Revenue","Revenues",a.length,!0)}`,Icon:DN,transactions:a,resetSelected:e})},{id:"review",isVisible:e.length>0,render:({resetSelected:t})=>I(zN,{label:"Change Review Status",Icon:xi,transactions:e,subActions:o,resetSelected:t})}];return{selectedCount:e.length,actions:i}},[n,t])}(s),{setFilters:d}=qI(),u=s.getIsAllRowsSelected(),h=s.getIsSomeRowsSelected(),p=u||h;let g;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?g=I(nk,{buttonText:"Clear Filters",onButtonClick:()=>d([])}):r&&0===e?.length&&(g=I(FT,{})):g=I(MT,{eventSource:i});const m=p&&dr(g)&&!l;return R(oc,{dashboard:"transactionDashboard",children:[m?I(RN,{table:s,...c}):I(_l,{headerGroups:s.getHeaderGroups()}),dr(g)?I(GT,{table:s}):I(Ed,{children:g})]})}const KN={transform(e){const{align:t,justify:n,direction:r,gap:a,...o}=e;return{display:"flex",flexDirection:r,alignItems:t,justifyContent:n,gap:a,...o}},defaultValues:{direction:"column",gap:"8px"}},YN=(e={})=>{const t=Zn(KN,e);return KN.transform(t,Yn)},ZN=e=>rr(YN(e));ZN.raw=YN;const GN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},QN=(e={})=>{const t=Zn(GN,e);return GN.transform(t,Yn)},XN=e=>rr(QN(e));XN.raw=QN;const JN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},$N=(e={})=>{const t=Zn(JN,e);return JN.transform(t,Yn)},eR=e=>rr($N(e));eR.raw=$N;const tR={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},nR=(e={})=>{const t=Zn(tR,e);return tR.transform(t,Yn)},rR=e=>rr(nR(e));rR.raw=nR;const aR=rr({display:"flex",padding:"16px 12px",borderWidth:"md",borderStyle:"solid",borderRadius:"lg",borderColor:"border.layout",backgroundColor:"surface.foreground"}),oR=fr(cr.card,aR,rr({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function iR({children:e}){return I("div",{...oR,children:e})}const lR=fr(cr["card-header"],rr({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function sR({children:e}){return I("div",{...lR,children:e})}const cR=rr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function dR({children:e}){return I("div",{className:cR,children:e})}const uR=lr({base:{display:"flex",height:"48px",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",borderRadius:"sm",cursor:"pointer",background:"surface.background",gap:"8px",alignSelf:"stretch",userSelect:"none"},variants:{filterStatus:{inactive:{padding:"8px"},active:{paddingTop:"8px",paddingBottom:"8px",paddingRight:"8px",paddingLeft:"4px",borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:"brand.action.strong",background:"surface.background.hover"},zeroState:{color:"typography.base.weak",cursor:"default",padding:"8px"}}},defaultVariants:{filterStatus:"inactive"}});function hR({filterApiNames:e,filterModelKey:t,extractFilterValue:n,filterStatus:r,buttonClassName:a,isZeroState:o,filterEffectiveValueExtractor:i,children:l}){const{addFilters:s,filters:c,getModel:d,removeFilter:u}=qI();if(!d(t))return null;const h="active"===r,p=fr(cr["card-button"],uR({filterStatus:r}),a);return I("div",o?{...p,children:l}:{...p,onClick:h?()=>{return t=u,void function(e,t,n){const r=[];return e.forEach((e,a)=>{n(e).some(e=>t.includes(e))&&r.push(a)}),r.reverse()}(c,e,i).forEach(e=>{t(e)});var t}:()=>((e,t,n,r,a)=>{const o=e(t);if(!o||!o.possibleValues)return;const i=[];o.possibleValues().values.forEach(e=>{const t=n(e.value);if(t&&t.some(e=>r.includes(e))){const t=o.createFilter(e);i.push(t)}}),a(i)})(d,t,n,e,s),children:l})}const pR=lr({base:{display:"flex",padding:"10px",justifyContent:"center",alignItems:"center",gap:"8px",borderRadius:"sm",borderWidth:"1px",borderStyle:"solid"},variants:{intent:{danger:{borderColor:"border.intent.danger",background:"surface.intent.danger"},warning:{borderColor:"border.intent.warning",background:"surface.intent.warning"},success:{borderColor:"border.intent.success",background:"surface.intent.success"},neutral:{borderColor:"border.intent.secondary",background:"surface.intent.secondary"}}},defaultVariants:{intent:"neutral"}}),gR=rr({minWidth:"200px"}),mR=rr({marginLeft:"auto"});function vR({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=qI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Br({queryKey:rC({groupBy:e,filter:t}),queryFn:aC})}({groupBy:"REVIEW_STATUS",filter:e});return{data:t?.data??void 0,isFilling:n,isRehydrating:r}}(r);let o=e.value.some(e=>{return t=n,!(!(r=e)||!Qi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,fr(cr["card-button-icon-container"],pR({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Qi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return R(hR,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:gR,isZeroState:t,filterEffectiveValueExtractor:jS,children:[I("div",{...l,children:I(Pd,{Component:e.Icon})}),!t&&i&&R(N,{children:[I(Eo,{children:e.text}),I("div",{className:mR,children:I(Du,{children:s})})]}),!t&&!i&&R(N,{children:[I(uc,{children:e.text}),I("div",{className:rr({marginLeft:"auto"}),children:I(Du,{children:s})})]}),t&&R(N,{children:[I(uc,{intent:"weak",children:e.text}),I("div",{className:rr({marginLeft:"auto"}),children:I(Du,{children:s})})]})]},e.text)}function fR({isZeroState:e}){const t=function(){const e=Zi();return(e?Wi:_i).map(t=>Ki(t,e))}();return R(iR,{children:[I(sR,{children:I(uc,{intent:"weak",children:"Review Status"})}),I(dR,{children:t.map(t=>I(vR,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const bR=rr({width:"20px",height:"20px",borderRadius:"sm"});function yR({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return ur(e)?R(N,{children:[!r&&I($o,{styles:bR}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[fr(cr["medium-icon"],cr.icon),...n??[]],size:20})}const wR=rr({minWidth:"269px"}),CR=rr({marginLeft:"auto"});function xR({account:e,isZeroState:t}){const{apiFilters:n}=qI(),r=(i=n,l=e.id,i.bankAccount?.id?.in?.includes(l)?"active":"inactive"),a="active"===r,o=e.name??"";var i,l;const s=Rr(e.mask)?void 0:gh(e.mask),c=yo(null!=(d=e.accountBalance)?hh(d):0,{dollarSign:!0});var d;return R(hR,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:wR,isZeroState:t,filterEffectiveValueExtractor:aI,children:[e.iconUrl&&I(yR,{imageUrl:e.iconUrl,Component:ym}),!t&&a&&R(N,{children:[I(Eo,{children:o}),s&&I(uc,{wrap:"wrap",children:s}),I("div",{className:CR,children:I(Du,{children:c})})]}),!t&&!a&&R(N,{children:[I(uc,{children:o}),s&&I(uc,{wrap:"wrap",children:s}),I("div",{className:CR,children:I(Du,{children:c})})]}),t&&R(N,{children:[I(uc,{intent:"weak",children:o}),s&&I(uc,{intent:"weak",wrap:"wrap",children:s}),I("div",{className:CR,children:I(Du,{children:c})})]})]},e.id)}const TR=[{name:"Expenses Card",mask:"0000",accountBalance:1e6},{name:"Travel Card",mask:"0001",accountBalance:5e5},{name:"Primary Checking",mask:"0002",accountBalance:15e5},{name:"Emergency Savings",mask:"0003",accountBalance:15e5}];function kR({isZeroState:e}){const{query:{data:t}}=xh({params:{filter:{apiName:{in:[...am]}}}}),n=(r=t?.data??[],e?TR:r.filter(e=>"ACTIVE"===e.status).sort((e,t)=>{const n=e.latestTransactionDate??"",r=t.latestTransactionDate??"";if(n!==r)return r.localeCompare(n);const a=e.accountBalance??0;return(t.accountBalance??0)-a}).slice(0,4));var r;return R(iR,{children:[I(sR,{children:I(uc,{intent:"weak",children:"Account Balances"})}),I(dR,{children:n.map((t,n)=>I(xR,{account:t,isZeroState:e},n))})]})}const ER=rr({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),AR=rr({display:{"@page/xl":"flex",base:"none"}}),SR=rr({display:{"@page/xl":"none",base:"flex"}}),IR=rr({maxWidth:"100%",display:{"@page/md":"grid",base:"none"},gridTemplateColumns:{"@page/xl":"1fr 2fr 4fr","@page/md":"1fr 1fr"},gridTemplateRows:{"@page/xl":"1fr"},height:"auto",gap:"16px",alignSelf:"stretch",borderRadius:"borderWidths.sm"});function NR({showZeroStates:e,Chart:t}){return R("div",{className:IR,children:[I("div",{className:AR,children:I(fR,{isZeroState:e})}),I("div",{className:AR,children:I(kR,{isZeroState:e})}),I("div",{className:ER,children:I(t,{})}),I("div",{className:SR,children:I(fR,{isZeroState:e})}),I("div",{className:SR,children:I(kR,{isZeroState:e})})]})}const RR=rr({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),PR=rR({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),DR=rr({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),MR=rr({paddingTop:"8px"}),LR=rr({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),FR=rr({display:"flex",flexDirection:"column",gap:"10px"});function OR({columns:e=AN,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1,zeroStateEventName:d}){const{filters:u}=qI(),{hasPlaidLinkedBankAccount:h}=im(),p=h??!1,g=ET();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(xl,{});if(void 0!==t){const r=function(e,t){let n;return n=0===e?"FILTERS_NOT_APPLIED":e>0&&0===t?"FILTERS_MATCHED_NONE":"FILTERS_MATCHED_ANY",n}(1===u.length&&ur(u[0].value?.date)?0:u.length,t.length);return I("div",{className:PR,children:R("div",{className:RR,children:[g&&c&&I("div",{className:FR,children:I(qk,{})}),I(NR,{Chart:l,showZeroStates:!i}),R("div",{className:DR,children:[I("div",{className:MR,children:I(EN,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:LR,children:I(qN,{hasLinkedBankAccount:p,filterState:r,transactions:t,columns:e,zeroStateEventName:d})})]}),I(IN,{})]})})}return"zero state"}const VR=rr({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),UR=fr(cr.card,aR,VR);function BR({children:e}){return I("div",{...UR,children:e})}const HR=rr({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function WR({children:e}){return I("div",{className:HR,children:e})}const _R=fr(cr["card-header"],rr({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function zR({children:e}){return I("div",{..._R,children:e})}const jR=rr({minWidth:"300px"});function qR({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:jR,children:I(Of,{options:e,handleClick:t,selectedIndex:n})})}function KR(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=ut(e);return{beginDate:dt(at(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:rt(at(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:it()}:"LAST_12_MONTHS"}const YR=Po.var("colors.border.layout"),ZR=fr(cr["profit-loss-graph"],rr({"& .recharts-surface":{outline:"none"}})),GR=Po.var("colors.money.positive.weak"),QR=Po.var("colors.money.positive"),XR=Po.var("colors.money.negative.weak"),JR=Po.var("colors.money.negative"),$R=Po.var("colors.surface.intent.action"),eP=Po.var("colors.surface.intent.action.active"),tP=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],nP=()=>{const[e,t]=d(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=_a({accountingMethod:"CASH",filter:KR(e),grouping:e,select:t=>{if("SUCCESS"!==t.result)return[];const n=t.json?.data;if(void 0===n)return[];let r=n;return"YEARLY"===e&&(r=function(e){let t=!1;const n=[],r=e.length-1,a=e.length-2;return e.forEach((e,o)=>{((e?.income?.total??0)>0||(e?.expenses?.total??0)>0)&&(t=!0),(t||o===r||o===a)&&n.push(e)}),n}(n)),r.map(t=>{const n=t.period?.beginDate,{label:r,longLabel:a}=function(e,t){return void 0===e?{label:"",longLabel:""}:"MONTHLY"===t?function(e){const t=Rt(e??"");return{longLabel:t?Lt(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:ja(e)}}(e):"QUARTERLY"===t?function(e){const t=ot(e),n=t.getMonth(),r=Math.trunc(n/3)+1,a=t.getFullYear();return{label:`Q${r} ${"'"+a%100}`,longLabel:`Quarter ${r} ${a}`}}(e):"YEARLY"===t?function(e){const t=ot(e).getFullYear();return{label:t.toString(),longLabel:t.toString()}}(e):{label:"",longLabel:""}}(n,e);return{longLabel:a,income:(t.income?.total??0)+(t.otherIncome?.total??0),expense:(t.cogs?.total??0)+(t.expenses?.total??0)+(t.otherExpenses?.total??0),label:r}})}});return t??[]}(tP[e].value)}};function rP({selectedIndex:e,onSelect:t}){return I(qR,{options:tP,handleClick:t,selectedIndex:e})}const aP={top:20,right:20,left:20,bottom:5},oP={fill:Po.var("colors.typography.base"),fontSize:Po.var("fontSizes.metric.sm")};function iP({data:e,children:t,tooltip:n}){return I(W,{width:"100%",height:"100%",...ZR,style:{flexGrow:1},children:R(_,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:aP,children:[I(q,{dataKey:"label",interval:0,tickLine:!1,stroke:YR,tick:oP}),I(Y,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const lP=rr({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function sP(){return R("div",{className:lP,children:[I(Fo,{color:GR,label:"Income",diameter:10}),I(Fo,{color:XR,label:"Expense",diameter:10})]})}const cP=fr(null,rr({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),dP=fr(null,rr({width:"100%",height:"1px",backgroundColor:"border.layout"})),uP=fr(null,rr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),hP=Po.var("colors.money.positive"),pP=Po.var("colors.money.negative");function gP({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t.find(e=>"income"===e.dataKey),r=t.find(e=>"expense"===e.dataKey),a=t[0]?.payload?.longLabel||"",o=n?.value??0,i=r?.value??0;return R("div",{...cP,children:[I(Eo,{children:a}),I("div",{...dP}),R("div",{...uP,children:[I(Fo,{color:hP,label:"Income",diameter:12}),I(Du,{children:wo(Number(o))})]}),R("div",{...uP,children:[I(Fo,{color:pP,label:"Expense",diameter:12}),I(Du,{children:wo(Number(i))})]})]})}function mP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=nP(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(BR,{children:[R(WR,{children:[R(zR,{children:[I(uc,{intent:"weak",children:"All Transactions"}),I(po,{title:wo(r),label:void 0})]}),R(zR,{children:[I(rP,{selectedIndex:e,onSelect:t}),I(sP,{})]})]}),R(iP,{data:n,tooltip:({active:e,payload:t})=>I(gP,{active:e,payload:t}),children:[I(Z,{name:"Income",dataKey:"income",minPointSize:2,fill:GR,isAnimationActive:!1,activeBar:{fill:QR}}),I(Z,{name:"Expense",dataKey:"expense",minPointSize:2,fill:XR,isAnimationActive:!1,activeBar:{fill:JR}})]})]})}const vP=rr({display:"flex",flexDirection:"column",gap:{base:0,sm:"16px"}});function fP({columns:e,limit:t=100}){const n=_I(),{userRole:r}=i(ed),{sortInstance:a,setSortInstance:o,apiSort:l}=sw(),s=jk(),{isFilling:c,paginationControls:d,query:{data:u,isError:h,error:p,isFetching:g}}=Ts({limit:t,sort:l,filter:{...n.apiFilters}}),m=u?.data,v=Ss();return zI("transactionsDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,c,v),R("div",{className:vP,children:[s&&I(Hk,{}),I(jI.Provider,{value:n,children:I(dl.Provider,{value:d,children:I(ic.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(OR,{columns:e,transactions:m,isFetching:g,isFilling:c,isError:h,error:p??null,hasTransactions:v,Chart:mP,manualTransactionOptions:[vw.EXPENSE,vw.REVENUE,"TRANSFER_IN"],zeroStateEventName:"TransactionsDashboardZeroState"})})})})]})}const bP=e=>I(Xk,{children:I(Jk,{source:"TransactionsDashboard",children:I(fP,{...e})})}),yP={in:["EXPENSE","TRANSFER_OUT"]},wP=[{name:"Expense",types:bw.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:vw.TRANSFER_OUT}]}];function CP(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=PI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=DI(),p=o(()=>({reviewStatus:_S(h),amount:tI(),bankAccount:rI(l),category:HS(i),customer:cS(c),date:Wt,description:UI(),glAccount:II(d),notes:HI(),status:yI(),vendor:sI(s),type:cI(wP),search:nt}),[l,i,s,c,d,h]),g=o(()=>[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor],[p.reviewStatus,p.amount,p.bankAccount,p.category,p.customer,p.date,p.description,p.glAccount,p.notes,p.status,p.type,p.vendor]),m=/* @__PURE__ */(new Date).getDate(),v=o(()=>RI(e,yP),[e,m]),f=u(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}const xP=fr(cr.text,rr({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),eo);function TP({children:e}){return I("div",{...xP,children:e})}const kP=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function EP({active:e,payload:t}){if(!e||!t||0===t.length)return null;const n=t[0]?.payload?.longLabel||"",r=Number(t[0]?.value??0);return R("div",{className:kP,children:[I(yy,{children:n}),I(TP,{children:xo(r)})]})}const AP=rr({width:"160px",height:"32px"}),SP=rr({width:"54px",height:"32px"}),IP=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:AP,children:I(uc,{children:String(t.value)})}),NP=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:SP,children:I(uc,{alignment:"right",children:(r=n.value,yo(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},RP=({active:e,payload:t})=>I(EP,{active:e,payload:t});function PP({data:e}){return I(W,{width:"100%",height:44*(e?.length??0)+12,...ZR,children:R(_,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[I(q,{type:"number",hide:!0,domain:[0,"dataMax"]}),I(K,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:IP,width:172}),I(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:NP,width:66}),I(Y,{content:RP,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(Z,{dataKey:"total",minPointSize:2,fill:$R,isAnimationActive:!1,activeBar:{fill:eP},barSize:32})]})})}const DP=e=>{if("SUCCESS"!==e.result)return[];const t=e.json?.data?.[0];return void 0!==t&&void 0!==t.expenses&&t.expenses.children?t.expenses.children.map(e=>{const t=e.name??"Uncategorized";return{name:t,longLabel:t,total:e.total??0}}).filter(e=>0!==e.total).sort((e,t)=>t.total-e.total).slice(0,5):[]},MP=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function LP(){const[e,t]=d(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Pt(n),endDate:Pt(t)}})(MP[e].value),{query:{data:r}}=_a({filter:n,select:DP}),a=n?`${St(Rt(n.beginDate))} - ${St(Rt(n.endDate))}`:"";return R(BR,{children:[R(WR,{children:[R(zR,{children:[I(uc,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(uc,{intent:"weak",wrap:"ellipsis",children:a})]}),I(qR,{options:MP,handleClick:e=>t(e),selectedIndex:e})]}),I(PP,{data:r})]})}function FP({columns:e,limit:t=100}){const n=CP(),{userRole:r}=i(ed),{sortInstance:a,setSortInstance:o,apiSort:l}=sw(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=Ts({limit:t,sort:l,filter:{...n.apiFilters}}),g=d?.data,m=Ss();return zI("expenseDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),I(jI.Provider,{value:n,children:I(dl.Provider,{value:c,children:I(ic.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(OR,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:LP,manualTransactionOptions:[vw.EXPENSE,"TRANSFER_OUT"],showTasks:!0,zeroStateEventName:"ExpenseDashboardZeroState"})})})})}const OP=e=>I(Xk,{children:I(Jk,{source:"ExpenseDashboard",children:I(FP,{...e})})}),VP={in:["REVENUE","TRANSFER_IN"]},UP=[{name:mw,types:bw.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:vw.TRANSFER_IN}]}];function BP(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=PI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=DI(),h=o(()=>({reviewStatus:_S(d),amount:tI(),bankAccount:rI(l),category:HS(i),customer:cS(s),date:Wt,description:UI(),glAccount:II(c),notes:HI(),status:yI(),type:cI(UP),search:nt}),[l,i,s,c,d]),p=o(()=>[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type],[h.reviewStatus,h.amount,h.bankAccount,h.category,h.customer,h.date,h.description,h.glAccount,h.notes,h.status,h.type]),g=/* @__PURE__ */(new Date).getDate(),m=o(()=>RI(e,VP),[e,g]),v=u(e=>h[e],[h]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:p,setFilters:t,addFilters:n,removeFilter:r,apiFilters:m,getModel:v,hasUserConfiguredFilters:a}}function HP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=nP(),r=n.reduce((e,t)=>e+t.income,0);return R(BR,{children:[R(WR,{children:[R(zR,{children:[I(uc,{intent:"weak",children:"Total Income"}),I(po,{title:wo(r),label:void 0})]}),I(zR,{children:I(rP,{selectedIndex:e,onSelect:t})})]}),I(iP,{data:n,tooltip:({active:e,payload:t})=>I(EP,{active:e,payload:t}),children:I(Z,{name:"Revenue",dataKey:"income",minPointSize:2,fill:$R,isAnimationActive:!1,activeBar:{fill:eP}})})]})}function WP({columns:e,limit:t=100}){const n=BP(),{userRole:r}=i(ed),{sortInstance:a,setSortInstance:o,apiSort:l}=sw(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=Ts({limit:t,sort:l,filter:{...n.apiFilters}}),g=d?.data,m=Ss();return zI("incomeDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),I(jI.Provider,{value:n,children:I(dl.Provider,{value:c,children:I(ic.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(OR,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:HP,manualTransactionOptions:[vw.REVENUE,"TRANSFER_IN"],showTasks:!0,zeroStateEventName:"IncomeDashboardZeroState"})})})})}const _P=e=>I(Xk,{children:I(Jk,{source:"IncomeDashboard",children:I(WP,{...e})})});var zP=(e=>(e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e))(zP||{});function jP(e){return"object"==typeof e&&null!=e&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function qP(e={}){const{initialEntries:t=["/"],initialIndex:n,v5Compat:r=!1}=e;let a;a=t.map((e,t)=>d(e,"string"==typeof e?null:e.state,0===t?"default":void 0,"string"==typeof e?void 0:e.mask));let o=s(null==n?a.length-1:n),i="POP",l=null;function s(e){return Math.min(Math.max(e,0),a.length-1)}function c(){return a[o]}function d(e,t=null,n,r){const o=ZP(a?c().pathname:"/",e,t,n,r);return YP("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function u(e){return"string"==typeof e?e:GP(e)}return{get index(){return o},get action(){return i},get location(){return c()},createHref:u,createURL:e=>new URL(u(e),"http://localhost"),encodeLocation(e){const t="string"==typeof e?QP(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,t){i="PUSH";const n=jP(e)?e:d(e,t);o+=1,a.splice(o,a.length,n),r&&l&&l({action:i,location:n,delta:1})},replace(e,t){i="REPLACE";const n=jP(e)?e:d(e,t);a[o]=n,r&&l&&l({action:i,location:n,delta:0})},go(e){i="POP";const t=s(o+e),n=a[t];o=t,l&&l({action:i,location:n,delta:e})},listen:e=>(l=e,()=>{l=null})}}function KP(e,t){if(!1===e||null==e)throw new Error(t)}function YP(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function ZP(e,t,n=null,r,a){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?QP(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10),mask:a}}function GP({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function QP(e){const t={};if(e){const n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));const r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}var XP=(e=>(e.data="data",e.redirect="redirect",e.error="error",e))(XP||{});class JP{#e=/* @__PURE__ */new Map;constructor(e){if(e)for(const[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(void 0!==e.defaultValue)return e.defaultValue;throw new Error("No value found for context")}set(e,t){this.#e.set(e,t)}}const $P=/* @__PURE__ */new Set(["lazy","caseSensitive","path","id","index","children"]),eD=/* @__PURE__ */new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function tD(e){return eD.has(e)}function nD(e,t,n=[],r={},a=!1){return e.map((e,o)=>{const i=[...n,String(o)],l="string"==typeof e.id?e.id:i.join("-");if(KP(!0!==e.index||!e.children,"Cannot specify children on an index route"),KP(a||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),!0===e.index){const n={...e,id:l};return r[l]=rD(n,t(n)),n}{const n={...e,id:l,children:void 0};return r[l]=rD(n,t(n)),e.children&&(n.children=nD(e.children,t,i,r,a)),n}})}function rD(e,t){return Object.assign(e,{...t,..."object"==typeof t.lazy&&null!=t.lazy?{lazy:{...e.lazy,...t.lazy}}:{}})}function aD(e,t,n,r,a){const o=yD(("string"==typeof t?QP(t):t).pathname||"/",n);if(null==o)return null;const i=a??iD(e);let l=null;const s=function(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return YP(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}(o);for(let c=0;null==l&&c<i.length;++c)l=fD(i[c],s,r);return l}function oD(e,t){const{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function iD(e){const t=lD(e);return t.sort((e,t)=>{return e.score!==t.score?t.score-e.score:(n=e.routesMeta.map(e=>e.childrenIndex),r=t.routesMeta.map(e=>e.childrenIndex),n.length===r.length&&n.slice(0,-1).every((e,t)=>e===r[t])?n[n.length-1]-r[r.length-1]:0);var n,r}),t}function lD(e,t=[],n=[],r="",a=!1){const o=(e,o,i=a,l)=>{const s={relativePath:void 0===l?e.path||"":l,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};if(s.relativePath.startsWith("/")){if(!s.relativePath.startsWith(r)&&i)return;KP(s.relativePath.startsWith(r),`Absolute route path "${s.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),s.relativePath=s.relativePath.slice(r.length)}const c=ID([r,s.relativePath]),d=n.concat(s);e.children&&e.children.length>0&&(KP(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),lD(e.children,t,d,c,i)),(null!=e.path||e.index)&&t.push({path:c,score:vD(c,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(const n of sD(e.path))o(e,t,!0,n);else o(e,t)}),t}function sD(e){const t=e.split("/");if(0===t.length)return[];const[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];const i=sD(r.join("/")),l=[];return l.push(...i.map(e=>""===e?o:[o,e].join("/"))),a&&l.push(...i),l.map(t=>e.startsWith("/")&&""===t?"/":t)}const cD=/^:[\w-]+$/,dD=3,uD=2,hD=1,pD=10,gD=-2,mD=e=>"*"===e;function vD(e,t){const n=e.split("/");let r=n.length;return n.some(mD)&&(r+=gD),t&&(r+=uD),n.filter(e=>!mD(e)).reduce((e,t)=>e+(cD.test(t)?dD:""===t?hD:pD),r)}function fD(e,t,n=!1){const{routesMeta:r}=e,a={};let o="/";const i=[];for(let l=0;l<r.length;++l){const e=r[l],s=l===r.length-1,c="/"===o?t:t.slice(o.length)||"/";let d=bD({path:e.relativePath,caseSensitive:e.caseSensitive,end:s},c);const u=e.route;if(!d&&s&&n&&!r[r.length-1].route.index&&(d=bD({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:ID([o,d.pathname]),pathnameBase:RD(ID([o,d.pathnameBase])),route:u}),"/"!==d.pathnameBase&&(o=ID([o,d.pathnameBase]))}return i}function bD(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});const[n,r]=function(e,t=!1,n=!0){YP("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);const r=[];let a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n,a,o)=>{if(r.push({paramName:t,isOptional:null!=n}),n){const t=o.charAt(a+e.length);return t&&"/"!==t?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");return[new RegExp(a,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;const o=a[0];let i=o.replace(/(.)\/+$/,"$1");const l=a.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if("*"===t){const e=l[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const a=l[r];return e[t]=n&&!a?void 0:(a||"").replace(/%2F/g,"/"),e},{}),pathname:o,pathnameBase:i,pattern:e}}function yD(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;const n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}const wD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,CD=e=>wD.test(e);function xD(e,t){const n=ND(t).split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function TD(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function kD(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function ED(e){const t=kD(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function AD(e,t,n,r=!1){let a;"string"==typeof e?a=QP(e):(a={...e},KP(!a.pathname||!a.pathname.includes("?"),TD("?","pathname","search",a)),KP(!a.pathname||!a.pathname.includes("#"),TD("#","pathname","hash",a)),KP(!a.search||!a.search.includes("#"),TD("#","search","hash",a)));const o=""===e||""===a.pathname,i=o?"/":a.pathname;let l;if(null==i)l=n;else{let e=t.length-1;if(!r&&i.startsWith("..")){const t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}l=e>=0?t[e]:"/"}const s=function(e,t="/"){let n,{pathname:r,search:a="",hash:o=""}="string"==typeof e?QP(e):e;return r?(r=SD(r),n=r.startsWith("/")?xD(r.substring(1),"/"):xD(r,t)):n=t,{pathname:n,search:PD(a),hash:DD(o)}}(a,l),c=i&&"/"!==i&&i.endsWith("/"),d=(o||"."===i)&&n.endsWith("/");return s.pathname.endsWith("/")||!c&&!d||(s.pathname+="/"),s}const SD=e=>e.replace(/\/\/+/g,"/"),ID=e=>SD(e.join("/")),ND=e=>e.replace(/\/+$/,""),RD=e=>ND(e).replace(/^\/*/,"/"),PD=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",DD=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class MD{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function LD(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}function FD(e){const t=e.map(e=>e.route.path).filter(Boolean);return ID(t)||"/"}const OD="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function VD(e,t){let n=e;if("string"!=typeof n||!wD.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};const r=n;let a=!1;if(OD)try{const e=new URL(window.location.href),r=n.startsWith("//")?new URL(e.protocol+n):new URL(n),o=yD(r.pathname,t);r.origin===e.origin&&null!=o?n=o+r.search+r.hash:a=!0}catch(o){YP(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}const UD=Symbol("Uninstrumented");function BD(e,t){const n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){const t=Object.keys(n);for(const r of t)e[r]&&n[r].push(e[r])}}));const r={};if("function"==typeof t.lazy&&n.lazy.length>0){const e=HD(n.lazy,t.lazy,()=>{});e&&(r.lazy=e)}if("object"==typeof t.lazy){const e=t.lazy;["middleware","loader","action"].forEach(t=>{const a=e[t],o=n[`lazy.${t}`];if("function"==typeof a&&o.length>0){const e=HD(o,a,()=>{});e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return["loader","action"].forEach(e=>{const a=t[e];if("function"==typeof a&&n[e].length>0){const t=a[UD]??a,o=HD(n[e],t,(...e)=>_D(e[0]));o&&("loader"===e&&!0===t.hydrate&&(o.hydrate=!0),o[UD]=t,r[e]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{const t=e[UD]??e,r=HD(n.middleware,t,(...e)=>_D(e[0]));return r?(r[UD]=t,r):e})),r}function HD(e,t,n){return 0===e.length?null:async(...r)=>{const a=await WD(e,n(...r),()=>t(...r),e.length-1);if("error"===a.type)throw a.value;return a.value}}async function WD(e,t,n,r){const a=e[r];let o;if(a){let l;const s=async()=>(l?console.error("You cannot call instrumented handlers more than once"):l=WD(e,t,n,r-1),o=await l,KP(o,"Expected a result"),"error"===o.type&&o.value instanceof Error?{status:"error",error:o.value}:{status:"success",error:void 0});try{await a(s,t)}catch(i){console.error("An instrumentation function threw an error:",i)}l||await s(),await l}else try{const e=await n();o={type:"success",value:e}}catch(i){o={type:"error",value:i}}return o||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function _D(e){const{request:t,context:n,params:r,pattern:a}=e;return{request:jD(t),params:{...r},pattern:a,context:qD(n)}}function zD(e,t){return{currentUrl:GP(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function jD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function qD(e){if(function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t||Object.getOwnPropertyNames(t).sort().join("\0")===KD}(e)){const t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}const KD=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),YD=["POST","PUT","PATCH","DELETE"],ZD=new Set(YD),GD=["GET",...YD],QD=new Set(GD),XD=/* @__PURE__ */new Set([301,302,303,307,308]),JD=/* @__PURE__ */new Set([307,308]),$D={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},eM={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},tM={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},nM=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),rM="remix-router-transitions",aM=Symbol("ResetLoaderData");let oM=class{#t;#n;#r;#a;constructor(e){this.#t=e,this.#n=iD(e)}get stableRoutes(){return this.#t}get activeRoutes(){return this.#r??this.#t}get branches(){return this.#a??this.#n}get hasHMRRoutes(){return null!=this.#r}setRoutes(e){this.#t=e,this.#n=iD(e)}setHmrRoutes(e){this.#r=e,this.#a=iD(e)}commitHmrRoutes(){this.#r&&(this.#t=this.#r,this.#n=this.#a,this.#r=void 0,this.#a=void 0)}};function iM(e,t,n,r,a,o){let i,l;if(a){i=[];for(const e of t)if(i.push(e),e.route.id===a){l=e;break}}else i=t,l=t[t.length-1];const s=AD(r||".",ED(i),yD(e.pathname,n)||e.pathname,"path"===o);if(null==r&&(s.search=e.search,s.hash=e.hash),(null==r||""===r||"."===r)&&l){const e=YM(s.search);if(l.route.index&&!e)s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&e){const e=new URLSearchParams(s.search),t=e.getAll("index");e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));const n=e.toString();s.search=n?`?${n}`:""}}return"/"!==n&&(s.pathname=function({basename:e,pathname:t}){return"/"===t?e:ID([e,t])}({basename:n,pathname:s.pathname})),GP(s)}function lM(e,t,n){if(!n||(null==(r=n)||!("formData"in r&&null!=r.formData||"body"in r&&void 0!==r.body)))return{path:t};var r,a;if(n.formMethod&&(a=n.formMethod,!QD.has(a.toUpperCase())))return{path:t,error:VM(405,{method:n.formMethod})};const o=()=>({path:t,error:VM(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=BM(t);if(void 0!==n.body){if("text/plain"===n.formEncType){if(!KM(i))return o();const e="string"==typeof n.body?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===n.formEncType){if(!KM(i))return o();try{const e="string"==typeof n.body?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch(r){return o()}}}let s,c;if(KP("function"==typeof FormData,"FormData is not available in this environment"),n.formData)s=RM(n.formData),c=n.formData;else if(n.body instanceof FormData)s=RM(n.body),c=n.body;else if(n.body instanceof URLSearchParams)s=n.body,c=PM(s);else if(null==n.body)s=new URLSearchParams,c=new FormData;else try{s=new URLSearchParams(n.body),c=PM(s)}catch(r){return o()}const d={formMethod:i,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(KM(d.formMethod))return{path:t,submission:d};const u=QP(t);return e&&u.search&&YM(u.search)&&s.append("index",""),u.search=`?${s}`,{path:GP(u),submission:d}}function sM(e,t,n,r,a,o,i,l,s,c,d,u,h,p,g,m,v,f,b,y,w,C){const x=w?_M(w[1])?w[1].error:w[1].data:void 0,T=a.createURL(o.location),k=a.createURL(s);let E;if(d&&o.errors){const e=Object.keys(o.errors)[0];E=i.findIndex(t=>t.route.id===e)}else if(w&&_M(w[1])){const e=w[0];E=i.findIndex(t=>t.route.id===e)-1}const A=w?w[1].statusCode:void 0,S=A&&A>=400,I={currentUrl:T,currentParams:o.matches[0]?.params||{},nextUrl:k,nextParams:i[0].params,...l,actionResult:x,actionStatus:A},N=FD(i),R=i.map((a,i)=>{const{route:l}=a;let h=null;if(null!=E&&i>E)h=!1;else if(l.lazy)h=!0;else if(cM(l))if(d){const{shouldLoad:e}=dM(l,o.loaderData,o.errors);h=e}else(function(e,t,n){const r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a})(o.loaderData,o.matches[i],a)&&(h=!0);else h=!1;if(null!==h)return xM(n,r,e,s,N,a,c,t,h);let p=!1;"boolean"==typeof C?p=C:S?p=!1:(u||T.pathname+T.search===k.pathname+k.search||T.search!==k.search||function(e,t){const n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}(o.matches[i],a))&&(p=!0);const g={...I,defaultShouldRevalidate:p},m=uM(a,g);return xM(n,r,e,s,N,a,c,t,m,g,C)}),P=[];return g.forEach((e,l)=>{if(d||!i.some(t=>t.route.id===e.routeId)||p.has(l))return;const s=o.fetchers.get(l),g=s&&"idle"!==s.state&&void 0===s.data,w=aD(v,e.path,f??"/",!1,y);if(!w){if(b&&g)return;return void P.push({key:l,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null})}if(m.has(l))return;const x=ZM(w,e.path),T=new AbortController,k=IM(a,e.path,T.signal);let E=null;if(h.has(l))h.delete(l),E=TM(n,r,k,e.path,w,x,c,t);else if(g)u&&(E=TM(n,r,k,e.path,w,x,c,t));else{let a;a="boolean"==typeof C?C:!S&&u;const o={...I,defaultShouldRevalidate:a};uM(x,o)&&(E=TM(n,r,k,e.path,w,x,c,t,o))}E&&P.push({key:l,routeId:e.routeId,path:e.path,matches:E,match:x,request:k,controller:T})}),{dsMatches:R,revalidatingFetchers:P}}function cM(e){return null!=e.loader||null!=e.middleware&&e.middleware.length>0}function dM(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!cM(e))return{shouldLoad:!1,renderFallback:!1};const r=null!=t&&e.id in t,a=null!=n&&void 0!==n[e.id];if(!r&&a)return{shouldLoad:!1,renderFallback:!1};if("function"==typeof e.loader&&!0===e.loader.hydrate)return{shouldLoad:!0,renderFallback:!r};const o=!r&&!a;return{shouldLoad:o,renderFallback:o}}function uM(e,t){if(e.route.shouldRevalidate){const n=e.route.shouldRevalidate(t);if("boolean"==typeof n)return n}return t.defaultShouldRevalidate}function hM(e,t,n,r,a,o){let i;if(e){const t=r[e];KP(t,`No route found to patch children into: routeId = ${e}`),t.children||(t.children=[]),i=t.children}else i=n.activeRoutes;const l=[],s=[];if(t.forEach(e=>{const t=i.find(t=>pM(e,t));t?s.push({existingRoute:t,newRoute:e}):l.push(e)}),l.length>0){const t=nD(l,a,[e||"_","patch",String(i?.length||"0")],r);i.push(...t)}if(o&&s.length>0)for(let c=0;c<s.length;c++){const{existingRoute:e,newRoute:t}=s[c],n=e,[r]=nD([t],a,[],{},!0);Object.assign(n,{element:r.element?r.element:n.element,errorElement:r.errorElement?r.errorElement:n.errorElement,hydrateFallbackElement:r.hydrateFallbackElement?r.hydrateFallbackElement:n.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function pM(e,t){return"id"in e&&"id"in t&&e.id===t.id||e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive&&(!(e.children&&0!==e.children.length||t.children&&0!==t.children.length)||(e.children?.every((e,n)=>t.children?.some(t=>pM(e,t)))??!1))}const gM=/* @__PURE__ */new WeakMap,mM=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{const a=n[t.id];if(KP(a,"No route found in manifest"),!a.lazy||"object"!=typeof a.lazy)return;const o=a.lazy[e];if(!o)return;let i=gM.get(a);i||(i={},gM.set(a,i));const l=i[e];if(l)return l;const s=(async()=>{const t=(l=e,$P.has(l)),n=void 0!==a[e]&&"hasErrorBoundary"!==e;var l;if(t)YP(!t,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(n)YP(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{const t=await o();null!=t&&(Object.assign(a,{[e]:t}),Object.assign(a,r(a)))}"object"==typeof a.lazy&&(a.lazy[e]=void 0,Object.values(a.lazy).every(e=>void 0===e)&&(a.lazy=void 0))})();return i[e]=s,s},vM=/* @__PURE__ */new WeakMap;async function fM(e){const t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function bM(e){return e.matches.some(e=>e.route.middleware)?yM(e,()=>fM(e)):fM(e)}function yM(e,t){return async function(t,n,r,a){const{matches:o,...i}=t,l=o.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),s=await wM(i,l,n,e=>{if(qM(t=e)&&(n=t.status,XD.has(n))&&t.headers.has("Location"))throw e;var t,n;return e},a,function(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:"error",result:t}}));{const{matches:r}=e,a=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),o=FM(r,r[a].route.id).route.id;return Promise.resolve({[o]:{type:"error",result:t}})}});return s}(e,t,0,HM)}async function wM(e,t,n,r,a,o,i=0){const{request:l}=e;if(l.signal.aborted)throw l.signal.reason??new Error(`Request aborted: ${l.method} ${l.url}`);const s=t[i];if(!s)return await n();const[c,d]=s;let u;const h=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{const l=await wM(e,t,n,r,a,o,i+1);return u={value:l},u.value}catch(l){return u={value:await o(l,c,u)},u.value}};try{const t=await d(e,h),n=null!=t?r(t):void 0;return a(n)?n:u?n??u.value:(u={value:await h()},u.value)}catch(p){return await o(p,c,u)}}function CM(e,t,n,r,a){const o=mM({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=function(e,t,n,r,a){const o=n[e.id];if(KP(o,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if("function"==typeof e.lazy){const t=vM.get(o);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};const n=(async()=>{KP("function"==typeof e.lazy,"No lazy route function found");const t=await e.lazy(),n={};for(const e in t){const r=t[e];if(void 0===r)continue;const a=tD(e),i=void 0!==o[e]&&"hasErrorBoundary"!==e;a?YP(!a,"Route property "+e+" is not a supported property to be returned from a lazy route function. This property will be ignored."):i?YP(!i,`Route "${o.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(o,n),Object.assign(o,{...r(o),lazy:void 0})})();return vM.set(o,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}const i=Object.keys(e.lazy),l=[];let s;for(const d of i){if(a&&a.includes(d))continue;const o=mM({key:d,route:e,manifest:n,mapRouteProperties:r});o&&(l.push(o),d===t&&(s=o))}const c=l.length>0?Promise.all(l).then(()=>{}):void 0;return c?.catch(()=>{}),s?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:s}}(r.route,KM(n.method)?"action":"loader",t,e,a);return{middleware:o,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function xM(e,t,n,r,a,o,i,l,s,c=null,d){let u=!1;const h=CM(e,t,n,o,i);return{...o,_lazyPromises:h,shouldLoad:s,shouldRevalidateArgs:c,shouldCallHandler:e=>(u=!0,c?uM(o,"boolean"==typeof d?{...c,defaultShouldRevalidate:d}:"boolean"==typeof e?{...c,defaultShouldRevalidate:e}:c):s),resolve(e){const{lazy:t,loader:i,middleware:c}=o.route,d=u||s||e&&!KM(n.method)&&(t||i),p=c&&c.length>0&&!i&&!t;return!d||!KM(n.method)&&p?Promise.resolve({type:XP.data,result:void 0}):async function({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:o,handlerOverride:i,scopedContext:l}){let s,c;const d=KM(e.method),u=d?"action":"loader",h=a=>{let o;const s=new Promise((e,t)=>o=t);c=()=>o(),e.signal.addEventListener("abort",c);const d=o=>"function"!=typeof a?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${u}" [routeId: ${r.route.id}]`)):a({request:e,url:NM(e,t),pattern:n,params:r.params,context:l},...void 0!==o?[o]:[]),h=(async()=>{try{return{type:"data",result:await(i?i(e=>d(e)):d())}}catch(e){return{type:"error",result:e}}})();return Promise.race([h,s])};try{const t=d?r.route.action:r.route.loader;if(a||o)if(t){let e;const[n]=await Promise.all([h(t).catch(t=>{e=t}),a,o]);if(void 0!==e)throw e;s=n}else{await a;const t=d?r.route.action:r.route.loader;if(!t){if("action"===u){const t=new URL(e.url),n=t.pathname+t.search;throw VM(405,{method:e.method,pathname:n,routeId:r.route.id})}return{type:XP.data,result:void 0}}[s]=await Promise.all([h(t),o])}else{if(!t){const t=new URL(e.url);throw VM(404,{pathname:t.pathname+t.search})}s=await h(t)}}catch(p){return{type:XP.error,result:p}}finally{c&&e.signal.removeEventListener("abort",c)}return s}({request:n,path:r,pattern:a,match:o,lazyHandlerPromise:h?.handler,lazyRoutePromise:h?.route,handlerOverride:e,scopedContext:l})}}}function TM(e,t,n,r,a,o,i,l,s=null){return a.map(c=>c.route.id!==o.route.id?{...c,shouldLoad:!1,shouldRevalidateArgs:s,shouldCallHandler:()=>!1,_lazyPromises:CM(e,t,n,c,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:xM(e,t,n,r,FD(a),c,i,l,!0,s))}async function kM(e){const{result:t,type:n}=e;if(qM(t)){let e;try{e=await async function(e){const t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?null==e.body?null:e.json():e.text()}(t)}catch(a){return{type:XP.error,error:a}}return n===XP.error?{type:XP.error,error:new MD(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:XP.data,data:e,statusCode:t.status,headers:t.headers}}return n===XP.error?jM(t)?t.data instanceof Error?{type:XP.error,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:XP.error,error:(r=t,new MD(r.init?.status??500,r.init?.statusText??"Internal Server Error",r.data)),statusCode:LD(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:XP.error,error:t,statusCode:LD(t)?t.status:void 0}:jM(t)?{type:XP.data,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:XP.data,data:t};var r}function EM(e,t,n,r,a){let o=e.headers.get("Location");if(KP(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!CD(o)){const i=r.slice(0,r.findIndex(e=>e.route.id===n)+1);o=iM(new URL(t.url),i,a,o),e.headers.set("Location",o)}return e}const AM=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function SM(e,t,n,r){if(CD(e)){const r=e,a=r.startsWith("//")?new URL(t.protocol+r):new URL(r);if(AM.includes(a.protocol))throw new Error("Invalid redirect location");const o=null!=yD(a.pathname,n);if(a.origin===t.origin&&o)return SD(a.pathname)+a.search+a.hash}try{const t=r.createURL(e);if(AM.includes(t.protocol))throw new Error("Invalid redirect location")}catch(a){}return e}function IM(e,t,n,r){const a=e.createURL(BM(t)).toString(),o={signal:n};if(r&&KM(r.formMethod)){const{formMethod:e,formEncType:t}=r;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(r.json)):"text/plain"===t?o.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?o.body=RM(r.formData):o.body=r.formData}return new Request(a,o)}function NM(e,t){const n=new URL(e.url),r="string"==typeof t?QP(t):t;if(n.pathname=r.pathname||"/",r.search){const e=new URLSearchParams(r.search),t=e.getAll("index");e.delete("index");for(const n of t.filter(Boolean))e.append("index",n);n.search=e.size?`?${e.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function RM(e){const t=new URLSearchParams;for(const[n,r]of e.entries())t.append(n,"string"==typeof r?r:r.name);return t}function PM(e){const t=new FormData;for(const[n,r]of e.entries())t.append(n,r);return t}function DM(e,t,n,r,a,o,i){let{loaderData:l,errors:s}=function(e,t,n,r=!1,a=!1){const o={};let i,l=null,s=!1;const c={};let d=n&&_M(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;const u=n.route.id,h=t[u];if(KP(!zM(h),"Cannot handle redirect results in processLoaderData"),_M(h)){let t=h.error;if(void 0!==d&&(t=d,d=void 0),l=l||{},a)l[u]=t;else{const n=FM(e,u);null==l[n.route.id]&&(l[n.route.id]=t)}r||(o[u]=aM),s||(s=!0,i=LD(h.error)?h.error.status:500),h.headers&&(c[u]=h.headers)}else o[u]=h.data,h.statusCode&&200!==h.statusCode&&!s&&(i=h.statusCode),h.headers&&(c[u]=h.headers)}),void 0!==d&&n&&(l={[n[0]]:d},n[2]&&(o[n[2]]=void 0)),{loaderData:o,errors:l,statusCode:i||200,loaderHeaders:c}}(t,n,r);return a.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{const{key:n,match:r,controller:a}=t;if(a&&a.signal.aborted)return;const l=o[n];if(KP(l,"Did not find corresponding fetcher result"),_M(l)){const t=FM(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:l.error}),i.delete(n)}else if(zM(l))KP(!1,"Unhandled fetcher revalidation redirect");else{const e=JM(l.data);i.set(n,e)}}),{loaderData:l,errors:s}}function MM(e,t,n,r){const a=Object.entries(t).filter(([,e])=>e!==aM).reduce((e,[t,n])=>(e[t]=n,e),{});for(const o of n){const n=o.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&o.route.loader&&(a[n]=e[n]),r&&r.hasOwnProperty(n))break}return a}function LM(e){return e?_M(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function FM(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>!0===e.route.hasErrorBoundary)||e[0]}function OM(e){const t=1===e.length?e[0]:e.find(e=>e.index||!e.path||"/"===e.path)||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function VM(e,{pathname:t,routeId:n,method:r,type:a,message:o}={}){let i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",r&&t&&n?l=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l=`Route "${n}" does not match URL "${t}"`):404===e?(i="Not Found",l=`No route matches URL "${t}"`):405===e&&(i="Method Not Allowed",r&&t&&n?l=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(l=`Invalid request method "${r.toUpperCase()}"`)),new MD(e||500,i,new Error(l),!0)}function UM(e){const t=Object.entries(e);for(let n=t.length-1;n>=0;n--){const[e,r]=t[n];if(zM(r))return{key:e,result:r}}}function BM(e){return GP({..."string"==typeof e?QP(e):e,hash:""})}function HM(e){return null!=e&&"object"==typeof e&&Object.entries(e).every(([e,t])=>{return"string"==typeof e&&(null!=(n=t)&&"object"==typeof n&&"type"in n&&"result"in n&&(n.type===XP.data||n.type===XP.error));var n})}function WM(e){return qM(e.result)&&XD.has(e.result.status)}function _M(e){return e.type===XP.error}function zM(e){return(e&&e.type)===XP.redirect}function jM(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function qM(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function KM(e){return ZD.has(e.toUpperCase())}function YM(e){return new URLSearchParams(e).getAll("index").some(e=>""===e)}function ZM(e,t){const n="string"==typeof t?QP(t).search:t.search;if(e[e.length-1].route.index&&YM(n||""))return e[e.length-1];const r=kD(e);return r[r.length-1]}function GM(e){const{formMethod:t,formAction:n,formEncType:r,text:a,formData:o,json:i}=e;if(t&&n&&r)return null!=a?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a}:null!=o?{formMethod:t,formAction:n,formEncType:r,formData:o,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}:void 0}function QM(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function XM(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function JM(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function $M(){let e,t;const n=new Promise((r,a)=>{e=async e=>{r(e);try{await n}catch(t){}},t=async e=>{a(e);try{await n}catch(t){}}});return{promise:n,resolve:e,reject:t}}const eL=r.createContext(null);eL.displayName="DataRouter";const tL=r.createContext(null);tL.displayName="DataRouterState";const nL=r.createContext(!1),rL=r.createContext({isTransitioning:!1});rL.displayName="ViewTransition";const aL=r.createContext(/* @__PURE__ */new Map);aL.displayName="Fetchers",r.createContext(null).displayName="Await";const oL=r.createContext(null);oL.displayName="Navigation";const iL=r.createContext(null);iL.displayName="Location";const lL=r.createContext({outlet:null,matches:[],isDataRoute:!1});lL.displayName="Route";const sL=r.createContext(null);sL.displayName="RouteError";const cL="REACT_ROUTER_ERROR";function dL(){return null!=r.useContext(iL)}function uL(){return KP(dL(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(iL).location}const hL="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pL(e){r.useContext(oL).static||r.useLayoutEffect(e)}function gL(){const{isDataRoute:e}=r.useContext(lL);return e?function(){const{router:e}=function(){const e=r.useContext(eL);return KP(e,TL("useNavigate")),e}(),t=EL("useNavigate"),n=r.useRef(!1);return pL(()=>{n.current=!0}),r.useCallback(async(r,a={})=>{YP(n.current,hL),n.current&&("number"==typeof r?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))},[e,t])}():function(){KP(dL(),"useNavigate() may be used only in the context of a <Router> component.");const e=r.useContext(eL),{basename:t,navigator:n}=r.useContext(oL),{matches:a}=r.useContext(lL),{pathname:o}=uL(),i=JSON.stringify(ED(a)),l=r.useRef(!1);return pL(()=>{l.current=!0}),r.useCallback((r,a={})=>{if(YP(l.current,hL),!l.current)return;if("number"==typeof r)return void n.go(r);const s=AD(r,JSON.parse(i),o,"path"===a.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:ID([t,s.pathname])),(a.replace?n.replace:n.push)(s,a.state,a)},[t,n,i,o,e])}()}const mL=r.createContext(null);function vL(e,{relative:t}={}){const{matches:n}=r.useContext(lL),{pathname:a}=uL(),o=JSON.stringify(ED(n));return r.useMemo(()=>AD(e,JSON.parse(o),a,"path"===t),[e,o,a,t])}function fL(e,t,n){KP(dL(),"useRoutes() may be used only in the context of a <Router> component.");const{navigator:a}=r.useContext(oL),{matches:o}=r.useContext(lL),i=o[o.length-1],l=i?i.params:{};!i||i.pathname;const s=i?i.pathnameBase:"/";i&&i.route;const c=uL();let d;if(t){const e="string"==typeof t?QP(t):t;KP("/"===s||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=c;const u=d.pathname||"/";let h=u;if("/"!==s){const e=s.replace(/^\//,"").split("/");h="/"+u.replace(/^\//,"").split("/").slice(e.length).join("/")}const p=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):function(e,t,n="/"){return aD(e,t,n,!1)}(e,{pathname:h}),g=function(e,t=[],n){const r=n?.state;if(null==e){if(!r)return null;if(r.errors)e=r.matches;else{if(0!==t.length||r.initialized||!(r.matches.length>0))return null;e=r.matches}}let a=e;const o=r?.errors;if(null!=o){const e=a.findIndex(e=>e.route.id&&void 0!==o?.[e.route.id]);KP(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let e=0;e<a.length;e++){const t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){const{loaderData:e,errors:o}=r,s=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!o||void 0===o[t.route.id]);if(t.route.lazy||s){n.isStatic&&(i=!0),a=l>=0?a.slice(0,l+1):[a[0]];break}}}}const s=n?.onError,c=r&&s?(e,t)=>{s(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:FD(r.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,s)=>{let d,u=!1,h=null,p=null;r&&(d=o&&n.route.id?o[n.route.id]:void 0,h=n.route.errorElement||bL,i&&(l<0&&0===s?(AL["route-fallback"]||(AL["route-fallback"]=!0,YP(!1,"No `HydrateFallback` element provided to render during initial hydration")),u=!0,p=null):l===s&&(u=!0,p=n.route.hydrateFallbackElement||null)));const g=t.concat(a.slice(0,s+1)),m=()=>{let t;return t=d?h:u?p:n.route.Component?I(n.route.Component,{}):n.route.element?n.route.element:e,I(xL,{match:n,routeContext:{outlet:e,matches:g,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===s)?I(yL,{location:r.location,revalidation:r.revalidation,component:h,error:d,children:m(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):m()},null)}(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:ID([s,a.encodeLocation?a.encodeLocation(e.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:ID([s,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),o,n);return t&&g?I(iL.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:zP.Pop},children:g}):g}const bL=I(function(){const e=function(){const e=r.useContext(sL),t=kL("useRouteError"),n=EL("useRouteError");return void 0!==e?e:t.errors?.[n]}(),t=LD(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return R(N,{children:[I("h2",{children:"Unexpected Application Error!"}),I("h3",{style:{fontStyle:"italic"},children:t}),n?I("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},children:n}):null,null]})},{});class yL extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=nL;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&"object"==typeof e&&e&&"digest"in e&&"string"==typeof e.digest){const t=function(e){if(e.startsWith(`${cL}:ROUTE_ERROR_RESPONSE:{`))try{const t=JSON.parse(e.slice(40));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText)return new MD(t.status,t.statusText,t.data)}catch{}}(e.digest);t&&(e=t)}const t=void 0!==e?I(lL.Provider,{value:this.props.routeContext,children:I(sL.Provider,{value:e,children:this.props.component})}):this.props.children;return this.context?I(CL,{error:e,children:t}):t}}const wL=/* @__PURE__ */new WeakMap;function CL({children:e,error:t}){const{basename:n}=r.useContext(oL);if("object"==typeof t&&t&&"digest"in t&&"string"==typeof t.digest){const e=function(e){if(e.startsWith(`${cL}:REDIRECT:{`))try{const t=JSON.parse(e.slice(28));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText&&"string"==typeof t.location&&"boolean"==typeof t.reloadDocument&&"boolean"==typeof t.replace)return t}catch{}}(t.digest);if(e){const r=wL.get(t);if(r)throw r;const a=VD(e.location,n);if(OD&&!wL.get(t)){if(!a.isExternal&&!e.reloadDocument){const n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw wL.set(t,n),n}window.location.href=a.absoluteURL||a.to}return I("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function xL({routeContext:e,match:t,children:n}){const a=r.useContext(eL);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),I(lL.Provider,{value:e,children:n})}function TL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kL(e){const t=r.useContext(tL);return KP(t,TL(e)),t}function EL(e){const t=function(e){const t=r.useContext(lL);return KP(t,TL(e)),t}(e),n=t.matches[t.matches.length-1];return KP(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}const AL={},SL={};function IL(e,t){e||SL[t]||(SL[t]=!0,console.warn(t))}const NL=r.useOptimistic,RL=()=>{};class PL{status="pending";promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}})}}function DL({router:e,flushSync:t,onError:n,useTransitions:a}){const o=r.useContext(nL);a=o||a;const[i,l]=r.useState(e.state),[s,c]=(d=i,NL?NL(d):[d,RL]);var d;const[u,h]=r.useState(),[p,g]=r.useState({isTransitioning:!1}),[m,v]=r.useState(),[f,b]=r.useState(),[y,w]=r.useState(),C=r.useRef(/* @__PURE__ */new Map),x=r.useCallback((o,{deletedFetchers:i,newErrors:s,flushSync:d,viewTransitionOpts:u})=>{s&&n&&Object.values(s).forEach(e=>n(e,{location:o.location,params:o.matches[0]?.params??{},pattern:FD(o.matches)})),o.fetchers.forEach((e,t)=>{void 0!==e.data&&C.current.set(t,e.data)}),i.forEach(e=>C.current.delete(e)),IL(!1===d||null!=t,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `tight-react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "tight-react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');const p=null!=e.window&&null!=e.window.document&&"function"==typeof e.window.document.startViewTransition;if(IL(null==u||p,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),u&&p){if(t&&d){t(()=>{f&&(m?.resolve(),f.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:u.currentLocation,nextLocation:u.nextLocation})});const n=e.window.document.startViewTransition(()=>{t(()=>l(o))});return n.finished.finally(()=>{t(()=>{v(void 0),b(void 0),h(void 0),g({isTransitioning:!1})})}),void t(()=>b(n))}f?(m?.resolve(),f.skipTransition(),w({state:o,currentLocation:u.currentLocation,nextLocation:u.nextLocation})):(h(o),g({isTransitioning:!0,flushSync:!1,currentLocation:u.currentLocation,nextLocation:u.nextLocation}))}else t&&d?t(()=>l(o)):!1===a?l(o):r.startTransition(()=>{!0===a&&c(e=>ML(e,o)),l(o)})},[e.window,t,f,m,a,c,n]);r.useLayoutEffect(()=>e.subscribe(x),[e,x]),r.useEffect(()=>{p.isTransitioning&&!p.flushSync&&v(new PL)},[p]),r.useEffect(()=>{if(m&&u&&e.window){const t=u,n=m.promise,o=e.window.document.startViewTransition(async()=>{!1===a?l(t):r.startTransition(()=>{!0===a&&c(e=>ML(e,t)),l(t)}),await n});o.finished.finally(()=>{v(void 0),b(void 0),h(void 0),g({isTransitioning:!1})}),b(o)}},[u,m,e.window,a,c]),r.useEffect(()=>{m&&u&&s.location.key===u.location.key&&m.resolve()},[m,f,s.location,u]),r.useEffect(()=>{!p.isTransitioning&&y&&(h(y.state),g({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),w(void 0))},[p.isTransitioning,y]);const T=r.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),k=e.basename||"/",E=r.useMemo(()=>({router:e,navigator:T,static:!1,basename:k,onError:n}),[e,T,k,n]);return R(N,{children:[I(eL.Provider,{value:E,children:I(tL.Provider,{value:s,children:I(aL.Provider,{value:C.current,children:I(rL.Provider,{value:p,children:I(UL,{basename:k,location:s.location,navigationType:s.historyAction,navigator:T,useTransitions:a,children:I(LL,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})})})})})}),null]})}function ML(e,t){return{...e,navigation:"idle"!==t.navigation.state?t.navigation:e.navigation,revalidation:"idle"!==t.revalidation?t.revalidation:e.revalidation,actionData:"submitting"!==t.navigation.state?t.actionData:e.actionData,fetchers:t.fetchers}}const LL=r.memo(function({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:o}){return fL(e,void 0,{manifest:t,state:r,isStatic:a,onError:o})});function FL({basename:e,children:t,initialEntries:n,initialIndex:a,useTransitions:o}){const i=r.useRef();null==i.current&&(i.current=qP({initialEntries:n,initialIndex:a,v5Compat:!0}));const l=i.current,[s,c]=r.useState({action:l.action,location:l.location}),d=r.useCallback(e=>{!1===o?c(e):r.startTransition(()=>c(e))},[o]);return r.useLayoutEffect(()=>l.listen(d),[l,d]),I(eL.Provider,{value:null,children:I(tL.Provider,{value:null,children:I(UL,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:l,useTransitions:o})})})}function OL(e){return function(e){const t=r.useContext(lL).outlet;return r.useMemo(()=>t&&I(mL.Provider,{value:e,children:t}),[t,e])}(e.context)}function VL(e){KP(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function UL({basename:e="/",children:t=null,location:n,navigationType:a=zP.Pop,navigator:o,static:i=!1,useTransitions:l}){const s=e.replace(/^\/*/,"/"),c=r.useMemo(()=>({basename:s,navigator:o,static:i,useTransitions:l,future:{}}),[s,o,i,l]);"string"==typeof n&&(n=QP(n));const{pathname:d="/",search:u="",hash:h="",state:p=null,key:g="default",mask:m}=n,v=r.useMemo(()=>{const e=yD(d,s);return null==e?null:{location:{pathname:e,search:u,hash:h,state:p,key:g,mask:m},navigationType:a}},[s,d,u,h,p,g,a,m]);return YP(null!=v,`<Router basename="${s}"> is not able to match the URL "${d}${u}${h}" because it does not start with the basename, so the <Router> won't render anything.`),null==v?null:I(oL.Provider,{value:c,children:I(lL.Provider,{value:BL,children:I(iL.Provider,{children:t,value:v})})})}const BL={outlet:null,matches:[],isDataRoute:!1};function HL({children:e,location:t}){return fL(WL(e),t)}function WL(e,t=[]){const n=[];return r.Children.forEach(e,(e,a)=>{if(!r.isValidElement(e))return;const o=[...t,a];if(e.type===r.Fragment)return void n.push.apply(n,WL(e.props.children,o));KP(e.type===VL,`[${"string"==typeof e.type?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),KP(!e.props.index||!e.props.children,"An index route cannot have child routes.");const i={id:e.props.id||o.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:!0===e.props.hasErrorBoundary||null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(i.children=WL(e.props.children,o)),n.push(i)}),n}const _L="get",zL="application/x-www-form-urlencoded";function jL(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}let qL=null;const KL=/* @__PURE__ */new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function YL(e){return null==e||KL.has(e)?e:(YP(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zL}"`),null)}const ZL="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{ZL&&(window.__reactRouterVersion=REACT_ROUTER_VERSION)}catch(sr){}const GL=r.forwardRef(function({onClick:e,relative:t,reloadDocument:n,replace:a,mask:o,state:i,target:l,to:s,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:u,...h},p){const{basename:g,navigator:m,useTransitions:v}=r.useContext(oL),f=VD(s,g),b=function(e,{relative:t}={}){KP(dL(),"useHref() may be used only in the context of a <Router> component.");const{basename:n,navigator:a}=r.useContext(oL),{hash:o,pathname:i,search:l}=vL(e,{relative:t});let s=i;return"/"!==n&&(s="/"===i?n:ID([n,i])),a.createHref({pathname:s,search:l,hash:o})}(s=f.to,{relative:t}),y=uL();let w=null;if(o){const e=AD(o,[],y.mask?y.mask.pathname:"/",!0);"/"!==g&&(e.pathname="/"===e.pathname?g:ID([g,e.pathname])),w=m.createHref(e)}const C=function(e,{target:t,replace:n,mask:a,state:o,preventScrollReset:i,relative:l,viewTransition:s,defaultShouldRevalidate:c,useTransitions:d}={}){const u=gL(),h=uL(),p=vL(e,{relative:l});return r.useCallback(g=>{if(v=t,!(0!==(m=g).button||v&&"_self"!==v||(f=m,f.metaKey||f.altKey||f.ctrlKey||f.shiftKey))){g.preventDefault();const t=void 0!==n?n:GP(h)===GP(p),m=()=>u(e,{replace:t,mask:a,state:o,preventScrollReset:i,relative:l,viewTransition:s,defaultShouldRevalidate:c});d?r.startTransition(()=>m()):m()}var m,v,f},[h,u,p,n,a,o,t,e,i,l,s,c,d])}(s,{replace:a,mask:o,state:i,target:l,preventScrollReset:c,relative:t,viewTransition:d,defaultShouldRevalidate:u,useTransitions:v}),x=!(f.isExternal||n);return I("a",{...h,href:(x?w:void 0)||f.absoluteURL||b,onClick:x?function(t){e&&e(t),t.defaultPrevented||C(t)}:e,ref:p,target:l})});GL.displayName="Link";const QL=r.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:l,children:s,...c},d){const u=vL(i,{relative:c.relative}),h=uL(),p=r.useContext(tL),{navigator:g,basename:m}=r.useContext(oL),v=null!=p&&function(e,{relative:t}={}){const n=r.useContext(rL);KP(null!=n,"`useViewTransitionState` must be used within `tight-react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `tight-react-router`?");const{basename:a}=XL("useViewTransitionState"),o=vL(e,{relative:t});if(!n.isTransitioning)return!1;const i=yD(n.currentLocation.pathname,a)||n.currentLocation.pathname,l=yD(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=bD(o.pathname,l)||null!=bD(o.pathname,i)}(u)&&!0===l;let f=g.encodeLocation?g.encodeLocation(u).pathname:u.pathname,b=h.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(b=b.toLowerCase(),y=y?y.toLowerCase():null,f=f.toLowerCase()),y&&m&&(y=yD(y,m)||y);const w="/"!==f&&f.endsWith("/")?f.length-1:f.length,C=b===f||!a&&b.startsWith(f)&&"/"===b.charAt(w),x=null!=y&&(y===f||!a&&y.startsWith(f)&&"/"===y.charAt(f.length)),T={isActive:C,isPending:x,isTransitioning:v},k=C?e:void 0;let E;E="function"==typeof n?n(T):[n,C?"active":null,x?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");const A="function"==typeof o?o(T):o;return I(GL,{...c,"aria-current":k,className:E,ref:d,style:A,to:i,viewTransition:l,children:"function"==typeof s?s(T):s})});function XL(e){const t=r.useContext(eL);return KP(t,`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`),t}QL.displayName="NavLink",r.forwardRef(({fetcherKey:e,navigate:t,reloadDocument:n,replace:a,state:o,method:i=_L,action:l,onSubmit:s,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:h,...p},g)=>{const{useTransitions:m}=r.useContext(oL),v=function(){const{router:e}=XL("useSubmit"),{basename:t}=r.useContext(oL),n=EL("useRouteId"),a=e.fetch,o=e.navigate;return r.useCallback(async(e,r={})=>{const{action:i,method:l,encType:s,formData:c,body:d}=function(e,t){let n,r,a,o,i;if(jL(s=e)&&"form"===s.tagName.toLowerCase()){const i=e.getAttribute("action");r=i?yD(i,t):null,n=e.getAttribute("method")||_L,a=YL(e.getAttribute("enctype"))||zL,o=new FormData(e)}else if(jL(l=e)&&"button"===l.tagName.toLowerCase()||function(e){return jL(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){const i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');const s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?yD(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||_L,a=YL(e.getAttribute("formenctype"))||YL(i.getAttribute("enctype"))||zL,o=new FormData(i,e),!function(){if(null===qL)try{new FormData(document.createElement("form"),0),qL=!1}catch(l){qL=!0}return qL}()){const{name:t,type:n,value:r}=e;if("image"===n){const e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(jL(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_L,r=null,a=zL,i=e}var l,s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}(e,t);if(!1===r.navigate){const e=r.fetcherKey||$L();await a(e,n,r.action||i,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||l,formEncType:r.encType||s,flushSync:r.flushSync})}else await o(r.action||i,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||l,formEncType:r.encType||s,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[a,o,t,n])}(),f=function(e,{relative:t}={}){const{basename:n}=r.useContext(oL),a=r.useContext(lL);KP(a,"useFormAction must be used inside a RouteContext");const[o]=a.matches.slice(-1),i={...vL(e||".",{relative:t})},l=uL();if(null==e){i.search=l.search;const e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));const n=e.toString();i.search=n?`?${n}`:""}}return e&&"."!==e||!o?.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(i.pathname="/"===i.pathname?n:ID([n,i.pathname])),GP(i)}(l,{relative:c}),b="get"===i.toLowerCase()?"get":"post";return I("form",{ref:g,method:b,action:f,onSubmit:n?s:n=>{if(s&&s(n),n.defaultPrevented)return;n.preventDefault();const l=n.nativeEvent.submitter,p=l?.getAttribute("formmethod")||i,g=()=>v(l||n.currentTarget,{fetcherKey:e,method:p,navigate:t,replace:a,state:o,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:h});m&&!1!==t?r.startTransition(()=>g()):g()},...p})}).displayName="Form";let JL=0;const $L=()=>`__${String(++JL)}__`;function eF(){return I(dp,{color:"weak",alignment:"horizontal"})}function tF(e){return t=>{"Enter"!==t.key&&"Space"!==t.code||(t.preventDefault(),e?.(t))}}const nF=lr({base:{display:"flex",padding:"16px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...sl,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),rF=lr({base:{...oo},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function aF({name:e,disabled:t,onClick:n}){const r=t?void 0:n,a=t?void 0:tF(n);return R("div",{className:nF({disabled:t}),role:"button",tabIndex:t?-1:0,onKeyDown:a,onClick:r,children:[I("div",{className:rF({disabled:t??!1}),children:e}),!t&&I(Pd,{Component:ol})]})}const oF=rr({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),iF=rr({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 12px",width:"100%",cursor:"pointer"}),lF=rr({display:"flex",alignItems:"center",gap:"8px"}),sF=rr(oo,{color:"typography.base.weak"});function cF({label:e,icon:t,defaultExpanded:n=!1,children:r}){const[a,o]=d(n),i=()=>o(e=>!e),l=tF(i);return R("div",{className:oF,children:[R("div",{className:iF,role:"button",tabIndex:0,"aria-expanded":a,onClick:i,onKeyDown:l,children:[R("div",{className:lF,children:[t&&I(Pd,{Component:t}),I("div",{className:sF,children:e})]}),I(Pd,{Component:a?Up:ol})]}),a&&r]})}const dF=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.438 3.298H6.325",strokeMiterlimit:10}),r.createElement("path",{d:"M3.378 0.358V6.245",strokeMiterlimit:10}),r.createElement("path",{d:"M1.028 9.186L5.734 13.892",strokeMiterlimit:10}),r.createElement("path",{d:"M5.734 9.186L1.028 13.892",strokeMiterlimit:10}),r.createElement("path",{d:"M8.675 3.298H14.563",strokeMiterlimit:10}),r.createElement("path",{d:"M8.675 11.536H14.563",strokeMiterlimit:10}),r.createElement("path",{d:"M11.031 9.186H12.206",strokeMiterlimit:10}),r.createElement("path",{d:"M11.031 13.892H12.206",strokeMiterlimit:10})),"Accounting");function uF(e){return{path:"general-ledger",route:`/${e}/general-ledger`,handle:{label:"General Ledger"}}}function hF(e){return{path:"profit-and-loss",route:`/${e}/profit-and-loss`,handle:{label:"Profit & Loss"}}}const pF={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}},"profit-and-loss/general-ledger":uF("profit-and-loss"),"balance-sheet":{path:"balance-sheet",route:"/balance-sheet",handle:{label:"Balance Sheet"}},"balance-sheet/general-ledger":uF("balance-sheet"),"balance-sheet/profit-and-loss":hF("balance-sheet"),"balance-sheet/profit-and-loss/general-ledger":uF("balance-sheet/profit-and-loss"),"cash-flow-statement":{path:"cash-flow-statement",route:"/cash-flow-statement",handle:{label:"Cash Flow Statement"}},"cash-flow-statement/general-ledger":uF("cash-flow-statement"),"cash-flow-statement/profit-and-loss":hF("cash-flow-statement"),"cash-flow-statement/profit-and-loss/general-ledger":uF("cash-flow-statement/profit-and-loss")};function gF(){const e=gL();return u((t,n)=>{e(pF[t].route,n)},[e])}function mF(){const e=gF();return R(cF,{label:"Accounting",icon:dF,defaultExpanded:!0,children:[I(eF,{}),I(aF,{name:"Profit & Loss",onClick:()=>e("profit-and-loss")}),I(eF,{}),I(aF,{name:"Balance Sheet",onClick:()=>e("balance-sheet")}),I(eF,{}),I(aF,{name:"Cash Flow Statement",onClick:()=>e("cash-flow-statement")}),I(eF,{}),I(aF,{disabled:!0,name:"Trial Balance"})]})}const vF=bi(e=>r.createElement("svg",{stroke:"currentColor",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.8474 4.45435H2.84612C2.17063 4.45435 1.62305 5.00193 1.62305 5.67742V13.0094C1.62305 13.6849 2.17063 14.2325 2.84612 14.2325H13.8474C14.5228 14.2325 15.0704 13.6849 15.0704 13.0094V5.67742C15.0704 5.00193 14.5228 4.45435 13.8474 4.45435Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.7927 4.45439H5.90039L6.51513 2.01465H10.1779L10.7927 4.45439Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.12376 11.1779H8.6542C8.89706 11.1779 9.12997 11.0815 9.3017 10.9097C9.47342 10.738 9.5699 10.5051 9.5699 10.2622C9.5699 10.0194 9.47342 9.78647 9.3017 9.61474C9.12997 9.44302 8.89706 9.34654 8.6542 9.34654H8.01385C7.77099 9.34654 7.53808 9.25007 7.36635 9.07834C7.19462 8.90661 7.09814 8.6737 7.09814 8.43084C7.09814 8.18798 7.19462 7.95507 7.36635 7.78334C7.53808 7.61161 7.77099 7.51514 8.01385 7.51514H9.54429",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 6.90039V7.51513",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 11.178V11.7927",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06922 13.6005C4.07207 13.816 4.03519 14.0302 3.96036 14.2326H2.84621C2.68367 14.2318 2.52291 14.1991 2.37322 14.1366C2.22354 14.0741 2.08791 13.9828 1.97417 13.8682C1.86044 13.7536 1.77085 13.6179 1.71061 13.4688C1.65037 13.3198 1.62066 13.1605 1.6232 13.0001V11.9003C1.82715 11.8223 2.04493 11.7858 2.26352 11.7928C2.74476 11.7995 3.20401 11.9929 3.54192 12.3312C3.87984 12.6694 4.06926 13.1254 4.06922 13.6005Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0703 11.9012V13.0126C15.0686 13.3356 14.9392 13.6449 14.7102 13.8733C14.4812 14.1017 14.1711 14.2308 13.8472 14.2325H12.733C12.6582 14.0279 12.6213 13.8115 12.6242 13.5938C12.6242 13.3533 12.6718 13.1153 12.7642 12.8932C12.8566 12.6712 12.9921 12.4696 13.1628 12.2999C13.3336 12.1301 13.5362 11.9957 13.7592 11.9043C13.9821 11.8129 14.2209 11.7663 14.462 11.7671C14.6715 11.7723 14.8781 11.8178 15.0703 11.9012Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06919 5.06911C4.06919 5.31015 4.02223 5.54882 3.93098 5.77144C3.83974 5.99405 3.70602 6.19623 3.53748 6.36637C3.36895 6.53652 3.16892 6.67129 2.94886 6.76295C2.72881 6.8546 2.49305 6.90135 2.25513 6.90051C2.03959 6.90424 1.82525 6.86733 1.62305 6.79165V5.67744C1.62385 5.51434 1.65668 5.35304 1.71961 5.20292C1.78255 5.05281 1.87434 4.91688 1.98964 4.80305C2.10494 4.68922 2.24144 4.59977 2.3912 4.53991C2.54095 4.48005 2.70097 4.45097 2.86192 4.45437H3.96174C4.03315 4.65123 4.06953 4.85937 4.06919 5.06911Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0702 5.68985V6.79252C14.8755 6.86364 14.6695 6.90011 14.4619 6.90025C14.2209 6.90109 13.9821 6.85482 13.7592 6.76411C13.5362 6.6734 13.3336 6.54003 13.1629 6.37165C12.9921 6.20327 12.8567 6.00318 12.7643 5.78287C12.6718 5.56257 12.6242 5.32637 12.6242 5.08782C12.6208 4.87175 12.6577 4.65691 12.7331 4.4541H13.8472C14.0098 4.45492 14.1705 4.48763 14.3202 4.55033C14.4699 4.61304 14.6055 4.7045 14.7193 4.81942C14.833 4.93434 14.9226 5.07044 14.9828 5.21985C15.0431 5.36926 15.0728 5.52901 15.0702 5.68985Z",strokeMiterlimit:10,strokeLinecap:"square"})),"Income");function fF(){return R(cF,{label:"Income and Invoices",icon:vF,children:[I(eF,{}),I(aF,{disabled:!0,name:"Income Analysis"}),I(eF,{}),I(aF,{disabled:!0,name:"Accounts Receivable Aging"})]})}const bF=e=>r.createElement("svg",{stroke:"currentColor",width:16,height:15,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.36217 8.45534H7.95444C8.20781 8.45534 8.45081 8.35469 8.62998 8.17552C8.80914 7.99636 8.9098 7.75336 8.9098 7.49998C8.9098 7.24661 8.80914 7.00361 8.62998 6.82444C8.45081 6.64528 8.20781 6.54463 7.95444 6.54463H7.31753C7.06416 6.54463 6.82116 6.44397 6.64199 6.26481C6.46283 6.08564 6.36217 5.84265 6.36217 5.58927C6.36217 5.33589 6.46283 5.09289 6.64199 4.91373C6.82116 4.73456 7.06416 4.63391 7.31753 4.63391H8.9098",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 3.36011V4.63392",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.63599 8.45532V9.72913",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.54074 14.1875L4.23491 12.9137L5.93545 14.1875L7.62962 12.9137L9.33015 14.1875L11.0307 12.9137L12.7312 14.1875L13.3681 13.5506V0.8125H1.90384V13.5506L2.54074 14.1875Z",strokeMiterlimit:10,strokeLinecap:"square"})),yF=bi(bF,"Expenses");function wF(){return R(cF,{label:"Expenses and Bills",icon:yF,children:[I(eF,{}),I(aF,{disabled:!0,name:"Expense Analysis"}),I(eF,{}),I(aF,{disabled:!0,name:"Accounts Payable Aging"}),I(eF,{}),I(aF,{disabled:!0,name:"Time & Task Analysis"}),I(eF,{}),I(aF,{disabled:!0,name:"Mileage Analysis"})]})}const CF=bi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.32498 11.2259H0.775757V0.774048H8.37577V3.64998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.47954 2.37524H2.677V4.84696H6.47954V2.37524Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.57825 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M4.57825 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M8.1449 7.27441C8.14484 7.32563 8.10334 7.36713 8.05212 7.36719C8.01365 7.36719 7.98028 7.34389 7.96619 7.31055L7.95935 7.27441C7.95935 7.22312 8.00083 7.18164 8.05212 7.18164L8.08826 7.18848C8.1216 7.20257 8.1449 7.23594 8.1449 7.27441Z"}),r.createElement("path",{d:"M9.77344 8.90295C9.77338 8.95417 9.73188 8.99567 9.68066 8.99573C9.64219 8.99573 9.60882 8.97243 9.59473 8.93909L9.58789 8.90295C9.58789 8.85166 9.62937 8.81018 9.68066 8.81018L9.7168 8.81702C9.75014 8.83111 9.77344 8.86448 9.77344 8.90295Z"}),r.createElement("path",{d:"M9.80828 6.96296L7.92403 9.21425",strokeMiterlimit:10}),r.createElement("path",{d:"M8.86626 10.6502C10.281 10.6502 11.428 9.50333 11.428 8.08855C11.428 6.67377 10.281 5.52686 8.86626 5.52686C7.45148 5.52686 6.30457 6.67377 6.30457 8.08855C6.30457 9.50333 7.45148 10.6502 8.86626 10.6502Z",strokeMiterlimit:10})),"Taxes");function xF(){return R(cF,{label:"Taxes",icon:CF,children:[I(eF,{}),I(aF,{disabled:!0,name:"Schedule C"}),I(eF,{}),I(aF,{disabled:!0,name:"Form 1065"}),I(eF,{}),I(aF,{disabled:!0,name:"Form 1120-S"}),I(eF,{}),I(aF,{disabled:!0,name:"Form 1120"}),I(eF,{}),I(aF,{disabled:!0,name:"T2125"}),I(eF,{}),I(aF,{disabled:!0,name:"Tax Details for Filing"})]})}const TF=ZN({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),kF=XN({gap:"16px",width:"100%"}),EF=eR({gap:"8px",alignItems:"center"}),AF=rr(oo,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),SF=rr(oo,{color:"typography.base"});function IF(){const e=function(){const{matches:e,loaderData:t}=kL("useMatches");return r.useMemo(()=>e.map(e=>oD(e,t)),[e,t])}(),t=gL(),n=e.flatMap(e=>function(e){try{return cB.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:I("nav",{className:EF,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return R(f,{children:[r>0&&I(ul,{Component:ol}),a?I("span",{className:SF,"aria-current":"page",children:e.label}):I("button",{type:"button",className:AF,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const NF=XN({gap:"16px",alignItems:"flex-start",width:"100%"}),RF=rr({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),PF=l(void 0);function DF({children:e,seed:t}){const[n,r]=d(()=>t?.dateRange??wt(ht.LAST_6_MONTHS)),[a,o]=d(t?.period??"MONTHLY"),[i,l]=d(t?.accountingMethod??"ACCRUAL"),[s,c]=d(void 0),[u,h]=d([]);return I(PF.Provider,{value:{dateRange:n,setDateRange:r,period:a,setPeriod:o,accountingMethod:i,setAccountingMethod:l,dimensionId:s,setDimensionId:c,reportDimensionFilters:u,setReportDimensionFilters:h},children:e})}const MF={[ht.LAST_6_MONTHS]:"Last 6 Months",[ht.LAST_12_MONTHS]:"Last 12 Months (TTM)",[ht.LAST_QUARTER]:"Last Quarter",[ht.LAST_YEAR]:"Last Year",[ht.THIS_QUARTER]:"This Quarter",[ht.THIS_YEAR]:"This Year"},LF=[ht.LAST_6_MONTHS,ht.LAST_12_MONTHS,ht.LAST_QUARTER,ht.LAST_YEAR,ht.THIS_QUARTER,ht.THIS_YEAR];const FF=rr({width:"200px",minWidth:"200px"}),OF={width:"fit-content"};function VF({onPresetSelect:e,onCustomSelect:t}){const{close:n}=Sc();return I(Uc,{children:R(Ug,{style:FF,children:[LF.map((t,r)=>R(f,{children:[I(qg,{onClick:()=>(e(t),void n()),children:I(uc,{children:MF[t]})}),(1===r||3===r)&&I(dp,{alignment:"horizontal"})]},t)),I(dp,{alignment:"horizontal"}),I(tx,{triggerChildren:I(ax,{displayLabel:"Custom"}),popupChildren:I(Uc,{style:OF,children:I(rN,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function UF({value:e,onChange:t,collapseToIconOnMobile:n=!1}){const r=ET(),a=n&&r,o=function(e){const t=Rt(e.endDate),n=Rt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:St(n)} - ${null===t?e.endDate:St(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${St(n)} - ${St(t)}`;const r=n.getFullYear(),a=t.getFullYear(),o=n.getMonth(),i=t.getMonth();return 0===o&&11===i?r===a?`${r}`:`${r} - ${a}`:r===a&&o===i?Lt(n,{abbreviateMonth:!0}):`${Lt(n,{abbreviateMonth:!0})} - ${Lt(t,{abbreviateMonth:!0})}`}(e);return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(ec,{styles:QI,popupTriggerProps:e,children:a?I(GI,{Component:dE}):R(N,{children:[I(Pd,{Component:dE}),I(uc,{wrap:"nowrap",children:o})]})})}),I(VF,{onPresetSelect:e=>{t(wt(e))},onCustomSelect:e=>{t(e)}})]})}const BF={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},HF={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},WF=["NONE","MONTHLY","QUARTERLY","YEARLY"],_F=rr({width:"200px",minWidth:"200px"});function zF({onSelect:e}){const{close:t}=Sc();return I(Uc,{children:I(Ug,{style:_F,children:WF.map(n=>I(qg,{onClick:()=>(e(n),void t()),children:I(uc,{children:BF[n]})},n))})})}function jF({value:e,onChange:t}){const n=HF[e];return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>R(ec,{popupTriggerProps:e,children:[I(Pd,{Component:cu}),I(uc,{wrap:"nowrap",children:n})]})}),I(zF,{onSelect:t})]})}function qF({popupTriggerProps:e,text:t}){return R(ff,{popupTriggerChildrenProps:e,children:[I(hS,{children:I(uc,{wrap:"wrap",children:t})}),I(Pd,{Component:ol})]})}function KF({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=JT(n,e.key),i=tk(e.name,o,1);return R(Ac,{children:[I(Ic,{children:e=>I(qF,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>$T(n,e.key,t))},filters:a})]})}const YF=bi(bm,"Bank");function ZF({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(hI,{isSelected:n}):I(mf,{selected:n,showEmptyIndicator:!0});return R(ff,{handleClick:t,selected:n,children:[R(hS,{children:[o&&I(Sd,{imageUrl:e.iconUrl,Component:YF}),I(uc,{wrap:"wrap",children:e.name})]}),i]})}function GF({values:e,model:t,pendingFilters:n,onClick:r}){return I(hf,{title:I(So,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=JT(n,t.key),i=(l=e,o.some(e=>C(e.value,l.value)));var l;return I(ZF,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(sf,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function QF({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ae(e,Jg),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return I(GF,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function XF({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I(rf,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:QF,DefaultList:GF,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function JF({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=Sc();return I(Qv,{title:"Back",Footer:I(DS,{onClearAll:()=>{a(e=>$T(e,t.key,[]))},onApply:()=>{const e=JT(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?I(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):I(XF,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function $F({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=Sc();return I(DS,{onApply:()=>{n(ek(e)),a()},onClearAll:()=>{t(e=>$T(e,r,[]))}})}function eO({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=JT(n,e.key),a=e.singleSelect?(o=r,i=t,l=e.createFilter,o.some(e=>C(e.value,i.value))?o:[l(i)]):function(e,t,n){const r=e.findIndex(e=>C(e.value,t.value));return-1!==r?e.filter((e,t)=>t!==r):[...e,n(t)]}(r,t,e.createFilter);var o,i,l;return $T(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=I(Qv,{title:"Back",Footer:I($F,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:I(e.SimpleListComponent,{filters:t,pendingFilters:n,onToggle:o,model:e,setPendingFilters:r,setFilters:a})});else if(void 0!==e.possibleValues){const{values:l,isFilling:s}=e.possibleValues();if(dr(l)||!$e(l))return null;if(s)return I(wf,{});i=I(JF,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=JT(n,e.key),s=tk(e.name,l);return R(Ac,{children:[I(Ic,{children:e=>I(qF,{popupTriggerProps:e,text:s})}),i]})}const tO=rr({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function nO({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=ET();return I("div",{className:tO,children:I(hf,{title:I(So,{children:"Filter by"}),children:t.filter(e=>{return n=o,(t=e)&&(n||!n&&!t.hideInFilterListOnDesktop);var t,n}).map(t=>{const o=t.possibleValues?t.possibleValues():null;return dr(o)&&void 0===t.SimpleListComponent?I(KF,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):I(eO,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function rO(e){return function(e){const t=[],n=/* @__PURE__ */new Set;for(const r of e){const{id:e,name:a,requiredness:o}=r.dimension;if(dr(e)||n.has(e))continue;const i=r.children.find(e=>!dr(e.dimension.id)),l=i?.dimension,s=l?.id,c=s?{id:s,name:l?.name??"",status:"ACTIVE",requiredness:l?.requiredness??"NOT_REQUIRED",child:null}:null;n.add(e),t.push({id:e,name:a??"",status:"ACTIVE",requiredness:o??"NOT_REQUIRED",child:c})}return t}(e?.data??[]).sort((e,t)=>e.id.localeCompare(t.id))}function aO(){return iI({select:rO})}function oO(e){return!dr(e)&&e.startsWith("dimension_")}const iO=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:ki(t[1].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function lO(){return Br({queryKey:["dimensions"],queryFn:iO})}function sO({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=lO(),{query:{data:i}}=iI(),l=oO(t?.key)?t.key:"dimension_NO_MODEL_YOU_MESSED_UP",s=o(()=>a?.data??[],[a]),c=o(()=>(i?.data??[]).filter(t=>t.dimension.id===e.id).filter(e=>{if(e.children.length>0)return!0;const t=s.find(t=>t.id===e.dimension?.id);return!t||!Gf(t)}).map(e=>[e,...e.children]),[i,s,e.id]),d=o(()=>c.flat(),[c]),u=o(()=>{const e=n.get(l),t={};return e?.forEach(e=>{const n=e.value[l];void 0!==n&&(t[n.value.dimensionValueId]=!0)}),t},[n,l]);return I(ab,{fieldDimension:e.name,dimensionValueOptions:c,dimensions:s,flatDimensionValues:d,selectedRow:u,setSelectedRow:e=>{if(void 0===r)return;const n=Object.entries(e).filter(([,e])=>e).flatMap(([e])=>{if(void 0===t)return[];const n=d.find(t=>t.id===e);if(void 0===n)return[];const r=n.name??"",a=n.dimension.id??"";return[t.createFilter({name:r,value:{[l]:{name:r,value:{dimensionId:a,dimensionValueId:e}}}})]});r(e=>$T(e,l,n))},allowMultiselect:!0})}function cO(e,t){return et({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>I(sO,{...e,dimension:t})})}function dO({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=lI(),t=function(){const{query:{data:e}}=aO();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,cO(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:cS(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=Sc(),[a,i]=d(()=>XT(e,n));return I(Gv,{title:"Filter By",padChildren:!1,Footer:I(DS,{onApply:()=>{t(ek(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:I(nO,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function uO({filters:e,setFilters:t}){const{open:n}=Sc();return I(Hv,{overlay:!0,children:n&&I(dO,{filters:e,setFilters:t})})}function hO({filters:e,setFilters:t}){return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>R(ec,{popupTriggerProps:e,children:[I(Pd,{Component:YI}),I(uc,{wrap:"nowrap",children:"Filters"})]})}),I(uO,{filters:e,setFilters:t})]})}const pO=e=>r.createElement("svg",{stroke:"currentColor",width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_43563_992)"},r.createElement("path",{d:"M5.99982 3.61C6.78959 3.61 7.42982 2.96977 7.42982 2.18C7.42982 1.39023 6.78959 0.75 5.99982 0.75C5.21006 0.75 4.56982 1.39023 4.56982 2.18C4.56982 2.96977 5.21006 3.61 5.99982 3.61Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.705 11.25C2.23243 11.25 2.66 10.8224 2.66 10.295C2.66 9.76756 2.23243 9.34 1.705 9.34C1.17757 9.34 0.75 9.76756 0.75 10.295C0.75 10.8224 1.17757 11.25 1.705 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M5.99992 11.25C6.52735 11.25 6.95492 10.8224 6.95492 10.295C6.95492 9.76756 6.52735 9.34 5.99992 9.34C5.47249 9.34 5.04492 9.76756 5.04492 10.295C5.04492 10.8224 5.47249 11.25 5.99992 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.2948 11.25C10.8223 11.25 11.2498 10.8224 11.2498 10.295C11.2498 9.76756 10.8223 9.34 10.2948 9.34C9.76741 9.34 9.33984 9.76756 9.33984 10.295C9.33984 10.8224 9.76741 11.25 10.2948 11.25Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M1.70508 9.33998V6.47998H10.2951V9.33998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6 9.33999V3.61499",strokeMiterlimit:10,strokeLinecap:"square"})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_43563_992"},r.createElement("rect",{width:12,height:12,fill:"none"})))),gO=bi(pO,"DimensionValue"),mO=rr({width:"200px",minWidth:"200px"});function vO({labels:e,onSelect:t}){const{close:n}=Sc(),r=e=>{t(e),n()};return I(Uc,{children:R(Ug,{style:mO,children:[I(qg,{onClick:()=>r(void 0),children:I(uc,{children:"None"})}),e.map(e=>I(qg,{onClick:()=>r(e.id),children:I(uc,{children:e.name})},e.id))]})})}function fO({value:e,onChange:t}){const{query:{data:n=[]}}=aO();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>R(ec,{popupTriggerProps:e,children:[I(Pd,{Component:gO}),I(uc,{wrap:"nowrap",children:a})]})}),I(vO,{labels:n,onSelect:t})]})}function bO({accountingMethod:e,onChange:t,textOverrides:n}){const r=o(()=>{return e=n?.cash,t=n?.accrual,[{label:t??"Accrual",value:"ACCRUAL"},{label:e??"Cash",value:"CASH"}];var e,t},[n?.cash,n?.accrual]),a=o(()=>Object.fromEntries(r.map((e,t)=>[e.value,t])),[r])[e],i=u(e=>{t(r[e].value)},[t,r]);return I("div",{children:I(Of,{width:"fit",options:r,selectedIndex:a,handleClick:i})})}const yO=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M14.1641 9.87903V14.125H0.835876V9.87903",strokeMiterlimit:10}),r.createElement("path",{d:"M7.49988 10.4883V0.1875",strokeMiterlimit:10}),r.createElement("path",{d:"M11.7395 6.85162L7.4999 11.0913L3.26025 6.85162",strokeMiterlimit:10})),"Download"),wO=rr({display:"inline-flex",alignItems:"center",gap:"8px",cursor:"pointer",_disabled:{cursor:"not-allowed",opacity:.5}}),CO=rr({display:"inline-flex",borderRadius:"9999px",_focusVisible:{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}});function xO({option:e,isSelected:t}){return R(Pe.Item,{className:wO,value:e.label,disabled:e.disabled,children:[I(Pe.ItemControl,{className:CO,children:I(hI,{isSelected:t})}),I(Pe.ItemText,{children:I(uc,{children:e.label})}),I(Pe.ItemHiddenInput,{})]})}const TO=fr(cr["radio-group"],rr({display:"flex",flexDirection:"column",gap:"8px"})),kO=rr({display:"flex",alignItems:"center",gap:"24px"});function EO({label:e,options:t,selected:n,onChange:r}){return R(Pe.Root,{...TO,value:n,orientation:"horizontal","aria-label":e,onValueChange:e=>r(e.value??""),children:[I(Pe.Label,{children:I(So,{children:e})}),I("div",{className:kO,children:t.map(e=>I(xO,{option:e,isSelected:e.label===n},e.label))})]})}const AO=[{label:"CSV"},{label:"XLSX",disabled:!0},{label:"PDF",disabled:!0}],SO=rr({paddingBlock:"16px",minWidth:"400px"});function IO(){const e=hn(e=>e.FEATUREFLAG_REPORT_DOWNLOAD);return R(ec,{disabled:!e,onClick:async()=>{await async function(){return dh({title:"Download Report",body:I("div",{className:SO,children:I(EO,{label:"Download as",options:AO,selected:AO[0].label,onChange:()=>{}})}),cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"action",key:"DOWNLOAD",label:"Download"}]}).then(e=>"DOWNLOAD"===e?"DOWNLOAD":"CANCEL").catch(()=>"CANCEL")}().then(e=>{"DOWNLOAD"===e&&console.log})},children:[I(ul,{Component:yO}),I(uc,{children:"Export Report"})]})}function NO(){return R(ec,{disabled:!0,children:[I(ul,{Component:Md}),I(uc,{children:"Send Report"})]})}function RO({filters:e,setFilters:t}){return e.map((n,r)=>I(vb,{text:n.name,onClickRemove:()=>t(Je(e,r)),additionalValidClassName:cr["filter-pill"]},n.id))}function PO(){const e=i(PF);if(void 0===e)throw new Error("useReportPreviewContext must be used within a ReportPreviewProvider");return e}const DO=eR({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),MO=eR({gap:"8px",flexWrap:"wrap"});function LO({hasDimensionFiltering:e=!0,textOverrides:t}){const{dateRange:n,setDateRange:r,period:a,setPeriod:o,accountingMethod:i,setAccountingMethod:l,dimensionId:s,setDimensionId:c,reportDimensionFilters:d,setReportDimensionFilters:u}=PO();return R(N,{children:[R("div",{className:DO,children:[R("div",{className:MO,children:[I(UF,{value:n,onChange:r}),I(jF,{value:a,onChange:o}),e&&I(hO,{filters:d,setFilters:u}),e&&I(fO,{value:s,onChange:c})]}),R("div",{className:MO,children:[I(bO,{textOverrides:t?.accountingMethod,accountingMethod:i,onChange:l}),I(IO,{}),I(NO,{})]})]}),e&&I(wN,{children:I(RO,{filters:d,setFilters:u})})]})}const FO=lr({base:{border:"inherit",whiteSpace:"nowrap",padding:"6px 8px",color:"typography.base"},variants:{alignment:{end:{textAlign:"end"},start:{textAlign:"start"},center:{textAlign:"center"}},weight:{inherit:{},regular:oo,bold:io},clickable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},false:{cursor:"inherit"}},border:{left:{borderLeftStyle:"solid",borderLeftWidth:"md",borderLeftColor:"border.layout"},right:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout"}},stickyLeft:{true:{position:"sticky",left:0,zIndex:1,backgroundColor:"inherit",_scrolledX:{borderRightStyle:"solid",borderRightWidth:"md",borderRightColor:"border.layout",filter:"drop-shadow(4px 2px 4px rgba(0, 0, 0, 0.05))"}}}},defaultVariants:{alignment:"end",clickable:!1,weight:"inherit",stickyLeft:!1}});function OO({children:e,colspan:t,...n}){return I("th",{colSpan:t,className:FO({...n}),children:e})}const VO=lr({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:oo,bold:io},expandable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},false:{cursor:"auto"}},rowType:{normal:{},expandTotal:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout"},reportTotal:{borderTopWidth:"4px",borderTopStyle:"double",borderTopColor:"border.layout.strong",borderBottomWidth:"4px",borderBottomStyle:"double",borderBottomColor:"border.layout.strong"},sectionStart:{borderTopWidth:"md",borderTopStyle:"solid",borderTopColor:"border.layout.strong"},sectionEnd:{borderBottomWidth:"md",borderBottomStyle:"solid",borderBottomColor:"border.layout.strong"}}},defaultVariants:{weight:"regular",expandable:!1,rowType:"normal"}}),UO=rR({name:"report-table-container",containerType:"scroll-state",overflowX:"auto",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout",width:"fit-content",maxWidth:"100%",paddingBottom:"16px",maxHeight:"80dvh",isolation:"isolate",boxSizing:"border-box"}),BO=rr({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),HO=rr({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),WO=rr({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function _O({table:e}){const t=a(null),n=u(()=>{const e=r.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[r=t]);var r;const o=e.getExpandedRowModel().rows;return I("div",{className:UO,ref:t,onScroll:n,children:R("table",{className:BO,children:[I("thead",{className:HO,children:e.getHeaderGroups().map(e=>I("tr",{className:WO,children:e.headers.map((e,t)=>e.isPlaceholder?I(OO,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):I(f,{children:X(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),I("tbody",{children:o.map((e,t)=>{const n=e.getCanExpand(),r=n?()=>e.toggleExpanded():void 0,a=e.original.type,i=n||"expandTotal"===a?"bold":"regular";let l=e.original.type;if(t<o.length-1){const e=o[t+1];"sectionEnd"===a&&"reportTotal"===e.original.type&&(l=void 0)}return I("tr",{className:VO({rowType:l,expandable:n,weight:i}),onClick:r,children:e.getVisibleCells().map(e=>I(f,{children:X(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})}const zO=e=>["reports","profitAndLoss",e],jO=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result?r.data:void 0};function qO(e){const t=[];return{caboose:()=>[...t],car(e){return t.push(e),this}}}const KO="Total";function YO(e){return Rr(e)?KO:`${KO} ${e}`}function ZO(e){if(void 0!==e)return yo(hh(e),{cents:"always",signage:"parens"})}function GO(e){if(!dr(e))return yo(hh(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function QO(e,t,n,r){return e.map((e,a)=>{const o=`${t}.${a}`,i=e=>n(e)?.[a],l=r(i),s=e.children??[],c=s.length>0?QO(s,o,e=>i(e)?.children,r):void 0;return{key:o,label:e.name,values:l,accountId:e.accountId??void 0,subrows:c}})}function XO(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function JO(e){if(!dr(e))return yo(e,{cents:"always",decorator:"%",signage:"parens"})}function $O({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return I("td",{rowSpan:e,onClick:n,className:FO({clickable:r??void 0!==n,...a}),children:t})}const eV=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e}),"Nothing");function tV({expanded:e,canExpand:t=!0,size:n="tiny"}){return I("largeish"===n?GI:Rc,{Component:t?"largeish"===n?e?Xf:Up:e?Up:ol:eV})}const nV=rr({alignItems:"center",display:"flex",gap:8});function rV({depth:e=0,children:t}){return I("div",{className:nV,style:{paddingLeft:9*e},children:t})}function aV({context:e}){const t=e.table.getIsAllRowsExpanded();return I($O,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:R(rV,{children:[I(tV,{expanded:t}),t?"Collapse All":"Expand All"]})})}function oV(e){return"expandTotal"===e.row.original.type?e.row.depth-1:e.row.depth}function iV({context:e,onClick:t}){return I($O,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),onClick:t,children:R(rV,{depth:oV(e),children:[I(tV,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})}const lV=J();function sV(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const cV=lV.accessor("label",{id:"label",header:e=>I(aV,{context:e}),cell:e=>I(iV,{context:e})});const dV={placeholderData:L},uV=S.object({glAccountId:S.string(),dateRange:S.object({start:S.string().optional(),end:S.string().optional()}).optional(),accountingMethod:S.enum(["CASH","ACCRUAL"]),includeBeginningBalance:S.boolean().optional()});function hV(e,{includeBeginningBalance:t}={}){const{accountingMethod:n}=PO(),r=function(){const e=gF();return u((t,n)=>{e(t,{state:n})},[e])}();return u((a,o)=>{Rr(a.accountId)||r(e,{glAccountId:a.accountId,dateRange:{start:o.period?.beginDate,end:o.period?.endDate},accountingMethod:n,includeBeginningBalance:t})},[r,n,e,t])}const pV=[];function gV(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function mV(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!oO(e.modelKey))return;const n=e.value[e.modelKey];if(void 0===n)return;const{dimensionId:r,dimensionValueId:a}=n.value;t.set(r,[...t.get(r)??[],a])}),0!==t.size)return Array.from(t.entries()).map(([e,t])=>({dimensionId:e,dimensionValueIds:t}))}function vV(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=PO(),{query:{data:i},isFilling:l}=(s={filter:{...e,dimensionValues:mV(a),customerIds:gV(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},c=dV,Br({queryKey:zO(s??{}),queryFn:jO,...c}));var s,c;const d=hV(function(){const{pathname:e}=uL(),t=pF["balance-sheet/profit-and-loss"].route,n=pF["cash-flow-statement/profit-and-loss"].route;return e===t||e.startsWith(`${t}/`)?"balance-sheet/profit-and-loss/general-ledger":e===n||e.startsWith(`${n}/`)?"cash-flow-statement/profit-and-loss/general-ledger":"profit-and-loss/general-ledger"}()),u=o(()=>function(e){const t=e?.json;if(void 0===t)return[];const n=/* @__PURE__ */function(e){return(t,n)=>{const r=n((i=e,i[0]?.data?.[0]??{})),a=r?.name,o=XO(e,e=>GO(n(e)?.total));var i;return{key:t,label:a,values:o,subrows:[...QO(r?.children??[],t,e=>n(e)?.children,t=>XO(e,e=>ZO(t(e)?.total))),{key:`${t}.total`,label:YO(a),type:"expandTotal",values:o}]}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,type:a,values:XO(e,r)})}(t);return qO().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>GO(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>JO(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>GO(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>JO(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>GO(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}(i),[i]),h=o(()=>function(e,t){const n=e?.json??[],r=n[0],a=r?.data,o=n.map((e,o)=>{const i=e.data?.length??0,l=o!==n.length-1&&(i>1||a?.[0]?.name!==r?.name),s=(d=o,u=l,h=t,void 0===(c=e).data?[]:c.data.map((e,t)=>lV.accessor(`values.${d}[${t}]`,{header:t=>I(OO,{border:sV(t.column)?"left":void 0,weight:u?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.original,n=e.row.getCanExpand(),r=n&&e.row.getIsExpanded(),a=void 0!==h&&Pr(t.accountId)&&!n?()=>h(t,c):void 0;return I($O,{border:sV(e.column)?"left":void 0,alignment:"end",onClick:a,children:!r&&e.cell.getValue()})}})));var c,d,u,h;return l?lV.group({id:`valueRecord.${o}`,header:t=>I(OO,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:s}):s[0]});return[cV,...o]}(i,d),[i,d]);return{table:$({data:u??pV,columns:h,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{income:!0,cogs:!0,expenses:!0,otherExpenses:!0,otherIncome:!0},columnPinning:{left:["label"]}}}),isFilling:l}}const fV=S.object({dateRange:S.object({beginDate:S.string(),endDate:S.string()}),accountingMethod:S.enum(["CASH","ACCRUAL"]),period:S.enum(["NONE","MONTHLY","QUARTERLY","YEARLY"])});function bV(){const e=gF();return u((t,n)=>{e(t,{state:n})},[e])}function yV(){const{table:e,isFilling:t}=vV();return R(N,{children:[I(LO,{hasDimensionFiltering:!0}),!t&&I(_O,{table:e})]})}function wV(){const{state:e}=uL(),t=(n=e,fV.safeParse(n).success?e:void 0);var n;return I(DF,{seed:t,children:I(yV,{})})}const CV=e=>["reports","balanceSheet",e],xV=async e=>{const t=e.queryKey,n={path:"/v6/reports/balanceSheet",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result?r.data:void 0};function TV(e,t){const n=e.map((e,n)=>[`${n}[0]`,t(e)]);return Object.fromEntries(n)}function kV(e,t,n,r){const a=TV(n,e=>GO(r(e)?.total)),o=[...QO(e.children??[],t,e=>r(e)?.children,e=>TV(n,t=>ZO(e(t)?.total))),{key:`${t}.total`,label:YO(e.name),type:"expandTotal",values:a}];return{key:t,label:e.name,values:a,subrows:o}}const EV=YO("Liabilities and Equity");function AV(e){return"Current Income"===e.label}const SV=J();function IV(e){return SV.accessor("label",{id:"label",header:e=>I(aV,{context:e}),cell:t=>{const n=t.row.original,r=void 0!==e&&AV(n)?e:void 0;return I(iV,{context:t,onClick:r})}})}const NV=[],RV="2000-01-01";function PV(){const{dateRange:e,period:t,accountingMethod:n}=PO(),{query:{data:r},isFilling:a}=(i=dV,Br({queryKey:CV({filter:e,grouping:{period:t},accountingMethod:n}),queryFn:xV,...i}));var i;const l=hV("balance-sheet/general-ledger",{includeBeginningBalance:!0}),s=bV(),c=u((e,t)=>{if(AV(e)){const e=t.period?.endDate;if(Rr(e))return;return()=>s("balance-sheet/profit-and-loss",{dateRange:{beginDate:RV,endDate:e},accountingMethod:n,period:"NONE"})}if(Pr(e.accountId))return()=>l(e,t)},[l,s,n]),d=u(()=>{s("balance-sheet/profit-and-loss",{dateRange:{beginDate:RV,endDate:e.endDate},accountingMethod:n,period:"NONE"})},[s,e.endDate,n]),h=o(()=>function(e){return function(e){const t=e?.json;if(void 0===t||0===t.length)return[];const n=t[0],r=qO(),a=n.assets;a&&r.car(kV(a,"assets",t,e=>e.assets));const o=n.liabilitiesAndEquity?.liabilities;o&&r.car(kV(o,"liabilities",t,e=>e.liabilitiesAndEquity?.liabilities));const i=n.liabilitiesAndEquity?.equity;i&&r.car(kV(i,"equity",t,e=>e.liabilitiesAndEquity?.equity));const l=n.liabilitiesAndEquity?.name;return r.car({key:"totalLiabilitiesAndEquity",label:void 0!==l?YO(l):EV,type:"reportTotal",values:TV(t,e=>GO(e.liabilitiesAndEquity?.total))}),r.caboose().filter(e=>void 0!==Object.values(e.values)[0])}(e)}(r),[r]),p=o(()=>function(e,t,n){const r=(e?.json??[]).map((e,n)=>{return r=e,a=n,o=t,SV.accessor(`values.${a}[0]`,{header:()=>I(OO,{border:"left",weight:"bold",alignment:"end",children:r.name}),cell:e=>{const t=e.row.original,n=e.row.getCanExpand(),a=n&&e.row.getIsExpanded(),i=n?void 0:o?.(t,r);return I($O,{border:"left",alignment:"end",onClick:i,children:!a&&e.cell.getValue()})}});var r,a,o});return[IV(n),...r]}(r,c,d),[r,c,d]);return{table:$({data:h??NV,columns:p,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{assets:!0,liabilities:!0,equity:!0},columnPinning:{left:["label"]}}}),isFilling:a}}function DV(){const{table:e,isFilling:t}=PV();return R(N,{children:[I(LO,{hasDimensionFiltering:!1}),!t&&I(_O,{table:e})]})}const MV=e=>["reports","cashFlowStatement",e],LV=async e=>{const t=e.queryKey,n={path:"/v6/reports/cashFlowStatement",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result?r.data:void 0};function FV(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function OV(e,t,n,r){const a=QO(e.children??[],t,e=>r(e)?.children,e=>FV(n,t=>ZO(e(t)?.total))),o=FV(n,e=>GO(r(e)?.total)),i=[...a,{key:`${t}.total`,label:YO(e.name),type:"expandTotal",values:o}];return{key:t,label:e.name,values:o,subrows:i}}function VV(e){return"Net Income"===e.label}const UV=J();function BV(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}function HV(e){return UV.accessor("label",{id:"label",header:e=>I(aV,{context:e}),cell:t=>{const n=t.row.original,r=void 0!==e&&VV(n)?e:void 0;return I(iV,{context:t,onClick:r})}})}const WV=[];function _V(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!oO(e.modelKey))return;const n=e.value[e.modelKey];if(void 0===n)return;const{dimensionId:r,dimensionValueId:a}=n.value;t.set(r,[...t.get(r)??[],a])}),0!==t.size)return Array.from(t.entries()).map(([e,t])=>({dimensionId:e,dimensionValueIds:t}))}function zV(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=PO(),{query:{data:i},isFilling:l}=(s={filter:{...e,dimensionValues:_V(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},c=dV,Br({queryKey:MV(s??{}),queryFn:LV,...c}));var s,c;const d=hV("cash-flow-statement/general-ledger"),h=bV(),p=u((e,t)=>{if(VV(e)){const e=t.period?.beginDate,r=t.period?.endDate;if(Rr(e)||Rr(r))return;return()=>h("cash-flow-statement/profit-and-loss",{dateRange:{beginDate:e,endDate:r},accountingMethod:n,period:"NONE"})}if(Pr(e.accountId))return()=>d(e,t)},[d,h,n]),g=u(()=>{h("cash-flow-statement/profit-and-loss",{dateRange:e,accountingMethod:n,period:"NONE"})},[h,e,n]),m=o(()=>function(e){return function(e){const t=e?.json;if(void 0===t||0===t.length)return[];const n=t[0].data?.[0];if(!n)return[];const r=qO();return n.operatingActivities&&r.car(OV(n.operatingActivities,"operatingActivities",t,e=>e.operatingActivities)),n.investingActivities&&r.car(OV(n.investingActivities,"investingActivities",t,e=>e.investingActivities)),n.financingActivities&&r.car(OV(n.financingActivities,"financingActivities",t,e=>e.financingActivities)),r.car({key:"changeInCash",label:"Change in Cash",type:"sectionStart",values:FV(t,e=>GO(e.netCashChange))}),r.car({key:"beginCash",label:"Beginning Cash",values:FV(t,e=>GO(e.beginCashBalance))}),r.car({key:"endCash",label:"End Cash",type:"reportTotal",values:FV(t,e=>GO(e.endCashBalance))}),r.caboose().filter(e=>void 0!==Object.values(e.values)[0])}(e)}(i),[i]),v=o(()=>function(e,t,n){const r=e?.json??[],a=r[0],o=a?.data,i=r.map((e,n)=>{const i=e.data?.length??0,l=n!==r.length-1&&(i>1||o?.[0]?.name!==a?.name),s=(d=n,u=l,h=t,void 0===(c=e).data?[]:c.data.map((e,t)=>UV.accessor(`values.${d}[${t}]`,{header:t=>I(OO,{border:BV(t.column)?"left":void 0,weight:u?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.original,n=e.row.getCanExpand(),r=n&&e.row.getIsExpanded(),a=n?void 0:h?.(t,c);return I($O,{border:BV(e.column)?"left":void 0,alignment:"end",onClick:a,children:!r&&e.cell.getValue()})}})));var c,d,u,h;return l?UV.group({id:`valueRecord.${n}`,header:t=>I(OO,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:s}):s[0]});return[HV(n),...i]}(i,p,g),[i,p,g]);return{table:$({data:m??WV,columns:v,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{operatingActivities:!0,investingActivities:!0,financingActivities:!0},columnPinning:{left:["label"]}}}),isFilling:l}}const jV={accountingMethod:{cash:"Cash (Direct)",accrual:"Accrual (Indirect)"}};function qV(){const{table:e,isFilling:t}=zV();return R(N,{children:[I(LO,{hasDimensionFiltering:!0,textOverrides:jV}),!t&&I(_O,{table:e})]})}const KV=e=>r.createElement("svg",{width:90,height:24,viewBox:"0 0 90 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M15.6182 11.5362V8.24941C15.6182 3.87291 12.0796 0.325012 7.71366 0.325012H1.375V12.1459H15.0099C15.1782 12.1459 15.3141 12.2822 15.3141 12.4508V15.7376C15.3141 20.1141 18.8534 23.662 23.2194 23.662H29.558V11.8411H15.9231C15.7549 11.8411 15.619 11.7049 15.619 11.5362H15.6182Z",fill:"white"}),r.createElement("path",{d:"M52.4967 23.6612V20.9282H59.1775C60.8137 20.9282 61.7406 20.1628 61.7406 18.3313V16.336C60.7045 17.5392 59.1225 18.2218 57.3504 18.2218C53.3969 18.2218 50.5337 15.2147 50.5337 11.3336C50.5337 7.45246 53.6153 4.4729 57.3779 4.4729C59.15 4.4729 60.7595 5.12881 61.7956 6.41387V4.74613H64.6863V18.1951C64.6863 21.9943 62.2865 23.662 59.0958 23.662H52.4967V23.6612ZM61.6589 11.3336C61.6589 8.98237 59.941 7.26112 57.5954 7.26112C55.2499 7.26112 53.5595 8.98318 53.5595 11.3336C53.5595 13.684 55.2499 15.4069 57.5954 15.4069C59.941 15.4069 61.6589 13.6848 61.6589 11.3336Z",fill:"white"}),r.createElement("path",{d:"M43.3378 18.3037C40.2563 18.3037 38.7842 16.9643 38.7842 14.1485V7.53353H36.5479V4.74531H38.1024C38.5116 4.74531 38.7842 4.47209 38.7842 3.97995V1.35632H41.8108V4.74612H45.41V7.53434H41.8108V13.8486C41.8108 14.9147 42.3292 15.4612 43.5562 15.4612H45.4108V18.3045H43.3386L43.3378 18.3037Z",fill:"white"}),r.createElement("path",{d:"M66.536 18.3037V0.325012H69.5633V6.11224C70.4086 5.07365 71.7172 4.47207 73.3809 4.47207C76.7351 4.47207 79.1073 6.85004 79.1073 10.595V18.3037H76.0799V10.8682C76.0799 8.65399 74.8805 7.34217 72.9167 7.34217C70.9529 7.34217 69.5625 8.70912 69.5625 10.8682V18.3037H66.5352H66.536Z",fill:"white"}),r.createElement("path",{d:"M86.0307 18.3037C82.9491 18.3037 81.4771 16.9643 81.4771 14.1485V7.53353H79.2407V4.74531H80.7953C81.2045 4.74531 81.4771 4.47209 81.4771 3.97995V1.35632H84.5037V4.74612H88.1029V7.53434H84.5037V13.8486C84.5037 14.9147 85.0221 15.4612 86.2491 15.4612H88.1037V18.3045H86.0315L86.0307 18.3037Z",fill:"white"}),r.createElement("path",{d:"M49.3991 4.74609H46.3726V18.3045H49.3991V4.74609Z",fill:"white"}),r.createElement("path",{d:"M48.1859 0.325012H46.3726V3.22998H49.3991V1.54116C49.3991 0.869845 48.8564 0.325012 48.1859 0.325012Z",fill:"white"})),YV=rr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"center",paddingTop:"15%",width:"100%",height:"100vh"}),ZV=rr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"flex-start"}),GV=rr({display:"flex",flexDirection:"column",gap:"24px",width:{xl:"368px",sm:"316px",base:"auto"},minHeight:{md:"110px",base:"140px"},padding:"36px 24px",alignItems:"flex-start",borderRadius:"4px",backgroundLinear:"to-t",gradientFrom:"#009C75",gradientTo:"#2AD17B",gradientFromPosition:"23.41%",gradientToPosition:"106.24%"}),QV=rr({display:"flex",flexDirection:"column",gap:"12px"}),XV=rr({fontFamily:"Duplet Semibold, sans-serif",fontWeight:"md",fontSize:"md",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),JV=rr({fontFamily:"Duplet Regular, sans-serif",fontWeight:"sm",fontSize:"md",lineHeight:"template",letterSpacing:"0.84px",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),$V=rr({display:"inline"});function eU(){const e=jk();return I("div",{className:YV,children:R("div",{className:ZV,children:[e&&I(Hk,{}),R("div",{className:GV,children:[I(KV,{width:89,height:24,overflow:"visible"}),R("div",{className:QV,children:[R("span",{className:$V,children:[I("span",{className:XV,children:"This component is currently only available in the "}),I("a",{className:XV,href:"https://docs.tight.com/v5.0/embeddable-ui/white-labeled-experience/how-to-embed",target:"_blank",rel:"noreferrer",children:"v5 Javascript SDK"})]}),R("span",{className:$V,children:[I("span",{className:JV,children:"It will be available in "}),I("a",{className:JV,href:"https://docs.tight.com/embeddable-ui/tight-embeddable-ui",target:"_blank",rel:"noreferrer",children:"v6 React Components"}),I("span",{className:JV,children:" soon"})]})]})]})]})})}function tU({onClick:e,accounts:t,listLabel:n,nestedTitle:r,isFilling:a,selectedAccountId:o,onSelect:i,Header:l}){return a?I(Tf,{}):R(N,{children:[l,I(hf,{title:I(Eo,{children:n}),children:t.map(t=>t.hasChilds?I(pS,{text:t.name,iconUrl:t.iconUrl,title:r,children:I(nU,{accounts:t.children,selectedAccountId:o,onSelect:i,listLabel:t.name,nestedTitle:r})},t.id):I(bf,{handleClick:()=>e(t),selected:t.id===o,children:I(hS,{children:I(uc,{wrap:"wrap",children:t.name})})},t.id))})]})}function nU({accounts:e,selectedAccountId:t,onSelect:n,isFilling:r=!1,listLabel:a="All Accounts",placeholder:o="Search accounts...",nestedTitle:i="All Accounts",Header:l}){const s=Sc(),c=e=>{n(e),s.close()},d=t?/* @__PURE__ */new Set([t]):/* @__PURE__ */new Set;return I(rf,{placeholder:o,onClick:c,SearchList:({searchTerm:t,onClick:n})=>I(kS,{searchTerm:t,onClick:n,glAccounts:e,isFilling:r,selectedIds:d}),DefaultList:tU,listLength:e.length,extraProps:{accounts:e,listLabel:a,nestedTitle:i,isFilling:r,selectedAccountId:t,onSelect:c,Header:l},forceSearchVisible:!0})}const rU=rr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function aU({children:e,...t}){return I("button",{className:rU,type:"button",...t,children:e})}const oU=rr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",minWidth:"280px"});function iU({isMobile:e}){const t=Sc(),n=a(e);return s(()=>{n.current!==e&&(n.current=e,t.close())},[e,t]),null}function lU({selectedAccountId:e,onSelect:t}){const{query:{data:n},isFilling:r}=yC({select:e=>IC(e.filter(e=>"ACTIVE"===e.status))});return I(Qv,{title:"Select Account",overlay:!0,children:I(nU,{accounts:n??[],isFilling:r,onSelect:t,selectedAccountId:e})})}function sU({onSelect:e}){return I(sx,{onClick:e,activeOnly:!0})}function cU({selectedAccountId:e,onSelect:t,initialOpen:n=!1,open:r,onOpenChange:a}){const o=ET(),{query:{data:i}}=yC(),l=i?.find(t=>t.id===e);return R(Ac,{placement:"bottom-start",initialOpen:n,open:r,onOpenChange:a,children:[I(iU,{isMobile:o}),I(Ic,{children:e=>{return I(kp,{label:"Account",popupTriggerProps:e,additionalStyles:oU,children:R(aU,{children:[I(uc,{intent:l?"default":"weak",children:(t=l,t?(n=t.accountNo,r=t.name,`${n?`#${n}`:""} ${r??""}`.trim()):"Select an account")}),I(Pd,{Component:ol})]})});var t,n,r}}),o?I(lU,{selectedAccountId:e,onSelect:t}):I(sU,{onSelect:t})]})}function dU({onSelectAnotherAccount:e}){return R(N,{children:[I(Sd,{Component:of}),I(Eo,{children:"No results"}),I(So,{wrap:"wrap",children:"Try another search, or adjust the filters"}),I(ec,{onClick:e,children:I(uc,{wrap:"nowrap",children:"Select Another Account"})})]})}function uU({name:e,align:t="left"}){return I(Qc,{align:t,padding:"right"===t?"large":"default",children:I(yc,{children:e})})}function hU({btId:e,entry:t}){const{mutate:n}=hC();return I(dx,{accountName:t.entity?.glAccount?.displayName??t.entity?.glAccount?.name,iconUrl:t.entity?.glAccount?.iconUrl,onChange:t=>{n({id:e,glAccountId:t.id})},types:RC,placeholder:"Search revenue accounts..."})}function pU({onClick:e}){const{open:t}=Sc();return I(N,{children:t&&I(Ux,{onClick:e})})}function gU({btId:e,entry:t}){const{startPrefetch:n,cancelPrefetch:r}=Nx(),{mutate:a}=hC(),o=t.entity?.glAccount?.iconUrl,i=Pr(o)?Em(o,""):void 0;return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>R(YC,{...e,onMouseEnter:n,onMouseLeave:r,children:[i&&I(Pd,{Component:i}),I(uc,{children:t.entity?.glAccount?.displayName??t.entity?.glAccount?.name??""})]})}),I(pU,{onClick:t=>{null!==t&&a({id:e,categoryId:t.id})}})]})}function mU({entry:e}){const t="TRANSFER_IN"===e.type?"Deposited to":"Withdrawn from",n=e.entity?.glAccount?.displayName??e.entity?.glAccount?.name;return I(Kw,{annotation:t,accountName:n})}function vU(e){return null===e||0===e?"":xo(hh(e))}function fU(e){return function(e){return yo(e,{cents:"always",condense:!1,decorator:"$",signage:"parens"})}(null===e?0:hh(e))}function bU({balance:e}){return I(cc,{alignVariant:"flexEnd",children:I(Ww,{amount:fU(e??null)})})}function yU(e){return"EXPENSE"===e||"REVENUE"===e||"TRANSFER_IN"===e||"TRANSFER_OUT"===e}function wU(e,t){if(Rr(e.entity?.id)||!yU(n=e.type)&&"BILL"!==n&&"PAYROLL"!==n&&"INVOICE"!==n)return!1;var n;switch(e.type){case"BILL":return null!==t.bill;case"PAYROLL":return null!==t.payroll;case"INVOICE":return null!==t.invoice;default:return!0}}function CU(e){const t=e.entity?.id;if(Rr(t))return;if(yU(e.type))return void gs(null,{transactionId:t});const{events:n}=hn.getState();switch(e.type){case"BILL":return void ps(n.bill,{type:"OPEN_BILL",result:"SUCCESS",data:{id:t},error:null});case"PAYROLL":return void ps(n.payroll,{type:"OPEN_PAYROLL",result:"SUCCESS",data:{data:{id:t}},error:null});case"INVOICE":return void ps(n.invoice,{type:"OPEN_INVOICE_FORM",result:"SUCCESS",data:{id:t},error:null})}}function xU({row:e}){return"entry"!==e.original.kind?null:I(hw,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler(),disabled:!e.getCanSelect()})}function TU({label:e}){return I(cc,{children:I(uc,{children:e})})}function kU({entry:e}){return I(cc,{children:I(Fw,{label:e.entity?.displayName??"",subLabel:e.entity?.secondaryDisplayName??void 0,iconSpacing:!1})})}const EU={...fw,INVOICE:"Invoice",BILL:"Bill",PAYROLL:"Payroll",JOURNAL_ENTRY:"Journal Entry"},AU=rr({padding:"12px 16px",display:"flex",gap:"12px",flexDirection:"row",alignItems:"center",justifyContent:"space-between",maxWidth:"100%"}),SU=rr({display:"flex",flexDirection:"column",gap:"4px",minWidth:0}),IU=rr({display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"4px",flexShrink:0}),NU=rr({display:"flex",alignItems:"center",gap:"6px"});function RU({entry:e}){const t=0!==(e.crAmount??0),n=t?e.crAmount:e.drAmount,r=0!==(n??0),a=e.entity?.glAccount?.displayName??e.entity?.glAccount?.name??"";return R(N,{children:[R("div",{className:SU,children:[I(Eo,{children:e.entity?.displayName??""}),I(So,{children:a})]}),R("div",{className:IU,children:[R("div",{className:NU,children:[r&&I(So,{children:t?"CR":"DR"}),I(Du,{children:vU(n)})]}),I(So,{children:`BAL ${fU(e.runningBalance??null)}`})]})]})}function PU({label:e,balance:t}){return R(N,{children:[I("div",{className:SU,children:I(Eo,{children:e})}),I("div",{className:IU,children:I(So,{children:`BAL ${fU(t??null)}`})})]})}function DU({row:e}){const t=e.original;return I("div",{className:AU,children:"entry"===t.kind?I(RU,{entry:t.entry}):I(PU,{label:"beginningBalance"===t.kind?"Beginning Balance":"Ending Balance",balance:t.balance})})}function MU(e){return function(t){return"entry"!==t.row.original.kind?null:I(e,{entry:t.row.original.entry})}}const LU=J(),FU=[LU.display({id:"select",header:({table:e})=>I(wT,{table:e}),cell:({row:e})=>I(xU,{row:e}),maxSize:35,meta:{clickable:!0}}),LU.display({id:"date",cell:MU(function({entry:e}){return I(cc,{children:I(gw,{date:e.date})})}),header:()=>I(uU,{name:"Date"}),size:100,maxSize:130}),LU.display({id:"type",cell:MU(function({entry:e}){return I(cc,{children:I(uc,{children:(t=e.type,dr(t)?"":EU[t])})});var t}),header:()=>I(uU,{name:"Type"}),size:110}),LU.display({id:"source",cell:e=>{const t=e.row.original;if("entry"===t.kind)return I(kU,{entry:t.entry});const n="beginningBalance"===t.kind?"Beginning Balance":"Ending Balance";return I(TU,{label:n})},header:()=>I(uU,{name:"Source"}),size:180}),LU.display({id:"debit",cell:MU(function({entry:e}){return I(cc,{alignVariant:"flexEnd",children:I(Ww,{amount:vU(e.drAmount)})})}),header:()=>I(uU,{name:"Debit",align:"right"}),size:100,maxSize:130}),LU.display({id:"credit",cell:MU(function({entry:e}){return I(cc,{alignVariant:"flexEnd",children:I(Ww,{amount:vU(e.crAmount)})})}),header:()=>I(uU,{name:"Credit",align:"right"}),size:100,maxSize:130}),LU.display({id:"balance",cell:e=>{const t=e.row.original,n="entry"===t.kind?t.entry.runningBalance:t.balance;return I(bU,{balance:n})},header:()=>I(uU,{name:"Balance",align:"right"}),size:110,maxSize:140}),LU.display({id:"account",cell:MU(function({entry:e}){if("TRANSFER_IN"===e.type||"TRANSFER_OUT"===e.type)return I(mU,{entry:e});const t=e.entity?.id,n=ur(e.entity?.glAccount);return void 0!==t&&n&&"REVENUE"===e.type?I(hU,{btId:t,entry:e}):void 0!==t&&n&&"EXPENSE"===e.type?I(gU,{btId:t,entry:e}):null}),header:()=>I(uU,{name:"Account"}),size:140,meta:{clickable:!0}}),LU.display({id:"drilldown",cell:MU(function({entry:e}){return wU(e,hn(e=>e.events))?I(cc,{alignVariant:"center",children:I(Pd,{Component:ol})}):null}),size:40,maxSize:60})],OU=LU.display({id:"MOBILE",cell:e=>I(DU,{row:e.row})});function VU(e){return"beginningBalance"===e.kind?"__beginning_balance__":"endingBalance"===e.kind?"__ending_balance__":e.entry.id}const UU=[OU];const BU=fr(cr["dashboard-header"],rr({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),HU=rr({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}});function WU(e){const t=rn();return{beginDate:e?.start??t.start??"",endDate:e?.end??t.end??""}}const _U=[vw.EXPENSE,vw.REVENUE,vw.TRANSFER_IN];function zU({search:e,onSearchChange:t,dateRange:n,onDateRangeChange:r,isFetching:a}){return I("div",{...BU,children:R("div",{className:HU,children:[I(zT,{searchTerm:e,onChange:t,isFetching:a,placeholder:"Search ledger..."}),I(UF,{value:WU(n),onChange:e=>{r({start:e.beginDate,end:e.endDate})},collapseToIconOnMobile:!0}),I(mN,{intent:"primary",manualTransactionOptions:_U})]})})}function jU(e){return e.map(e=>e.entity?.id).filter(e=>void 0!==e).map(e=>({id:e}))}function qU({entries:e,resetSelected:t,...n}){const{mutateAsync:r}=mC(),a=async()=>{const n=ON(jU(e));await r(n),t&&t()};return I(LN,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&dh({title:"Delete transactions",body:`Are you sure you want to delete ${uh("transaction","transactions",t,!0)}?`,buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Delete",type:ch.DANGER}]}).then(e=>{e===Zu&&n()}));var t,n}})}function KU({entries:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=vC();return I(LN,{label:t,...r,children:I(Ux,{onClick:async function(t){if(t?.id){const r=UN(jU(e),t.id.toString());await a(r),n&&n()}}})})}function YU({entries:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=vC();return I(LN,{label:t,...r,children:I(sx,{onClick:async function(t){const r=BN(jU(e),t.id);await a(r),n&&n()},types:RC,placeholder:"Search revenue accounts..."})})}function ZU(e){if(!0===e.column.columnDef.meta?.clickable)return;const t=e.row.original;"entry"===t.kind&&CU(t.entry)}function GU({rowData:e}){const{startPrefetch:t,cancelPrefetch:n}=As(),r=hn(e=>e.events),a="entry"===e.original.kind?e.original.entry:void 0,o=void 0!==a&&wU(a,r),i=void 0!==a&&yU(a.type)?a.entity?.id:void 0,l=u(()=>{void 0!==i&&t({id:i})},[t,i]);return I(os,{rowData:e,mutatingRowId:i,onMouseEnter:void 0!==i?l:void 0,onMouseLeave:void 0!==i?n:void 0,onRowClick:o&&void 0!==a?()=>CU(a):void 0,onCellClick:o?ZU:void 0,shouldDisplayDivider:()=>!1})}const QU=rr({padding:"8px 16px",display:"flex",alignItems:"center",backgroundColor:"surface.elevated"});function XU({formattedDate:e}){return I("div",{className:QU,children:I(Eo,{wrap:"wrap",children:e})})}function JU(e){const t=[];let n=null;for(const r of e){const e=r.original;if("entry"!==e.kind){n=null,t.push({kind:"row",row:r});continue}const a=e.entry.date;null!==n&&n.date===a||(n={kind:"dateGroup",date:a,formattedDate:St(Rt(a)),rows:[]},t.push(n)),n.rows.push(r)}return t}function $U({rows:e}){return I(N,{children:JU(e).map(e=>"dateGroup"===e.kind?R(f,{children:[I(XU,{formattedDate:e.formattedDate}),e.rows.map(e=>I(GU,{rowData:e},e.id))]},`date-${e.date}`):I(GU,{rowData:e.row},e.row.id))})}const eB=XN({gap:"16px",alignItems:"stretch",width:"100%"}),tB=rr({alignSelf:"flex-start",width:{base:"100%",xl:"auto"}}),nB=rr({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground"}),rB=rr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"});function aB(e,t){if(!Nr(e))return!0;const n=rn();return void 0!==t&&(t.start!==n.start||t.end!==n.end)}const oB=[];function iB({glAccountId:e,onGlAccountChange:t,dateRange:n,onDateRangeChange:r,accountingMethod:a,search:i,onSearchChange:l,limit:s=100,includeBeginningBalance:c}){const u=ET(),[h,p]=d(()=>void 0===e&&!u),g=o(()=>{return e=n,t=i,{includeBeginningBalance:!0===c||void 0,beginDate:e?.start,endDate:e?.end,search:t.length>0?t.trim():void 0};var e,t},[n,i,c]),{query:{data:m},isFilling:v,paginationControls:f}=function(e,t={},n){return Al({queryKey:oC(e??"",t),queryFn:iC,...n,enabled:Pr(e)&&!0})}(e,{filter:g,accountingMethod:a,limit:s}),b=m?.data,y=m?.beginningBalance,w=o(()=>{if(void 0===b||0===b.length)return oB;const e=[];f.hasPreviousPage||dr(y)||e.push({kind:"beginningBalance",balance:y});for(const t of b)e.push({kind:"entry",entry:t});if(!f.hasNextPage){const t=b[b.length-1];e.push({kind:"endingBalance",balance:t.runningBalance})}return e},[b,y,f.hasPreviousPage,f.hasNextPage]),C=function({rows:e}){const t=ET();return $({data:e,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,columns:t?UU:FU,getCoreRowModel:ee(),getRowId:VU,enableRowSelection:e=>{return"entry"===(t=e.original).kind&&yU(t.entry.type);var t},meta:{editMutationKey:["banks/transactions"]}})}({rows:w}),x=function(e){const t=e.getSelectedRowModel().rows;return o(()=>{const e=t.flatMap(e=>"entry"===e.original.kind?[e.original.entry]:[]),n=e.filter(e=>"EXPENSE"===e.type),r=e.filter(e=>"REVENUE"===e.type),a=[{id:"delete",isVisible:e.length>0,render:({resetSelected:t})=>I(qU,{label:"Delete",Icon:PN,entries:e,resetSelected:t})},{id:"recategorize-expenses",isVisible:n.length>0,render:({resetSelected:e})=>I(KU,{label:`Reassign ${uh("Expense","Expenses",n.length,!0)}`,Icon:DN,entries:n,resetSelected:e})},{id:"recategorize-revenues",isVisible:r.length>0,render:({resetSelected:e})=>I(YU,{label:`Reassign ${uh("Revenue","Revenues",r.length,!0)}`,Icon:DN,entries:r,resetSelected:e})}];return{selectedCount:e.length,actions:a}},[t])}(C),T=C.getIsSomeRowsSelected();return R("div",{className:eB,children:[I("div",{className:tB,children:I(cU,{selectedAccountId:e,onSelect:e=>{t(e.id),p(!1)},open:h,onOpenChange:p})}),R(dl.Provider,{value:f,children:[R("div",{className:nB,children:[I(zU,{search:i,onSearchChange:l,dateRange:n,onDateRangeChange:r,isFetching:v}),e?I(oc,{dashboard:"generalLedger",children:v?I(xl,{numColumns:u?1:FU.length}):R(N,{children:[T?I(RN,{table:C,...x}):!u&&I(_l,{headerGroups:C.getHeaderGroups()}),w.length>0?I(Zl,{editMutationKey:C.options.meta?.editMutationKey,children:I(jl,{children:u?I($U,{rows:C.getRowModel().rows}):C.getRowModel().rows.map(e=>I(GU,{rowData:e},e.id))})}):I(Ed,{children:aB(i,n)?I(nk,{buttonText:"Clear Filters",onButtonClick:()=>{l(""),r(rn())}}):I(dU,{onSelectAnotherAccount:()=>p(!0)})})]})}):I(Ed,{children:I(dU,{onSelectAnotherAccount:()=>p(!0)})})]}),e&&I("div",{className:rB,children:I(vl,{})})]})]})}const lB=XN({gap:"16px",alignItems:"flex-start",width:"100%"});function sB(){const e=ze(),{state:t}=uL(),n=(r=t,uV.safeParse(r).success?t:void 0);var r;const[a,o]=d(n?.glAccountId),[i,l]=d(n?.dateRange??rn()),[s,c]=d(n?.accountingMethod??nn),[u,h]=d(""),p=n?.includeBeginningBalance;return e?I("div",{className:lB,children:I(iB,{glAccountId:a,onGlAccountChange:o,dateRange:i,onDateRangeChange:l,accountingMethod:s,onAccountingMethodChange:c,search:u,onSearchChange:h,includeBeginningBalance:p})}):I(eU,{})}const cB=S.object({label:S.string()}),dB=(uB=[{path:pF["/"].path,errorElement:I(N,{}),element:I(OL,{}),handle:pF["/"].handle,children:[{index:!0,Component:function(){const e=jk();return R("div",{className:TF,children:[e&&I(Hk,{}),R("div",{className:kF,children:[I(mF,{}),I(fF,{}),I(wF,{}),I(xF,{})]})]})}},{Component:function(){return R("div",{className:NF,children:[I(IF,{}),I("div",{className:RF,children:I(OL,{})})]})},children:[{path:pF["profit-and-loss"].path,element:I(OL,{}),handle:pF["profit-and-loss"].handle,children:[{index:!0,Component:wV},{path:pF["profit-and-loss/general-ledger"].path,Component:sB,handle:pF["profit-and-loss/general-ledger"].handle}]},{path:pF["balance-sheet"].path,element:I(OL,{}),handle:pF["balance-sheet"].handle,children:[{index:!0,Component:function(){return I(DF,{children:I(DV,{})})}},{path:pF["balance-sheet/general-ledger"].path,Component:sB,handle:pF["balance-sheet/general-ledger"].handle},{path:pF["balance-sheet/profit-and-loss"].path,element:I(OL,{}),handle:pF["balance-sheet/profit-and-loss"].handle,children:[{index:!0,Component:wV},{path:pF["balance-sheet/profit-and-loss/general-ledger"].path,Component:sB,handle:pF["balance-sheet/profit-and-loss/general-ledger"].handle}]}]},{path:pF["cash-flow-statement"].path,element:I(OL,{}),handle:pF["cash-flow-statement"].handle,children:[{index:!0,Component:function(){return I(DF,{children:I(qV,{})})}},{path:pF["cash-flow-statement/general-ledger"].path,Component:sB,handle:pF["cash-flow-statement/general-ledger"].handle},{path:pF["cash-flow-statement/profit-and-loss"].path,element:I(OL,{}),handle:pF["cash-flow-statement/profit-and-loss"].handle,children:[{index:!0,Component:wV},{path:pF["cash-flow-statement/profit-and-loss/general-ledger"].path,Component:sB,handle:pF["cash-flow-statement/profit-and-loss/general-ledger"].handle}]}]}]}]}],function(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,n=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement;KP(e.routes.length>0,"You must provide a non-empty routes array to createRouter");const r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||nM;let o=a;if(e.instrumentations){const t=e.instrumentations;o=e=>({...a(e),...BD(t.map(e=>e.route).filter(Boolean),e)})}let i={};const l=new oM(nD(e.routes,o,void 0,i));let s=e.basename||"/";s.startsWith("/")||(s=`/${s}`);const c=e.dataStrategy||bM,d={...e.future};let u=null;const h=/* @__PURE__ */new Set;let p,g,m,v=null,f=null,b=null,y=null,w=null!=e.hydrationData,C=aD(l.activeRoutes,e.history.location,s,!1,l.branches),x=!1,T=null;if(null!=C||e.patchRoutesOnNavigation)if(C&&!e.hydrationData&&pe(C,l.activeRoutes,e.history.location.pathname).active&&(C=null),C)if(C.some(e=>e.route.lazy))p=!1,g=!p;else if(C.some(e=>cM(e.route))){const t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;let r=C;if(n){const e=C.findIndex(e=>void 0!==n[e.route.id]);r=r.slice(0,e+1)}g=!1,p=!0,r.forEach(e=>{const r=dM(e.route,t,n);g=g||r.renderFallback,p=p&&!r.shouldLoad})}else p=!0,g=!p;else{p=!1,g=!p,C=[];const t=pe(null,l.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(x=!0,C=t.matches)}else{const t=VM(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=OM(l.activeRoutes);p=!0,g=!p,C=n,T={[r.id]:t}}let k,E={historyAction:e.history.action,location:e.history.location,matches:C,initialized:p,renderFallback:g,navigation:$D,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||T,fetchers:/* @__PURE__ */new Map,blockers:/* @__PURE__ */new Map},A=zP.Pop,S=null,I=!1,N=!1;const R=/* @__PURE__ */new Map;let P=null,D=!1,M=!1;const L=/* @__PURE__ */new Set,F=/* @__PURE__ */new Map;let O=0,V=-1;const U=/* @__PURE__ */new Map,B=/* @__PURE__ */new Set,H=/* @__PURE__ */new Map,W=/* @__PURE__ */new Map,_=/* @__PURE__ */new Set,z=/* @__PURE__ */new Map;let j,q=null;function K(e,t={}){e.matches&&(e.matches=e.matches.map(e=>{const t=i[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e})),E={...E,...e};const n=[],r=[];E.fetchers.forEach((e,t)=>{"idle"===e.state&&(_.has(t)?n.push(t):r.push(t))}),_.forEach(e=>{E.fetchers.has(e)||F.has(e)||n.push(e)}),0===h.size&&(v={newErrors:e.errors??null}),[...h].forEach(r=>r(E,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),n.forEach(e=>ne(E.fetchers,e)),r.forEach(e=>E.fetchers.delete(e))}function Y(t,n,{flushSync:r}={}){const a=null!=E.actionData&&null!=E.navigation.formMethod&&KM(E.navigation.formMethod)&&"loading"===E.navigation.state&&!0!==t.state?._isRedirect;let o;o=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:a?E.actionData:null;const i=n.loaderData?MM(E.loaderData,n.loaderData,n.matches||[],n.errors):E.loaderData;let s=E.blockers;s.size>0&&(s=new Map(s),s.forEach((e,t)=>s.set(t,tM)));const c=!D&&he(t,n.matches||E.matches),d=!0===I||null!=E.navigation.formMethod&&KM(E.navigation.formMethod)&&!0!==t.state?._isRedirect;let u;if(l.commitHmrRoutes(),D||A===zP.Pop||(A===zP.Push?e.history.push(t,t.state):A===zP.Replace&&e.history.replace(t,t.state)),A===zP.Pop){const e=R.get(E.location.pathname);e&&e.has(t.pathname)?u={currentLocation:E.location,nextLocation:t}:R.has(t.pathname)&&(u={currentLocation:t,nextLocation:E.location})}else if(N){let e=R.get(E.location.pathname);e?e.add(t.pathname):(e=/* @__PURE__ */new Set([t.pathname]),R.set(E.location.pathname,e)),u={currentLocation:E.location,nextLocation:t}}K({...n,actionData:o,loaderData:i,historyAction:A,location:t,initialized:!0,renderFallback:!1,navigation:$D,revalidation:"idle",restoreScrollPosition:c,preventScrollReset:d,blockers:s},{viewTransitionOpts:u,flushSync:!0===r}),A=zP.Pop,I=!1,N=!1,D=!1,M=!1,S?.resolve(),S=null,q?.resolve(),q=null}async function Z(t,n,a){k&&k.abort(),k=null,A=t,D=!0===(a&&a.startUninterruptedRevalidation),function(e,t){if(f&&y){const n=ue(e,t);f[n]=y()}}(E.location,E.matches),I=!0===(a&&a.preventScrollReset),N=!0===(a&&a.enableViewTransition);const c=l.activeRoutes;let d=a?.initialHydration&&E.matches&&E.matches.length>0&&!x?E.matches:aD(c,n,s,!1,l.branches),u=!0===(a&&a.flushSync);if(d&&E.initialized&&!M&&(h=E.location,p=n,h.pathname===p.pathname&&h.search===p.search&&(""===h.hash?""!==p.hash:h.hash===p.hash||""!==p.hash))&&!(a&&a.submission&&KM(a.submission.formMethod)))return void Y(n,{matches:d},{flushSync:u});var h,p;const g=pe(d,c,n.pathname);if(g.active&&g.matches&&(d=g.matches),!d){const{error:e,notFoundMatches:t,route:r}=de(n.pathname);return void Y(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}let m=a&&a.overrideNavigation?{...a.overrideNavigation,matches:d,historyAction:t}:void 0;k=new AbortController;let v=IM(e.history,n,k.signal,a&&a.submission);const b=e.getContext?await e.getContext():new JP;let w;if(a&&a.pendingError)w=[FM(d).route.id,{type:XP.error,error:a.pendingError}];else if(a&&a.submission&&KM(a.submission.formMethod)){const c=await async function(t,n,a,c,d,u,h,p,g={}){$();const m=function(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}(n,c,d,a);if(K({navigation:m},{flushSync:!0===g.flushSync}),h){const e=await ge(c,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){const{matches:t,route:n}=OM(l.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:XP.error,error:e.error}]}}const t=FM(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:XP.error,error:e.error}]}}if(!e.matches){const{notFoundMatches:e,error:t,route:r}=de(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:XP.error,error:t}]}}c=e.matches}let v;const f=ZM(c,n);if(f.route.action||f.route.lazy){const e=TM(o,i,t,n,c,f,p?[]:r,u),a=await X(t,n,e,u,null);if(v=a[f.route.id],!v)for(const t of c)if(a[t.route.id]){v=a[t.route.id];break}if(t.signal.aborted)return{shortCircuited:!0}}else v={type:XP.error,error:VM(405,{method:t.method,pathname:n.pathname,routeId:f.route.id})};if(zM(v)){let n;return n=g&&null!=g.replace?g.replace:SM(v.response.headers.get("Location"),new URL(t.url),s,e.history)===E.location.pathname+E.location.search,await Q(t,v,!0,{submission:a,replace:n}),{shortCircuited:!0}}if(_M(v)){const e=FM(c,f.route.id);return!0!==(g&&g.replace)&&(A=zP.Push),{matches:c,pendingActionResult:[e.route.id,v,f.route.id]}}return{matches:c,pendingActionResult:[f.route.id,v]}}(v,n,a.submission,d,t,b,g.active,a&&!0===a.initialHydration,{replace:a.replace,flushSync:u});if(c.shortCircuited)return;if(c.pendingActionResult){const[e,t]=c.pendingActionResult;if(_M(t)&&LD(t.error)&&404===t.error.status)return k=null,void Y(n,{matches:c.matches,loaderData:{},errors:{[e]:t.error}})}d=c.matches||d,w=c.pendingActionResult,m=QM(n,d,t,a.submission),u=!1,g.active=!1,v=IM(e.history,v.url,v.signal)}const{shortCircuited:C,matches:T,loaderData:S,errors:R,workingFetchers:P}=await async function(t,n,a,c,d,u,h,p,g,m,v,f,b,y){const w=h||QM(n,a,c,p),C=p||g||GM(w),x=!D&&!v;if(u){if(x){const e=G(b);K({navigation:w,...void 0!==e?{actionData:e}:{}},{flushSync:f})}const e=await ge(a,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){const{matches:t,route:n}=OM(l.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}const t=FM(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(!e.matches){const{error:e,notFoundMatches:t,route:r}=de(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}a=e.matches}const T=l.activeRoutes,{dsMatches:A,revalidatingFetchers:S}=sM(t,d,o,i,e.history,E,a,C,n,v?[]:r,!0===v,M,L,_,H,B,T,s,null!=e.patchRoutesOnNavigation,l.branches,b,y);if(V=++O,!e.dataStrategy&&!A.some(e=>e.shouldLoad)&&!A.some(e=>e.route.middleware&&e.route.middleware.length>0)&&0===S.length){const e=new Map(E.fetchers),t=oe(e);return Y(n,{matches:a,loaderData:{},errors:b&&_M(b[1])?{[b[0]]:b[1].error}:null,...LM(b),...t?{fetchers:e}:{}},{flushSync:f}),{shortCircuited:!0}}if(x){const e={};if(!u){e.navigation=w;const t=G(b);void 0!==t&&(e.actionData=t)}S.length>0&&(e.fetchers=function(e){const t=new Map(E.fetchers);return e.forEach(e=>{const n=t.get(e.key),r=XM(void 0,n?n.data:void 0);t.set(e.key,r)}),t}(S)),K(e,{flushSync:f})}S.forEach(e=>{re(e.key),e.controller&&F.set(e.key,e.controller)});const I=()=>S.forEach(e=>re(e.key));k&&k.signal.addEventListener("abort",I);const{loaderResults:N,fetcherResults:R}=await J(A,S,t,n,d);if(t.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",I),S.forEach(e=>F.delete(e.key));let P=UM(N);if(P)return await Q(t,P.result,!0,{replace:m}),{shortCircuited:!0};if(P=UM(R),P)return B.add(P.key),await Q(t,P.result,!0,{replace:m}),{shortCircuited:!0};const U=new Map(E.fetchers);let{loaderData:W,errors:z}=DM(E,a,N,b,S,R,U);v&&E.errors&&(z={...E.errors,...z});const j=oe(U),q=ie(V,U);return{matches:a,loaderData:W,errors:z,...j||q||S.length>0?{workingFetchers:U}:{}}}(v,n,d,t,b,g.active,m,a&&a.submission,a&&a.fetcherSubmission,a&&a.replace,a&&!0===a.initialHydration,u,w,a&&a.callSiteDefaultShouldRevalidate);C||(k=null,Y(n,{matches:T||d,...LM(w),loaderData:S,errors:R,...P?{fetchers:P}:{}}))}function G(e){return e&&!_M(e[1])?{[e[0]]:e[1].data}:E.actionData?0===Object.keys(E.actionData).length?null:E.actionData:void 0}async function Q(r,a,o,{submission:i,fetcherSubmission:l,preventScrollReset:c,replace:d}={}){o||(S?.resolve(),S=null),a.response.headers.has("X-Remix-Revalidate")&&(M=!0);let u=a.response.headers.get("Location");KP(u,"Expected a Location header on the redirect Response"),u=SM(u,new URL(r.url),s,e.history);const h=ZP(E.location,u,{_isRedirect:!0});if(n){let e=!1;if(a.response.headers.has("X-Remix-Reload-Document"))e=!0;else if(CD(u)){const n=function(e,t,n=!1){let r="http://localhost";e&&(r="null"!==e.location.origin?e.location.origin:e.location.href),KP(r,"No window.location.(origin|href) available to create URL");let a="string"==typeof t?t:GP(t);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}(t,u,!0);e=n.origin!==t.location.origin||null==yD(n.pathname,s)}if(e)return void(d?t.location.replace(u):t.location.assign(u))}k=null;const p=!0===d||a.response.headers.has("X-Remix-Replace")?zP.Replace:zP.Push,{formMethod:g,formAction:m,formEncType:v}=E.navigation;!i&&!l&&g&&m&&v&&(i=GM(E.navigation));const f=i||l;if(JD.has(a.response.status)&&f&&KM(f.formMethod))await Z(p,h,{submission:{...f,formAction:u},preventScrollReset:c||I,enableViewTransition:o?N:void 0});else{const e=QM(h,[],p,i);await Z(p,h,{overrideNavigation:e,fetcherSubmission:l,preventScrollReset:c||I,enableViewTransition:o?N:void 0})}}async function X(e,t,n,r,a){let o;const i={};try{o=await async function(e,t,n,r,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));const i={request:t,url:NM(t,n),pattern:FD(r),params:r[0].params,context:o,matches:r},l=await e({...i,fetcherKey:a,runClientMiddleware:e=>{const t=i;return yM(t,()=>e({...t,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch(s){}return l}(c,e,t,n,a,r)}catch(l){return n.filter(e=>e.shouldLoad).forEach(e=>{i[e.route.id]={type:XP.error,error:l}}),i}if(e.signal.aborted)return i;if(!KM(e.method))for(const s of n){if(o[s.route.id]?.type===XP.error)break;o.hasOwnProperty(s.route.id)||E.loaderData.hasOwnProperty(s.route.id)||E.errors&&E.errors.hasOwnProperty(s.route.id)||!s.shouldCallHandler()||(o[s.route.id]={type:XP.error,result:new Error(`No result returned from dataStrategy for route ${s.route.id}`)})}for(const[c,d]of Object.entries(o))if(WM(d)){const t=d.result;i[c]={type:XP.redirect,response:EM(t,e,c,n,s)}}else i[c]=await kM(d);return i}async function J(e,t,n,r,a){const o=X(n,r,e,a,null),i=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){const t=(await X(e.request,e.path,e.matches,a,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:XP.error,error:VM(404,{pathname:e.path})}})}));return{loaderResults:await o,fetcherResults:(await i).reduce((e,t)=>Object.assign(e,t),{})}}function $(){M=!0,H.forEach((e,t)=>{F.has(t)&&L.add(t),re(t)})}function ee(e,t,n={}){const r=new Map(E.fetchers);r.set(e,t),K({fetchers:r},{flushSync:!0===(n&&n.flushSync)})}function te(e,t,n,r={}){const a=FM(E.matches,t),o=new Map(E.fetchers);ne(o,e),K({errors:{[a.route.id]:n},fetchers:o},{flushSync:!0===(r&&r.flushSync)})}function ne(e,t){const n=E.fetchers.get(t);!F.has(t)||n&&"loading"===n.state&&U.has(t)||re(t),H.delete(t),U.delete(t),B.delete(t),_.delete(t),L.delete(t),e.delete(t)}function re(e,t){const n=F.get(e);n&&(n.abort(t),F.delete(e))}function ae(e,t){for(const n of e){const e=t.get(n);KP(e,`Expected fetcher: ${n}`);const r=JM(e.data);t.set(n,r)}}function oe(e){const t=[];let n=!1;for(const r of B){const a=e.get(r);KP(a,`Expected fetcher: ${r}`),"loading"===a.state&&(B.delete(r),t.push(r),n=!0)}return ae(t,e),n}function ie(e,t){const n=[];for(const[r,a]of U)if(a<e){const e=t.get(r);KP(e,`Expected fetcher: ${r}`),"loading"===e.state&&(re(r),U.delete(r),n.push(r))}return ae(n,t),n.length>0}function le(e){E.blockers.delete(e),z.delete(e)}function se(e,t){const n=E.blockers.get(e)||tM;KP("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,`Invalid blocker state transition: ${n.state} -> ${t.state}`);const r=new Map(E.blockers);r.set(e,t),K({blockers:r})}function ce({currentLocation:e,nextLocation:t,historyAction:n}){if(0===z.size)return;z.size>1&&YP(!1,"A router only supports one blocker at a time");const r=Array.from(z.entries()),[a,o]=r[r.length-1],i=E.blockers.get(a);return i&&"proceeding"===i.state?void 0:o({currentLocation:e,nextLocation:t,historyAction:n})?a:void 0}function de(e){const t=VM(404,{pathname:e}),n=l.activeRoutes,{matches:r,route:a}=OM(n);return{notFoundMatches:r,route:a,error:t}}function ue(e,t){return b&&b(e,t.map(e=>oD(e,E.loaderData)))||e.key}function he(e,t){if(f){const n=ue(e,t),r=f[n];if("number"==typeof r)return r}return null}function pe(t,n,r){if(e.patchRoutesOnNavigation){const e=l.branches;if(!t)return{active:!0,matches:aD(n,r,s,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:aD(n,r,s,!0,e)}}return{active:!1,matches:null}}async function ge(t,n,r,a){if(!e.patchRoutesOnNavigation)return{type:"success",matches:t};let c=t;for(;;){const t=i;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:c,fetcherKey:a,patch:(e,n)=>{r.aborted||hM(e,n,l,t,o,!1)}})}catch(d){return{type:"error",error:d,partialMatches:c}}if(r.aborted)return{type:"aborted"};const u=l.branches,h=aD(l.activeRoutes,n,s,!1,u);let p=null;if(h){if(0===Object.keys(h[0].params).length)return{type:"success",matches:h};if(p=aD(l.activeRoutes,n,s,!0,u),!(p&&c.length<p.length&&me(c,p.slice(0,c.length))))return{type:"success",matches:h}}if(p||(p=aD(l.activeRoutes,n,s,!0,u)),!p||me(c,p))return{type:"success",matches:null};c=p}}function me(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}return m={get basename(){return s},get future(){return d},get state(){return E},get routes(){return l.stableRoutes},get branches(){return l.branches},get manifest(){return i},get window(){return t},initialize:function(){if(u=e.history.listen(({action:t,location:n,delta:r})=>{if(j)return j(),void(j=void 0);YP(0===z.size||null!=r,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");const a=ce({currentLocation:E.location,nextLocation:n,historyAction:t});if(a&&null!=r){const t=new Promise(e=>{j=e});return e.history.go(-1*r),se(a,{state:"blocked",location:n,proceed(){se(a,{state:"proceeding",proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){const e=new Map(E.blockers);e.set(a,tM),K({blockers:e})}}),S?.resolve(),void(S=null)}return Z(t,n)}),n){!function(e,t){try{const n=e.sessionStorage.getItem(rM);if(n){const e=JSON.parse(n);for(const[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch(n){}}(t,R);const e=()=>function(e,t){if(t.size>0){const r={};for(const[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(rM,JSON.stringify(r))}catch(n){YP(!1,`Failed to save applied view transitions in sessionStorage (${n}).`)}}}(t,R);t.addEventListener("pagehide",e),P=()=>t.removeEventListener("pagehide",e)}return E.initialized||Z(zP.Pop,E.location,{initialHydration:!0}),m},subscribe:function(e){if(h.add(e),v){const{newErrors:t}=v;v=null,e(E,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>h.delete(e)},enableScrollRestoration:function(e,t,n){if(f=e,y=t,b=n||null,!w&&E.navigation===$D){w=!0;const e=he(E.location,E.matches);null!=e&&K({restoreScrollPosition:e})}return()=>{f=null,y=null,b=null}},navigate:async function t(n,r){if(S?.resolve(),S=null,"number"==typeof n){S||(S=$M());const t=S.promise;return e.history.go(n),t}const a=iM(E.location,E.matches,s,n,r?.fromRouteId,r?.relative),{path:o,submission:i,error:l}=lM(!1,a,r);let c;r?.mask&&(c={pathname:"",search:"",hash:"",..."string"==typeof r.mask?QP(r.mask):{...E.location.mask,...r.mask}});const d=E.location;let u=ZP(d,o,r&&r.state,void 0,c);u={...u,...e.history.encodeLocation(u)};const h=r&&null!=r.replace?r.replace:void 0;let p=zP.Push;!0===h?p=zP.Replace:!1===h||null!=i&&KM(i.formMethod)&&i.formAction===E.location.pathname+E.location.search&&(p=zP.Replace);const g=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,m=!0===(r&&r.flushSync),v=ce({currentLocation:d,nextLocation:u,historyAction:p});v?se(v,{state:"blocked",location:u,proceed(){se(v,{state:"proceeding",proceed:void 0,reset:void 0,location:u}),t(n,r)},reset(){const e=new Map(E.blockers);e.set(v,tM),K({blockers:e})}}):await Z(p,u,{submission:i,pendingError:l,preventScrollReset:g,replace:r&&r.replace,enableViewTransition:r&&r.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:r&&r.defaultShouldRevalidate})},fetch:async function(t,n,a,c){re(t);const d=!0===(c&&c.flushSync),u=l.activeRoutes,h=iM(E.location,E.matches,s,a,n,c?.relative);let p=aD(u,h,s,!1,l.branches);const g=pe(p,u,h);if(g.active&&g.matches&&(p=g.matches),!p)return void te(t,n,VM(404,{pathname:h}),{flushSync:d});const{path:m,submission:v,error:f}=lM(!0,h,c);if(f)return void te(t,n,f,{flushSync:d});const b=e.getContext?await e.getContext():new JP,y=!0===(c&&c.preventScrollReset);v&&KM(v.formMethod)?await async function(t,n,a,c,d,u,h,p,g,m){$(),H.delete(t);const v=E.fetchers.get(t);var f,b;ee(t,(b=v,{state:"submitting",formMethod:(f=g).formMethod,formAction:f.formAction,formEncType:f.formEncType,formData:f.formData,json:f.json,text:f.text,data:b?b.data:void 0}),{flushSync:h});const y=new AbortController,w=IM(e.history,a,y.signal,g);if(u){const e=await ge(c,new URL(w.url).pathname,w.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void te(t,n,e.error,{flushSync:h});if(!e.matches)return void te(t,n,VM(404,{pathname:a}),{flushSync:h});c=e.matches}const C=ZM(c,a);if(!C.route.action&&!C.route.lazy){const e=VM(405,{method:g.formMethod,pathname:a,routeId:n});return void te(t,n,e,{flushSync:h})}F.set(t,y);const x=O,T=TM(o,i,w,a,c,C,r,d),S=await X(w,a,T,d,t);let I=S[C.route.id];if(!I)for(const e of T)if(S[e.route.id]){I=S[e.route.id];break}if(w.signal.aborted)return void(F.get(t)===y&&F.delete(t));if(_.has(t)){if(zM(I)||_M(I))return void ee(t,JM(void 0))}else{if(zM(I))return F.delete(t),V>x?void ee(t,JM(void 0)):(B.add(t),ee(t,XM(g)),Q(w,I,!1,{fetcherSubmission:g,preventScrollReset:p}));if(_M(I))return void te(t,n,I.error)}const N=E.navigation.location||E.location,R=IM(e.history,N,y.signal),P=l.activeRoutes,D="idle"!==E.navigation.state?aD(P,E.navigation.location,s,!1,l.branches):E.matches;KP(D,"Didn't find any matches after fetcher action");const W=++O;U.set(t,W);const{dsMatches:z,revalidatingFetchers:j}=sM(R,d,o,i,e.history,E,D,g,N,r,!1,M,L,_,H,B,P,s,null!=e.patchRoutesOnNavigation,l.branches,[C.route.id,I],m),q=XM(g,I.data),Z=new Map(E.fetchers);Z.set(t,q),j.filter(e=>e.key!==t).forEach(e=>{const t=e.key,n=Z.get(t),r=XM(void 0,n?n.data:void 0);Z.set(t,r),re(t),e.controller&&F.set(t,e.controller)}),K({fetchers:Z});const G=()=>j.forEach(e=>re(e.key));y.signal.addEventListener("abort",G);const{loaderResults:ne,fetcherResults:ae}=await J(z,j,R,N,d);if(y.signal.aborted)return;y.signal.removeEventListener("abort",G),U.delete(t),F.delete(t),j.forEach(e=>F.delete(e.key));const oe=E.fetchers.has(t),le=e=>{if(!oe)return e;const n=new Map(e.fetchers);return n.set(t,JM(I.data)),{...e,fetchers:n}};let se=UM(ne);if(se)return E=le(E),Q(R,se.result,!1,{preventScrollReset:p});if(se=UM(ae),se)return B.add(se.key),E=le(E),Q(R,se.result,!1,{preventScrollReset:p});const ce=new Map(E.fetchers);oe&&ce.set(t,JM(I.data));const{loaderData:de,errors:ue}=DM(E,D,ne,void 0,j,ae,ce);ie(W,ce),"loading"===E.navigation.state&&W>V?(KP(A,"Expected pending action"),k&&k.abort(),Y(E.navigation.location,{matches:D,loaderData:de,errors:ue,fetchers:ce})):(K({errors:ue,loaderData:MM(E.loaderData,de,D,ue),fetchers:ce}),M=!1)}(t,n,m,p,b,g.active,d,y,v,c&&c.defaultShouldRevalidate):(H.set(t,{routeId:n,path:m}),await async function(t,n,a,l,s,c,d,u,h){const p=E.fetchers.get(t);ee(t,XM(h,p?p.data:void 0),{flushSync:d});const g=new AbortController,m=IM(e.history,a,g.signal);if(c){const e=await ge(l,new URL(m.url).pathname,m.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void te(t,n,e.error,{flushSync:d});if(!e.matches)return void te(t,n,VM(404,{pathname:a}),{flushSync:d});l=e.matches}const v=ZM(l,a);F.set(t,g);const f=O,b=TM(o,i,m,a,l,v,r,s),y=await X(m,a,b,s,t);let w=y[v.route.id];if(!w)for(const e of l)if(y[e.route.id]){w=y[e.route.id];break}if(F.get(t)===g&&F.delete(t),!m.signal.aborted){if(!_.has(t))return zM(w)?V>f?void ee(t,JM(void 0)):(B.add(t),void(await Q(m,w,!1,{preventScrollReset:u}))):void(_M(w)?te(t,n,w.error):ee(t,JM(w.data)));ee(t,JM(void 0))}}(t,n,m,p,b,g.active,d,y,v))},revalidate:function(){q||(q=$M()),$(),K({revalidation:"loading"});const e=q.promise;return"submitting"===E.navigation.state?e:"idle"===E.navigation.state?(Z(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),e):(Z(A||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:!0===N}),e)},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:function(e){return W.set(e,(W.get(e)||0)+1),_.has(e)&&_.delete(e),E.fetchers.get(e)||eM},resetFetcher:function(e,t){re(e,t?.reason),ee(e,JM(null))},deleteFetcher:function(e){const t=(W.get(e)||0)-1;t<=0?(W.delete(e),_.add(e)):W.set(e,t),K({fetchers:new Map(E.fetchers)})},dispose:function(){u&&u(),P&&P(),h.clear(),k&&k.abort(),E.fetchers.forEach((e,t)=>ne(E.fetchers,t)),E.blockers.forEach((e,t)=>le(t))},getBlocker:function(e,t){const n=E.blockers.get(e)||tM;return z.get(e)!==t&&z.set(e,t),n},deleteBlocker:le,patchRoutes:function(e,t,n=!1){hM(e,t,l,i,o,n),l.hasHMRRoutes||K({})},_internalFetchControllers:F,_internalSetRoutes:function(e){i={},l.setHmrRoutes(nD(e,o,void 0,i))},_internalSetStateDoNotUseOrYouWillBreakYourApp(e){K(e)}},e.instrumentations&&(m=function(e,t){const n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){const t=Object.keys(e);for(const r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){const t=e.navigate[UD]??e.navigate,r=HD(n.navigate,t,(...t)=>{const[n,r]=t;return{to:"number"==typeof n||"string"==typeof n?n:n?GP(n):".",...zD(e,r??{})}});r&&(r[UD]=t,e.navigate=r)}if(n.fetch.length>0){const t=e.fetch[UD]??e.fetch,r=HD(n.fetch,t,(...t)=>{const[n,,r,a]=t;return{href:r??".",fetcherKey:n,...zD(e,a??{})}});r&&(r[UD]=t,e.fetch=r)}return e}(m,e.instrumentations.map(e=>e.router).filter(Boolean))),m}({basename:undefined,getContext:undefined,future:undefined,history:qP({initialEntries:undefined,initialIndex:undefined}),hydrationData:undefined,routes:uB,hydrationRouteProperties:["HydrateFallback","hydrateFallbackElement"],mapRouteProperties:function(e){const t={hasErrorBoundary:e.hasErrorBoundary||null!=e.ErrorBoundary||null!=e.errorElement};return e.Component&&Object.assign(t,{element:r.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:r.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:r.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t},dataStrategy:undefined,patchRoutesOnNavigation:undefined,instrumentations:undefined}).initialize());var uB;function hB(){return s(()=>()=>{dB.navigate(pF["/"].route)},[]),I(DL,{router:dB})}function pB(){return I(Xk,{children:I(hB,{})})}const gB=De("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),mB={queryClient:Or,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await gB).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await gB).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await gB).delete("queryClient",e)}(e)}}}(),maxAge:Fr,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function vB({children:e}){return I(Me,{client:Or,persistOptions:mB,children:e})}const fB=rr({position:"absolute",top:0,left:{base:0,sm:"auto"},right:0,bottom:{base:0,sm:"auto"},width:"100%",height:"100%",minWidth:"100%",minHeight:"100%",maxHeight:"100%",maxWidth:"100%",overflow:"hidden",overscrollBehavior:{base:"contain",xl:"none"}}),bB=rr({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:"overlay",overscrollBehavior:{base:"contain",xl:"none"}}),yB=fr(null,cr.component,fB);function wB({children:e}){const t=a(null),n=a(null),r=ET();return g(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),I(fe,{children:I(be,{lockScroll:!0,className:bB,children:I("div",{onMouseDown:e=>{n.current=e.target},onClick:e=>{const r=n.current===t.current,a=e.target===t.current;r&&a&&(n.current=null,hn.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...yB,children:e})})})}const CB=l({closingQueue:[],drawerHistory:[]});function xB({children:e}){const t=hn(e=>e.drawerHistory),n=hn(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(CB.Provider,{value:r,children:a&&I(wB,{children:e})})}const TB=l({isActive:!0,isClosing:!1});function kB({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=i(CB),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),l=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==l,d=(o&&o[t])??(l&&l[t]);return I(TB.Provider,{value:{isActive:s,isClosing:c},children:d&&I(e,{...d.routeProps})})}const EB=lr({base:{position:"absolute",display:"flex",top:0,bottom:{base:0,sm:"auto"},height:"100%",maxHeight:"100%",maxWidth:"100%",backgroundColor:"surface.background",width:{base:"100%",sm:"512px"},minWidth:{base:"100%",sm:"fit-content"},overscrollBehavior:{base:"contain",xl:"none"},_focus:{outline:"none"}},variants:{side:{right:{right:0,left:{base:0,sm:"auto"}},left:{left:0,right:{base:0,sm:"auto"}}},mobileCoverage:{full:{},partial:{width:{base:"80%"},minWidth:{base:"auto"}}}},defaultVariants:{side:"right",mobileCoverage:"full"}}),AB=rr({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function SB({children:e,side:t="right",mobileCoverage:n="full"}){const r=a(null),{isActive:o,isClosing:l}=i(TB),{onExitAnimationEnd:c,onInitialAnimationComplete:h}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=d(!0),o=u(()=>{hn.getState().confirmCloseDrawer()},[]),i=u(()=>{a(!1)},[a]);return s(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:o,isClosing:l,focusRef:r}),{context:p,refs:g}=re({open:o&&!l}),m=ve([r,g.setFloating]);return I(Ie,{onExitComplete:c,children:!l&&I(ye,{context:p,modal:!0,initialFocus:-1,children:R(Ne.div,{tabIndex:-1,ref:m,onAnimationComplete:()=>h(),transition:Pv,initial:Mv(t),animate:Dv,exit:Lv(t),...fr(cr.drawer,EB({side:t,mobileCoverage:n})),children:[e,!o&&I("div",{className:AB})]})})})}const IB=lr({base:{display:"flex",height:"100%",maxHeight:"100%",minHeight:0,flexDirection:"column",minWidth:{base:"128px",sm:"512px"},maxWidth:{base:"100%",sm:"512px"},flexGrow:1,overflow:"hidden"},variants:{background:{foreground:{backgroundColor:"surface.foreground"}}}});function NB({background:e,children:t}){return I("div",{className:IB({background:e}),children:t})}const RB=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function PB(e){return void 0!==RB[e]}function DB(e){return RB[e]}const MB=bi(e=>r.createElement("svg",{id:"Layer_1","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,width:24,height:24,...e},r.createElement("defs",null,r.createElement("style",null,".cls-63ce7444ea57ea6c838005ed-1{fill:none;stroke:currentColor;stroke-miterlimit:10;}")),r.createElement("path",{className:"cls-63ce7444ea57ea6c838005ed-1",d:"M6.27,21.55H8.5l2.33.95h7.92a2.86,2.86,0,0,0,2.85-2.59l.88-9.13c0-.14,0-.28,0-.42h0a2.18,2.18,0,0,0-2.18-2.18H15.63l.52-1.09a6.27,6.27,0,0,0,.62-2.73h0A2.86,2.86,0,0,0,13.91,1.5h0A1.9,1.9,0,0,0,12,3.41h0a6,6,0,0,1-1.25,3.66l-2.33,3H6.27"}),r.createElement("rect",{className:"cls-63ce7444ea57ea6c838005ed-1",x:1.5,y:9.14,width:4.77,height:13.36})),"ThumbsUp"),LB=rr({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function FB({cldrShortName:e}){return I("div",{className:LB,children:DB(e)})}const OB=lr({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),VB=rr({display:"flex",gap:"4px",backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",padding:"4px 8px",alignItems:"center",justifyContent:"center",scrollbar:"hidden",overflow:"hidden"});function UB({reactions:e,type:t,handleClick:n}){return I("div",{className:VB,children:e.map((e,r)=>I("button",{className:OB({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(FB,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const BB=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:ki(n)};return await Ma(o)},HB=async({data:e,accessToken:t,environment:n})=>{const{id:r,emojiCode:a}=e,o={path:"/v6/messages/{id}/reactions/{emojiCode}",pathParams:{id:r,emojiCode:a},accessToken:t,endpointManager:ki(n)};return await rv(o)};function WB(e,t,n){return Sr(Is({id:e}),t,n)}async function _B(e){const t=Is({id:e});return xa("mutation successful, invalidating messages queries"),Or.invalidateQueries({queryKey:t}).catch(e=>Ta({error:e,severity:"error"}))}function zB(e,t,n){const r=[...e];return r[n]=t,r}const jB=rr({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),qB=Object.keys(RB).filter(PB).map(e=>({emojiCode:e,authorInfo:[]}));function KB({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:l}=i(ed),{mutate:s}=function(e){const{userId:t,userEmail:n}=i(ed);return tv({mutationFn:BB,meta:{toastOptions:{defaultErrorMessage:"Failed to react to message"}},onMutateFn:({data:r,accessToken:a,environment:o})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a,userEmail:o}){const i=WB(n,t,r);await Or.cancelQueries({queryKey:i});const l=Or.getQueryData(i);return Or.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:zB(t,(r=t[n],i=e,l=a,s=o,{...r,reactions:[...r.reactions,{emojiCode:i.emojiCode,authorInfo:[{userId:l,email:s}]}]}),n);var r,i,l,s}),{oldMessages:l}}({data:r,accessToken:a,conversationId:e,environment:o,userId:t,userEmail:n})},onSettled:()=>_B(e)})}(e);return R(Ac,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(Ic,{children:e=>I("button",{className:jB,...e,children:I(Pd,{Component:MB})})}),I(Uc,{type:"reaction",children:I(UB,{reactions:qB,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===l);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const YB=lr({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function ZB({reactions:e,type:t,handleClick:n}){const r=YB({type:t});return I("div",{className:r,children:I(UB,{reactions:e,handleClick:n,type:t})})}const GB=lr({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),QB=lr({base:{position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"column",alignItems:"flex-start",borderRadius:"md",borderWidth:1,borderStyle:"solid",flexShrink:1,overflow:"wrap",wordBreak:"break-word",whiteSpace:"pre-wrap"},variants:{type:{sent:{color:"typography.intent.primary",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary"},received:{color:"typography.base",borderColor:"border.layout",backgroundColor:"surface.foreground"}}}}),XB=rr({position:"relative",display:"flex",flexDirection:"column"});function JB({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const l=a(null),{isHover:c,setIsHover:u,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=d(!1),[r,a]=d(!1);return s(()=>{if(null===o.current||!i||c)return;const e=o.current,t=t=>{t.target===e||e.contains(t.target)||l(!1)};return window.addEventListener("mousemove",t),()=>{window.removeEventListener("mousemove",t)}},[i=t,o=e,c=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,c}(l),{mutate:g}=function(e){const{userId:t}=i(ed);return tv({mutationFn:HB,meta:{toastOptions:{defaultErrorMessage:"Failed to delete reaction"}},onMutateFn:({data:n,accessToken:r,environment:a})=>{if(void 0!==t)return async function({data:e,accessToken:t,conversationId:n,environment:r,userId:a}){const o=WB(n,t,r);await Or.cancelQueries({queryKey:o});const i=Or.getQueryData(o);return Or.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return dr(r)||0===r.reactions.length?t:zB(t,function(e,t,n){const r=e.reactions.filter(e=>e.emojiCode!==t||!e.authorInfo.some(e=>e.userId===n));return{...e,reactions:r}}(r,e.emojiCode,a),n)}),{oldMessages:i}}({data:n,accessToken:r,conversationId:e,environment:a,userId:t})},onSettled:()=>_B(e)})}(e),m=n?"sent":"received",v=o.filter(e=>PB(e.emojiCode)),f=v.length>0,b="sent"===m?cr["message-sent"]:cr["message-received"],y=fr(cr[b],QB({type:m}));return R("div",{className:GB({type:m,hasReactionsOnMessage:f}),ref:l,onMouseEnter:()=>"received"===m&&u(!0),children:[R("div",{className:XB,children:[I("div",{...y,children:r}),f&&I(ZB,{reactions:v,type:m,handleClick:e=>g({id:t,emojiCode:e})})]}),c&&I(KB,{conversationId:e,messageId:t,type:m,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const $B=lr({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),eH=rr({position:"static",display:"flex",maxWidth:325,padding:"12px 16px",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"12px",borderRadius:"md",borderWidth:1,borderStyle:"solid",borderColor:"border.layout",backgroundColor:"surface.foreground",flexShrink:1}),tH=rr({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),nH=rr({textDecoration:"none",color:"inherit",cursor:"pointer"});function rH({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=ET();return I("div",{className:$B({type:e?"sent":"received"}),children:I("div",{onClick:async()=>{if(o)window.open(a,"_self","noopener,noreferrer");else try{if(a){const e=await fetch(a),t=await e.blob(),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n??"attachment",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}}catch(e){await Ta({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:nH,children:R("div",{className:eH,children:[R("div",{className:tH,children:[I(uc,{children:n}),I(So,{children:`${r}`})]}),I(Pd,{Component:yO})]})})})}const aH=fr(null,rr({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function oH({children:e}){return I("div",{...aH,children:e})}const iH=fr(null,rr({display:"flex",flexDirection:"column-reverse",alignItems:"flex-start",gap:"26px",flex:"1 1 0%",alignSelf:"stretch",overflowY:"auto",overflowX:"hidden",flexFlow:"column",padding:15,scrollbarWidth:"thin",maxHeight:"calc(100% + 15px)",marginBottom:"-15px"})),lH=rr({minHeight:1,width:"100%"}),sH=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=u(()=>{t&&ur(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){s(()=>{const r=e.current;if(null!==r){let e=r.scrollTop,a=Date.now();const o=()=>{if(t){const{scrollVelocity:t,currentScrollTop:o,currentTime:i}=function(e,t,n){const r=e.scrollTop,a=Date.now(),o=Math.abs(r-t),i=a-n;return{scrollVelocity:i>0?o/i:0,currentScrollTop:r,currentTime:a}}(r,e,a);t>5&&n(),e=o,a=i}};return r.addEventListener("scroll",o),()=>{r.removeEventListener("scroll",o)}}},[t,n,e])}(i,t,l),R("div",{tabIndex:-1,...iH,ref:i,children:[I("div",{className:lH,ref:o}),e]})}),cH=Object.freeze({message:{text:"",attachments:[]}}),dH=rr({width:"24px",height:"24px",objectFit:"contain"});function uH({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:dH})}const hH=rr({display:"flex",flex:"1 1 0",flexDirection:"row",justifyContent:"space-between",backgroundColor:"surface.foreground",borderWidth:"1px",borderStyle:"solid",borderColor:"border.layout",padding:"8px 16px",marginBottom:"8px"}),pH=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),gH=rr({display:"grid",flexDirection:"column",minWidth:0}),mH="LOADING",vH="LOADED",fH="ERROR";function bH({attachment:e,onRemove:t}){const n=e.hasError?fH:e.isPending?mH:vH;return R("div",{className:hH,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:pH,children:[e.iconUrl&&I(uH,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:gH,children:[I(uc,{children:e.displayFileName}),n===mH&&e.displayText&&I(So,{accent:"strongest",children:e.displayText}),n===vH&&e.fileSize&&I(So,{children:e.fileSize}),n===fH&&I(So,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(qc,{onClick:async n=>{n.stopPropagation(),await dh({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Remove",type:ch.DANGER}]})===Zu&&t(e)},children:I(ul,{Component:Nc})})]})}const yH=rr({width:"100%"});function wH({conversationId:e,addMessage:t,blockSubmit:n,isMobile:r,scrollRef:o,setActiveKeyboard:i,inputRef:l,defaultValues:s}){const{form:c}=function({onSubmit:e,defaultValues:t}){return{form:wb({defaultValues:t??cH,onSubmit:t=>{yg.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),d=a(null),h=u(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:g}=Oh({mutationFn:gg,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Or.invalidateQueries({queryKey:["files/attachments"]}),await Or.invalidateQueries({queryKey:["conversations"]})}}),m=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&g({id:e.id})},[c,g]);return I("form",{className:yH,ref:d,onKeyDown:e=>function(e,t,n,r){if(!r&&!e.shiftKey&&"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),null!==t&&!n)){const e=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});t.dispatchEvent(e)}}(e,d.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:I(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>I(bH,{attachment:e,onRemove:m},e.localId)),I(c.AppField,{name:"message",children:t=>I(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function CH(e,t){return{id:`placeholder_${e.conversationId}_${Date.now()}`,conversationId:e.conversationId,author:{userId:t??"placeholderUserId",email:"placeholderEmail"},status:"ACTIVE",createdDateTime:"",lastUpdatedDateTime:"",text:e.text??"",reactions:[],attachments:[]}}async function xH(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return xa("mutation successful, invalidating messages queries"),Promise.all([Or.invalidateQueries({queryKey:e}),Or.invalidateQueries({queryKey:t}),Or.invalidateQueries({queryKey:n})]).catch(e=>Ta({error:e,severity:"error"}))}const TH=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Vl({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),kH=async({data:e,accessToken:t,environment:n})=>Vl({data:{data:[e]},accessToken:t,environment:n}),EH=rr({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),AH=rr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),SH=rr({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),IH="Marked As Resolved";function NH({resolver:e}){const t=e?`${e} ${IH}`:IH;return R("div",{className:AH,children:[I("div",{className:EH}),I("div",{className:SH,children:t}),I("div",{className:EH})]})}const RH=lr({variants:{width:{xs:{width:"30px"},sm:{width:"60px"},md:{width:"120px"},lg:{width:"240px"},xl:{width:"420px"}},height:{xs:{height:"5px"},sm:{height:"10px"},md:{height:"20px"},lg:{height:"40px"},xl:{height:"80px"}}}});function PH({width:e="md",height:t="md"}){return I($o,{styles:RH({width:e,height:t})})}const DH=rr({display:"flex",flexDirection:"row-reverse"});function MH(){return R(N,{children:[I(PH,{width:"lg",height:"lg"}),I("div",{className:DH,children:I(PH,{width:"md",height:"lg"})}),I("div",{className:DH,children:I(PH,{width:"lg",height:"xl"})}),I(PH,{width:"md",height:"lg"})]})}const LH=rr({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function FH({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(oH,{children:I(JB,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(oH,{children:I(MH,{})}):R("div",{className:LH,children:[I(Eo,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(uc,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const OH=fr(null,rr({display:"flex",alignItems:"center",justifyContent:"center",maxWidth:"100%",minHeight:0,height:"auto",flexDirection:"column",position:"relative",backgroundColor:"surface.background",borderTop:"{borderWidths.lg} solid",borderTopColor:"border.layout",padding:"12px 15px"}));function VH({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:l,defaultValues:c,defaultSubject:u}){const{userId:h}=i(ed),{mutate:p}=function(){const{userId:e}=i(ed);return tv({mutationFn:Ps,meta:{toastOptions:{defaultErrorMessage:"Failed to send message"}},onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=Sr(Is({id:e.conversationId}),t,n);await Or.cancelQueries({queryKey:a});const o=Or.getQueryData(a);return Or.setQueryData(a,t=>[CH(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:xH})}(),{query:{data:g},isFilling:m}=function(e){const t=ur(e);return Br({queryKey:Is({id:e??""}),queryFn:Rs,select:Ns,enabled:t})}(e),{mutate:v,isPending:f,variables:b}=(k=t,E=l,tv({mutationFn:kH,meta:{toastOptions:{defaultErrorMessage:"Failed to create conversation"}},onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(dr(e)||dr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(ur(E)){const e={id:E};ds(E,cs.BANK_TRANSACTION)?o=async()=>{const t=Cs(e);return await Or.invalidateQueries({queryKey:t})}:ds(E,cs.FINANCIAL_SUMMARY)&&(i=async()=>await Or.invalidateQueries({queryKey:a}))}return xa("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Or.invalidateQueries({queryKey:n}),Or.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>Ta({error:e,severity:"error"}))}})),{mutate:y}=tv({mutationFn:TH,meta:{toastOptions:{defaultErrorMessage:"Failed to mark conversation as read"}},onSuccess:async()=>{const e=["conversations"],t=["tasks"];return xa("mutation successful, invalidating conversations queries"),Promise.all([Or.invalidateQueries({queryKey:e}),Or.invalidateQueries({queryKey:t})]).catch(e=>Ta({error:e,severity:"error"}))}}),[w,C]=d(!1),x=a(null),T=a(null);var k,E;s(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),s(()=>{ng(T)},[g,T]);const A=dr(e)||dr(g)||m;return R(N,{children:[A?I(sH,{ref:T,inputRef:x,activeKeyboard:w,setActiveKeyboard:C,children:I(FH,{isConversationLoading:f,isFilling:m,message:b?.message?.text})}):R(sH,{ref:T,activeKeyboard:w,setActiveKeyboard:C,inputRef:x,children:[n&&I(NH,{resolver:"Conversation"}),g.map((t,n)=>{const r=t[0].author.userId===h;return I(oH,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!dr(e)).map(e=>I(rH,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(JB,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...OH,children:I(wH,{scrollRef:T,inputRef:x,conversationId:e,blockSubmit:f,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),i=o.map(e=>`att_${e.id}`),s=a.length>0,c=i.length>0;if(s||c)if(dr(e)){const e=function(e,t,n){let r="";return ur(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(u,a,o[0]?.displayFileName),t=(d=a,h=i,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...ur(g=l)&&{attachedEntityId:g},message:{text:d,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:i}});var d,h,g},setActiveKeyboard:C,defaultValues:c})})]})}function UH({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=d(e),{query:{data:o}}=Ol(r),i="CLOSED"===o?.resolutionStatus;return R(NB,{children:[I(jv,{}),I(VH,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const BH=fr(cr["form-body"],rr({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"16px",overflowY:"auto",overflowX:"hidden",overscrollBehavior:{base:"contain",xl:"none"},minWidth:{base:0,sm:"512px"},width:"100%"}));function HH({children:e}){return I("div",{...BH,tabIndex:-1,children:e})}const WH=fr(null,rr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),_H=fr(null,rr({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),zH=rr({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),jH=e=>{Ip(e),Np(e)},qH=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:o,conversationId:l,transactionId:c,transaction:d})=>{const{isClosing:u}=i(TB),h=a(d);s(()=>{h.current=d},[d]);const p=a(!1);return s(()=>{if(!u||p.current)return;p.current=!0;const{events:e}=hn.getState(),t=h.current;ur(t)&&(ds(t.id,cs.BANK_TRANSACTION)?ps(e.transactionForm,{type:"CLOSE_BANK_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}):ps(e.transactionForm,{type:"CLOSE_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}))},[u]),I(SB,{children:R("div",{...WH,children:[I(NB,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:jH,..._H,children:[n,I(HH,{children:e}),r]})}),null!==o&&I("div",{className:zH}),"conversation"===o&&c&&I(UH,{conversationId:l,attachedEntityId:c,defaultSubject:d?.description})]})})},KH=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],YH=["FEDERAL","STATE","SALES"],ZH=["Q1","Q2","Q3","Q4"],GH=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function QH(e){if(!dr(e))return GH.find(t=>t.value===e)?.name}const XH=S.object({id:S.string(),type:S.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:S.enum(Object.values(Li)),amount:S.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:S.string("Required").refine(e=>(function(e,t){const n=at(e.getFullYear(),e.getMonth(),e.getDate()),r=at(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||kt(new Date(e),/* @__PURE__ */new Date))&&At(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),frequency:S.union([S.object({name:S.string(),value:S.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),S.undefined()]),category:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),dimensionValues:S.array(S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).optional()),bankAccount:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:S.string().nullable(),itemizedByOptions:S.object({category:S.boolean(),customer:S.boolean()}).optional(),attachments:S.array(bg)}),JH=S.object({id:S.string(),name:S.string().optional(),requiredness:S.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),$H=S.object({id:S.string(),name:S.string().optional(),dimension:JH.optional()}),eW=$H.extend({child:$H.optional()}),tW=S.object({id:S.string().optional(),lineItemType:S.literal("itemized"),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).optional(),dimensionValues:S.array(eW),customer:S.object({id:S.string(),name:S.string().optional()}).nullable(),amount:S.number()}),nW=S.object({lineItemType:S.literal("invoice"),amount:S.number().nullable(),invoice:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),rW=S.object({lineItemType:S.literal("bill"),amount:S.number().nullable(),bill:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),aW=S.object({lineItemType:S.literal("fee"),amount:S.number()}),oW=S.object({lineItemType:S.literal("payment"),amount:S.number(),payment:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string(),bankAccount:S.object({id:S.string(),displayName:S.string()})})}),iW=S.discriminatedUnion("lineItemType",[tW,nW,aW,rW,oW]),lW=XH.extend({children:S.array(iW),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).nullable()});lW.extend({tax:S.object({paymentInfo:S.object({region:S.enum(YH).optional(),year:S.number().optional(),quarter:S.enum(ZH).optional()}).nullable().optional()}).optional()});const sW=XH.extend({id:S.string(),type:S.literal(Object.values(vw)),description:S.string(),displayName:S.string(),iconUrl:S.string(),status:S.literal(Object.values(FN)),reviewStatus:S.literal(Object.values(Li)),apiName:S.literal(Object.values({PLAID:"PLAID",UNIT:"UNIT",STRIPE:"STRIPE",SHOPIFY:"SHOPIFY",SQUARE:"SQUARE",RUTTER:"RUTTER",UBER:"UBER",MOOV:"MOOV",QUALPAY:"QUALPAY",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",QBO:"QBO",XERO:"XERO",BENCH:"BENCH",WAVE:"WAVE"})),apiSourceId:S.string().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()},{message:"Required"}),customer:S.object({id:S.string(),name:S.string().optional(),email:S.string().optional()}).nullable(),vendor:S.object({id:S.string(),name:S.string().optional()}).nullable(),invoice:S.object({id:S.string(),name:S.string(),date:S.string(),lineItems:S.array(S.object({id:S.string(),amount:S.number()}))}).nullable(),bill:S.object({id:S.string(),name:S.string().optional()}).nullable(),payroll:S.object({id:S.string(),date:S.string().optional(),checkDate:S.string().optional(),description:S.string().optional()}).nullable(),apiItemId:S.string().nullable()}),cW=S.looseObject({amount:S.number().nullable(),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),dW=S.object({children:S.array(cW),itemizeByOptions:S.record(S.string(),S.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.category?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"category"]})})}),uW=lW.extend({type:S.literal("EXPENSE"),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable()}).check(e=>{const t=e.value.children;(function(e,t){if(0===e.length)return!0;if(!e.some(e=>"itemized"===e.lineItemType))return!0;const n=e?.reduce((e,t)=>"itemized"!==t.lineItemType?e:e+(t.amount??0),0);return n===t})(t,e.value.amount)||e.issues.push({code:"custom",message:"Sum of children amounts must equal total amount",input:e.value,path:["children"]}),function(e,t=null){return 0===e.length&&Rr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),hW=lW.extend({type:S.literal("BANK_TRANSFER"),reconciliationMatch:S.object({id:S.string(),description:S.string().optional(),amount:S.number().optional(),date:S.string().optional(),apiInstitutionId:S.string().nullable().optional(),apiName:S.enum({BOX:"BOX",CLOVER:"CLOVER",STRIPE:"STRIPE",PLAID:"PLAID",KNOX:"KNOX",UBER:"UBER",FRESHBOOKS:"FRESHBOOKS",HARVEST:"HARVEST",KW:"KW",FRESHBOOKS2:"FRESHBOOKS2",CAPITAL_ONE:"CAPITAL_ONE",SQUARE:"SQUARE",DOTLOOP:"DOTLOOP",REALOGY:"REALOGY",UPWORK:"UPWORK",SHOPIFY:"SHOPIFY",DEDUCTR:"DEDUCTR",ENTERPRISE:"ENTERPRISE",MOXIWORKS:"MOXIWORKS",APPDIRECT:"APPDIRECT",LONEWOLF:"LONEWOLF",LONEWOLF_TRANSACTIONDESK:"LONEWOLF_TRANSACTIONDESK",SAMPLE_BANK:"SAMPLE_BANK",TAXBOT:"TAXBOT",GUSTO:"GUSTO",XERO:"XERO",UNIT:"UNIT",MOOV:"MOOV",QBO:"QBO",QUALPAY:"QUALPAY",BENCH:"BENCH",PARTNER_IMPLEMENTATION:"PARTNER_IMPLEMENTATION",CHECK:"CHECK",RUTTER:"RUTTER",WAVE:"WAVE",MANUAL_ENTRY:"MANUAL_ENTRY",CSV_IMPORT:"CSV_IMPORT",ADYEN:"ADYEN",PAYABLI:"PAYABLI"}).optional()}).nullish()}).refine(e=>{const t=e.reconciliationMatch?.amount,n=e.amount;return!!dr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>hW.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),pW=sW.extend({}),gW=S.looseObject({amount:S.number().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),mW=S.object({children:S.array(gW),itemizeByOptions:S.record(S.string(),S.boolean())}).check(e=>{const{children:t}=e.value;t.forEach((t,n)=>{null!==t.amount&&0!==t.amount||e.issues.push({code:"custom",message:"Amount must not be 0",input:e.value,path:["children",n,"amount"]}),t.glAccount?.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["children",n,"glAccount"]})})}),vW=lW.extend({type:S.literal("REVENUE"),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()},{message:"Required"}).nullable()}).check(e=>{e.value.children&&e.value.children.length>0||e.value.glAccount&&""!==e.value.glAccount.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["glAccount"]})});function fW(e){return e.reduce((e,t)=>new H(e).plus(t??0).toNumber(),0)}function bW(e,t){const n=new H(e).times(100).round(0),r=new H(t).times(100).round(0);return!n.eq(r)}function yW(e,t){const{dimensionsToIndex:n,childToRootId:r,dimensionFieldCount:a}=t,o=new Array(a).fill(void 0);if(e)for(const i of e){const e=i.dimension?.id;if(Rr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function wW(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function CW(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function xW(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function TW(e){return"EXPENSE"!==e.type||dr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function kW(e,t,n){if(e(t))return n}const EW={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function AW(e){return Rr(e)?void 0:e}function SW(e,t,n){const r=(e,t)=>kW(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:AW((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:AW(e.id),amount:e.amount?ph(e.amount):0,categoryId:e.category?.id,glAccountId:e.glAccount?.id,dimensionValueIds:e.dimensionValues?.map(e=>e.id),customerId:e.customer?.id}}(e);case"fee":return function(e){return{id:AW(e.id),amount:ph(e.amount)}}(e);case"bill":return function(e){return{id:AW(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:AW(e.payment.id)}}(e)}var t}(e))),o="TAX_PAYMENT"===e.type,i=/* @__PURE__ */new Set;for(const l of e.children)if("itemized"===l.lineItemType)for(const e of l.dimensionValues??[])e.dimension?.id&&i.add(e.dimension.id);return{...{amount:r("amount",e.amount?ph(e.amount):0),date:r("date",e.date),bankAccountId:r("bankAccount",e.bankAccount.id),frequency:r("frequency",e.frequency?.value),notes:r("notes",e.notes),dimensionValueIds:r("dimensionValues",e.dimensionValues?.filter(e=>!dr(e?.dimension?.id)&&!i.has(e.dimension.id)).map(e=>e?.id)),children:a,vendorId:r("vendor",e.vendor?.id||void 0),customerId:r("customer",e.customer?.id||void 0),categoryId:r("category",e.category?.id||void 0),glAccountId:r("glAccount",e.glAccount?.id||void 0),matchingBankTransactionId:r("reconciliationMatch",e.reconciliationMatch?.id||void 0),reviewStatus:r("reviewStatus",e.reviewStatus),tax:r("tax",o?e.tax:void 0),attachmentIds:r("attachments",e.attachments.filter(e=>null!==e.id&&!e.isPending&&!e.hasError).map(e=>`att_${e.id}`))},..."EXPENSE"===e.type&&(n("category")||n("children"))?function(e,t,n){const r=n.find(t=>t.id===e)?.accountId,a=t?.map(e=>{const t=n.find(t=>t.id===e.categoryId)?.accountId;return dr(t)?e:{...e,glAccountId:us({id:t,prefix:"GL_ACCOUNT"})}});return dr(r)?dr(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:us({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function IW(e=null){const{mutateAsync:t}=hC(),{mutateAsync:n}=gC({mutationFn:lC,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}}),{query:{data:r}}=Cx();return async(a,o,i)=>{const l=r?.data??[];var s,c;e?(await t(function(e,t,n,r){return{...SW(t,n,e=>{return r[e]?.isDirty??(t=e,Object.entries(r).some(([e,n])=>n?.isDirty&&(e.startsWith(`${t}.`)||e.startsWith(`${t}[`))));var t}),id:e}}(e.id,a,l,o)),i()):await n((s=a,c=l,{...SW(s,c,()=>!0),amount:s.amount?ph(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||EW[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}))}}const NW=lW.extend({type:S.literal("TAX_PAYMENT"),tax:S.object({paymentInfo:S.object({region:S.enum(YH,{message:`Tax region must be one of: ${YH.join(", ")}`}),quarter:S.enum(ZH,{message:"Required"}),year:S.number({message:"Tax year is required"})}).nullable()})}).superRefine((e,t)=>{e.tax?.paymentInfo||(t.addIssue({path:["tax","paymentInfo","region"],code:"custom",message:`Tax region must be one of: ${YH.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))});function RW(){const e=a(!0);return s(()=>(e.current=!0,()=>{e.current=!1}),[]),u(()=>{e.current&&ls()},[])}const PW={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Pt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:fs[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function DW(e){const t=/* @__PURE__ */new Map;for(const n of e){if(dr(n.bill)||!dr(n.paymentId))continue;const e=t.get(n.bill.id);e?t.set(n.bill.id,{...e,amount:e.amount+n.amount}):t.set(n.bill.id,n)}return[...t.values()]}function MW(e){const t=/* @__PURE__ */new Map;for(const n of e){if(dr(n.invoice)||!dr(n.paymentId))continue;const e=t.get(n.invoice.id);e?t.set(n.invoice.id,{...e,amount:e.amount+n.amount}):t.set(n.invoice.id,n)}return[...t.values()]}function LW(e){const t=/* @__PURE__ */new Map;for(const n of e){if(dr(n.paymentId))continue;const e=t.get(n.paymentId);e?t.set(n.paymentId,{...e,amount:e.amount+n.amount}):t.set(n.paymentId,n)}return[...t.values()]}function FW(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function OW(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(dr(e.paymentId)&&dr(e.bill)&&dr(e.invoice)||FW(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...DW(r),...MW(r),...LW(r),...a]}(e.children,t),r=(o=n,void 0===(i=t)||0===i.size?[]:o.filter(e=>{const t=e.glAccount?.id?i.get(e.glAccount.id):void 0;return void 0===t||"DEFERRED_REVENUE"!==t.liabilityType&&"Prepaid Expenses"!==t.name})),a=r.some(e=>!(dr(e.invoice)&&dr(e.payroll)&&dr(e.bill)&&dr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return dr(e.paymentId)||FW(e,n)?t&&FW(e,n)?(r=e,{...r,lineItemType:"fee",amount:hh(r.amount)}):dr(e.invoice)?dr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:hh(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return dr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:hh(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:hh(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:hh(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:hh(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=hh(e.amount);return{lineItemType:"payment",amount:n,payment:{id:t,amount:n,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName??e.bankAccount.name??""}}}}(e,e.paymentId);var r}(e,a,t))}function VW({value:e}){return{fields:UW(function(e){switch(e){case"EXPENSE":return uW;case"TAX_PAYMENT":return NW;case"BANK_TRANSFER":return hW;case"REVENUE":return vW}}(e.type).safeParse(e))}}function UW(e){const t={};if(!e.success)for(const n of e.error.issues){const e=n.path.reduce((e,t,n)=>"number"==typeof t?`${e}[${t}]`:0===n?String(t):`${e}.${String(t)}`,"");t[e]||(t[e]={message:n.message})}return t}function BW(e,t,n){const r=IW(e),{query:{data:a}}=yC({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=RW(),i=e?(s=t,c=a,{id:(l=e).id,type:TW(l),reviewStatus:l.reviewStatus,amount:hh(l.amount),category:l.category,date:l.date,vendor:l.vendor,customer:l.customer,frequency:l.frequency,bankAccount:l.bankAccount,glAccount:l.glAccount,notes:l.notes,dimensionValues:yW(l.dimensionValues,s),children:OW(l,c),reconciliationMatch:l.reconciliationMatch?{...l.reconciliationMatch,amount:hh(l.reconciliationMatch.amount??0)}:void 0,tax:l.tax,attachments:l.attachments?l.attachments.map(e=>({localId:e.id,file:new File([],e.fileName??""),displayFileName:e.fileName??"Unknown",displayText:"",fileSize:e.fileSize??null,id:hs(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...PW,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var l,s,c;return wb({defaultValues:i,canSubmitWhenInvalid:!0,validators:{onBlur:VW,onSubmit:VW},onSubmit:async e=>(await r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),o()),onSubmitInvalid:()=>{}})}function HW({onClick:e}){return I(hN,{Icon:PN,onClick:e,closeOnClick:!0,children:"Archive"})}function WW({onClick:e}){return I(hN,{onClick:e,closeOnClick:!0,children:"Restore"})}function _W(e){return u(async t=>{e.baseStore.setState(e=>({...e,isSubmitting:!0}));try{await t()}finally{e.baseStore.setState(e=>({...e,isSubmitting:!1}))}},[e])}const zW=bi(bF,"Bill");function jW({onClick:e,error:t,validate:n}){return I(vp,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const qW=rr({display:"flex",flexDirection:"column",width:"100%"}),KW=fr(cr["value-comparison-summary"],rr({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),YW=rr({display:"flex",flexDirection:"column",gap:"8px"});function ZW({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return I("div",{className:qW,children:R("div",{...KW,children:[R("div",{className:YW,children:[I(uc,{intent:"weak",children:"Selected Total"}),I(Eo,{children:To(hh(e),r)})]}),R("div",{className:YW,children:[I(uc,{intent:"weak",children:`${n} Total`}),I(Eo,{children:xo(t)})]})]})})}const GW=rr.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),QW=fr(null,rr({color:"icon.base"}));function XW({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=VT({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return I("div",{className:Jv,children:R("div",{...$v,children:[l?I(ip,{}):I(Pd,{stylists:[QW],Component:Xv}),I("input",{className:ef,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Np}),Pr(e)&&I(ec,{styles:GW,onClick:()=>o(""),children:I(Pd,{Component:Nc})})]})})}const JW=rr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function $W({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return R("div",{className:JW,children:[I(uc,{intent:"weak",children:"Search"}),I(XW,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function e_(e,t,n){return`${e} | ${St(Rt(t))} | ${xo(hh(n))}`}const t_=fr(cr["linked-entity-row"],rr({display:"flex",alignItems:"center",padding:"16px",gap:"9px",backgroundColor:"surface.foreground",border:"0.75px solid {colors.border.layout}",width:"100%",cursor:"pointer",outline:"none",_supportHover:{backgroundColor:"surface.background"}})),n_=rr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),r_=fr(null,rr({color:"icon.base"}));function a_({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return R("button",{type:"button",...t_,onClick:o,children:[R("div",{className:n_,children:[I(Pd,{stylists:[r_],Component:r}),I(uc,{wrap:"wrap",children:e_(t,n,e)})]}),I(mf,{selected:a,showEmptyIndicator:!0})]})}const o_={root:null,threshold:1};function i_({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=u(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return s(()=>{const e=new IntersectionObserver(o,o_);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return I("div",{ref:n})}function l_({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return I(N,{children:t.groups.map(t=>R(bS,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>I(a_,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),I(i_,{onIntersect:a,enable:!r&&o})]},t.key))})}function s_(e){return yo(e,{cents:"always",dollarSign:!0})}function c_(e){return s_(Math.abs(e))}function d_({title:e,body:t}){return dh({title:e,body:t,cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"FEE":"NO_FEE")}function u_(e,t,n){const r=c_(e);return`The selected bills total of ${c_(t)} is less than the expense total of ${r}. Was there a fee of ${c_(n)}?`}const h_=rr(_v,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function p_({children:e}){return I("div",{className:h_,children:e})}function g_({transactionTotal:e,bills:t,previouslySelected:n,onSubmit:r,fetchNextPage:a,hasNextPage:i,isFetching:l,isFetchingNextPage:s,searchTerm:c,onSearchChange:u}){const[h,p]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[g,m]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),v=o(()=>new Set(n.map(e=>e.id)),[n]),f=o(()=>Nr(c)?[...n,...t.filter(e=>!v.has(e.id))]:t,[c,n,t,v]),b=af({data:[f],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:e=>{p(e),m(t=>{const n={...t},r=f.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:h}}),y=Object.entries(h).filter(([,e])=>e).map(([e])=>g[e]),w=y.reduce((e,t)=>e+t.amount,0),C=l&&!s;return I(Gv,{title:"Link Bill",Footer:I(jW,{onClick:()=>{const t=new H(w).div(100).times(-1).toNumber(),n=new H(e).sub(t).toNumber();t>e&&y.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return d_({title:"Bill Payment",body:u_(n,e,t)})}({selectedTotal:t,transactionTotal:e,suggestedFee:n}).then(e=>{let t=0;"FEE"===e&&(t=n),r(y,t)}).catch(()=>{}):r(y,0)}}),padChildren:!1,children:R(p_,{children:[I(ZW,{selectedAmount:w,transactionTotal:e,transactionTypeLabel:"Expense"}),I($W,{searchTerm:c,onChange:u,isFetching:C,searchPlaceholder:"Search bills..."}),I(l_,{listLabel:"Bills",glSourceList:b,icon:zW,fetchNextPage:a,hasNextPage:i,isFetching:l,pluralNoun:"bills",singularNoun:"bill"})]})})}const m_=e=>["bills/bills","infinite",e??{}],v_=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/bills/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:ki(n)},o=await Ma(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},f_=[];function b_(e){const t=e.lineItems?.reduce((e,t)=>e+t.amount,0)??0;return{id:e.id,name:e.name??"",date:e.date??"",amount:t}}function y_(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return dr(e)||(t.search=e),t}function w_(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(c=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:c}),limit:10,filter:y_(t)},jm({queryFn:v_,queryKey:m_(s)}));var s,c;const u=(r?.pages??f_).flatMap(e=>(e.data??[]).map(b_));return I(g_,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function C_(e){const t=Sc();return I(Hv,{children:t.open&&I(w_,{...e})})}function x_(e){return{lineItemType:"fee",amount:e}}function T_(e){return{lineItemType:"bill",amount:hh(-e.amount),bill:{id:e.id,amount:hh(e.amount),date:e.date,name:e.name}}}function k_(e){return e.map(T_)}function E_(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function A_(e){return`Remove ${e}?`}function S_(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function I_({action:e,titleName:t,entityName:n}){return dh({title:A_(t),body:S_(e,n),cancellable:!0,buttons:[{type:"default",key:"NO",label:"No"},{type:"action",key:"YES",label:"Yes"}]}).then(e=>"YES"===e?"YES":"NO").catch(()=>"NO")}const N_={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},R_={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function P_(e,t){const n=R_[t];return I_({titleName:n,entityName:n.toLowerCase(),action:N_[e]})}function D_(e){return e.filter(e=>"bill"===e.lineItemType).map(e=>({id:e.bill.id,name:e.bill.name,date:e.bill.date,amount:ph(e.bill.amount)}))}const M_="bill",L_=Cb({defaultValues:PW,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType),a=D_(e.state.values.children);return R(Ac,{open:t,onOpenChange:n,children:[I(hN,{onClick:async()=>{const t=E_(M_,e.state.values.children);M_!==t?"YES"===await P_(M_,t)&&n(!0):n(!0)},Icon:zW,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),I(C_,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=k_(t);0!==r&&a.push(x_(r)),e.setFieldValue("children",a),n(!1)},previouslySelected:a})]})}}),F_=e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M5.71252 10.4813H7.80002C8.03706 10.4813 8.26439 10.3871 8.432 10.2195C8.59961 10.0519 8.69377 9.82454 8.69377 9.5875C8.69377 9.35046 8.59961 9.12313 8.432 8.95552C8.26439 8.78791 8.03706 8.69375 7.80002 8.69375H7.17502C6.93799 8.69375 6.71066 8.59959 6.54305 8.43198C6.37544 8.26437 6.28127 8.03704 6.28127 7.8C6.28127 7.56296 6.37544 7.33563 6.54305 7.16802C6.71066 7.00041 6.93799 6.90625 7.17502 6.90625H9.26252",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 5.11249V6.90624",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 10.4813V12.275",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V14.0625H2.13123V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8687 3.91875V4.51875H9.28748V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10})),O_=bi(F_,"Payroll");function V_(e,t,n){const r=c_(e);return`The selected invoice total of ${c_(t)} is greater than the transaction total of ${r}. Was there a fee of ${c_(n)}?`}const U_=e=>["payments/payments","infinite",e??{}],B_=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return async function({accessToken:e,cursor:t,environment:n,params:r}){const a={path:"/v6/payments/query",bodyParams:{...r,cursor:t},accessToken:e,endpointManager:ki(n)},o=await Ma(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}}({params:n,cursor:e.pageParam,accessToken:r,environment:a})},H_=rr({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),W_=rr({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),__=rr({marginLeft:"auto"});function z_({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:H_,children:[R("div",{className:W_,children:[I(uc,{children:e}),t&&I(uc,{wrap:"nowrap",children:Co(t)})]}),R("div",{className:W_,children:[n&&I(So,{children:n}),I("span",{className:__,children:r&&I(So,{wrap:"nowrap",children:St(Rt(r))})})]})]})}function j_({payment:e,selected:t,onClick:n}){return I(bf,{handleClick:n,selected:t,isMultiSelect:!0,children:I(z_,{description:e.description,amount:hh(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}function q_(e){return e}function K_(e){return e.pages.flatMap(e=>(e.data??[]).map(q_))}function Y_(e){return Object.values(e).some(e=>e)}function Z_(e,t){return e===ph(t)}function G_(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:Nr(t)?void 0:t}}function Q_({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const[a,i]=d(""),{query:{data:l,fetchNextPage:s,isFetching:c,hasNextPage:h,isFetchingNextPage:p}}=(g={filter:G_(n,a)},m={select:K_},jm({queryFn:B_,queryKey:U_(g),...m}));var g,m;const[v,f]=d(r),[b,y]=d([]),w=o(()=>Object.fromEntries([...v,...b].map(e=>[e.id,!0])),[v,b]),C=o(()=>new Set(r.map(e=>e.id)),[r]),x=o(()=>Nr(a)?[...r,...(l??[]).filter(e=>!C.has(e.id))]:l??[],[a,r,l,C]),T=[...v,...b].reduce((e,t)=>e+t.amount,0),[k,E]=d(void 0),A=u(e=>{const n=r.filter(t=>e[t.id]),a=b.filter(t=>e[t.id]),o=new Set(a.map(e=>e.id)),i=(l??[]).filter(t=>e[t.id]&&!C.has(t.id)&&!o.has(t.id)),s=[...a,...i],c=[...n,...s].reduce((e,t)=>e+t.amount,0),d=Y_(e);void 0===k||!Z_(c,t)&&d||E(void 0),f(n),y(s)},[r,b,l,C,t,k]),S=af({data:[x],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:w},onSelectedChange:A}),N=c&&!p;return I(Gv,{title:"Link Transactions",Footer:I(jW,{validate:()=>{const e=Z_(T,t),n=Y_(w),r=e||!n;return r||E("The selected total must equal the income amount."),r},error:k,onClick:()=>{e(v.map(e=>e.id),b)}}),padChildren:!1,children:R(p_,{children:[I(ZW,{selectedAmount:T,transactionTotal:t,transactionTypeLabel:mw,selectedAmountSignage:"default"}),I($W,{searchTerm:a,onChange:i,isFetching:N,searchPlaceholder:"Search transactions..."}),S.groups.map(e=>{const t=e.getRows();return I(bS,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return I(j_,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),I(i_,{onIntersect:s,enable:!c&&h})]})})}function X_({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const a=Sc();return I(Hv,{children:a.open&&I(Q_,{transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r,onSubmit:e})})}function J_({transactionTotal:e,invoices:t,previouslySelected:n,onInvoiceSubmit:r,onPaymentSubmit:a,hasExistingInvoices:i,parentBankAccountId:l,fetchNextPage:s,hasNextPage:c,isFetching:u,isFetchingNextPage:h,searchTerm:p,onSearchChange:g}){const[m,v]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[f,b]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),[y,w]=d(!1),C=o(()=>new Set(n.map(e=>e.id)),[n]),x=o(()=>Nr(p)?[...n,...t.filter(e=>!C.has(e.id))]:t,[p,n,t,C]),T=af({data:[x],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:e=>{v(e),b(t=>{const n={...t},r=x.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:m}}),k=Object.entries(m).filter(([,e])=>e).map(([e])=>f[e]),E=k.reduce((e,t)=>e+t.amount,0),A=u&&!h;return I(Gv,{title:"Link Invoice",HeaderRightAction:I(cE,{shouldUseButtonDiscreteStyles:!0,children:I(Ug,{forceNewCascade:!0,children:R(Ac,{open:y,onOpenChange:w,children:[I(hN,{onClick:async()=>{const e=k.length>0;if(i){if("YES"!==await P_("payment","invoice"))return}else if(e&&"YES"!==await async function(){return I_({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;w(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),I(X_,{transactionTotalDollars:e,parentBankAccountId:l,previouslySelected:[],onSubmit:a})]})})}),Footer:I(jW,{onClick:async()=>{const t=hh(E);if(t>e&&k.length>0){const n=new H(t).sub(e),a=n.toNumber(),o=n.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return d_({title:"Invoice Payment",body:V_(n,e,t)})})({selectedTotal:t,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=o),r(k,t)}).catch(()=>{})}else r(k,0)}}),padChildren:!1,children:R(p_,{children:[I(ZW,{selectedAmount:E,transactionTotal:e,transactionTypeLabel:mw}),I($W,{searchTerm:p,onChange:g,isFetching:A,searchPlaceholder:"Search invoices..."}),I(l_,{listLabel:"Invoices",glSourceList:T,icon:O_,fetchNextPage:s,hasNextPage:c,isFetching:u,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const $_=e=>["invoicing/invoices","infinite",e??{}],ez=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment;return(async({params:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/invoicing/invoices/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:ki(r)},o=await Ma(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}})({params:n,cursor:e.pageParam,accessToken:r,environment:a})},tz=[];function nz(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return Nr(e)||(t.search=e),t}function rz(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return jm({queryFn:ez,queryKey:$_(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:nz(t)}});var s;const c=(r?.pages??tz).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return I(J_,{...e,invoices:c,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function az(e){const t=Sc();return I(Hv,{children:t.open&&I(rz,{...e})})}function oz(e){const t=hh(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const iz=(e,t)=>{const n=e.map(oz);return 0!==t&&n.push(x_(t)),n};function lz(e){const t=hh(e.amount);return{lineItemType:"payment",amount:t,payment:{id:e.id,amount:t,date:e.date,name:e.displayName,bankAccount:{id:e.bankAccount.id,displayName:e.bankAccount.displayName}}}}function sz(e){return e.map(lz)}function cz(e){return e.filter(e=>"invoice"===e.lineItemType).map(e=>({id:e.invoice.id,name:e.invoice.name,date:e.invoice.date,amount:ph(e.invoice.amount)}))}const dz="invoice",uz=Cb({defaultValues:PW,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType),a=cz(e.state.values.children);return R(Ac,{open:t,onOpenChange:n,children:[I(hN,{onClick:async()=>{const t=E_(dz,e.state.values.children);dz!==t?"YES"===await P_(dz,t)&&n(!0):n(!0)},Icon:O_,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),I(az,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=iz(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:(t,r)=>{const a=sz(r);e.setFieldValue("children",a),n(!1)},hasExistingInvoices:r,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),hz=fs.filter(e=>"ONE_TIME"!=e.value);function pz({onClick:e}){const t=Sc();return I(tx,{triggerChildren:I(ax,{displayLabel:"Make recurring"}),popupChildren:I(Pf,{frequencies:hz,onClick:n=>{e(n),t.close()}})})}function gz({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(qc,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(Sd,{Component:t})})}function mz({activeTab:e,onClick:t,popupTriggerProps:n}){return I(gz,{active:"conversation"===e,onClick:()=>t("conversation"),icon:Nd,ariaLabel:"conversation-tab",popupTriggerProps:n})}const vz=rr({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function fz({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=Sc(),[a,o]=d(e),{query:{data:i}}=Ol(a),l="CLOSED"===i?.resolutionStatus;return I(Fv,{children:R("div",{className:vz,children:[I(jv,{children:R(Kv,{children:[I(rh,{Icon:al,handleClose:()=>r.setOpen(!1)}),I(Eo,{children:"Back"})]})}),I(VH,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const bz={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:mw},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},yz=Object.values(bz);function wz({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=_e();return a?I(Tf,{}):I(hf,{title:R(N,{children:[s&&t&&I(Eo,{children:"Suggested"}),I(Eo,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(pS,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(Tz,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I(bf,{handleClick:()=>e(t),selected:n,children:R(hS,{children:[t.iconUrl&&I(Pd,{Component:Em(t.iconUrl,t.name??"")}),I(uc,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const Cz="Search expense categories...",xz=[];function Tz({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=Ex(),s=r??i?.data??xz,c=Sc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I(rf,{placeholder:Cz,onClick:d,SearchList:xS,DefaultList:wz,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function kz({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,glAccount:r}){const{query:{data:a},isFilling:o}=NC(),i=PC(a,RC),l=_e()&&n?I(hf,{title:I(Eo,{children:"Suggested"})}):void 0;return I(nU,{accounts:i,selectedAccountId:r?.id,onSelect:e=>t({type:"REVENUE",value:e}),isFilling:o,listLabel:e,placeholder:"Search income categories...",nestedTitle:"All Categories",Header:l})}function Ez({list:e,onClick:t,NestedChildList:n}){return I(df,{children:e.groups.map(e=>I(bS,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(pS,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:I(n,{row:e})},e.key);const r=e.getIsSelected();return I(bf,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(hS,{children:[e.value.iconUrl&&I(Pd,{Component:Em(e.value.iconUrl,e.value.name)}),I(uc,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const Az="All Tax Categories";function Sz({handleConversion:e,region:t}){const n=Sc(),r=af({data:[GH],groups:[{label:Az,key:Az}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(Ez,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function Iz({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=_e(),d=!l&&i&&0===r.length;return l?I(Tf,{}):R(df,{children:[a&&I("div",{children:I(ff,{handleClick:t,children:I(uc,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(Eo,{children:"Suggested"}),!d&&R(N,{children:[I(Eo,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I(bf,{handleClick:()=>e(t),selected:n,children:I(z_,{description:t.description,amount:hh(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const Nz={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function Rz({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ae(n??[],Nz),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?I(Tf,{}):0===l.length?I(sf,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I(df,{children:I("div",{children:l.map(e=>{const n=a?.id===e.id;return I(bf,{handleClick:()=>t(e),selected:n,children:I(z_,{description:e.description,amount:hh(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const Pz=[];function Dz({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Rt(o),s=(c=r,{filter:{status:{in:["ACTIVE"]},type:{in:[(d=a)>0?"EXPENSE":"REVENUE",d>0?"TRANSFER_OUT":"TRANSFER_IN"]},amount:{equal:-d},date:{greaterThanEqual:Pt(Vt(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Pt(Vt(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=Ts(s,{enabled:null!==l}),m=h?.data??Pz,{query:{data:v}}=yC({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),f=Sc();return I(rf,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),f.close()},SearchList:Rz,DefaultList:Iz,listLength:m.length??0,extraProps:{listLabel:e,bankTransfers:m,isFetched:p,isFilling:g,holdingAccount:v,showSuggestedCategories:n,transactionDate:o,onNeedsMatchClick:()=>{v&&t({type:"BANK_TRANSFER",value:{glAccount:v}}),f.close()},reconciliationMatch:i}})}function Mz({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=d(function(e){switch(e){case"EXPENSE":return yz.indexOf(bz.EXPENSE);case"REVENUE":return yz.indexOf(bz.REVENUE);case"TAX_PAYMENT":return yz.indexOf(bz.TAX_EXPENSE);default:return yz.indexOf(bz.TRANSFER)}}(e)),{category:c,glAccount:u,tax:h,date:p,bankAccount:g,reconciliationMatch:m,amount:v}=o,f=h?.paymentInfo?.region,b=g?.id;return R(Qv,{title:t,children:[!i&&I(Of,{options:yz,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(yz[l].value){case"EXPENSE":return I(Tz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(kz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return I(Sz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:f});case"BANK_TRANSFER":return I(Dz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:v??0,transactionDate:p,reconciliationMatch:m})}},{})]})}function Lz({children:e}){const{startPrefetch:t,cancelPrefetch:n}=Nx();return I(aU,{onMouseEnter:t,onMouseLeave:n,children:e})}const Fz=rr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function Oz({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!dr(o)&&""!==o.id,l=dr(o?.iconUrl)?void 0:Em(o.iconUrl,"Expense Icon");return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(Fp,{label:"Category",popupTriggerProps:e,children:R(Lz,{children:[i?R("div",{className:Fz,children:[l&&I(Pd,{Component:l}),I(uc,{wrap:"wrap",children:o.name})]}):I(uc,{intent:"weak",children:"Select category"}),I(Pd,{Component:ol})]})})}),I(Mz,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function Vz(){const{query:{data:e}}=iI(),{query:{data:t=[]}}=aO(),n=o(()=>e?.data??[],[e]),r=o(()=>function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return e.forEach((e,r)=>{t.set(e.id,r),e.child?.id&&(t.set(e.child.id,r),n.set(e.child.id,e.id))}),{dimensionsToIndex:t,childToRootId:n,dimensionFieldCount:e.length}}(t),[t]);return{nestedDimensionValues:n,nestedDimensions:t,dimensionLookup:r}}const Uz=rr({display:"flex",gap:"8px",alignItems:"center"});function Bz({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!dr(o)&&""!==o.id,l=dr(o?.iconUrl)?void 0:Em(o.iconUrl,"Revenue Icon");return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(Fp,{label:"Category",popupTriggerProps:e,children:R(Lz,{children:[i?R("div",{className:Uz,children:[l&&I(Pd,{Component:l}),I(uc,{children:o.name})]}):I(uc,{intent:"weak",children:"Select category"}),I(Pd,{Component:ol})]})})}),I(Mz,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function Hz(e){return{id:e.id??"",type:e.type??"EXPENSE",date:e.date??"",amount:e.amount??0,displayName:e.displayName??"",description:e.description??"",notes:e.notes??null,reviewStatus:e.reviewStatus??"USER_REVIEW_REQUIRED",apiName:e.apiName??"MANUAL_ENTRY",iconUrl:e.iconUrl??"",apiSourceId:e.apiSourceId??null,bankAccount:e.bankAccount??{id:""},glAccount:e.glAccount??{id:""},dimensionValues:e.dimensionValues??[],customer:e.customer??null,vendor:e.vendor??null,category:e.category??null,invoice:e.invoice??null,bill:e.bill??null,payroll:e.payroll??null,paymentId:e.paymentId??null,...void 0!==e.apiItemId?{apiItemId:e.apiItemId}:{}}}const Wz=(e,t,n)=>{const r=new Set((e=>{const t=[];for(const n of e)for(const e of n.dimensionValues)e.dimension?.id&&t.push(e.dimension.id);return t})(e).map(e=>n.childToRootId.get(e)??e)),a=e.some(e=>!dr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},_z={id:"customer",name:"Customer"};function zz(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function jz(e){return Hz({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function qz(e,t,n,r,a){if(1===e.length){const o=e[0];"EXPENSE"===t?n(o.category??null):r(o.glAccount??null),a([])}else a(e)}const Kz=fr(cr["line-item-card"],rr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),Yz=rr({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),Zz=rr({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),Gz=Cb({defaultValues:{children:[],itemizeByOptions:{}},props:{index:0,transactionType:"EXPENSE",onUnitemize:()=>{}},render:function({form:e,index:t,transactionType:n,onUnitemize:r}){const{nestedDimensionValues:a,nestedDimensions:o,dimensionLookup:i}=Vz(),l=n=>{switch(n.type){case"EXPENSE":return void e.setFieldValue(`children[${t}].category`,n.value);case"REVENUE":return void e.setFieldValue(`children[${t}].glAccount`,n.value)}};return R("div",{...Kz,children:[R("div",{className:Yz,children:[I(uc,{children:`Line Item #${t+1}`}),R(qc,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(uc,{children:"Remove"}),I(Pd,{Component:PN})]})]}),R("div",{className:Zz,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(Oz,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(Bz,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),I(e.Subscribe,{selector:e=>({itemizeByOptions:e.values.itemizeByOptions,childDimensionValues:e.values.children[t].dimensionValues}),children:({itemizeByOptions:n,childDimensionValues:r})=>function(e,t,n,r,a,o){const{childToRootId:i}=o;return Object.entries(e).filter(([e,t])=>e!==a&&t).map(([e])=>{const a=(t??[]).findIndex(t=>!dr(t?.dimension?.id)&&(i.get(t.dimension.id)??t.dimension.id)===e);return-1===a?null:{fieldDimension:r.find(t=>t.id===e)?.name??"",dimensionValueOptions:wW(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,_z.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>I(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(CW(t))})},r[0][0].id))}),I(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&I(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),Qz=rr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function Xz({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=Sc();return I(Uc,{children:R(Ug,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return I(qg,{onClick:()=>{n(e.id,!r)},children:R("div",{className:Qz,children:[I(uc,{children:a(e)}),I(Pd,{Component:r?xi:pf})]})},e.id)}),!dr(r)&&I(qg,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(uc,{children:"Confirm Selection"})})]})})}const Jz=e=>Object.keys(e).filter(t=>e[t]);function $z({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return R(Ac,{placement:"bottom-end",children:[I(Ic,{children:e=>R(qc,{popupTriggerProps:e,children:[I(uc,{children:"Itemize By"}),I(Pd,{Component:Up})]})}),I(Xz,{items:[...e,_z],selectedIds:Jz(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const ej=rr({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),tj=rr({display:"flex",justifyContent:"space-between",alignItems:"center"}),nj=rr.raw({color:"surface.intent.danger.active"}),rj=rr({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function aj({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=fW(n),i=bW(t,o),l=a&&i,s=a&&r<2,c=o<t?"Your line item amounts are under-allocated":"Your line item amounts are over-allocated";return R("div",{className:ej,children:[R("div",{className:tj,children:[I(uc,{children:`${yw[e]} amount`}),I(uc,{children:s_(t)})]}),R("div",{className:tj,children:[I(uc,{children:"Line items total"}),I(uc,{children:s_(o)})]}),R("div",{className:tj,children:[I(uc,{extraClassNames:l?[nj]:void 0,children:"Difference"}),I(uc,{extraClassNames:l?[nj]:void 0,children:(d=t,u=o,To(new H(d).minus(u).toNumber(),"default"))})]}),l&&R("div",{className:rj,children:[I(ul,{Component:wi}),I(uc,{extraClassNames:[nj],children:c})]}),s&&R("div",{className:rj,children:[I(ul,{Component:wi}),I(uc,{extraClassNames:[nj],children:"At least 2 line items are required"})]})]});var d,u}function oj({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(vp,{onSave:e,children:I(aj,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const ij=rr({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function lj(e){const{form:t,dimensions:n,handleAddLineItem:r,handleUnitemize:a,handleItemizeCheckboxChange:i}=function({childTransactions:e,onSubmit:t,transactionType:n,amount:r,category:a,glAccount:i}){const{nestedDimensions:l,dimensionLookup:s}=Vz(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new H(r).div(2).round(2,H.roundDown),n=new H(r).sub(t);return[Hz({amount:t.toNumber(),...structuredClone(c)}),Hz({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=Sc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return dW;case"BANK_TRANSFER":return pW;case"REVENUE":return mW}}(r);return wb({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=UW(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=fW(e.children.map(e=>e.amount));return bW(n,r)?{form:"amount-mismatch",fields:t}:Object.keys(t).length>0?{fields:t}:void 0}},onSubmit:e=>{a(e.value.children)}})}({childTransactions:d,itemizeByOptions:Wz(d,l,s),parentAmount:r,transactionType:n,onSubmit:e=>{t(e),u.close()}});return{form:h,dimensions:l,handleAddLineItem:()=>{const e=h.state.values.children,t=e[0];h.setFieldValue("children",[...e,Hz({...t,id:"",amount:0,customer:null,...c})])},handleUnitemize:()=>{const e=h.state.values.children[0];t([e]),u.close()},handleItemizeCheckboxChange:(e,t)=>{if(h.setFieldValue("itemizeByOptions",{...h.state.values.itemizeByOptions,[e]:t}),e===_z.id)return void(t||h.setFieldValue("children",h.state.values.children.map(e=>({...e,customer:null}))));if(t){const t=l.find(t=>t.id===e);if(dr(t))return;const n={id:"",dimension:t},r=h.state.values.children.map(e=>({...e,dimensionValues:[...e.dimensionValues??[],n]}));return void h.setFieldValue("children",r)}const n=h.state.values.children.map(t=>({...t,dimensionValues:t.dimensionValues.filter(t=>t.dimension?.id!==e)}));h.setFieldValue("children",n)}}}(e),l=I(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>I($z,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=I(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>I(oj,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(Gv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[I(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>I(Gz,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),I(t.Subscribe,{selector:e=>e.values.children,children:e=>I("div",{className:ij,children:e.length<10&&R(qc,{onClick:r,active:!1,children:[I(uc,{children:"Add Line Item"}),I(ul,{Component:Bs})]})})})]})}function sj(e){const t=Sc();return I(Hv,{children:t.open&&I(lj,{...e})})}function cj({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=Sc();return R(Ac,{children:[I(Ic,{children:e=>I(hN,{Icon:px,popupTriggerProps:e,children:"Itemize"})}),I(sj,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(zz)),r.close()}})]})}const dj=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(Ac,{children:[I(Ic,{children:e=>I(mz,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(fz,{conversationId:r,attachedEntityId:a})]}):I(mz,{onClick:n,activeTab:t}),uj=Cb({defaultValues:PW,props:{title:"Transaction",transaction:null,activeTab:null,tabOnClick:()=>{},conversationId:null,transactionId:void 0},render:function({form:e,title:t,transaction:n,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}){const l=We(),s=ET(),c=!dr(n)&&Rg(n)&&"EXPENSE"===n.type,{mutateAsync:d}=pC({mutationFn:sC,meta:{toastOptions:{defaultSuccessMessage:"Transactions saved",defaultErrorMessage:"Couldn't save transactions"}}}),h=_W(e),p=u(t=>{qz(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(jv,{children:R(Kv,{children:[I(rh,{}),I(Eo,{children:t}),i&&I(dj,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(cE,{shouldUseButtonDiscreteStyles:!0,children:R(Ug,{children:[I(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>R(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&I(L_,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&I(uz,{form:e}),0===t.length&&I(cj,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:p}),xW(t)&&I(hN,{Icon:px,onClick:()=>p([t[0]]),children:"Unitemize"})]})}),c&&I(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&I(pz,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===FN.ACTIVE&&I(HW,{onClick:async()=>{dr(n)||await async function(){return dh({title:"Archive transaction",body:"Are you sure you want to archive this transaction?",buttons:[{key:Yu,label:"Cancel"},{key:Zu,label:"Archive",type:ch.DANGER}]}).then(e=>e===Zu)}()&&await h(async()=>{await d(ON([n])),ls()})}}),n?.status===FN.INACTIVE&&I(WW,{onClick:async()=>{dr(n)||await h(async()=>{var e;await d((e=[n],e.map(e=>({id:e.id,status:FN.ACTIVE})))),ls()})}})]})})]})})}});function hj(e){return 0===e.length||xW(e)&&e.every(e=>null===e.customer)}const pj=Cb({defaultValues:PW,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=We();return R(N,{children:[I(e.Subscribe,{selector:e=>{return 0===(t=e.values.children).length||t.every(e=>{switch(e.lineItemType){case"invoice":return!1;case"itemized":return!0}});var t},children:t=>t&&I(e.AppField,{name:"vendor",children:e=>I(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),I(e.Subscribe,{selector:e=>hj(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),I(e.Subscribe,{selector:e=>e.values.frequency,children:r=>{return a&&n&&(o=t?.type,void 0!==(i=r)&&"ONE_TIME"!==i.value&&"EXPENSE"===o)&&I(e.AppField,{name:"frequency",children:e=>I(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"category",children:t=>I(Oz,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),gj=Cb({defaultValues:PW,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.Subscribe,{selector:e=>hj(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"glAccount",children:t=>I(Bz,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}});function mj({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===hx(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(Fp,{label:a,popupTriggerProps:e,children:R(Lz,{children:[r?I(z_,{description:r.description||"",amount:r.amount||0,date:r.date||St(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(uc,{intent:"weak",children:"Needs Match"}),I(Pd,{Component:ol})]})})}),I(Mz,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const vj=Cb({defaultValues:PW,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"reconciliationMatch",children:()=>I(mj,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function fj({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(Ac,{placement:"bottom-start",children:[I(Ic,{children:e=>I(Fp,{label:"Category",popupTriggerProps:e,children:R(Lz,{children:[I(uc,{children:QH(r?.paymentInfo?.region)??"Select region..."}),I(Pd,{Component:ol})]})})}),I(Mz,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const bj=Cb({defaultValues:PW,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(fj,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),I(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>I(e.ButtonGroupField,{label:"Quarter",options:KH})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:Tt({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),yj=Cb({defaultValues:PW,props:{transaction:null,isManual:!1},render:function({form:e,transaction:t,isManual:n}){const r=t=>{switch(t.type){case"EXPENSE":return e.setFieldValue("category",t.value),void e.setFieldValue("type","EXPENSE");case"REVENUE":return e.setFieldValue("glAccount",t.value),void e.setFieldValue("type","REVENUE");case"TAX_PAYMENT":case"TAX_EXPENSE":return e.setFieldValue("tax.paymentInfo.region",t.value),void e.setFieldValue("type","TAX_PAYMENT");case"BANK_TRANSFER":case"TRANSFER_IN":case"TRANSFER_OUT":return ur(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:hh(t.value.transfer.amount)}),ur(t.value.glAccount)&&(e.setFieldValue("glAccount",t.value.glAccount),e.setFieldValue("reviewStatus","AWAITING_MATCH"),e.setFieldValue("reconciliationMatch",void 0)),void e.setFieldValue("type","BANK_TRANSFER")}};return I(N,{children:I(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return I(pj,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return I(gj,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return I(vj,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return I(bj,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),wj=fr(null,rr({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function Cj({transaction:e,bankAccount:t}){const n=e?e.description:"",r=dr(t)||dr(e)?"":((e,t)=>{const n=Tw(t.type),r=hx(t.amount);return`${n?`${r} `:""}${mh(e.name,e.mask)}`})(t,e);return R("div",{...wj,children:[I(Eo,{wrap:"wrap",children:n}),t&&I(So,{children:r})]})}const xj=rr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),Tj=rr({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function kj({attachments:e,onRemove:t}){return I("div",{className:xj,children:I("div",{className:Tj,children:e.map(e=>I(bH,{attachment:e,onRemove:t},e.localId))})})}const Ej=Cb({defaultValues:PW,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=Oh({mutationFn:gg,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Or.invalidateQueries({queryKey:["files/attachments"]}),await Or.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>R(N,{children:[I(e.AttachmentDropzoneField,{entityId:hs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(kj,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),Aj=rr({display:"flex",flexDirection:"column",gap:"8px"});function Sj({children:e}){return I("div",{className:Aj,children:e})}const Ij=lr({base:{display:"flex",flexDirection:"column",gap:"8px",padding:"8px 12px",backgroundColor:"surface.background",border:"1px solid",borderColor:"border.layout",borderRadius:"md",overflow:"hidden",width:"100%"},variants:{surface:{foreground:{backgroundColor:"surface.foreground"},background:{backgroundColor:"surface.background"}}}});function Nj({children:e,surface:t,style:n}){const r=rr(Ij.raw({surface:t}),n);return I("div",{className:r,children:e})}function Rj(){return I(dp,{alignment:"horizontal"})}const Pj=rr({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function Dj(e){return I("div",{className:Pj,children:e.children})}function Mj({property:e}){return"string"==typeof e?I(uc,{children:e}):e}function Lj({label:e,value:t}){return R(Dj,{children:[I(Mj,{property:e}),I(Mj,{property:t})]})}function Fj(e){return St(Rt(e))}function Oj({amount:e,date:t,description:n}){return R(Nj,{surface:"foreground",children:[I(Lj,{label:"Description",value:n}),I(Rj,{}),I(Lj,{label:"Date",value:Fj(t)}),I(Rj,{}),I(Lj,{label:"Amount",value:s_(e)})]})}const Vj=rr.raw({padding:12});function Uj({amount:e}){return I(Nj,{surface:"background",style:Vj,children:I(Lj,{label:"Fee",value:s_(e)})})}const Bj=rr({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),Hj=rr({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function Wj({label:e,warning:t}){return R("div",{className:Bj,children:[I(uc,{children:e}),t&&R("div",{className:Hj,children:[I(Pd,{Component:wi}),t]})]})}function _j(e){return s_(Math.abs(e))}function zj(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new H(0)),o=(i=a.toNumber(),l=r,"REVENUE"===(s=n)||"BANK_TRANSFER"===s&&l>0?i<l?"overpaid":i>l?"underpaid":"exact":"EXPENSE"===s||"BANK_TRANSFER"===s&&l<0?i>l?"overpaid":i<l?"underpaid":"exact":"exact");var i,l,s;if("exact"===o)return null;const c=a.minus(r).toNumber();return"overpaid"===o?`${_j(c)} Overpaid`:"underpaid"===o?function(e){return`${_j(e)} Underpaid`}(c):null}const jj=Cb({defaultValues:PW,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=cz(e.state.values.children);return R(Sj,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=zj(t,e.amount,e.type);return I(Wj,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?I(Oj,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?I(Uj,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(Ac,{open:n,onOpenChange:r,children:[I(Ic,{children:e=>R(qc,{popupTriggerProps:e,children:[I(uc,{children:"Edit Linked Invoices"}),I(ul,{Component:ol})]})}),I(az,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=iz(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:(t,n)=>{const a=sz(n);e.setFieldValue("children",a),r(!1)},hasExistingInvoices:!0,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function qj({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:s_(t)},{label:"Category",value:"EXPENSE"===e?n?.name??"":r?.name??""},...o.map(e=>{const t=a.find(t=>t.dimension?.id===e.id);return void 0===t?null:{label:e.name??"",value:t.name??""}}).filter(e=>null!==e),...null!==i?[{label:"Customer",value:i.name??""}]:[]];return I(Nj,{children:l.map((e,t)=>R(f,{children:[t>0&&I(Rj,{}),I(Lj,{label:e.label,value:e.value.toString()})]},e.label))})}const Kj=Cb({defaultValues:PW,render:function({form:e}){const{query:{data:t}}=lO(),n=e.state.values.children;if(xW(n))return R(Sj,{children:[I(uc,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(qj,{transactionType:e.state.values.type,amount:n.amount??0,category:n.category??null,glAccount:n.glAccount??null,dimensionValues:n.dimensionValues,dimensions:t?.data??[],customer:n.customer},`${n.id}_${r}`)),R(Ac,{children:[I(Ic,{children:e=>R(qc,{popupTriggerProps:e,children:[I(uc,{children:"Edit Line Items"}),I(ul,{Component:ol})]})}),I(sj,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(jz),onSubmit:t=>{qz(t.map(zz),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),Yj=Cb({defaultValues:PW,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=D_(e.state.values.children);return R(Sj,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=zj(t,e.amount,e.type);return I(Wj,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?I(Oj,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?I(Uj,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(Ac,{open:n,onOpenChange:r,children:[I(Ic,{children:e=>R(qc,{popupTriggerProps:e,children:[I(uc,{children:"Edit Linked Bills"}),I(ul,{Component:ol})]})}),I(C_,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=k_(t);0!==n&&a.push(x_(n)),e.setFieldValue("children",a),r(!1)},previouslySelected:a})]})]})}});function Zj({amount:e,bankAccountName:t,date:n,description:r}){return R(Nj,{surface:"foreground",children:[I(Lj,{label:"Description",value:r}),I(Rj,{}),t&&R(N,{children:[I(Lj,{label:"Account",value:t}),I(Rj,{})]}),I(Lj,{label:"Date",value:Fj(n)}),I(Rj,{}),I(Lj,{label:"Amount",value:s_(e)})]})}const Gj=Cb({defaultValues:PW,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.filter(e=>"payment"===e.lineItemType).map(e=>({id:e.payment.id,amount:ph(e.payment.amount),date:e.payment.date,description:e.payment.name,bankAccount:{displayName:e.payment.bankAccount.displayName}}));return R(Sj,{children:[I(Wj,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?I(Zj,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),R(Ac,{open:t,onOpenChange:n,children:[I(Ic,{children:e=>R(qc,{popupTriggerProps:e,children:[I(uc,{children:"Edit Linked Transactions"}),I(ul,{Component:ol})]})}),I(X_,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,previouslySelected:r,onSubmit:(t,r)=>{const a=e.state.values.children.filter(e=>"payment"===e.lineItemType&&t.includes(e.payment.id)),o=sz(r);e.setFieldValue("children",[...a,...o]),n(!1)}})]})]})}}),Qj=Cb({defaultValues:PW,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?I(jj,{form:e}):t.some(e=>"bill"===e.lineItemType)?I(Yj,{form:e}):t.some(e=>"payment"===e.lineItemType)?I(Gj,{form:e}):xW(t)?I(Kj,{form:e}):null}});function Xj({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:c}=Vz(),u=void 0===i?ww[s]:Cw[s],[h,p]=d(l??null),g=I(uj,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),m=I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(vp,{disabled:e,isSubmitting:t})});return R(qH,{onSubmit:n.handleSubmit,Header:g,Footer:m,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(Cj,{transaction:e,bankAccount:r}),I(n.AppField,{name:"amount",children:e=>I(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),I(n.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),I(yj,{form:n,transaction:e,isManual:a}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>function(e,t,n){const r=new Set(e.map(e=>e?.dimension?.id)),a=n.filter(e=>!r.has(e.dimension?.id));return t.filter(e=>!r.has(e.id)).map(e=>{const n=t.findIndex(t=>t.id===e.id),r=wW(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,c).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>I(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>I(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(CW(e))})},r[0][0].id))}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>$e(e)&&I(Qj,{form:n})}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(Ej,{form:n,transactionId:i})]})}function Jj({transactionId:e,initialTab:t,initialType:n}){const{transaction:r,nestedDimensions:a,form:o,bankAccount:i,isManual:l,isLoading:s}=function({transactionId:e,initialType:t}){const{nestedDimensions:n,dimensionLookup:r}=Vz(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=Es({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:BW(a,r,t),bankAccount:um(a?.bankAccount?.id??""),isManual:dr(a)||Rg(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return I(o.Subscribe,{selector:e=>e.values.type,children:n=>I(Xj,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function $j({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=Es({id:e});return s(()=>{!r&&dr(n)&&ls()},[n,r]),dr(n)?null:I(Jj,{transactionId:e,initialTab:t})}function eq({transactionId:e,initialTab:t,initialType:n}){return e?I($j,{transactionId:e,initialTab:t}):!e&&n?I(Jj,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function tq({subject:e,children:t}){return R(jv,{children:[R(Kv,{children:[I(rh,{}),I(Eo,{children:e})]}),I("div",{className:eR({alignItems:"center",gap:15}),children:t})]})}function nq({conversationId:e,defaultValues:t}){const[n,r]=d(e),{query:{data:a}}=Ol(n),o="CLOSED"===a?.resolutionStatus;return I(SB,{children:R(NB,{children:[I(tq,{subject:a?.subject??"Conversation"}),I(VH,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const rq=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("g",{clipPath:"url(#clip0_18201_5557)"},r.createElement("path",{d:"M7.5 14.0625C11.1244 14.0625 14.0625 11.1244 14.0625 7.5C14.0625 3.87563 11.1244 0.9375 7.5 0.9375C3.87563 0.9375 0.9375 3.87563 0.9375 7.5C0.9375 11.1244 3.87563 14.0625 7.5 14.0625Z",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M7.49999 10.4812V6.30624H6.30624",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.30624 10.4813H8.69374",strokeWidth:.9375,strokeMiterlimit:10}),r.createElement("path",{d:"M6.90625 4.51874H8.09375",strokeWidth:.9375,strokeMiterlimit:10})),r.createElement("defs",null,r.createElement("clipPath",{id:"clip0_18201_5557"},r.createElement("rect",{width:15,height:15,fill:"white"})))),"Info");function aq({onClick:e,active:t}){return I(ec,{type:"button",onClick:e,active:t,children:I(Pd,{Component:rq})})}const oq=rr({display:"flex",flexDirection:"column"});function iq({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:oq,children:[I(So,{children:e}),n?I(PH,{width:r}):I(Eo,{wrap:"wrap",children:t??""})]})}function lq({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=Es({id:e}),a=um(n?.bankAccount.id??"");if(dr(n))return null;const o=XN({alignItems:"stretch",gap:5,paddingLeft:16,paddingRight:16,backgroundColor:"surface.foreground",borderWidth:0,borderBottomStyle:"solid",borderColor:"border.layout.strong",maxHeight:0,overflow:"hidden",transition:"all 300ms ease-out","&[data-open='true']":{maxHeight:"1/3",paddingTop:16,paddingBottom:16,borderWidth:"lg",overflow:"scroll"}});return R("div",{"data-open":t,className:o,children:[R("div",{className:eR({justifyContent:"space-between"}),children:[I(iq,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(iq,{label:"Amount",data:Co(hh(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(iq,{label:"Bank Account",data:mh(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(iq,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function sq({conversationId:e,transactionId:t}){const[n,r]=d(e),[a,o]=d(!0),{query:{data:i}}=Ol(n),l="CLOSED"===i?.resolutionStatus;return I(SB,{children:R(NB,{children:[I(tq,{subject:i?.subject??"Conversation",children:ur(t)&&I(aq,{onClick:()=>o(!a),active:a},"infoButton")}),ur(t)&&I(lq,{transactionId:t,isOpen:a}),I(VH,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function cq(){const e=ss().length>1;return I(SB,{children:R(NB,{background:"foreground",children:[I(jv,{children:R(Kv,{children:[I(rh,e?{Icon:al}:{}),I(Eo,{children:"Add New Connection"})]})}),I(qA,{})]})})}function dq(){return I(jv,{children:R(Kv,{children:[I(rh,{}),I(Eo,{children:"Financial Summary"})]})})}const uq=rr({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),hq=kr.raw({body:"default"}),pq=rr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},hq);function gq({summaryText:e}){return I("div",{className:uq,children:I("div",{className:pq,children:e})})}const mq=rr({display:"flex",flexDirection:"column",overflow:"auto"});function vq({summary:e}){return R("div",{className:mq,children:[I(dq,{}),I(gq,{summaryText:e})]})}const fq=rr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function bq({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Br({queryKey:Ls({id:e}),queryFn:Os})}({id:e});return I(SB,{children:R("div",{className:fq,children:[I(NB,{children:I(vq,{summary:n?.summary})}),I(dp,{}),I(UH,{conversationId:t??null,attachedEntityId:e})]})})}function yq(){return I(SB,{children:I(NB,{children:I(oS,{showCloseButton:!0,inOverlay:!0})})})}const wq=S.object({id:S.string(),name:S.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:S.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:S.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Rr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),Cq={mergeDestination:Mm,selectedAccount:null};const xq=rr({display:"flex",flexDirection:"column",gap:"20px"}),Tq=rr({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),kq=rr.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),Eq=rr(kq,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),Aq=rr(kq,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),Sq=rr(kq,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),Iq=rr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),Nq=rr({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),Rq=rr({width:"100%",display:"flex",justifyContent:"flex-start"}),Pq=rr({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),Dq=rr({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),Mq=e=>{Ip(e),Np(e)};function Lq({account:e}){const t=Sc(),n=function(e,t){const{mutateAsync:n}=_h(),r=RW();return wb({defaultValues:Cq,onSubmit:async a=>{if(await Zh()===Zu&&ur(e)&&ur(a.value.selectedAccount)){const s=(o=e,i=a.value.mergeDestination,l=a.value.selectedAccount,i===Mm?{...Kh(l),duplicateBankAccountIds:[hs(o.id)]}:{...Kh(o),duplicateBankAccountIds:[hs(l.id)]});try{await n(s),t.close(),a.value.mergeDestination===Mm&&r()}catch{await Gh()}}var o,i,l},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=xh();if(!(r&&r.data||a))return null;const o=r?.data?.filter(t=>t.glAccountId&&t.isSupported&&t.id!==e?.id&&t.integration?.id!==e?.integration?.id);return R("form",{className:xq,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:Mq,children:[I(Eo,{children:"Merge Accounts"}),I("div",{className:Tq,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:Eq,children:[I("div",{className:Rq,children:I(Eo,{children:"Duplicate Account"})}),t===Mm?I(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Fm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Om(t,e,n.state.value)})})]}),R("div",{className:Aq,children:[I("div",{className:Pq,children:I(Eo,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:Nq,children:I(ec,{onClick:()=>e.handleChange(e.state.value===Mm?Dm:Mm),children:I(Pd,{Component:ol})})})})]}),R("div",{className:Sq,children:[I("div",{className:Dq,children:I(Eo,{children:"Destination Account"})}),t===Mm?I(n.AppField,{name:"selectedAccount",children:n=>I(Fm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Om(t,e,n.state.value)})}):I(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:Iq,children:[I(kb,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(np,{disabled:dr(e),showIcon:!1,textContent:"Merge"})})]})]})}function Fq({bankAccount:e}){return I(Ug,{children:R(Ac,{placement:"right-start",children:[I(Ic,{children:e=>R(qg,{...e,children:[I(Pd,{Component:xE}),I(uc,{children:"Merge Account"})]})}),I(Fv,{children:I(Uv,{children:I(hE,{children:I(Lq,{account:e})})})})]})})}const Oq=rr({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"left",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}}),Vq=({tranStartDate:e})=>R(N,{children:[I(So,{children:"Start Date"}),Pr(e)?I(Eo,{children:`${Ot(Rt(e))}`}):I(Eo,{children:"Set Start Date"})]});function Uq({bankAccount:e}){return R(Ac,{placement:"right-start",children:[I(Ic,{children:t=>I("button",{className:or(pr(cr["start-date-form-section"]),Oq,cl),...t,type:"button",children:I(Vq,{tranStartDate:e.tranStartDate})})}),I(Fv,{children:I(Uv,{children:I(hE,{width:"sm",children:I(yE,{bankAccounts:[e]})})})})]})}const Bq=e=>["accounting/manualJournalEntry",e.id],Hq=async e=>{const t=e.queryKey,n=t[2].accessToken,r=t[2].environment,a={path:"/accounting/manualJournalEntry?id={id}",pathParams:{id:t[1]},accessToken:n,environment:r};return await Ii(a)};function Wq({id:e}){return Br({queryKey:Bq({id:String(hs(e))}),queryFn:Hq,enabled:ur(e)})}const _q=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/accounting/manualJournalEntry",bodyParams:{manualJournalEntry:e},accessToken:t,endpointManager:Ba(n)};return await La(r)})({data:e,accessToken:t,environment:n});const zq=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Ba(n)};return await La(r)},jq=S.object({amount:S.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:S.string("Required")}),qq=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===hs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},Kq=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=Wq({id:t??null}),r=function(){const{query:{data:e}}=CC();return PC(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutateAsync:a}=Oh({mutationFn:zq,meta:{toastOptions:{defaultErrorMessage:"Couldn't save beginning balance"}},onSuccess:async()=>{xa("beginning balance mutation successful, invalidating bank account queries");try{return Or.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&Ta({error:e,severity:"error"})}}});const{mutateAsync:o}=Oh({onSuccess:async()=>{xa("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Or.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Or.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&Ta({error:e,severity:"error"})}},mutationFn:_q,meta:{toastOptions:{defaultErrorMessage:"Couldn't update journal entry"}}}),i=Sc(),l=((e,t)=>{const n=qq(e,t);return{amount:ur(e.beginningBalanceData.journalEntry?.id)?n:"",date:ur(t?.date)?t.date:""}})(e,n);return wb({defaultValues:l,validators:{onBlur:jq},onSubmit:async l=>{if(dr(t)||dr(n))await a({bankAccountId:hs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(dr(e.id))return null;const o={...e,id:e.id},i=a.map(e=>hs(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===hs(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),dr(l)?null:(o.transactions?.forEach(e=>{i.includes(e.glAccountId)&&(e.drAmount?e.drAmount=Number(e.drAmount)-l:e.crAmount&&(e.crAmount=Number(e.crAmount)-l))}),o.date=Pt(t)??o.date,o)})(n,Rt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);ur(t)&&await o(t)}return i.close()}})},Yq=rr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),Zq=rr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function Gq({bankAccount:e}){const t=Kq(e),n=Sc(),r=()=>{n.close()};return R("form",{className:Yq,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(Eo,{children:"Set Beginning Balance"}),I(t.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),I(t.AppField,{name:"amount",children:e=>I(e.EditableAmountField,{label:"Beginning Balance Amount"})}),I(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:Zq,children:[I(kb,{showIcon:!1,onClick:r}),I(np,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const Qq=lr({base:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",gap:"8px",padding:"12px 16px",borderRadius:"md",textAlign:"right",cursor:"pointer",outline:"none",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"},backgroundColor:{base:"surface.foreground",sm:"surface.intent.action.discreet"},borderWidth:"lg",borderStyle:"solid",borderColor:{base:"border.layout.strong",sm:"transparent"},_supportHover:{backgroundColor:{base:"surface.intent.action",sm:"surface.intent.action.discreet.hover"}}},variants:{layout:{left:{alignItems:"flex-start"},right:{alignItems:"flex-end"}}}}),Xq=rr({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function Jq({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=fr(cr["beginning-balance-form-section"],Qq({layout:a}),cl),i=fr(cr["beginning-balance-form-section"],Qq({layout:"right"}),cl),l=r&&Ot(r);return R(Ac,{placement:"right-start",children:[I(Ic,{children:e=>R("div",{className:Xq,children:[R("button",{...o,...e,type:"button",children:[I(So,{children:"Beginning Balance"}),I(Eo,{children:ur(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{...i,...e,type:"button",children:[I(So,{children:"Migration Date"}),I(Eo,{children:l})]})]})}),I(Fv,{children:I(Uv,{children:I(hE,{width:"sm",children:I(Gq,{bankAccount:e})})})})]})}const $q=lr({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function eK({bankAccount:e,showStartDate:t}){const{query:{data:n}}=Wq({id:e?.beginningBalanceData.journalEntry?.id??null}),r=qq(e,n),a=ur(n?.date)?Rt(n?.date):null,o=ur(e.tranStartDate)?Rt(e.tranStartDate):null,i=ur(a)&&ur(o)&&!kt(a,o),l=i?"left":t?"right":"left";return R("div",{className:$q({layout:i?"stacked":"inline"}),children:[t&&I(Uq,{bankAccount:e}),I(Jq,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const tK=rr({marginTop:"15px",marginBottom:"15px"}),nK={id:"",name:"",mask:"",type:void 0};const rK=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],aK=e=>{Ip(e),Np(e)};function oK({bankAccountId:e}){const t=um(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:nK,[r,a]=d(n),o=function(e,t){const{mutateAsync:n}=_h(),{mutateAsync:r}=Wh({mutationFn:Uh,meta:{toastOptions:{defaultSuccessMessage:"Account created",defaultErrorMessage:"Couldn't create account"}}}),a=Pr(String(e.id)),o=RW();return wb({defaultValues:e,validators:{onBlur:wq},onSubmit:async e=>{if(a)await n(Kh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((i=e.value,{apiAccountName:i.name,apiAccountNo:i.mask??void 0,apiAccountType:i.type||"DEPOSITORY",duplicateBankAccountIds:[]})),a={id:us({id:n?.dataObject?.id,prefix:"BANK_ACCOUNT"}),name:n?.dataObject?.apiAccountName??"",mask:n?.dataObject?.apiAccountNo??"",type:e.value.type};t(a),e.formApi.reset(a,{keepDefaultValues:!0})}var i;return o()},onSubmitInvalid:()=>{}})}(r,a),i=!t||jh(t.apiName),l=!!t&&qh(t.apiName),s=mh(r?.name??"",r?.mask??""),c=Pr(s)?s:"New Bank Account",u=l&&ur(t?.tranStartDate);return I(SB,{children:I(NB,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:aK,children:[R(jv,{children:[R(Kv,{children:[I(rh,{Icon:al}),I(Eo,{children:c}),ur(t)&&I(cE,{shouldUseButtonDiscreteStyles:!0,children:I(Fq,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),R(HH,{children:[I(o.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),I(o.AppField,{name:"mask",children:e=>I(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),I(o.AppField,{name:"type",children:e=>I(e.GenericSelectorField,{label:"Account Type",options:rK,disabled:!i})}),ur(t)&&R(N,{children:[I("div",{className:tK,children:I(dp,{alignment:"horizontal"})}),I(eK,{bankAccount:t,showStartDate:u})]})]})]})})})}function iK(){return I(SB,{children:R(NB,{children:[I(jv,{children:R(Kv,{children:[I(rh,{}),I(Eo,{children:"Add an Account"})]})}),I(HH,{})]})})}function lK({filters:e,filterModels:t,setFilters:n}){const r=ss().length>1,[a,o]=d(()=>XT(e,t));return I(SB,{children:R(NB,{children:[I(jv,{children:R(Kv,{children:[I(rh,r?{Icon:al}:{}),I(uc,{children:"Back"})]})}),I(nO,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),I(DS,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=ek(a);n(e),ls()}})]})})}function sK({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=PI(e);return I(lK,{filters:n,filterModels:t,setFilters:r})}function cK(){const e=CP();return I(sK,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function dK(){const e=BP();return I(sK,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function uK(){const e=_I();return I(sK,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function hK({Icon:e,label:t,popupTriggerChildrenProps:n}){return R(ff,{popupTriggerChildrenProps:n,children:[R(hS,{children:[I(Pd,{Component:e}),I(uc,{children:t})]}),I(Pd,{Component:ol})]})}function pK(){return I(hK,{Icon:yF,label:"Categories"})}const gK=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.50005 8.39072C9.01022 8.39072 10.2345 7.16647 10.2345 5.6563C10.2345 4.14612 9.01022 2.92188 7.50005 2.92188C5.98987 2.92188 4.76562 4.14612 4.76562 5.6563C4.76562 7.16647 5.98987 8.39072 7.50005 8.39072Z"}),r.createElement("path",{d:"M11.5981 13.1742V12.4749C11.5944 11.3904 11.161 10.3516 10.3929 9.58611C9.62473 8.82059 8.58446 8.39074 7.49999 8.39075C6.4131 8.39075 5.37072 8.82251 4.60217 9.59106C3.83362 10.3596 3.40186 11.402 3.40186 12.4889V13.1882"}),r.createElement("path",{d:"M7.50011 14.4244C11.3244 14.4244 14.4245 11.3242 14.4245 7.49998C14.4245 3.67573 11.3244 0.575562 7.50011 0.575562C3.67585 0.575562 0.575684 3.67573 0.575684 7.49998C0.575684 11.3242 3.67585 14.4244 7.50011 14.4244Z"})),"Person"),mK=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function vK(e){return{id:e.id,name:e.name,status:e.status,additionalContactName:e.additionalContactName,businessName:e.businessName,email:e.email,ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoiceSettings:e.invoiceSettings,address:e.address}}function fK(e,t){return{search:Pr(e)?e:void 0,status:{in:t}}}function bK(e){return e.pages.flatMap(e=>(e.data??[]).map(vK))}const yK=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function wK(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function CK(e,t){const n=(e,n)=>kW(e=>!t(e),e,n);return{state:n("state",Rr(e.state)?void 0:e.state),city:n("city",Rr(e.city)?void 0:e.city),zip:n("zip",Rr(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Rr(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Rr(e.address1)?void 0:e.address1),address2:n("address2",Rr(e.address2)?void 0:e.address2)}}const xK=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:yK});function TK(e){return{id:e.id,status:e.status,name:e.name,billingContactName:e.additionalContactName||"",email:e.email||"",ccEmails:e.ccEmails,bccEmails:e.bccEmails,invoicePrefix:e.invoiceSettings.invoicePrefix||"",address:wK(e.address)}}const kK=S.object({state:S.string(),city:S.string(),zip:S.string(),phoneWork:S.string(),address1:S.string(),address2:S.string()}),EK=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:S.string().optional(),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),email:S.email().or(S.literal("")),ccEmails:S.array(S.email()),bccEmails:S.array(S.email()),invoicePrefix:S.string().optional(),address:kK.optional()});function AK({customer:e}){const{mutateAsync:t}=Nv(),n=Sc();return wb({defaultValues:e??xK,validators:{onSubmit:EK},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>kW(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(yK).filter(e=>e in yK).some(e=>!n(e))?CK(e.address??yK,n):void 0,i=a("invoicePrefix",Pr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Pr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Pr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:dr(i)?void 0:{invoicePrefix:i},address:o}}(e,0,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}const SK=Object.entries({UNKNOWN:"UNKNOWN",ALABAMA:"AL",ALASKA:"AK",AMERICAN_SAMOA:"AS",ARIZONA:"AZ",ARKANSAS:"AR",CALIFORNIA:"CA",COLORADO:"CO",CONNECTICUT:"CT",DELAWARE:"DE",DISTRICT_of_COLUMBIA:"DC",FLORIDA:"FL",GEORGIA:"GA",GUAM:"GU",HAWAII:"HI",IDAHO:"ID",ILLINOIS:"IL",INDIANA:"IN",IOWA:"IA",KANSAS:"KS",KENTUCKY:"KY",LOUISIANA:"LA",MAINE:"ME",MARYLAND:"MD",MASSACHUSETTS:"MA",MICHIGAN:"MI",MINNESOTA:"MN",MISSISSIPPI:"MS",MISSOURI:"MO",MONTANA:"MT",NEBRASKA:"NE",NEVADA:"NV",NEW_HAMPSHIRE:"NH",NEW_JERSEY:"NJ",NEW_MEXICO:"NM",NEW_YORK:"NY",NORTH_CAROLINA:"NC",NORTH_DAKOTA:"ND",MARIANA_ISLANDS:"MP",OHIO:"OH",OKLAHOMA:"OK",OREGON:"OR",PENNSYLVANIA:"PA",PUERTO_RICO:"PR",RHODE_ISLAND:"RI",SOUTH_CAROLINA:"SC",SOUTH_DAKOTA:"SD",TENNESSEE:"TN",TEXAS:"TX",UTAH:"UT",VERMONT:"VT",VIRGIN_ISLANDS:"VI",VIRGINIA:"VA",WASHINGTON:"WA",WEST_VIRGINIA:"WV",WISCONSIN:"WI",WYOMING:"WY"}).filter(([e])=>"UNKNOWN"!==e).map(([e,t])=>({label:e.split("_").map(e=>/^[a-z]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),value:t})),IK=rr({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),NK=rr({width:"100%"}),RK=xb({defaultValues:yK,props:{disabled:!1},render:function({group:e,disabled:t}){return R(N,{children:[I(e.AppField,{name:"address1",children:e=>I(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),I(e.AppField,{name:"address2",children:e=>I(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),I(e.AppField,{name:"city",children:e=>I(e.TextField,{label:"City",placeholder:"City",disabled:t})}),R("div",{className:IK,children:[I("div",{className:NK,children:I(e.AppField,{name:"state",children:()=>I(vm,{label:"State",options:[{label:"Select State",value:""},...SK],isEmpty:Rr,disabled:t})})}),I("div",{className:NK,children:I(e.AppField,{name:"zip",children:e=>I(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),I(e.AppField,{name:"phoneWork",children:e=>I(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),PK=rr.raw({width:"100%"});function DK({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o,isSubmitting:i}){const l=ET();return R(N,{children:[I(dp,{alignment:"horizontal",color:"normal"}),R("div",{className:up,children:[!o&&I(sp,{disabled:a,onClick:t,isSubmitting:i}),o&&l&&I(ec,{onClick:n,styles:PK,children:I(uc,{children:r})}),e]})]})}const MK=rr({display:"flex",gap:"8px"});function LK({title:e,customer:t}){const n=AK({customer:t}),[r,a]=d(n.state.values.ccEmails.length>0),[o,i]=d(n.state.values.bccEmails.length>0),l=Sc(),s=ET(),c="ACTIVE"===t?.status,u="INACTIVE"===t?.status,h=u&&!s,{mutateAsync:p}=tv({mutationFn:Sv,onSuccess:Iv,meta:{toastOptions:{defaultSuccessMessage:"Customer deleted",defaultErrorMessage:"Couldn't delete customer"}}}),{mutateAsync:g}=Nv(),m=_W(n),v=async()=>{if(dr(t))return;"RESTORE"===await async function(e){return dh({title:"Restore customer",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&await m(async()=>{await g({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),l.close()})},f=c||h?I(cE,{shouldUseButtonDiscreteStyles:!0,children:R(Ug,{children:[c&&I(HW,{onClick:async()=>{if(dr(t))return;const{id:e}=t;if(dr(e))return;"ARCHIVE"===await async function(e){return dh({title:"Archive customer",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&await m(async()=>{await p({id:e}),l.close()})}}),u&&I(WW,{onClick:v})]})}):null,b=h?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(DK,{onSave:n.handleSubmit,disabled:e,restoreLabel:"Restore Customer",onRestore:v,isArchived:u,isSubmitting:t})});return I(Gv,{title:e,HeaderRightAction:f,Footer:b,padChildren:!1,children:R(HH,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:u})}),I(n.AppField,{name:"billingContactName",children:e=>I(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:u})}),I(n.AppField,{name:"email",children:e=>I(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:u})}),I(n.AppField,{name:"ccEmails",children:e=>r&&I(e.MultiEmailField,{label:"CC Billing Emails",disabled:u})}),I(n.AppField,{name:"bccEmails",children:e=>o&&I(e.MultiEmailField,{label:"BCC Billing Emails",disabled:u})}),(!r||!o)&&R("div",{className:MK,children:[!r&&I(qc,{onClick:()=>a(!0),children:"CC"}),!o&&I(qc,{onClick:()=>i(!0),children:"BCC"})]}),I(n.AppField,{name:"invoicePrefix",children:e=>I(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:u})}),I(RK,{form:n,fields:"address",disabled:u})]})})}function FK({title:e,customer:t}){const n=Sc();return I(Hv,{children:n.open&&I(LK,{title:e,customer:t})})}const OK=rr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function VK({customer:e}){const t=If(),[n,r]=d(!1),a=R(N,{children:[R(hS,{children:[I(Sd,{Component:gK}),R("div",{className:OK,children:[I(uc,{children:e.name}),e.email&&I(So,{children:e.email})]})]}),I(Pd,{Component:ol})]});if(t?.preventDefault)return I(ff,{handleClick:()=>{t.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null})},children:a});const o=()=>{t?.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null}),r(!0)};return R(Ac,t?{enableClickMiddleware:!1,open:n,onOpenChange:r,children:[I(Ic,{children:e=>I(ff,{handleClick:o,popupTriggerChildrenProps:e,children:a})}),I(FK,{title:"Edit Customer",customer:TK(e)})]}:{children:[I(Ic,{children:e=>I(ff,{popupTriggerChildrenProps:e,children:a})}),I(FK,{title:"Edit Customer",customer:TK(e)})]})}const UK=rr.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function BK({selectedValue:e,Icon:t=Up,options:n,onClick:r,additionalStyles:a=[]}){return R(Ac,{children:[I(Ic,{children:n=>R(ec,{popupTriggerProps:n,styles:[UK,...a],children:[I(uc,{children:e.label}),I(Pd,{Component:t})]})}),I(hm,{options:n,onClick:r})]})}const HK=rr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),WK=rr({display:"flex",gap:"8px"}),_K=rr.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function zK({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return R("div",{className:HK,children:[I(uc,{intent:"weak",children:"Search"}),R("div",{className:WK,children:[I(XW,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),I(BK,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[_K]})]})]})}const jK=R(N,{children:[I(Pd,{Component:Bs}),I(uc,{children:"Add Customer"})]});function qK(){const e=If(),[t,n]=d(!1);if(e?.preventDefault)return I(ec,{onClick:()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null})},children:jK});if(ur(e)){const r=()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}),n(!0)};return R(Ac,{enableClickMiddleware:!1,open:t,onOpenChange:n,children:[I(Ic,{children:e=>I(ec,{onClick:r,popupTriggerProps:e,children:jK})}),I(FK,{title:"Add Customer",customer:void 0})]})}return R(Ac,{children:[I(Ic,{children:e=>I(ec,{popupTriggerProps:e,children:jK})}),I(FK,{title:"Add Customer",customer:void 0})]})}function KK(){const[e,t]=d(""),[n,r]=d(mK[0]),{list:a,fetchNextPage:o,canFetchNextPage:i,isLoading:l}=function({searchTerm:e,statuses:t,selected:n,onSelectedChange:r}){const{query:{data:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isFetchingNextPage:s,isPending:c}}=function(e={},t){return jm({queryFn:Ev,queryKey:Cv(e),...t})}({filter:fK(e,t)},{select:bK});return{list:af({data:[a??[]],getRowKey:e=>e.id,getGroupKey:()=>"customers",state:void 0!==n?{selected:n}:void 0,onSelectedChange:r}),data:a,fetchNextPage:o,canFetchNextPage:!i&&l,isLoading:i&&!s||c}}({searchTerm:e,statuses:n.value});return R(Gv,{title:"Back",HeaderRightAction:I(qK,{}),padChildren:!0,children:[I(zK,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:mK,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>I(bS,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>I(VK,{customer:e.value},e.value.id))},e.key)),I(i_,{onIntersect:o,enable:i})]})}function YK(){const e=Sc();return I(Hv,{children:e.open&&I(KK,{})})}function ZK(){return R(Ac,{children:[I(Ic,{children:e=>I(hK,{Icon:gK,label:"Customers",popupTriggerChildrenProps:e})}),I(YK,{})]})}const GK=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",strokeMiterlimit:10,strokeLinecap:"square",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.05348 1.63635V5.42983C4.05348 5.88785 3.87154 6.3271 3.54768 6.65096C3.22381 6.97483 2.78456 7.15677 2.32655 7.15677C1.86853 7.15677 1.42928 6.97483 1.10542 6.65096C0.781554 6.3271 0.599609 5.88785 0.599609 5.42983L1.97971 1.63635H4.05348Z"}),r.createElement("path",{d:"M7.50007 1.63635V5.42983C7.51534 5.66553 7.4821 5.90185 7.4024 6.12419C7.3227 6.34653 7.19825 6.55015 7.03673 6.72248C6.8752 6.8948 6.68005 7.03216 6.46333 7.12607C6.24661 7.21997 6.01293 7.26842 5.77674 7.26842C5.54055 7.26842 5.30687 7.21997 5.09015 7.12607C4.87343 7.03216 4.67828 6.8948 4.51676 6.72248C4.35524 6.55015 4.23078 6.34653 4.15108 6.12419C4.07139 5.90185 4.03815 5.66553 4.05342 5.42983V1.63635H7.50007Z"}),r.createElement("path",{d:"M10.9468 1.63635V5.42983C10.9621 5.66553 10.9289 5.90185 10.8492 6.12419C10.7695 6.34653 10.645 6.55015 10.4835 6.72248C10.322 6.8948 10.1268 7.03216 9.91011 7.12607C9.69339 7.21997 9.45971 7.26842 9.22352 7.26842C8.98733 7.26842 8.75365 7.21997 8.53693 7.12607C8.32021 7.03216 8.12506 6.8948 7.96354 6.72248C7.80201 6.55015 7.67756 6.34653 7.59786 6.12419C7.51817 5.90185 7.48493 5.66553 7.5002 5.42983V1.63635H10.9468Z"}),r.createElement("path",{d:"M14.4007 5.42983C14.4007 5.88785 14.2187 6.3271 13.8948 6.65096C13.571 6.97483 13.1317 7.15677 12.6737 7.15677C12.2157 7.15677 11.7764 6.97483 11.4526 6.65096C11.1287 6.3271 10.9468 5.88785 10.9468 5.42983V1.63635H13.0205L14.4007 5.42983Z"}),r.createElement("path",{d:"M13.0206 7.15678V13.3636H1.97974V7.15678H2.32657C2.55335 7.15678 2.77792 7.11211 2.98744 7.02532C3.19696 6.93854 3.38734 6.81133 3.5477 6.65097C3.70806 6.49061 3.83526 6.30023 3.92205 6.09071C4.00884 5.88119 4.05351 5.65662 4.05351 5.42984C4.03824 5.66554 4.07148 5.90186 4.15117 6.12419C4.23087 6.34653 4.35532 6.55016 4.51685 6.72248C4.67837 6.89481 4.87352 7.03217 5.09024 7.12607C5.30696 7.21998 5.54064 7.26842 5.77683 7.26842C6.01302 7.26842 6.2467 7.21998 6.46342 7.12607C6.68014 7.03217 6.87529 6.89481 7.03681 6.72248C7.19834 6.55016 7.32279 6.34653 7.40249 6.12419C7.48218 5.90186 7.51542 5.66554 7.50015 5.42984C7.48488 5.66554 7.51812 5.90186 7.59782 6.12419C7.67752 6.34653 7.80197 6.55016 7.96349 6.72248C8.12502 6.89481 8.32017 7.03217 8.53689 7.12607C8.75361 7.21998 8.98729 7.26842 9.22348 7.26842C9.45967 7.26842 9.69335 7.21998 9.91007 7.12607C10.1268 7.03217 10.3219 6.89481 10.4835 6.72248C10.645 6.55016 10.7694 6.34653 10.8491 6.12419C10.9288 5.90186 10.9621 5.66554 10.9468 5.42984C10.9468 5.65662 10.9915 5.88119 11.0783 6.09071C11.165 6.30023 11.2922 6.49061 11.4526 6.65097C11.613 6.81133 11.8033 6.93854 12.0129 7.02532C12.2224 7.11211 12.447 7.15678 12.6737 7.15678H13.0206Z"}),r.createElement("path",{d:"M10.2604 9.91696H4.73999V13.3636H10.2604V9.91696Z"})),"Vendor"),QK=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:yK,iconUrl:void 0});function XK(e){return{id:e.id,name:e.name,status:e.status,address:wK(e.address),iconUrl:e.iconUrl||void 0}}const JK=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),address:kK.optional(),iconUrl:S.string().optional()});const $K=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function eY(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address}}function tY(e,t,n){return{search:Pr(e)?e:void 0,name:dr(n)?void 0:{notEqual:n},status:{in:t}}}function nY(e){return e.pages.flatMap(e=>(e.data??[]).map(eY))}function rY({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:tY(e,t,n)},u={select:nY},jm({queryFn:Qm,queryKey:Km(d),...u}));var d,u;return{list:af({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"vendors",state:void 0!==r?{selected:r}:void 0,onSelectedChange:a}),data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isLoading:l&&!c}}const aY=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M13.4375 7.5H0.3125",strokeMiterlimit:10}),r.createElement("path",{d:"M8.6626 2.72498L13.4376 7.49998L8.6626 12.275",strokeMiterlimit:10})),"LongArrowRight"),oY=rr({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),iY=rr({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),lY=lr({base:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"8px",padding:"8px",borderWidth:"md",borderColor:"border.layout",borderStyle:"solid",flex:"1",minWidth:"0"},variants:{archivedVendor:{true:{backgroundColor:"surface.background"},false:{backgroundColor:"surface.foreground"}}}}),sY=rr({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),cY=rr({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function dY({targetVendor:e,duplicateVendor:t}){return R("div",{className:oY,children:[I(uc,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),R("div",{className:iY,children:[R("div",{className:lY({archivedVendor:!0}),children:[I(Pd,{imageUrl:t.iconUrl,Component:GK}),I(uc,{intent:"weak",children:t.name})]}),R("div",{className:sY,children:[I(Pd,{Component:aY,stylists:[fr(null,cY)]}),I(So,{intent:"weak",children:"Merging Into"})]}),R("div",{className:lY({archivedVendor:!1}),children:[I(Pd,{imageUrl:e.iconUrl,Component:GK}),I(uc,{children:e.name})]})]}),I(uc,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function uY({vendor:e,onClose:t}){const{mutate:n}=tv({mutationFn:iv,onSuccess:lv}),[r,a]=d({}),[o,i]=d(""),{list:l,data:s,fetchNextPage:c,isFetching:u,hasNextPage:h,isLoading:p}=rY({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),g=Sc(),m=I(vp,{onSave:async()=>{const a=Object.keys(r).find(e=>r[e]),o=s?.find(e=>e.id===a);if(!o)return;const i={name:o.name,iconUrl:o.iconUrl||void 0};"MERGE"===await async function({targetVendor:e,duplicateVendor:t}){return dh({title:"Confirm Merge",body:I(dY,{targetVendor:e,duplicateVendor:t}),cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"action",key:"MERGE",label:"Merge"}]}).then(e=>"MERGE"===e?"MERGE":"CANCEL").catch(()=>"CANCEL")}({targetVendor:i,duplicateVendor:e})&&(n({targetId:o.id,duplicateId:e.id??""}),t()),g.close()},disabled:p||Object.values(r).every(e=>!e)});return R(Gv,{title:"Back",Footer:m,padChildren:!0,children:[I(XW,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>I(bS,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>I(bf,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:R(hS,{children:[I(Sd,{imageUrl:e.value.iconUrl??void 0,Component:GK}),I(uc,{children:e.value.name})]})},e.value.id))},e.key)),I(i_,{onIntersect:c,enable:!u&&h})]})}function hY({vendor:e,onClose:t}){const n=Sc();return I(Hv,{children:n.open&&I(uY,{vendor:e,onClose:()=>{t(),n.close()}})})}function pY({vendor:e,onClose:t}){return R(Ac,{children:[I(Ic,{children:e=>I(hN,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),I(hY,{vendor:e,onClose:t})]})}const gY=rr.raw({width:"100%"});function mY({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o,isSubmitting:i}){const l=ET();return I(DK,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,isSubmitting:i,children:l&&!dr(e)&&R(Ac,{children:[I(Ic,{children:e=>I(ec,{popupTriggerProps:e,styles:gY,children:I(uc,{children:"Merge"})})}),I(hY,{vendor:e,onClose:r})]})})}function vY({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=sv(),n=Sc();return wb({defaultValues:e??QK,validators:{onSubmit:JK},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(yK).filter(e=>e in yK).some(e=>!t(e))?CK(e.address??yK,t):void 0;return{id:e.id,name:e.name,address:n}}(e,e=>r.getFieldMeta(`address.${e}`)?.isDefaultValue??!0),{result:o}=await t({data:[a]});"SUCCESS"===o&&n.close()}})}({vendor:t}),r=Sc(),a=ET(),o="ACTIVE"===t?.status,i="INACTIVE"===t?.status,{mutateAsync:l}=tv({mutationFn:ov,onSuccess:lv,meta:{toastOptions:{defaultSuccessMessage:"Vendor deleted",defaultErrorMessage:"Couldn't delete vendor"}}}),{mutateAsync:s}=sv(),c=_W(n),d=async()=>{if(dr(t))return;"RESTORE"===await async function(e){return dh({title:"Restore vendor",body:`Are you sure you want to restore "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"success",key:"RESTORE",label:"Restore"}]}).then(e=>"RESTORE"===e?"RESTORE":"CANCEL").catch(()=>"CANCEL")}(t)&&await c(async()=>{await s({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),r.close()})},u=o&&(!a||o),h=i&&!a,p=dr(t)||!u&&!h?null:I(cE,{shouldUseButtonDiscreteStyles:!0,children:R(Ug,{children:[i&&I(WW,{onClick:d}),!a&&I(pY,{vendor:t,onClose:()=>r.close()}),o&&I(HW,{onClick:async()=>{if(dr(t)||dr(t.id))return;const{id:e}=t;if(dr(e))return;"ARCHIVE"===await async function(e){return dh({title:"Archive vendor",body:`Are you sure you want to archive "${e?.name}"?`,cancellable:!0,buttons:[{type:"default",key:"CANCEL",label:"Cancel"},{type:"danger",key:"ARCHIVE",label:"Archive"}]}).then(e=>"ARCHIVE"===e?"ARCHIVE":"CANCEL").catch(()=>"CANCEL")}(t)&&await c(async()=>{await l({id:e}),r.close()})}})]})}),g=i&&!a?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:a})=>I(mY,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>r.close(),disabled:e,isSubmitting:a,isArchived:i})});return I(Gv,{title:e,HeaderRightAction:p,Footer:g,padChildren:!1,children:R(HH,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:i,maxLength:255})}),I(RK,{form:n,fields:"address",disabled:i})]})})}function fY({title:e,vendor:t}){const n=Sc();return I(Hv,{children:n.open&&I(vY,{title:e,vendor:t})})}const bY=rr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function yY({vendor:e}){return R(Ac,{children:[I(Ic,{children:t=>R(ff,{popupTriggerChildrenProps:t,children:[R(hS,{children:[I(Sd,{imageUrl:e.iconUrl??void 0,Component:GK}),I("div",{className:bY,children:I(uc,{children:e.name})})]}),I(Pd,{Component:ol})]})}),I(fY,{title:"Edit Vendor",vendor:XK(e)})]})}function wY(){const[e,t]=d(""),[n,r]=d($K[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=rY({searchTerm:e,statuses:n.value}),c=ET();return R(Gv,{title:"Back",HeaderRightAction:R(Ac,{children:[I(Ic,{children:e=>R(ec,{popupTriggerProps:e,children:[I(Pd,{Component:Bs}),!c&&I(uc,{children:"Add Vendor"})]})}),I(fY,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[I(zK,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:$K,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>I(bS,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>I(yY,{vendor:e.value},e.value.id))},e.key)),I(i_,{onIntersect:o,enable:!i&&l})]})}function CY(){const e=Sc();return I(Hv,{children:e.open&&I(wY,{})})}function xY(){return R(Ac,{children:[I(Ic,{children:e=>I(hK,{Icon:GK,label:"Vendors",popupTriggerChildrenProps:e})}),I(CY,{})]})}const TY=rr({padding:"16px"});function kY(){const e=hn(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return I(SB,{children:R(NB,{children:[I(jv,{children:R(Kv,{children:[I(rh,{Icon:al}),I(Eo,{children:"Back"})]})}),I("div",{className:TY,children:R(bS,{label:"Transaction Settings",children:[e&&I(pK,{}),I(xY,{}),I(ZK,{})]})})]})})}const EY=lr({base:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"8px",cursor:"pointer",padding:"12px 16px",minHeight:"42px",width:"100%",borderRadius:"zero",borderWidth:"md",borderStyle:"solid",borderColor:"transparent",borderLeftWidth:"xl",color:"typography.intent.secondary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",borderColor:"border.intent.action.hover"}},"&:focus-visible":{outlineWidth:"xl",outlineStyle:"solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.foreground",borderLeftColor:"border.intent.action.active"},false:{backgroundColor:"surface.background",borderLeftColor:"transparent"}}}});function AY({children:e,handleClick:t,selected:n=!1}){return I("button",{...fr(cr["selector-row"],EY({selected:n}),ll),"aria-current":n,onClick:t,type:"button",children:e})}const SY=rr({display:"flex",alignItems:"center",gap:"8px",flex:"1 0 0"});function IY({children:e}){return I("div",{className:SY,children:e})}const NY={FinancialOverview:"/",TransactionsDashboard:"/transactions",BanksAndIntegrations:"/banks",ExpenseDashboard:"/expense",IncomeDashboard:"/income",ReportDashboard:"/reports",Invoices_NOT_IMPL:"/invoices",TimeAndTasks_NOT_IMPL:"/time-and-tasks",Mileage_NOT_IMPL:"/mileage",Payroll_NOT_IMPL:"/payroll",ChartOfAccounts_NOT_IMPL:"/chart-of-accounts",GeneralLedger:"/general-ledger",ChartOfAccounts:"/chart-of-accounts",Journal_NOT_IMPL:"/journal",Taxes_NOT_IMPL:"/taxes"};function RY(e,t){return NY[e.page]===t}const PY=rr({display:"flex",flexDirection:"column",gap:"8px"}),DY=rr({marginTop:"8px",marginBottom:"16px"});function MY({section:e,index:t,onClick:n}){const r=function(){const{isApp:e,navigate:t,location:n}=i(Fd);if(e)return{navigate:t,location:n}}();if(dr(r))return null;const{navigate:a,location:o}=r;return R("div",{className:PY,children:[t>0&&I("div",{className:DY,children:I(dp,{alignment:"horizontal"})}),void 0!==e.label&&I(So,{intent:"weak",children:e.label}),e.items.map(e=>I(AY,{selected:RY(e,o.pathname),handleClick:()=>{a&&(n?.(),a({page:e.page}))},children:R(IY,{children:[I(Pd,{Component:e.Icon}),I(uc,{children:e.label})]})},e.label))]})}const LY=l(null),FY=l(void 0),OY=rr({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"flex-start",alignItems:"center",width:"fit-content",color:"typography.intent.secondary",fontWeight:"label.strong"}),VY=rr({height:"32px",width:"auto",maxWidth:"100%",objectFit:"contain",objectPosition:"left"}),UY=rr({flex:1,overflowY:"auto",display:"flex",flexDirection:"column",padding:"16px",height:"100%"}),BY=rr({paddingTop:"16px",paddingBottom:"16px"});function HY({onClick:e}){const t=i(LY),n=i(FY);if(dr(t))return null;const{sections:r}=t;return R("div",{className:UY,children:[void 0!==n&&R(N,{children:[I("div",{className:OY,children:I("img",{src:n.partnerLogoUrl,alt:n.partnerName,className:VY})}),I("div",{className:BY,children:I(AY,{handleClick:n.onRtlExit,children:R(IY,{children:[I(Pd,{Component:al}),I(uc,{children:"Exit Bookkeeping"})]})})})]}),r.map((t,n)=>I(MY,{section:t,index:n,onClick:e},t.label??n))]})}function WY(){return I(SB,{side:"left",mobileCoverage:"partial",children:I(HY,{onClick:()=>ls()})})}function _Y(){return R(xB,{children:[I(kB,{name:"BankTransactionForm",Component:eq}),I(kB,{name:"Conversation",Component:nq}),I(kB,{name:"MobileConversation",Component:sq}),I(kB,{name:"FinancialSummary",Component:bq}),I(kB,{name:"BanksAndIntegrations",Component:yq}),I(kB,{name:"BankAccountForm",Component:oK}),I(kB,{name:"AccountForm",Component:iK}),I(kB,{name:"NewConnection",Component:cq}),I(kB,{name:"TransactionsFilterList",Component:uK}),I(kB,{name:"ExpensesFilterList",Component:cK}),I(kB,{name:"RevenueFilterList",Component:dK}),I(kB,{name:"TransactionSettingsDrawer",Component:kY}),I(kB,{name:"NavMenu",Component:WY})]})}const zY=({environment:e,children:t})=>I(Vr.Provider,{value:e,children:t});function jY({children:e}){const{query:{data:t},isFilling:n}=Mi(),r={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?us({id:t.companyId,prefix:"COMPANY"}):void 0,customerPartnerId:t?.customerPartnerId,apiPartnerName:t?.apiPartnerName,clientId:t?.clientId,unitIntegrationBankName:t?.unitIntegrationBankName??null,supportedIntegrations:t?.supportedIntegrations??[],isDfy:t?.isDfy??!1,hasBookkeeper:t?.isDfy||!1},a=!dr(r.companyId);return n||a||aa(),a?I(ed.Provider,{value:r,children:e}):null}const qY=e=>["whiteLabels",e??{}],KY=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:ki(t[3].environment)},r=await Ma(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function YY({children:e}){const t=Ri(),{query:{data:n}}=Al({queryKey:qY({filter:{name:{equal:t}}}),queryFn:KY}),r={icons:n?.data?.[0]?.icons};return I(vi.Provider,{value:r,children:e})}const ZY=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const GY="SSE connection failed with status";function QY({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Ur();s(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Ua[o]}/sse/v1/subscribe`);var o;return a.searchParams.append("customerPartnerId",n),t.forEach(e=>a.searchParams.append("events",e)),r&&a.searchParams.append("companyId",r),a.toString()}(r,n,t,e);let i=0;return Le(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${GY} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case ZY.CONNECTED:return void xa("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case ZY.ERROR:throw Ta({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case ZY.CACHE_BUST:return xa("cache bust event received",{sseTypes:JSON.stringify(Array.from(r))}),void function(e){try{const t=JSON.parse(e);Array.isArray(t)&&t.forEach(e=>{setTimeout(()=>{Or.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>Ta({error:e,severity:"error"}))},500*Math.random()),xa(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void Ta({error:t instanceof Error?t:new Error("JSON parse error"),severity:"error",extraData:{data:e}})}}(t)}}({event:a.event,data:a.data,env:r,sseTypes:n,customerPartnerId:t,companyId:e}),onclose:()=>function(){throw Ta({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(GY))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>Ta({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const XY=[ZY.CACHE_BUST];function JY({children:e}){const{companyId:t,customerPartnerId:n}=i(ed);return QY({companyId:t,customerPartnerId:n,sseTypes:XY}),e}const $Y=l({dimensions:{width:null,height:null}}),eZ="undefined"!=typeof window?g:s,tZ="undefined"==typeof window;const nZ=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;tZ&&(t=!1);const[n,r]=d(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=OT(r,e.debounceDelay,{leading:!0});function i(){(e.debounceDelay?o:r)({width:window.innerWidth,height:window.innerHeight})}return function(e,t,n,r){const o=a(t);eZ(()=>{o.current=t},[t]),s(()=>{const t=window;if(!t||!t.addEventListener)return;const n=e=>{o.current(e)};return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}},[e,void 0,r])}("resize",i),eZ(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I($Y.Provider,{value:r,children:e})},rZ=({children:e})=>{const{dimensions:t}=i($Y),n=ur(t.width)&&t.width<parseInt(Po("sizes.breakpoint-xl"));return I(kT.Provider,{value:n,children:e})},aZ=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",d:"M8.08708 2.34833H7.91602C7.75004 2.34808 7.58676 2.39026 7.44167 2.47087C7.29657 2.55147 7.1745 2.66783 7.08702 2.80888L1.24458 12.1581C1.14602 12.3136 1.09355 12.4938 1.09325 12.6779C1.09324 12.8069 1.11886 12.9346 1.16861 13.0536C1.21837 13.1726 1.29127 13.2805 1.38309 13.3711C1.47491 13.4617 1.58381 13.5332 1.70348 13.5813C1.82314 13.6295 1.95118 13.6534 2.08015 13.6516H13.9229C14.1812 13.6516 14.4289 13.549 14.6115 13.3664C14.7941 13.1838 14.8967 12.9361 14.8967 12.6779C14.8964 12.4938 14.8439 12.3136 14.7454 12.1581L8.91608 2.80888C8.8286 2.66783 8.70652 2.55147 8.56143 2.47087C8.41634 2.39026 8.25306 2.34808 8.08708 2.34833Z",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 5.48663V9.25659",fill:"none",stroke:"inherit",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",fill:"none",stroke:"inherit",strokeMiterlimit:10})),"ToastError"),oZ=bi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",strokeMiterlimit:10,d:"M7.99933 15.3859C12.0785 15.3859 15.3854 12.079 15.3854 7.99982C15.3854 3.92062 12.0785 0.61377 7.99933 0.61377C3.92013 0.61377 0.613281 3.92062 0.613281 7.99982C0.613281 12.079 3.92013 15.3859 7.99933 15.3859Z"}),r.createElement("path",{stroke:"inherit",fill:"none",d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"ToastSuccess"),iZ=fr(cr.toast,rr({boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",width:{base:"92%",xl:"328px"},paddingInline:"16px",paddingBlock:"12px",borderRadius:"sm",backgroundColor:"surface.intent.notification",color:"typography.intent.notification",boxShadow:"box-shadow",willChange:"translate, opacity",transitionProperty:"opacity, translate",transitionDuration:"toast.enter",transitionTimingFunction:"toast.enter","&[data-state='closed']":{transitionDuration:"toast.exit",transitionTimingFunction:"toast.exit"}})),lZ={translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)"},sZ=rr({flex:"1 0 0",minWidth:0}),cZ=rr.raw({lineClamp:2}),dZ=fr(cr["toast-dismiss"],rr({display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",cursor:"pointer",padding:0,color:"typography.intent.notification",flexShrink:0,borderRadius:"sm",outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}})),uZ=lr({base:{},variants:{type:{error:{fill:"typography.intent.notification",stroke:"surface.intent.notification"},success:{fill:"typography.intent.notification",stroke:"surface.intent.notification"}}}});function hZ({title:e,type:t}){const n=fr(null,uZ({type:t}));return R(Fe.Root,{...iZ,style:lZ,children:[I(Pd,{Component:"success"===t?oZ:aZ,stylists:[n]}),I(Fe.Title,{className:sZ,children:"string"==typeof e?I(uc,{intent:"notification",wrap:"wrap",extraClassNames:[cZ],children:e}):e}),I(Fe.CloseTrigger,{...dZ,children:I(ul,{Component:Nc})})]})}const pZ=Oe({placement:"bottom",offsets:{top:"0px",right:"0px",bottom:"60px",left:"0px"},gap:8,removeDelay:250,duration:3e3,max:24,pauseOnPageIdle:!0,overlap:!1}),gZ={success:3e3,error:6e3};function mZ(e,t,n){const r=n?.dedupeKey??`${e}:${t}`,a=Date.now();return function(e,t){const n=vZ.get(e);return void 0!==n&&t-n<2e3}(r,a)?null:(function(e,t){for(const[n,r]of vZ)t-r>=2e3&&vZ.delete(n);vZ.set(e,t)}(r,a),function(){const e=pZ.getVisibleToasts();!function(e){for(const t of fZ)e.has(t)||fZ.delete(t)}(new Set(e.map(e=>e.id)));const t=e.filter(e=>void 0!==e.id&&!fZ.has(e.id));if(t.length<3)return;const n=[...t].reverse().find(e=>"error"!==e.type)??t[t.length-1];void 0!==n?.id&&(fZ.add(n.id),pZ.update(n.id,{removeDelay:0}),pZ.dismiss(n.id))}(),pZ.create({type:e,title:t,duration:n?.duration??gZ[e]}))}const vZ=/* @__PURE__ */new Map,fZ=/* @__PURE__ */new Set;function bZ({children:e}){const t=o(()=>({createToast:mZ,dismiss:pZ.dismiss}),[]);return R(Ph.Provider,{value:t,children:[e,I(Ue,{children:I(Ve,{toaster:pZ,children:e=>{return I(hZ,{title:e.title,type:(t=e.type,"success"===t?"success":"error")},e.id);var t}})})]})}function yZ({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return s(()=>{var e,r;e=n,r=t,fa.setProperties(wa),ya=r,ba=e},[n,t]),I(zY,{environment:t,children:I(vB,{children:I(Dr.Provider,{value:r,children:I(jY,{children:I(YY,{children:I(JY,{children:I(nZ,{children:I(rZ,{children:R(bZ,{children:[I(we.ConfirmationRoot,{}),e,I(_Y,{})]})})})})})})})})})}function wZ({children:e,initialNav:t}){const n=gL(),r=uL(),i=a(void 0),l=u(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),c=u(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),d=u(e=>{const t=NY[e.page];t!==r.pathname&&(hn.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&is(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);s(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&is(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:d,registerAnchor:c,location:r,initialPageProps:t.pageProps}),[d,c,r,t.pageProps]);return I(Fd.Provider,{value:p,children:e})}const CZ=XN({gap:"16px",alignItems:"stretch",width:"100%"});function xZ({limit:e}){const t=ze(),n=hn(e=>e.generalLedgerGlAccountId),r=hn(e=>e.generalLedgerDateRange),a=hn(e=>e.generalLedgerAccountingMethod),o=hn(e=>e.setGeneralLedgerGlAccountId),i=hn(e=>e.setGeneralLedgerDateRange),l=hn(e=>e.setGeneralLedgerAccountingMethod),[s,c]=d(""),u=jk();return t?R("div",{className:CZ,children:[u&&I(Hk,{}),I(wr,{children:I(Ar,{children:"General Ledger"})}),I(iB,{glAccountId:n,onGlAccountChange:o,dateRange:r,onDateRangeChange:i,accountingMethod:a,onAccountingMethodChange:l,search:s,onSearchChange:c,limit:e})]}):I(eU,{})}const TZ={FinancialOverview:{path:NY.FinancialOverview,element:I($k,{})},FinancialOverviewDashboard:{path:NY.FinancialOverview,element:I($k,{})},TransactionsDashboard:{path:NY.TransactionsDashboard,element:I(bP,{})},BanksAndIntegrations:{path:NY.BanksAndIntegrations,element:I(sS,{})},ExpenseDashboard:{path:NY.ExpenseDashboard,element:I(OP,{})},IncomeDashboard:{path:NY.IncomeDashboard,element:I(_P,{})},Invoices_NOT_IMPL:{path:NY.Invoices_NOT_IMPL,element:I(eU,{})},TimeAndTasks_NOT_IMPL:{path:NY.TimeAndTasks_NOT_IMPL,element:I(eU,{})},Mileage_NOT_IMPL:{path:NY.Mileage_NOT_IMPL,element:I(eU,{})},Payroll_NOT_IMPL:{path:NY.Payroll_NOT_IMPL,element:I(eU,{})},ReportDashboard:{path:NY.ReportDashboard,element:I(pB,{})},ChartOfAccounts_NOT_IMPL:{path:NY.ChartOfAccounts_NOT_IMPL,element:I(eU,{})},GeneralLedger:{path:NY.GeneralLedger,element:I(function({limit:e=100}={}){return ze()?I(Xk,{children:I(xZ,{limit:e})}):I(eU,{})},{})},Journal_NOT_IMPL:{path:NY.Journal_NOT_IMPL,element:I(eU,{})},Taxes_NOT_IMPL:{path:NY.Taxes_NOT_IMPL,element:I(eU,{})}},kZ=bi(e=>r.createElement("svg",{width:12,height:13,viewBox:"0 0 12 13",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.03662 4.44452H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 6.4079H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 8.37134H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.9267 11.3112H2.07323C1.88019 11.3112 1.68904 11.2732 1.5107 11.1993C1.33236 11.1254 1.17031 11.0172 1.03381 10.8807C0.758141 10.605 0.603271 10.2311 0.603271 9.84124V1.01123L1.8882 1.99291L3.21938 1.01123L4.52487 1.99291L5.83549 1.01123L7.14098 1.99291L8.4516 1.01123V9.84124C8.45296 10.2316 8.60897 10.6054 8.88546 10.881C9.16195 11.1565 9.53637 11.3112 9.9267 11.3112Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.07324 4.44452H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 6.4079H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 8.37134H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M9.43334 4.93286H11.3967V9.84128C11.3745 10.2168 11.2097 10.5696 10.936 10.8276C10.6623 11.0856 10.3003 11.2293 9.92419 11.2293C9.54803 11.2293 9.18609 11.0856 8.91237 10.8276C8.63866 10.5696 8.47385 10.2168 8.45166 9.84128V4.93286H9.43334Z",strokeMiterlimit:10})),"Transactions"),EZ=bi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M3.0668 7.46405H1.11133V11.375H3.0668V7.46405Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.8887 4.53595H8.93323V11.375H10.8887V4.53595Z",strokeMiterlimit:10}),r.createElement("path",{d:"M6.97782 0.625H5.02234V11.375H6.97782V0.625Z",strokeMiterlimit:10}),r.createElement("path",{d:"M0.138672 11.375H11.8613",strokeMiterlimit:10})),"Reports"),AZ={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:kZ}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:vF},{page:"ExpenseDashboard",label:"Expenses",Icon:yF},{page:"IncomeDashboard",label:"Income",Icon:vF}]},{items:[{page:"ReportDashboard",label:"Reports",Icon:EZ}]}]},SZ=bi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.66504 7.91458H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.66504 10.6418H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M12.8125 3.95627V13.9937H2.1875V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.8125 3.95627V4.54998H9.26877V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10})),"Doc"),IZ=bi(e=>r.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M7.5 14.25C11.2279 14.25 14.25 11.2279 14.25 7.5C14.25 3.77208 11.2279 0.75 7.5 0.75C3.77208 0.75 0.75 3.77208 0.75 7.5C0.75 11.2279 3.77208 14.25 7.5 14.25Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 2.58856V7.49999L10.5664 10.5664",strokeMiterlimit:10})),"TimeAndTasks"),NZ=bi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.58591 0.969731H4.86823C4.67602 0.970222 4.4865 1.01495 4.31436 1.10046C4.14222 1.18597 3.99207 1.30996 3.87555 1.46283L2.38978 3.44818L0.53418 4.06455V8.3986H2.38978C2.38978 8.06994 2.52034 7.75473 2.75274 7.52233C2.98514 7.28993 3.30034 7.15937 3.629 7.15937C3.95766 7.15937 4.27287 7.28993 4.50527 7.52233C4.73767 7.75473 4.86823 8.06994 4.86823 8.3986H9.20228C9.20228 8.06994 9.33284 7.75473 9.56524 7.52233C9.79764 7.28993 10.1128 7.15937 10.4415 7.15937C10.7702 7.15937 11.0854 7.28993 11.3178 7.52233C11.5502 7.75473 11.6807 8.06994 11.6807 8.3986H14.1592V5.52437C14.1588 5.27713 14.0844 5.03565 13.9457 4.831C13.8069 4.62636 13.6101 4.46789 13.3806 4.37598L11.0644 3.44818L9.57858 1.46283C9.46275 1.30922 9.31275 1.18469 9.14045 1.09911C8.96815 1.01352 8.77829 0.969227 8.58591 0.969731Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4414 9.63788C11.1258 9.63788 11.6806 9.08306 11.6806 8.39865C11.6806 7.71424 11.1258 7.15942 10.4414 7.15942C9.75697 7.15942 9.20215 7.71424 9.20215 8.39865C9.20215 9.08306 9.75697 9.63788 10.4414 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.62887 9.63788C4.31328 9.63788 4.8681 9.08306 4.8681 8.39865C4.8681 7.71424 4.31328 7.15942 3.62887 7.15942C2.94447 7.15942 2.38965 7.71424 2.38965 8.39865C2.38965 9.08306 2.94447 9.63788 3.62887 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.6021 4.06445H4.25195",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9199 6.54297H14.1591",strokeMiterlimit:10}),r.createElement("path",{d:"M7.34668 2.20898V4.06458",strokeMiterlimit:10})),"Mileage"),RZ=bi(F_,"Payroll"),PZ=bi(pO,"ChartOfAccounts"),DZ=bi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.930835 6.6925H4.15797V7.04359C4.15797 7.44029 4.00038 7.82073 3.71987 8.10124C3.43937 8.38174 3.05892 8.53933 2.66223 8.53933H2.42176C2.02507 8.53933 1.64462 8.38174 1.36412 8.10124C1.08361 7.82073 0.926025 7.44029 0.926025 7.04359V6.6925H0.930835Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M0.469116 3.00363H3.07583C3.28237 3.00199 3.48644 2.95853 3.67573 2.87588C3.86502 2.79322 4.0356 2.67307 4.17719 2.52269C4.31979 2.37361 4.49058 2.25433 4.67964 2.17177C4.8687 2.08921 5.07227 2.04502 5.27855 2.04175H6.72138C6.92915 2.04454 7.13431 2.08849 7.325 2.17104C7.51569 2.25359 7.68813 2.37311 7.83236 2.52269C7.97715 2.67285 8.15037 2.7927 8.34193 2.87527C8.53349 2.95784 8.73956 3.00147 8.94815 3.00363H11.5308",strokeMiterlimit:10}),r.createElement("path",{d:"M6 0.699951V11.2999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.76535 11.2999H3.2345",strokeMiterlimit:10}),r.createElement("path",{d:"M2.7728 3.00366H2.31109L0.930786 6.23079V6.6925H4.15792V6.23079L2.7728 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.84197 6.6925H11.0691V7.04359C11.0691 7.44029 10.9115 7.82073 10.631 8.10124C10.3505 8.38174 9.97006 8.53933 9.57336 8.53933H9.33289C8.9362 8.53933 8.55575 8.38174 8.27525 8.10124C7.99474 7.82073 7.83716 7.44029 7.83716 7.04359V6.6925H7.84197Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.68886 3.00366H9.22716L7.84204 6.23079V6.6925H11.0692V6.23079L9.68886 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"})),"GeneralLedger"),MZ=bi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.650024 1.86523V8.67246H4.54278C4.73458 8.67246 4.92449 8.71032 5.10162 8.78387C5.27875 8.85742 5.43962 8.96522 5.57501 9.10108C5.71039 9.23693 5.81762 9.39818 5.89056 9.57557C5.96349 9.75295 6.00069 9.943 6.00002 10.1348V3.32247C6.00002 3.1311 5.96232 2.94161 5.88909 2.76481C5.81586 2.58801 5.70852 2.42737 5.5732 2.29205C5.43788 2.15673 5.27724 2.04939 5.10044 1.97616C4.92364 1.90293 4.73415 1.86523 4.54278 1.86523H0.650024Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 1.86523V8.67246H7.45724C7.26545 8.67246 7.07554 8.71032 6.89841 8.78387C6.72127 8.85742 6.5604 8.96522 6.42502 9.10108C6.28963 9.23693 6.1824 9.39818 6.10947 9.57557C6.03654 9.75295 5.99934 9.943 6.00001 10.1348V3.32247C6.00001 2.93599 6.15354 2.56533 6.42682 2.29205C6.70011 2.01876 7.07076 1.86523 7.45724 1.86523H11.35Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 8.67249V10.1348H7.45725H4.54278H0.650024V8.67249",strokeMiterlimit:10})),"Journal"),LZ={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:kZ}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:vF},{page:"ExpenseDashboard",label:"Expenses",Icon:yF},{page:"IncomeDashboard",label:"Income",Icon:vF}]},{items:[{page:"Invoices_NOT_IMPL",label:"Invoices",Icon:SZ},{page:"TimeAndTasks_NOT_IMPL",label:"Time & Tasks",Icon:IZ},{page:"Mileage_NOT_IMPL",label:"Mileage",Icon:NZ},{page:"Payroll_NOT_IMPL",label:"Payroll",Icon:RZ},{page:"ReportDashboard",label:"Reports",Icon:EZ}]},{label:"Accounting",items:[{page:"ChartOfAccounts_NOT_IMPL",label:"Chart of Accounts",Icon:PZ},{page:"GeneralLedger",label:"General Ledger",Icon:DZ},{page:"Journal_NOT_IMPL",label:"Journal",Icon:MZ}]},{items:[{page:"Taxes_NOT_IMPL",label:"Taxes",Icon:CF}]}]},FZ=rr({position:"sticky",top:0,alignSelf:"flex-start",width:"256px",maxWidth:"256px",height:"100dvh",display:"flex",flexDirection:"column",backgroundColor:"surface.background",borderRight:"1px solid {colors.border.layout}",flexShrink:0});function OZ(){return I("div",{className:FZ,children:I(HY,{})})}const VZ=rr({width:"100%",display:"flex",flexDirection:"row"}),UZ=rr({flex:1,display:"flex",flexDirection:"column",padding:{xl:"50px",base:"16px"}});function BZ(){const e=ET();return R("div",{className:VZ,children:[!e&&I(OZ,{}),I("div",{className:UZ,children:I(HL,{children:Object.entries(TZ).map(([e,t])=>I(VL,{path:t.path,element:t.element},e))})})]})}function HZ(e){const{accessToken:t,environment:n="PRODUCTION",initialNav:r={page:"FinancialOverview"},buildTarget:a,rtlConfig:o}=e,i=/* @__PURE__ */function(e){return e?LZ:AZ}("PLAYGROUND"===a||"LAB"===a);return I(FL,{initialEntries:[TZ[r.page].path],children:I(FY.Provider,{value:o,children:I(wZ,{initialNav:r,children:I(LY.Provider,{value:i,children:I(yZ,{environment:n,accessToken:t,children:I(BZ,{})})})})})})}const WZ=["BanksAndIntegrations"],_Z={BanksAndIntegrations:!0,FinancialOverview:!0,TransactionsDashboard:!0,ExpenseDashboard:!0,IncomeDashboard:!0,ReportDashboard:!0,GeneralLedger:!0,ChartOfAccounts:!0},zZ=new Set(Object.values(mi).flatMap(e=>Object.values(e)));function jZ(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!_Z[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&WZ.includes(i)){const e=function(e){if("BanksAndIntegrations"===e)return{name:e}}(a);void 0!==e&&(o=e)}var i,l;if("FinancialOverview"===n||"FinancialOverviewDashboard"===n){const e=t.searchParams.get("bkAnchor"),r=null!==(l=e)&&zZ.has(l)?e:void 0,a=function(e){const t=e.get("bkPage_period_month"),n=e.get("bkPage_period_year");if(null===t||null===n)return;const r=parseInt(t,10),a=parseInt(n,10);return!Number.isInteger(r)||r<0||r>11||!Number.isInteger(a)||a<2e3||a>2100?void 0:{month:r,year:a}}(t.searchParams),i=void 0!==a?{period:a}:void 0;return void 0!==r&&void 0!==o?{page:n,anchor:r,drawer:o,...void 0!==i?{pageProps:i}:{}}:void 0!==r?{page:n,anchor:r,...void 0!==i?{pageProps:i}:{}}:void 0!==o?{page:n,drawer:o,...void 0!==i?{pageProps:i}:{}}:{page:n,...void 0!==i?{pageProps:i}:{}}}return void 0!==o?{page:n,drawer:o}:{page:n}}export{sS as BanksAndIntegrations,OP as ExpenseDashboard,$k as FinancialOverview,_P as IncomeDashboard,pB as ReportDashboard,yZ as Tight,HZ as TightApp,bP as TransactionsDashboard,jZ as parseNavUrl,Sn as useEmbeddedEventListeners,An as useEventSource,kn as useOptions};
2
2
  //# sourceMappingURL=index.js.map