@tight-embedded/react 6.7.1 → 6.9.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,3 +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,createContext as i,useContext as l,Component as s,useState as c,useCallback as d,useEffect as u,createElement as h,forwardRef as p,useLayoutEffect as g,useImperativeHandle as m,useReducer as v,Fragment as b}from"react";import"zustand/react/shallow";import{cloneDeep as f,entries as y,mapValues as x,isEqual as C,differenceBy as T,debounce as w,isEmpty as k}from"lodash-es";import{v4 as E}from"uuid";import*as A from"zod";import{z as I}from"zod";import{jsx as S,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as D,useIsRestoring as P,useQuery as M,keepPreviousData as L,useMutation as F,useQueries as O,useInfiniteQuery as V}from"@tanstack/react-query";import B from"yocto-queue";import U from"big.js";import{ResponsiveContainer as W,BarChart as H,Legend as z,CartesianGrid as q,XAxis as j,YAxis as _,Tooltip as K,Bar as Y,ReferenceLine as Z,Line as G}from"recharts";import{flexRender as Q,createColumnHelper as X,useReactTable as J,getCoreRowModel as $,getExpandedRowModel as ee}from"@tanstack/react-table";import{useFloatingNodeId as te,useFloating as ne,offset as re,flip as ae,shift as oe,size as ie,autoUpdate as le,useClick as se,useDismiss as ce,useRole as de,useInteractions as ue,useFloatingParentNodeId as he,FloatingTree as pe,FloatingNode as ge,useMergeRefs as me,FloatingPortal as ve,FloatingOverlay as be,FloatingFocusManager as fe}from"@floating-ui/react";import{ContextAwareConfirmation as ye,confirmable as xe}from"react-confirm";import{createFormHookContexts as Ce,useStore as Te,createFormHook as we}from"@tanstack/react-form";import{NumericFormat as ke}from"react-number-format";import Ee from"fuse.js";import Ae from"react-inlinesvg";import{AnimatePresence as Ie,motion as Se}from"motion/react";import{useDropzone as Ne}from"react-dropzone";import{useNavigate as Re,useMatches as De,Outlet as Pe,createMemoryRouter as Me,RouterProvider as Le,useLocation as Fe,MemoryRouter as Oe,Routes as Ve,Route as Be}from"react-router";import{openDB as Ue}from"idb";import{PersistQueryClientProvider as We}from"@tanstack/react-query-persist-client";import{fetchEventSource as He}from"@microsoft/fetch-event-source";function ze(e,t){return`${e.trim()}:${t.trim()}`}const qe=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,FEATUREFLAG_CATEGORY_SETTINGS:!1,FEATUREFLAG_REPORT_FILTERS:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,ze("featureFlags","updateFlags"))});function je(){return ln(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function _e(){return ln(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}let Ke=null,Ye=!1;function Ze(){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 Ge(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Qe(){const e=Ze();if(!e)return;const{meta:t,params:n}=e;if(Ye)return t.remove(),Ye=!1,void(Ke=null);Ke?n["interactive-widget"]=Ke:delete n["interactive-widget"],Ke=null,Ge(t,n)}const Xe="drawerNavigation",Je=(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=Ze();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),Ye=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;Ke=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Ge(t,n)}(),{drawerHistory:[o]};{const t=f(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,ze(Xe,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,ze(Xe,"closeDrawer")),0===t().drawerHistory.length&&Qe()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,ze(Xe,"closeAllDrawers")),Qe()},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,ze(Xe,"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,ze(Xe,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,ze(Xe,"confirmCloseDrawer")),0===t().drawerHistory.length&&Qe()}}),$e=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,ze("externalOptions","setOptions"))});function et(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function tt(e){return Array.isArray(e)&&e.length>0}function nt(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 rt="search",at=nt({key:rt,name:"Search"});function ot(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function it(e,t,n){return new Date(e,t,n)}function lt(e){const[t,n,r]=e.split("-");return it(Number(t),Number(n),Number(r))}function st(){return ot(it(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function ct(e,t){return ot(it(t,e,1))}function dt(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth()+1,0))}function ut(e){const t=/* @__PURE__ */new Date;return ot(it(t.getFullYear(),t.getMonth()-e,1))}function ht(e){const t=e.getMonth(),n=t-t%3;return ot(it(e.getFullYear(),n,1))}function pt(e){const t=e.getMonth(),n=t-t%3+3;return ot(it(e.getFullYear(),n,0))}const gt={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"},mt={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"},vt=e=>Object.values(gt).includes(e),bt={[gt.ALL_TIME]:()=>"",[gt.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ct(e.getMonth(),e.getFullYear())}(),[gt.LAST_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[gt.LAST_MONTH]:()=>ut(1),[gt.LAST_6_MONTHS]:()=>ut(5),[gt.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth()-11,1))}(),[gt.THIS_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear(),0,1)),[gt.LAST_3_MONTHS]:()=>ut(2),[gt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ht(it(e.getFullYear(),e.getMonth()-3,1))}(),[gt.THIS_QUARTER]:()=>ht(/* @__PURE__ */new Date)};function ft(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 yt=e=>bt[e](),xt={[gt.ALL_TIME]:()=>"",[gt.THIS_MONTH]:()=>dt(),[gt.LAST_YEAR]:()=>ot(it(/* @__PURE__ */(new Date).getFullYear(),0,0)),[gt.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ot(it(e.getFullYear(),e.getMonth(),0))}(),[gt.LAST_6_MONTHS]:()=>dt(),[gt.LAST_12_MONTHS]:()=>dt(),[gt.THIS_YEAR]:()=>st(),[gt.LAST_3_MONTHS]:()=>dt(),[gt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return pt(it(e.getFullYear(),e.getMonth()-3,1))}(),[gt.THIS_QUARTER]:()=>pt(/* @__PURE__ */new Date)},Ct=e=>xt[e](),Tt=e=>{return vt(e)?{beginDate:yt(e),endDate:Ct(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:ot((t=e).beginDate),endDate:ot(t.endDate)};var t},wt=["SUN","MON","TUE","WED","THU","FRI","SAT"],kt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Et({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 At(e,t){return e.toDateString()===t.toDateString()}function It(e){return At(e,/* @__PURE__ */new Date)}function St(e,t){const n=it(e.getFullYear(),e.getMonth(),e.getDate()),r=it(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function Nt(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 Rt(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=it(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Dt(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 Rt(o,i,l)?it(l,o-1,i):null}function Pt(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 Rt(i,l,o)?it(o,i-1,l):null}function Mt(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 Lt(e,t){return St(e,t)?t:e}function Ft(e,t){return St(t,e)?t:e}const Ot=(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},Vt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return It(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Ot(t,{abbreviateMonth:!0,abbreviateYear:!1})},Bt=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Ut(e,t){return it(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Wt(e){const{month:t,year:n}=e;return{beginDate:it(n,t-1,1),endDate:it(n,t+1,0)}}const Ht="date",zt=Object.values(gt).map(e=>{return{name:mt[t=e],value:{date:{name:mt[t],value:t}}};var t}),qt=nt({key:Ht,name:"Date",possibleValues:()=>({values:zt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function jt(e){return"OWNER"===e||"READ_ONLY"===e}function _t(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===rt);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==rt)}const Kt=qt.createFilter({name:mt[gt.LAST_12_MONTHS],value:{date:{name:mt[gt.LAST_12_MONTHS],value:gt.LAST_12_MONTHS}}});function Yt(e,t){return _t([...t.some(e=>e.modelKey===Ht)?function(e){const t=e.findIndex(e=>e.modelKey===Ht);return-1!==t?et(e,t):e}(e.filters):e.filters,...t])}function Zt(e,t){const n=e.filters[t];return n&&n.modelKey===Ht?function(e,t){const n=[...e];return n[t]=Kt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Gt(e){return _t(e.some(e=>e.modelKey===Ht)?e:[...e,Kt])}function Qt(e,t){if(e.hasInitialized)return e;const n=[];return jt(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(Kt),{filters:n,hasInitialized:!0}}const Xt="transactionsDashboardFilters",Jt=e=>({transactionsDashboardFilters:[Kt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Yt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,ze(Xt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:Zt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,ze(Xt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Gt(t)}),void 0,ze(Xt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Qt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,ze(Xt,"initialize"))}),$t="expenseDashboardFilters",en=e=>({expenseDashboardFilters:[Kt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Yt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,ze($t,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:Zt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,ze($t,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Gt(t)}),void 0,ze($t,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Qt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,ze($t,"initialize"))}),tn="incomeDashboardFilters",nn=e=>({incomeDashboardFilters:[Kt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Yt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,ze(tn,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:Zt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,ze(tn,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Gt(t)}),void 0,ze(tn,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Qt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,ze(tn,"initialize"))}),rn={label:"Connected Accounts",value:"connected"},an="banksAndIntegrationsState",on=e=>({banksAndIntegrationsSelectedTab:rn,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,ze(an,"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,ze(an,"toggleExpandedIntegration"))}),ln=e()(t(n((...e)=>({...qe(...e),...Je(...e),...$e(...e),...Jt(...e),...en(...e),...nn(...e),...on(...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})),sn={SELECT:"select",EXPAND:"expand"},cn={...sn,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},dn=[cn.COMMENTS,cn.DATE,cn.DESCRIPTION,cn.AMOUNT,cn.CATEGORY,cn.DIMENSION_VALUE,cn.REVIEW_STATUS],un=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(dn)))}),hn=e=>{const t=un.safeParse(e);return t.success?t.data:void 0},pn=A.optional(A.string().trim()),gn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,mn=A.optional(A.array(A.string().trim())),vn=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())}),bn={transactionsDashboard:hn,incomeDashboard:hn,expenseDashboard:hn,accessToken:e=>{const t=pn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=mn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>gn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=vn.safeParse(e);return t.success?t.data:void 0}},fn=(e,t)=>{if(void 0!==bn[e])return(0,bn[e])(t)};function yn(e){const t=a(!1),n=ln(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=fn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=ln(e=>e.externalOptions);return{options:o(()=>f(r),[r]),setOptions:n}}function xn(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Cn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function Tn(e){return String.fromCharCode(e+(e>25?39:97))}function wn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Tn(t%52)+n;return Tn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var kn=/\s*!(important)?/i;function En(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var An=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}},In=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Sn(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(In.has(n))return;const r=e[n],a=t[n];xn(r)&&xn(a)?e[n]=Sn(r,a):e[n]=a}),e):e,{})}var Nn=e=>null!=e;function Rn(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);Nn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Dn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return Rn(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 Pn={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Mn=/([A-Z])/g,Ln=/^ms-/,Fn=An(e=>e.startsWith("--")?e:e.replace(Mn,"-$1").replace(Ln,"-ms-").toLowerCase()),On=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),Vn=`(?:${"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("|")})`,Bn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${Vn}$`),Un={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):xn(e)?Rn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&On.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&Bn.test(e)},Wn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Cn(t))};const Hn=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,base".split(",")),zn=/^@|&|&$/;function qn(e){return Hn.has(e)||zn.test(e)}const jn=/^_/,_n=/&|@/,Kn=/* @__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(":");Kn.set(t,n)});const Yn={conditions:{shift:function(e){return e.sort((e,t)=>{const n=qn(e),r=qn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Hn.has(e)?e.replace(jn,""):_n.test(e)?`[${En(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${Kn.get(e)||Fn(e)}_${En(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},Zn=function(e){const{utility:t,hash:n,conditions:r=Pn}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return An(({base:o,...i}={})=>{const l=Dn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return Rn(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&kn.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(kn,"").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,wn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(Yn),Gn=(...e)=>Zn(Qn(...e));Gn.raw=(...e)=>Qn(...e);const{mergeCss:Qn}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>xn(e)&&Object.keys(Cn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Dn(t,e))}return{mergeCss:An(function(...e){return Sn(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(Yn);function Xn(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const Jn=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function $n(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=Jn(e),o=e=>({...r,...Cn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=Qn(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=Qn(n,e.css))}),n}(a,r);return Qn(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(An(function(e){return Gn(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=Jn(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 $n({base:Qn(t,o.base),variants:Object.fromEntries(i.map(e=>[e,Qn(n[e],o.variants[e])])),defaultVariants:Sn(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 er,tr=((er=tr||{}).component="component",er["dashboard-placeholder-table"]="dashboard-placeholder-table",er["dashboard-header"]="dashboard-header",er["dashboard-table"]="dashboard-table",er["dashboard-table-body"]="dashboard-table-body",er["dashboard-table-cell"]="dashboard-table-cell",er["dashboard-table-column-header"]="dashboard-table-column-header",er["dashboard-table-header"]="dashboard-table-header",er.label="label",er.popup="popup",er["popup-sort-row"]="popup-sort-row",er["progress-bar"]="progress-bar",er["progress-bar-fill"]="progress-bar-fill",er.drawer="drawer",er.summation="summation",er["table-parent-row"]="table-parent-row",er["table-row"]="table-row",er["table-sub-row"]="table-sub-row",er.tile="tile",er["tile-bar-label"]="tile-bar-label",er["tile-bar-label-outer"]="tile-bar-label-outer",er["tile-body"]="tile-body",er["tile-filter-button"]="tile-filter-button",er["tile-filter-list"]="tile-filter-list",er["tile-filter-row"]="tile-filter-row",er["tile-header"]="tile-header",er["business-owner-dashboard"]="business-owner-dashboard",er["business-owner-dashboard-header"]="business-owner-dashboard-header",er["transaction-type-label"]="transaction-type-label",er["transaction-date-cell-container"]="transaction-date-cell-container",er["selector-row"]="selector-row",er["popup-list"]="popup-list",er.badge="badge",er["badge-chip"]="badge-chip",er["date-cell"]="date-cell",er["vertical-divider"]="vertical-divider",er["horizontal-divider"]="horizontal-divider",er["checkbox-input"]="checkbox-input",er["bulk-select"]="bulk-select",er["button-base"]="button-base",er["button-discreet-small"]="button-discreet-small",er["button-primary"]="button-primary",er["button-secondary"]="button-secondary",er["button-success"]="button-success",er["button-danger"]="button-danger",er["button-warning"]="button-warning",er["button-action"]="button-action",er["button-table-header"]="button-table-header",er["button-inline"]="button-inline",er["small-square-button"]="small-square-button",er.card="card",er["card-button"]="card-button",er["card-button-icon-container"]="card-button-icon-container",er["pagination-button"]="pagination-button",er.text="text",er["cell-button"]="cell-button",er["selector-button"]="selector-button",er["review-status-selector-button"]="review-status-selector-button",er["review-status-dropdown-arrow"]="review-status-dropdown-arrow",er["financial-summary-layout"]="financial-summary-layout",er["financial-summary-chatbox"]="financial-summary-chatbox",er["financial-summary-chatbox-header"]="financial-summary-chatbox-header",er["month-picker"]="month-picker",er["month-picker-left-button"]="month-picker-left-button",er["month-picker-right-button"]="month-picker-right-button",er["month-picker-label"]="month-picker-label",er["filter-bar"]="filter-bar",er["filter-search-bar"]="filter-search-bar",er.pill="pill",er["filter-pill"]="filter-pill",er["email-pill"]="email-pill",er["discreet-form-input"]="discreet-form-input",er["editable-form-input"]="editable-form-input",er["category-text"]="category-text",er["amount-input-container"]="amount-input-container",er["amount-input"]="amount-input",er["modal-popup"]="modal-popup",er["drawer-header"]="drawer-header",er["form-body"]="form-body",er.body="body",er.heading="heading",er["sub-label"]="sub-label",er["strong-label"]="strong-label",er["strong-sub-label"]="strong-sub-label",er["weak-label"]="weak-label",er["metric-xl"]="metric-xl",er["metric-md"]="metric-md",er["large-icon"]="large-icon",er["medium-icon"]="medium-icon",er["small-icon"]="small-icon",er["tiny-icon"]="tiny-icon",er["x-large-icon"]="x-large-icon",er["xx-large-icon"]="xx-large-icon",er["category-icon"]="category-icon",er["card-header"]="card-header",er.icon="icon",er["neutral-badge"]="neutral-badge",er["highlight-badge"]="highlight-badge",er["success-badge"]="success-badge",er["warning-badge"]="warning-badge",er["danger-badge"]="danger-badge",er["critical-badge"]="critical-badge",er["button-group"]="button-group",er["alert-dialog"]="alert-dialog",er["alert-header"]="alert-header",er["emphasis-label"]="emphasis-label",er["profit-loss-graph"]="profit-loss-graph",er.banner="banner",er["banner-high"]="banner-high",er["banner-medium"]="banner-medium",er["banner-low"]="banner-low",er["banner-urgent"]="banner-urgent",er["banner-default"]="banner-default",er["banner-button"]="banner-button",er["banner-button-text"]="banner-button-text",er["banner-button-icon"]="banner-button-icon",er["banner-icon"]="banner-icon",er["banner-title"]="banner-title",er["empty-dashboard-layout"]="empty-dashboard-layout",er["emphasis-sub-label"]="emphasis-sub-label",er["bar-transactions-positive"]="bar-transactions-positive",er["bar-transactions-negative"]="bar-transactions-negative",er["message-sent"]="message-sent",er["message-received"]="message-received",er["date-amount-header"]="date-amount-header",er["close-button"]="close-button",er["start-date-form-section"]="start-date-form-section",er["beginning-balance-form-section"]="beginning-balance-form-section",er["date-picker-nav-button"]="date-picker-nav-button",er["date-picker-day-button"]="date-picker-day-button",er["dropdown-selector-button"]="dropdown-selector-button",er.chip="chip",er["attachment-dropzone"]="attachment-dropzone",er["list-body"]="list-body",er["loading-skeleton"]="loading-skeleton",er["line-item-card"]="line-item-card",er["linked-entity-row"]="linked-entity-row",er["drawer-search-bar"]="drawer-search-bar",er["value-comparison-summary"]="value-comparison-summary",er["category-selector-table-cell"]="category-selector-table-cell",er["zero-state-button"]="zero-state-button",er);const nr=e=>null==e,rr=e=>!nr(e),ar="Tight-",or=e=>`${ar}${e}`;function ir(e){return e in tr}function lr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===ar&&r in tr}function sr(e){return!ir(e)&&!lr(e)}const cr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(or(e)),t.forEach(e=>{nr(e)||(sr(e)?r.push(e):ir(e)?n.push(or(e)):lr(e)&&n.push(e))}),{className:Xn(...n,...r)}},dr=cr(tr["business-owner-dashboard-header"],Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function ur({children:e}){return S("div",{...dr,children:e})}function hr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(lr(t)&&e.push(t),e),[])],[])}function pr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(sr(t)&&e.push(t),e),[])],[])}function gr(e){const t=Array.isArray(e)?e:[e];return{className:Xn(...hr(t),...pr(t))}}const mr=$n({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:{xl:"16px",base:"18px"}}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:{xl:"16px",base:"18px"}},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:{xl:"14px",base:"16px"}},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"20px",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"16px"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:{sm:"16px",base:"20px"}},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:{xl:"14px",base:"16px"}},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:{xl:"14px",base:"16px"}}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"25px"}},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"}}}}),vr=cr(tr.heading,mr({heading:"default"}));function br({children:e,stylists:t=[]}){const n=gr([vr,...t]);return S("div",{...n,children:e})}function fr(e,t,n){return[...e,{accessToken:t,environment:n}]}function yr(e,t){return[...e,t]}function xr(e){return""===e.trim()}function Cr(e){return nr(e)||xr(e)}function Tr(e){return!Cr(e)}const wr=i({activeToken:void 0,accountantToken:void 0});function kr(){const{activeToken:e}=l(wr);return e}const Er=()=>{throw new Error("No access token provided")},Ar=72e5,Ir=new D({defaultOptions:{queries:{gcTime:Ar,staleTime:3e4,refetchInterval:6e4}}}),Sr=i("SANDBOX");function Nr(){return l(Sr)}function Rr({queryKey:e,queryFn:t,...n}){const r=kr(),a=Nr(),o=Tr(r),i=fr(e,r??"",a),l=P(),s=M({...n,queryKey:i,queryFn:o?t:Er,...o?{}:{retry:!1,staleTime:1/0}},Ir);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Dr{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 Pr=Symbol("Circular"),Mr=Symbol("AccessError");function Lr(e,t,n){return Fr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Fr({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=Pr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=Or(()=>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=Or(()=>s[i]);e.push(Fr({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=Or(()=>s[c]);e[c]=Fr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function Or(e){try{return e()}catch{return Mr}}const Vr=Object.prototype.toString,Br=Object.getPrototypeOf;function Ur(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Wr=/^\s*at .*(\S+:\d+|\(native\))/m,Hr=/^(eval@)?(\[native code])?$/;function zr(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=jr(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Ur(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[_r(n)];return a.push(...Zr(n).map(e=>_r(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function jr(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===Vr.call(t))return!0;t=Br(t)}return!1}(e))return e;let n=function(e){if(!Ur(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 _r(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:Kr(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function Kr(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(Wr)?e.split("\n").filter(e=>!!e.match(Wr)).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=zr(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(Hr)).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=zr(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<Yr;){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 Yr=20;function Zr(e){const t=e;if(t.cause){const e=jr(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(Zr(e))}return[]}function Gr(...e){console.error}const Qr={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 Xr=Date.now();const Jr=()=>{Xr=Date.now()},$r={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-Xr,!0}),{reset:Jr})},ea=[["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\)$/]],ta=[["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/]],na=(ra=function(e){const t=""!==(n=e)&&ea.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 ta)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,...ra(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 ra;class aa{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 oa extends s{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 S(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return S(N,{children:this.props.children})}}const ia={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>S(oa,{client:e,onError:t,FallbackComponent:n,children:r})})},la=new class{breadcrumbs=[];config;delivery=new Dr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return Gr(),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 m of c){const e=await m(s);if("boolean"==typeof e&&!e)return}const u=Lr(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){Gr()}}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 sa="",ca="";const da="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",ua=la.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.7.1",appType:"browser",releaseStage:da,enabledReleaseStages:["prod","DEV"],plugins:[$r,na,Qr,(()=>{const e=new aa(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),ia]}),ha=(e,t)=>{try{la.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?pa({error:n,severity:"error"}):pa({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},pa=async e=>{try{await la.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:sa,environment:ca}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await pa({error:t,severity:"error"}):await pa({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},ga=ua.getPlugin("react"),ma=ga?.BugsnagErrorBoundary,va=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,ba=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},fa=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},ya={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function xa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...x(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?ya:{}}});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 Ca({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=ba({extraHeaders:t,authorization:e});ha("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return ha("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),fa(e)}catch(l){return Promise.reject(l)}}async function Ta(e){const{url:t,headers:n}=xa(e);return Ca({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function wa(e){return Ta(e)}async function ka(e){return Ta(e)}const Ea=(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}),Aa={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"},Ia={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"},Sa={...Ia,LOCAL:"http://localhost:8082"};function Na(e){return Ea(`${t=e,Aa[t]}/v5`,"v5");var t}const Ra=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Da=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...Tt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Na(a)};return await ka(o)};function Pa({filter:e,grouping:t,select:n,accountingMethod:r}){return Rr({queryKey:Ra({filter:e,grouping:t,accountingMethod:r}),queryFn:Da,select:n})}const Ma="noDataHeight";function La(e){const t=Pt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function Fa(e){const t=La(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?U(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?U(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 Oa(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(nr(n))return t;for(const i of n){const{month:e,netIncome:n}=Fa(i);t.total=U(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 Va="MONTHLY",Ba=cr(tr["tile-header"],Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Ua({title:e}){return S("div",{...Ba,children:S(br,{children:e})})}const Wa=cr(tr["tile-body"],Gn({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 Ha({children:e}){return S("div",{...Wa,children:e})}const za=$n({base:{display:"flex",flexDirection:"column",boxShadow:"box-shadow",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=cr(tr.tile,za({type:t,isSample:n}));return S("div",{...r,children:e})}const ja=Gn({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),_a=Gn.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),Ka=Gn.raw({whiteSpace:"normal",overflowWrap:"break-word"}),Ya=Gn.raw({overflow:"visible",whiteSpace:"nowrap"}),Za=Gn({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"12px"}),Ga=Gn.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px"}),Qa=Gn.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"16px"}),Xa=Gn.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"14px"}),Ja=cr(tr.text,Gn({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function $a({children:e}){return S("div",{...Ja,children:e})}const eo=cr(tr["metric-xl"],mr({metric:"xl"}));function to(e){return S("div",{...eo,children:e.children})}const no=cr(tr.summation,Gn({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function ro({title:e,label:t}){return R("div",{...no,children:[S(to,{children:e}),S($a,{children:t})]})}const ao=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function oo({children:e}){return S("div",{...ao,children:e})}const io=(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},lo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),so=1e9;function co(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<so&&l>=1e3&&(l/=1e3),o>=so?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${lo(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:io(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:io(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:io(e,t)}}{const t=2,n=io(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=lo(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 uo(e){return co(e,{condense:!0,dollarSign:!0})}function ho(e){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function po(e){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function go(e,t){return co(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const mo=$n({variants:{wrap:{ellipsis:_a,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function vo({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Cr(n))return null;const a=gr([cr(tr["strong-label"],tr.text,mr({label:"strongLabel"}),mo({wrap:e,textAlign:t})),...r]);return S("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const bo=$n({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"16px",fontStyle:"normal",xl:{lineHeight:"14px",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:_a,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:_a,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function fo({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=cr(tr["sub-label"],tr.text,bo({intent:e,wrap:t,accent:r}),ja);return Cr(n)?null:S("div",{...a,children:n})}const yo=cr(null,Gn({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 xo({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ma)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",{...yo,children:[S(vo,{children:t[0].name??""}),S(fo,{children:uo(Number(n))})]})}const Co={"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)"},"fonts.base":{value:"Duplet Regular, sans-serif",variable:"var(--Tight-fonts-base)"},"fontSizes.sm":{value:"12px",variable:"var(--Tight-fontSizes-sm)"},"fontSizes.md":{value:"14px",variable:"var(--Tight-fontSizes-md)"},"fontSizes.lg":{value:"16px",variable:"var(--Tight-fontSizes-lg)"},"fontSizes.xl":{value:"20px",variable:"var(--Tight-fontSizes-xl)"},"fontSizes.2xl":{value:"24px",variable:"var(--Tight-fontSizes-2xl)"},"fontWeights.sm":{value:"400",variable:"var(--Tight-fontWeights-sm)"},"fontWeights.md":{value:"600",variable:"var(--Tight-fontWeights-md)"},"fontWeights.lg":{value:"900",variable:"var(--Tight-fontWeights-lg)"},"radii.zero":{value:"0",variable:"var(--Tight-radii-zero)"},"radii.sm":{value:"1px",variable:"var(--Tight-radii-sm)"},"radii.md":{value:"2px",variable:"var(--Tight-radii-md)"},"radii.lg":{value:"4px",variable:"var(--Tight-radii-lg)"},"borderWidths.sm":{value:"0.5px",variable:"var(--Tight-borderWidths-sm)"},"borderWidths.md":{value:"1px",variable:"var(--Tight-borderWidths-md)"},"borderWidths.lg":{value:"1px",variable:"var(--Tight-borderWidths-lg)"},"borderWidths.xl":{value:"2px",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)"},"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-black200)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-black400)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-black800)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-blue200)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-blue300)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-blue500)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-blue700)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-blue900)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-green100)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-green300)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-green500)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-green900)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-yellow200)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-yellow300)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-yellow500)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-yellow700)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-yellow800)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-red300)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-red500)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"transparent",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-black400)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.accent.success":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-white300)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-black100)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-green200)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-green700)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-red700)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"rgba(0, 0, 0, 0.5)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"transparent",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"none",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"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.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-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.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-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.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.background":{value:"var(--Tight-colors-colorPalette-background)",variable:"var(--Tight-colors-colorPalette-background)"},"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":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"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.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 To(e,t){return Co[e]?.value||t}To.var=function(e,t){return Co[e]?.variable||t};const wo=cr(null,Gn({borderRadius:"50%",flexShrink:0})),ko=cr(null,Gn({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Eo=To.var("colors.surface.foreground.disabled");function Ao({color:e=Eo,diameter:t=17,label:n}){return R("div",{...ko,"data-testid":"bullet-row",children:[S("div",{...wo,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&S(fo,{children:n})]})}const Io=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function So({payload:e}){return void 0===e?null:S("div",{...Io,children:e.map((e,t)=>"none"!==e.type&&S(Ao,{color:e.color,label:e.value,diameter:17},t))})}const No={right:20,left:20},Ro=["income","profit","expenses","loss"],Do=e=>Ro.findIndex(t=>t===e.dataKey),Po={paddingBottom:"20px",marginLeft:"-20px"},Mo={stackId:"stack",isAnimationActive:!1},Lo=cr(tr["profit-loss-graph"],Gn({"& .recharts-surface":{outline:"none"}})),Fo=To.var("colors.money"),Oo=To.var("colors.border.layout"),Vo=To.var("colors.border.layout.strong"),Bo={fill:To.var("colors.typography.base"),fontSize:To.var("fontSizes.metric.sm")},Uo={profit:To.var("colors.money.positive.strong"),income:To.var("colors.money.positive.weak"),loss:To.var("colors.money.negative.strong"),expenses:To.var("colors.money.negative.weak")},Wo=[0,100],Ho=["auto","auto"];function zo({data:e}){const[t,n]=c(!0);if(void 0===e)return null;const r=e.hasAnyData?Ho:Wo;return S(W,{width:"100%",height:"100%",...Lo,children:R(H,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:No,children:[S(z,{verticalAlign:"top",itemSorter:Do,wrapperStyle:Po,content:({payload:e})=>S(So,{payload:e})}),S(q,{strokeDasharray:"0",vertical:!1,stroke:Oo}),S(j,{dataKey:"month",interval:0,tickLine:!1,stroke:Oo,tick:Bo}),S(_,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:Oo,tick:Bo,tickFormatter:e=>uo(e)}),S(K,{content:({active:e,payload:t})=>S(xo,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),S(Y,{name:"Profit",dataKey:"profit",fill:Uo.profit,...Mo}),S(Y,{name:"Income",dataKey:"income",fill:Uo.income,...Mo}),S(Y,{name:"Loss",dataKey:"loss",fill:Uo.loss,...Mo}),S(Y,{name:"Expenses",dataKey:"expenses",fill:Uo.expenses,...Mo}),S(Y,{dataKey:Ma,fill:Oo,legendType:"none",...Mo}),S(Z,{y:0,stroke:Vo}),S(G,{dataKey:"netIncome",fill:Fo,stroke:Fo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const qo=Gn({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 jo({styles:e}){const t=Xn(or(tr["loading-skeleton"]),qo,e);return S("div",{className:t,"data-testid":"shimmer-block"})}const _o=Gn({width:"40%",minHeight:65});function Ko({children:e}){return R(N,{children:[S(jo,{styles:_o}),S(oo,{children:e})]})}const Yo=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),Zo=Gn({width:"80px",height:"17px",marginBottom:"10px"}),Go=Gn({width:"100%",height:"100%"});function Qo(){return R(N,{children:[R("div",{...Yo,children:[S(jo,{styles:Zo}),S(jo,{styles:Zo}),S(jo,{styles:Zo}),S(jo,{styles:Zo})]}),S(jo,{styles:Go})]})}const Xo=$n({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 Jo({size:e}){const t=Xo({size:e});return S("div",{className:t,children:"Sample"})}const $o=20200,ei=5043,ti=Object.freeze({income:$o,expenses:ei,netIncome:15157,absoluteSum:Math.abs($o)+Math.abs(ei)}),ni=Object.freeze({total:ei,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),ri=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),ai=[{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 oi({filter:e=gt.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:Oa})}({filter:e,grouping:Va}),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=Ot(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=ai[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:[S(Ua,{title:"Profit + Loss"}),S(Ha,{children:r?S(Ko,{children:S(Qo,{})}):R(N,{children:[S(ro,{title:uo(a?.total??0),label:"Profit"}),S(oo,{children:S(zo,{data:a})})]})}),t&&S(Jo,{size:"xl"})]})}const ii={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},li=i({}),si=$n({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 ci(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:i}=l(li),s=n?.styleIconKey?i?.[n.styleIconKey]:void 0,c=gr([cr(null,si()),...o]);return s?S("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:Gn({objectFit:"contain"})}):S(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const di=ci(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"}),ui=ci(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"),hi=ci(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"),pi=ci(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"}),gi=ci(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 mi(e){return Ea(`${t=e,Ia[t]}`,"v6");var t}async function vi({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=ba({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=>va(e,t)).join("&"):va(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});ha("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return ha("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),fa(e)}catch(s){return Promise.reject(s)}}async function bi(e){const{url:t,headers:n}=xa(e);return vi({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function fi(e){return bi({...e,endpointManager:mi(e.environment)})}async function yi(e){return bi({...e,endpointManager:Na(e.environment)})}const xi=i(void 0);function Ci(){return l(xi)}const Ti=e=>["introspect",e];function wi(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 yi(r)}(n[2].accessToken,n[2].environment,e)}}function ki(){const e=Ci();return Rr({queryKey:Ti(e),queryFn:wi(e)})}const Ei={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"},Ai=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Ii={DISCREPANCY:{text:"Discrepancy",Icon:ui,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:hi,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:di,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:hi,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:hi,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:di,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:gi,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:pi,variant:"success"}},Si={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"]},Ni={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"]},Ri=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Di=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Pi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],Mi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],Li=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],Fi=[{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 Oi(){return Ui()?Fi:Li}function Vi(e,t){return{...Ii[e],key:e,value:(t?Si:Ni)[e]}}function Bi(e){const t=Ui()?Si:Ni,n=Ai.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Ii[n]}function Ui(){const{query:{data:e}}=ki();return"ACCOUNTANT"===e?.userRole}function Wi(){return Vi("NEEDS_REVIEW",Ui())}function Hi(e){return e in Ei}const{CONVERSATIONS:zi,TRANSACTIONS:qi}=ii.FinancialOverview,ji={MESSAGE_REVIEW:zi,TRANSACTION_REVIEW:qi,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},_i={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},Ki={resolutionStatus:{in:["OPEN"]}},Yi=[],Zi=[],Gi=ci(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"),Qi=ci(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"),Xi=Gn.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"}}),Ji=Gn(Xi),$i=Gn.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),el=Gn($i),tl=Gn({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}});Gn({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),Gn({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const nl=i({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function rl({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["small-icon"],tr.icon),...t??[]],size:12})}const al=cr(tr["pagination-button"],Gn({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})),ol=cr(null,Gn({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"}}),el),il=cr(null,Gn({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),ll=cr(null,Gn({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function sl(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=l(nl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...al,children:[S("div",{...il,children:S("button",{...ol,onClick:r,disabled:!t,children:S(rl,{Component:Gi,stylists:[ll]})})}),S("div",{...il,children:S("button",{...ol,onClick:n,disabled:!e,children:S(rl,{Component:Qi,stylists:[ll]})})})]})}const cl=Gn({width:"100%",height:"50px"});function dl(){return S(jo,{styles:cl})}const ul=cr(tr["dashboard-placeholder-table"],Gn({display:"flex",flexDirection:"column",gap:"4px"})),hl=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),pl=Gn({width:"100px",height:"20px"});function gl({numColumns:e=6}){return R("div",{...ul,children:[S("div",{...hl,children:Array.from({length:e},(e,t)=>S(jo,{styles:pl},t))}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{}),S(dl,{})]})}function ml(e,t){const n=kr(),r=Nr();return d(a=>{const o=Tr(n),i=o?{}:{retry:!1,staleTime:1/0};return Ir.prefetchQuery({queryKey:fr(e(a),n??"",r),queryFn:o?t:Er,...i})},[e,t,n,r])}const vl=Object.freeze({}),bl=Object.freeze({cursor:"FINAL_PAGE"});function fl({queryKey:e,queryFn:t,...n}){const[r,i]=c(vl),l=a(e);C(l.current,e)||(l.current=e,i(vl));const s=n.select,h=rr(s)?e=>({...s(e),cursor:e.cursor}):void 0,p=yr(e,r),g=Rr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),m=o(()=>{return e=g.query.data?.cursor,t=i,{getFirstPage:()=>t(vl),getLastPage:()=>t(bl),hasNextPage:rr(e?.after),hasPreviousPage:rr(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[g.query.data?.cursor]),v=ml(d(t=>yr(e,t),[e]),t),b=ml(d(t=>yr(e,t),[e]),t);return u(()=>{const e=g.query.data?.cursor;!g.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{pa({error:e,severity:"error"})}),e.before&&b({cursor:e.before}).catch(e=>{pa({error:e,severity:"error"})}))},[g.query.data?.cursor,g.query.isFetching,v,b]),{...g,paginationControls:m}}function yl({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 u(()=>()=>{n.cancelCallback()},[n]),{startCallback:d(e=>{n.startCallback(e)},[n]),cancelCallback:d(()=>{n.cancelCallback()},[n])}}function xl({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=yl({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Cl={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"},Tl={ASC:"ASC",DESC:"DESC"},wl=e=>["conversations",e??{}],kl=e=>["conversations","conversation",e],El=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Al(e){return fl({queryKey:e?wl(e):["conversations",{}],queryFn:El})}const Il=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 fi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Sl(e){const t=rr(e);return Rr({queryKey:kl({id:e??""}),queryFn:Il,enabled:t})}const Nl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:mi(n)};return await wa(r)};function Rl(){return xl({prefetchFn:ml(kl,Il)})}function Dl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Pl({header:e}){const t=Dl(e.column);return S("div",{...cr(tr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:Q(e.column.columnDef.header,e.getContext())})}const Ml=cr(tr["dashboard-table-header"],Gn({display:"flex",flexDirection:"row",alignItems:"center"}));function Ll({headerGroups:e}){return S("div",{children:e.map(e=>h("div",{...Ml,key:e.id},e.headers.map(e=>S(Pl,{header:e},e.id))))})}const Fl=cr(tr["dashboard-table-body"],Gn({display:"flex",flexDirection:"column"}));function Ol({children:e}){return S("div",{...Fl,children:e})}function Vl({cell:e,onCellClick:t}){const n=Dl(e.column),r=cr(tr["dashboard-table-cell"],Gn({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),a=cr(null,Gn({display:"flex",flexDirection:"row",height:"100%"}));return S("div",{...a,style:n,onClick:()=>{t&&t(e)},children:S("div",{style:n,...r,children:Q(e.column.columnDef.cell,e.getContext())})})}const Bl=cr(tr["table-sub-row"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function Ul({rowData:e,onCellClick:t}){const n=e.getVisibleCells();return S("div",{...Bl,children:n.map(e=>S(Vl,{cell:e,onCellClick:t,isChild:!0},e.id))})}const Wl=Gn({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden"}),Hl=Gn({background:"surface.background"}),zl=cr(tr["table-row"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.weaker"}}));function ql({rowData:e,onMouseEnter:t,onMouseLeave:n,onCellClick:r,shouldDisplayDivider:a}){const o=e.getIsExpanded(),i=cr(tr["table-parent-row"],Wl,e.index%2==0?Hl:void 0),l=e.getVisibleCells();return R("div",{...i,onMouseEnter:t,onMouseLeave:n,children:[S("div",{...zl,children:l.map(e=>S(Vl,{cell:e,onCellClick:r},e.id))}),o&&S("div",{children:e.subRows.map(e=>S(Ul,{rowData:e,onCellClick:r,shouldDisplayDivider:a},e.id))})]})}const jl=(e,t={})=>{ln.getState().openDrawer(e,t)},_l=()=>{ln.getState().requestCloseDrawer()},Kl=()=>ln(e=>e.drawerHistory);function Yl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=fr(e,n,r);return Ir.fetchQuery({queryKey:a,queryFn:t})}function Zl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=fr(e,n,r);return Ir.prefetchQuery({queryKey:a,queryFn:t})}const Gl=[{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"}],Ql={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},Xl={ASC:"ASC",DESC:"DESC"},Jl=e=>["banks/transactions",e??{}],$l=e=>["banks/transactions",e.id],es=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(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 fl({queryKey:Jl(e),queryFn:es,...t})}const ns=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 fi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function rs({id:e,enabled:t=!0}){return Rr({queryKey:$l({id:e??""}),queryFn:ns,enabled:t})}function as(){return xl({prefetchFn:ml($l,ns)})}function os(){const{query:{data:e}}=ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!nr(t)&&t.length>0}const 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!Cr(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)}const ds=e=>["conversations/messages",e];function us(e){if(nr(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 hs=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 fi(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:mi(n),accessToken:t};return await wa(r)};function gs(){return xl({prefetchFn:ml(ds,hs)})}const ms=e=>["summaries",e??{}],vs=e=>["summaries",e.id],bs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:mi(t[2].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const fs=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 fi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function ys({rowData:e,isMobile:t}){const{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),{startPrefetch:i,cancelPrefetch:l}=as(),{startPrefetch:s,cancelPrefetch:c}=xl({prefetchFn:ml(vs,fs)}),u=d(()=>{rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?i({id:e.original.attachedEntityId}):rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&s({id:e.original.attachedEntityId}),a({id:e.original.id}),n({id:e.original.id})},[e.original.attachedEntityId,e.original.id,a,n,i,s]),h=d(()=>{rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?l():rr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&c(),o(),r()},[l,c,r,o,e.original.attachedEntityId]);return S(ql,{rowData:e,onMouseEnter:u,onMouseLeave:h,shouldDisplayDivider:e=>0!==e,onCellClick:()=>((e,t,n)=>{n?jl("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):rr(t)?ls(t,is.BANK_TRANSACTION)?jl("BankTransactionForm",{routeProps:{transactionId:t,initialTab:"conversation"}}):ls(t,is.FINANCIAL_SUMMARY)&&(r=e,a=t,jl("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){jl("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t)})}const xs=ci(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"),Cs=Gn.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}}),Ts=Gn(Cs),ws=Gn.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"}});Gn(ws);const ks=Gn.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Es=Gn(ks),As=Gn.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});Gn(As);const Is=Gn.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"}}),Ss=Gn.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"}}),Ns=Gn.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"}}}),Rs=Gn.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"}}),Ds=Gn.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"}}}),Ps=Gn.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"}}),Ms=$n({base:Gn.raw(Cs,ks,Xi),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:ks,small:As},intent:{default:{},danger:Ss,primary:ws,secondary:Ds,success:Ns,warning:Rs,action:Ps}}}),Ls=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},g){const m=function(e){switch(e){case"danger":return tr["button-danger"];case"primary":return tr["button-primary"];case"secondary":return tr["button-secondary"];case"success":return tr["button-success"];case"warning":return tr["button-warning"];case"action":return tr["button-action"];case"default":return null}}(c),v=gr([cr(tr["button-base"],m,r,Gn(Ms.raw({width:s,size:l,intent:c}),n)),...t]);return S("button",{ref:g,...v,type:a,onClick:o,disabled:i,"data-active":d,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function Fs({children:e,stylists:t=[],...n}){return S(Ls,{intent:"secondary",stylists:t,...n,children:e})}const Os=()=>{jl("Conversation",{routeProps:{conversationId:null}})},Vs=cr(tr["small-square-button"],void 0),Bs=Gn({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function Us(){return S("div",{className:Bs,children:S(Fs,{stylists:[Vs],onClick:Os,width:"fill-parent",children:S(rl,{Component:xs})})})}const Ws=$n({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"}}}});function Hs({children:e,dashboard:t}){const n=cr(tr["dashboard-table"],Ws({dashboard:t}));return S("div",{...n,children:e})}const zs=i(null),qs="mobile",js=$n({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 _s({children:e,alignVariant:t="flexStart"}){const n=cr(null,js({alignVariant:t}));return S("div",{...n,children:e})}const Ks=$n({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"18px",maxWidth:"100%",xl:{lineHeight:"16px",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"}},wrap:{ellipsis:_a,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:Ya},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function Ys({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=cr(tr.label,tr.text,Gn(Ks.raw({intent:t,wrap:n,alignment:r}),a));return Cr(e)?null:S("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const Zs={"sm-sm":cr(tr.text,Gn({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"sm-med":cr(tr.text,Gn({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"sm-lg":cr(tr.text,Gn({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-sm":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-med":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja),"med-lg":cr(tr.text,Gn({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja)};function Gs({children:e,size:t,weight:n,stylists:r=[]}){const a=gr([Zs[`${t}-${n}`],...r]);return S("div",{title:e,...a,children:e})}const Qs=cr(tr["emphasis-label"],Gn({lineHeight:"16px"}));function Xs({children:e}){return S(Gs,{size:"med",weight:"lg",stylists:[Qs],children:e})}function Js({text:e,isRead:t}){return S(t?Ys:Xs,{children:e})}function $s({date:e,isRead:t=!1}){const n=Vt(e);return S(Js,{text:n,isRead:t})}const ec=cr(tr["strong-sub-label"],mr({label:"strongSubLabel"}));function tc({children:e,stylists:t=[]}){return Cr(e)?null:S(Gs,{size:"sm",weight:"med",stylists:[ec,...t],children:e})}const nc=i(null),rc=Gn({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),ac=Gn.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"}}),oc=cr(tr["selector-row"],Gn(ac));function ic(e,t,n){const[r,a]=c(e);return[t??r,n??a]}function lc({children:e}){return null===he()?S(pe,{children:e}):e}function sc({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const u=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=c(),[u,h]=c(),[p,g]=ic(e,r,a),m=te(),v=ne({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:le,middleware:[re(n),ae({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),oe({padding:8}),ie({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})]}),b=v.context,f=se(b,{enabled:i}),y=ce(b,{bubbles:{escapeKey:!0}}),x=de(b),C=ue([f,y,x]),T=d(()=>g(!1),[g]);return o(()=>({open:p,setOpen:g,close:T,...C,...v,modal:!0,labelId:l,descriptionId:u,setLabelId:s,setDescriptionId:h,nodeId:m}),[p,g,T,C,v,l,u,m])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=he(),p=l&&null===h,g=u.nodeId;return S(lc,{children:S(ge,{id:g,children:S(nc.Provider,{value:{...u,popupParentNodeId:h,blockInteraction:p},children:e})})})}function cc(){const e=l(nc);if(nr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function dc({children:e}){const t=cc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return S(N,{children:e(a)})}const uc=ci(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 hc({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["tiny-icon"],tr.icon),...t??[]],size:9})}const pc=ci(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"),gc=cr(tr["button-discreet-small"],Gn(Is,{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"}}),Ji),mc=cr(null,Gn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),vc=cr(null,Gn({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"}})),bc=cr(null,Gn({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function fc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...gc,"data-active":a,children:[R("button",{...mc,...r,children:[S(tc,{children:t}),!a&&S("div",{...bc,children:S(hc,{Component:pc})})]}),a&&S("button",{...vc,onClick:e,children:S(hc,{Component:uc})})]})}const yc=$n({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 xc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=cc(),d=me([c.refs.setFloating,n]),u=cr(tr.popup,yc({type:r}));return a||l.open?R(ve,{children:[s&&S(be,{lockScroll:!0}),S(fe,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:S("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Cc=cr(tr["popup-sort-row"],Gn({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 Tc({onClick:e,children:t,active:n}){return S("button",{onClick:e,...Cc,children:S(fo,{accent:n?"active":"action",children:t})})}const wc=cr(null,Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),kc=cr(null,Gn({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Ec({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=cc(),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:[S(tc,{stylists:[kc],children:"Sort by:"}),S(Tc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),S(Tc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Ac=Gn.raw(Is,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Ic({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,d]=c(!1),u=cr(tr["button-discreet-small"],Gn(Ac,e),Ji),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return S("button",{type:"button",...u,onClick:e=>{void 0===h&&d(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const Sc={minWidth:"140px"};function Nc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=l(zs);if(!a)return null;const{sortInstance:o,setSortInstance:i}=a,s=o?.orderBy===t,c=()=>{i(void 0)};return t&&n&&r?R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(fc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),S(xc,{style:Sc,children:S(Ec,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{i(e)},sortInstance:o})})]}):S(Ic,{disabled:!0,children:S(tc,{children:e})})}const Rc=$n({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 Dc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return S("div",{className:Rc({align:a,padding:o}),children:S(Nc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Pc="Oldest to Newest",Mc="Newest to Oldest";const Lc=i({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 Fc({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=l(Lc);let a="";return e===r?a="Me":jt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),S(Js,{text:a,isRead:t})}const Oc=ci(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"),Vc=cr(tr.text,Gn({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"16px",maxWidth:"100%",fontFamily:"label"}),ja);function Bc({children:e,stylists:t=[]}){const n=gr([Vc,...t]);return S("div",{...n,children:e})}const Uc=$n({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"}}}}),Wc=Xn(Gn({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),ja),Hc=Gn({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),zc=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),qc=Gn({display:"flex",alignItems:"center",gap:8}),jc=Gn({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),_c=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),Kc=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),Yc=Gn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Zc({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return S("button",{className:Uc({isRead:a}),onTouchEnd:o,children:R("div",{className:Wc,children:[R("div",{className:_c,children:[!a&&S("div",{className:Yc}),S(Js,{text:t,isRead:a})]}),R("div",{className:Hc,children:[S("div",{className:Kc,children:S(Fc,{authorUserId:e,isRead:a})}),R("div",{className:qc,children:[S("div",{className:zc,children:S($s,{date:n,isRead:a})}),a?S(rl,{Component:Qi}):S(Bc,{children:S(rl,{Component:Qi})})]})]}),S("div",{className:jc,children:Cr(r)?R(N,{children:[S(rl,{Component:Oc}),S(Ys,{children:"Shared a file"})]}):S(Ys,{children:r})})]})})}const Gc=Gn({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),Qc=Gn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Xc({text:e,isRead:t}){return t?S(Ys,{children:e}):R("div",{className:Gc,children:[S("div",{className:Qc}),S(Xs,{children:e})]})}const Jc=X(),$c=cr(null,Gn({paddingLeft:"25px"})),ed=[Jc.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>S(_s,{children:S(Fc,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>S(tc,{stylists:[$c],children:"From"}),size:160,maxSize:160}),Jc.accessor("subject",{id:"subject",cell:({row:e})=>R(_s,{children:[S(Xc,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),S(Ys,{children:e.original.latestMessage.text})]}),header:()=>S(tc,{stylists:[$c],children:"Subject"}),size:200}),Jc.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>S(_s,{children:S($s,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>S(Dc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Mc,sortAscDisplay:Pc}),size:150,maxSize:150}),Jc.display({id:qs,cell:({row:e})=>S(Zc,{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 td(e){return e?ed.filter(e=>e.id===qs):ed.filter(e=>e.id!==qs)}const nd=[],rd=Gn({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"}),ad=cr(tr["empty-dashboard-layout"],rd);function od({children:e}){return S("div",{...ad,"data-testid":"empty-dashboard-layout",children:e})}const id=Gn({width:"25px",height:"25px",borderRadius:"sm"});function ld({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:id}),S("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["large-icon"],tr.icon),...n??[]],size:25})}const sd=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return S(Ls,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),cd=ci(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"}),dd=Gn({width:"15px",height:"15px",borderRadius:"sm"});function ud({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:dd}),S("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:15})}const hd=()=>{jl("Conversation",{routeProps:{conversationId:null}})};function pd(){return R(N,{children:[S(ld,{Component:cd}),S(vo,{wrap:"wrap",children:"Need help with your financials?"}),R(sd,{...cr(tr["zero-state-button"]),onClick:hd,children:[S(vo,{children:"Message Bookkeeper"}),S(ud,{Component:Qi})]})]})}const gd=ci(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 md(){return R(N,{children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",children:"All caught up"}),S(fo,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const vd=i({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,unstable_mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function bd(e){const{registerAnchor:t}=l(vd);g(()=>{t(e)},[e,t])}const fd=cr(null,Gn({display:"flex",flexDirection:"row",gap:"5px"}));function yd({children:e}){return S("div",{...fd,children:e})}const xd=$n({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Cd(e){return S(e?md:pd,{})}function Td({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){bd(zi);const i=function({conversations:e,isMobile:t}){return J({data:e??nd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??nd.length,columns:td(t),getCoreRowModel:$(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Al({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!nr(l?.data?.[0])&&!s;return R("div",{className:xd({isMobile:o}),children:[S("div",{id:zi}),R(nl.Provider,{value:r,children:[R(ur,{children:[S(br,{children:"Conversations"}),R(yd,{children:[S(sl,{}),S(Us,{})]})]}),S(Hs,{dashboard:"financialOverviewDashboard",children:a?S(gl,{numColumns:4}):R(N,{children:[!o&&S(zs.Provider,{value:{sortInstance:e,setSortInstance:t},children:S(Ll,{headerGroups:i.getHeaderGroups()})}),n.length>0?S(Ol,{children:i.getRowModel().rows.map(e=>S(ys,{rowData:e,isMobile:o},e.id))}):S(od,{children:Cd(c)})]})})]})]})}const wd=cr(tr.body,mr({body:"default"}));function kd({children:e,stylists:t=[]}){if(Cr(e))return null;const n=gr([wd,...t]);return S("div",{...n,children:e})}const Ed=cr(null,Gn({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Ad=$n({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),Id=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Sd(){return S("div",{...Ed,children:Id.map((e,t)=>S(jo,{styles:Ad({width:e?.width})},t))})}const Nd=Gn({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}"}),Rd=Gn({position:"relative",width:"25px",height:"25px"});function Dd({hasUnread:e}){return R("div",{className:Rd,children:[S(ld,{Component:cd}),e&&S("div",{"data-testid":"unread-comment-badge",className:Nd,"aria-hidden":"true"})]})}const Pd=cr(tr["financial-summary-chatbox-header"],Gn({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Md({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Pd,children:[S(vo,{children:"Message Bookkeeper"}),t&&S(Dd,{hasUnread:e})]})}const Ld=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function Fd(){return R("div",{className:Ld,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),S(fo,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(sd,{...cr(tr["zero-state-button"]),onClick:()=>jl("Conversation"),children:[S(vo,{children:"Send a Message"}),S(ud,{Component:Qi})]})]})}const Od=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Vd({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),i=d(()=>{a({id:t}),n({id:t})},[t,a,n]),l=d(()=>{o(),r()},[o,r]);return R("div",{className:Od,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),S(fo,{wrap:"wrap",children:"Pick up where you left off."}),S(Fs,{onClick:()=>jl("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:S(vo,{children:"Continue conversation"})})]})}const Bd=Gn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Ud({summaryId:e}){return R("div",{className:Bd,children:[S(ld,{Component:gd}),S(vo,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),S(fo,{wrap:"wrap",children:"Your bookkeeper will respond here."}),S(Fs,{...cr(tr["zero-state-button"]),onClick:()=>jl("FinancialSummary",{routeProps:{summaryId:e}}),children:S(vo,{children:"Talk to a bookkeeper"})})]})}function Wd({summaryId:e,conversationId:t}){const n=rr(t);return nr(e)?S(Fd,{}):n?S(Vd,{conversationId:t,summaryId:e}):S(Ud,{summaryId:e})}const Hd=Gn({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"}),zd=cr(tr["financial-summary-chatbox"],Gn({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 qd({summaryData:e}){const t=rr(e?.summary),n=rr(e?.conversation);return R("div",{className:Hd,children:[S(Md,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),S("div",{...zd,children:S(Wd,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const jd=ci(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"),_d=Gn({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function Kd(){return R("div",{className:_d,children:[S(ld,{Component:jd}),S(vo,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const Yd=Gn({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),Zd=$n({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:{}}}}),Gd=cr(null,Gn({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),Qd=Gn({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function Xd({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Rr({queryKey:(t={limit:1,filter:{date:{equal:ct(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?ms(t):["summaries",{}],queryFn:bs,...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 $${$o.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${ei.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=cr(tr["financial-summary-layout"],Zd({isSample:e,isZeroState:o}));return R("div",{className:Qd,children:[S("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?S(Sd,{}):o?S(Kd,{}):R("div",{className:Yd,children:[S(kd,{stylists:[Gd],children:a}),e&&S(Jo,{size:"lg"})]})}),S(qd,{summaryData:n})]})}const Jd=cr(tr["month-picker"],Gn({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),$d=cr(tr["month-picker-left-button"],Gn({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),eu=cr(tr["month-picker-right-button"],Gn({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),tu=cr(tr["month-picker-label"],Gn({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function nu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=it(e.year,e.month,1),o=Ot(a,{abbreviateMonth:!0});return R("div",{...Jd,children:[S(Fs,{stylists:[$d],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:S(rl,{Component:Gi})}),S("div",{...tu,children:S(vo,{children:o})}),S(Fs,{stylists:[eu],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:S(rl,{Component:Qi})})]})}const ru=Gn({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function au({children:e}){return S("div",{className:ru,children:e})}const ou=$n({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),iu=cr(tr["progress-bar"],Gn({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),lu=cr(tr["progress-bar-fill"],Gn({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),su=cr(tr["tile-bar-label"],Gn({paddingLeft:"10px"})),cu=cr(tr["tile-bar-label-outer"],Gn({paddingLeft:"10px"}));function du({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?tr["bar-transactions-positive"]:tr["bar-transactions-negative"],l=cr(i,ou({color:n})),s=gr([lu,l]);return R("div",{...iu,style:{width:a},children:[S("div",{...s,style:{width:`${t}%`},children:o&&S("div",{...su,children:S(Ys,{children:e})})}),!o&&S("div",{...cu,children:S(Ys,{children:e})})]})}const uu=cr(tr["metric-md"],Gn(mr.raw({metric:"md"}),Ya));function hu(e){return S("div",{...uu,children:e.children})}const pu=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),gu=Gn({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function mu({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:pu,children:[S(du,{label:e,percentage:a,color:r}),S("div",{className:gu,children:S(hu,{children:uo(t)})})]})}const vu=ci(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"),bu={},fu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return bu[e]={loading:!1,error:null,scriptEl:t}},yu="undefined"!=typeof window&&void 0!==window.document;function xu({src:e,checkForExisting:t=!1,...n}){let r=bu[e];!r&&t&&e&&yu&&(r=fu(e));const[a,o]=c(r?r.loading:Boolean(e)),[i,l]=c(r?r.error:null),[s,d]=c(!1);return u(()=>{if(!yu||!e||s||i)return;let a;r=bu[e],!r&&t&&(r=fu(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=bu[e]={loading:!0,error:null,scriptEl:a});const c=()=>{r&&(r.loading=!1),o(!1),d(!0)},u=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",c),a.addEventListener("error",u),document.body.appendChild(a),()=>{a.removeEventListener("load",c),a.removeEventListener("error",u),r&&r.loading&&(a.remove(),delete bu[e])}},[e]),[a,i]}const Cu=e=>["integrations",e??{}],Tu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function wu(e,t){return fl({...t,queryKey:Cu(e),queryFn:Tu})}function ku(e){return wu({filter:{apiName:{equal:"PLAID"}}},e)}function Eu(e){return Ea(`${t=e,Aa[t]}/v1`,"v1");var t}async function Au({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:Eu(n)},{url:a,headers:o}=xa(r);return await vi({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const Iu="cancel",Su="danger",Nu="success",Ru=Gn({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Du=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Pu=$n({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"}}),Mu={transform:"none",willChange:"auto"};function Lu({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=ne({open:e,strategy:"fixed"}),s=ce(l,{outsidePress:o,escapeKey:i}),c=de(l,{role:t}),{getFloatingProps:d}=ue([s,c]),u="alertdialog"===t?tr["alert-dialog"]:null,{className:h}=cr(u,Pu({size:r,padding:a}));return e?S(ve,{children:S(be,{lockScroll:!0,className:Ru,children:S(fe,{context:l,modal:!0,returnFocus:!0,children:S("div",{...d(),className:h,style:Mu,children:n})})})}):null}const Fu=cr(tr["close-button"],Gn({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"}}),el),Ou=()=>_l();function Vu({Icon:e=uc,handleClose:t=Ou}={}){return S("button",{...Fu,onClick:t,type:"button",children:S(ud,{Component:e,...Fu})})}const Bu=cr(tr["alert-header"],Gn({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"26px"},Ka));function Uu({children:e}){return S("div",{...Bu,children:e})}const Wu=Gn({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),Hu=Gn.raw({width:"100%"}),zu=e=>{switch(e){case qu.DANGER:return"danger";case qu.SUCCESS:return"success";case qu.ACTION:return"primary";default:return"secondary"}},qu={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ju=ye.createConfirmation(xe(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(Lu,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[R("div",{className:Du,children:[S(Uu,{children:r}),o&&S(Vu,{handleClose:()=>n()})]}),a&&"string"==typeof a?S(Ys,{wrap:"wrap",children:a}):S(N,{children:a}),S("div",{className:Wu,children:i.map(e=>S(Ls,{intent:zu(e.type),styles:Hu,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:S(vo,{children:e.label})},e.key))})]})}));function _u(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function Ku(e){return new U(e).div(100).toNumber()}function Yu(e){return new U(e).times(100).toNumber()}function Zu(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function Gu(e,t){return t?e?`${e} ${Zu(t)}`:Zu(t):e??""}const Qu=e=>jl("Conversation",{routeProps:{conversationId:null,defaultValues:e}}),Xu=Gn({display:"flex",flexDirection:"column",gap:"12px"});async function Ju(e){await ju({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const $u=e=>["banks/accounts",e??{}],eh={integration:{expand:!0},status:{notIn:["REMOVED"]}},th=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:mi(o)},l=await wa(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function nh(e){return fl({queryKey:$u({...e?.params,filter:{...eh,...e?.params?.filter}}),queryFn:th,enabled:e?.enabled,select:e?.select})}function rh(e,t){return Yl({queryKey:yr($u({filter:eh}),{}),queryFn:th,accessToken:e,environment:t})}const ah={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},oh={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."}},ih={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INVALID_MFA:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.invalidUpdatedUsername,buttonType:ah.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:oh.short.accountLocked,longMessage:oh.long.accountLocked,buttonType:ah.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:oh.short.credentialsChanged,longMessage:oh.long.relinkCredentials,buttonType:ah.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.supportChanged,buttonType:ah.CHAT},USER_SETUP_REQUIRED:{shortMessage:oh.short.updateNeeded,longMessage:oh.long.updateNeeded,buttonType:ah.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.mfaUpdateNeeded,buttonType:ah.OPEN_BANK},NO_ACCOUNTS:{shortMessage:oh.short.noAccountsAvailable,longMessage:oh.long.noAccountsUnlink,buttonType:ah.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:oh.short.noAccountsAvailable,longMessage:oh.long.noAccountsUnlink,buttonType:ah.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},ITEM_NOT_FOUND:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PRODUCT_NOT_READY:{shortMessage:oh.short.serverError,longMessage:oh.long.productNotReady,buttonType:ah.CHAT},USER_PERMISSION_REVOKED:{shortMessage:oh.short.connectionError,longMessage:oh.long.permissionRevoked,buttonType:ah.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:oh.short.serverDown,longMessage:oh.long.serverDown,buttonType:ah.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:oh.short.supportChanged,longMessage:oh.long.supportChanged,buttonType:ah.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT},PLANNED_MAINTENANCE:{shortMessage:oh.short.temporarilyDown,longMessage:oh.long.bankConnectionMaintenance,buttonType:ah.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:oh.short.requestError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:oh.short.inputError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:oh.short.volumeDown,longMessage:oh.long.bankMaintenance,buttonType:ah.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:oh.short.serverError,longMessage:oh.long.connectionError,buttonType:ah.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:oh.short.updateNeeded,longMessage:oh.long.partnerCredsChange,buttonType:ah.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:oh.short.credentialsExpiring,longMessage:oh.long.credentialsExpiring,buttonType:ah.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:oh.short.relinkNeeded,longMessage:oh.long.relinkForStatements,buttonType:ah.RELINK}},DEFAULT:{DEFAULT:{shortMessage:oh.short.connectionError,longMessage:oh.long.connectionError,buttonType:ah.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:oh.short.generic,longMessage:oh.long.generic,buttonType:ah.CHAT}}};function lh({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=ih[e];if(!n)return pa({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),ih.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(pa({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),ih.DEFAULT.DEFAULT)}const sh=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 ch({mutationFn:e,onMutateFn:t,...n}){const r=kr(),a=Nr(),o=!Cr(r);return F({...n,mutationFn:o?t=>e({data:t,accessToken:r,environment:a}):Er,onMutate:o&&rr(t)?e=>t({data:e,accessToken:r,environment:a}):void 0},Ir)}const dh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Na(n)};return await ka(r)},uh=async({data:e,accessToken:t,environment:n})=>dh({data:e,accessToken:t,environment:n}),hh=async({data:e,accessToken:t,environment:n})=>dh({data:e,accessToken:t,environment:n}),ph=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:Na(n)};return await ka(r)})({data:{accounts:e},accessToken:t,environment:n});function gh(e){return ch({onSuccess:async()=>{ha("mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},...e})}function mh(){return gh({mutationFn:hh})}function vh(){return ch({onSuccess:async()=>{ha("mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},mutationFn:ph})}const bh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,fh=e=>"PLAID"===e,yh=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:[]}),xh=Gn({display:"flex",flexDirection:"column",gap:"16px"}),Ch=async()=>ju({title:"Merge Accounts",body:R("div",{className:xh,children:[S(Ys,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),S(Ys,{wrap:"wrap",children:"This action can't be undone."}),S(Ys,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Continue",type:qu.DANGER}]}),Th=()=>ju({title:"Merge Failed",body:S(Ys,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Iu,label:"OK"}]}),{formContext:wh,fieldContext:kh,useFieldContext:Eh,useFormContext:Ah}=Ce(),Ih=ci(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 Sh({children:e,stylists:t=[],...n}){return S(Ls,{intent:"success",stylists:t,...n,children:e})}function Nh({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(Sh,{type:"submit",disabled:n,children:[e&&S(rl,{Component:Ih}),S(vo,{children:t})]})}const Rh=cr(null,Gn({display:"flex",width:"100%"}));function Dh({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r}){return R(sd,{type:"submit",disabled:n,stylists:[Rh],onClick:r,children:[e&&S(rl,{Component:Ih}),S(vo,{children:t})]})}const Ph=$n({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 Mh({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=cr("vertical"===e?tr["vertical-divider"]:tr["horizontal-divider"],n,Ph({alignment:e,color:t}));return S("div",{...r})}const Lh=Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),Fh=[cr(null,Gn({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],Oh=cr(null,Gn({display:"flex",alignItems:"center",gap:"4px"}));function Vh({errorMessage:e}){return R("div",{...Oh,children:[S(ud,{Component:ui,stylists:Fh}),S(fo,{intent:"danger",wrap:"wrap",children:e})]})}const Bh=Gn({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function Uh({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o}){return R(N,{children:[S(Mh,{alignment:"horizontal",color:"normal"}),R("div",{className:Lh,children:[e,o&&S("div",{className:Bh,children:S(Vh,{errorMessage:o})}),S(Dh,{showIcon:t,disabled:r,onClick:a,textContent:n})]})]})}const Wh=Gn.raw({"&[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"}}),Hh=Gn.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function zh({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i}}}const qh=Gn({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},Wh),jh=Gn(Hh),_h=Gn({display:"flex",flexDirection:"column",gap:"8px"}),Kh=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"});function Yh({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:d,errorMessage:u,disableHover:h=!1,type:p,remainingChars:g,hasErrorStyles:m}){const v=cr(i||null,qh,l,jh,el),[b,f]=c(!0),{dataAttributes:y}=zh({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:m,disableHover:h});return R("div",{className:_h,children:[R("div",{className:Kh,children:[void 0!==r&&S(Ys,{children:r}),rr(g)&&S(Ys,{children:`${g}`})]}),S("div",{...v,onClick:s,...n,onMouseDown:e=>{f(!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:()=>{f(!1),d?.()},...y,children:e}),o&&"open"!==n?.["data-state"]&&u&&S(Vh,{errorMessage:u})]})}const Zh=Gn({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled","&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}});function Gh({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a}){const o=Eh(),i=Te(o.store,e=>e.meta.errors[0]?.message),l=Te(o.store,e=>e.meta.isDefaultValue),s=Te(o.store,e=>e.meta.isTouched);return S(Yh,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:l,isTouched:s,className:tr["discreet-form-input"],additionalStyles:Zh,errorMessage:i,onClick:a,onBlur:o.handleBlur,children:e})}function Qh(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 Xh(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Jh(e){"Enter"===e.key&&e.currentTarget.blur()}const $h=cr(tr["amount-input"],mr({metric:"md"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),ep=cr(null,Gn({display:"flex",alignItems:"center",gap:"2px"}));function tp({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=c(!1);return R("div",{...ep,children:[nr(e)&&S(hu,{children:"$"}),S(ke,{...$h,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:nr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Jh,autoFocus:o})]})}const np=Gn({backgroundColor:"surface.foreground.disabled",pointerEvents:"none",border:"{borderWidths.lg} solid",borderColor:"border.layout"}),rp=$n({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function ap({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=Eh(),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=rr(c)?c-g:void 0,v=a?np:rp({kind:e});return S(Yh,{label:t,inputRef:r,popupTriggerProps:o,className:tr["editable-form-input"],additionalStyles:v,errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:m,hasErrorStyles:d,children:n})}const op=cr(null,Gn({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function ip({options:e,onSelect:t,selectedLabel:n}){const r=cc();return S("div",{...op,children:e.map(e=>S(Tc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const lp=ci(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"),sp=cr(tr["dropdown-selector-button"],Gn({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"}}),Ji);function cp({selectedLabel:e,options:t,onSelect:n}){return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>R("button",{...sp,...t,children:[S(vo,{children:e}),S(hc,{Component:lp})]})}),S(xc,{children:S(ip,{options:t,onSelect:n,selectedLabel:e})})]})}const dp=cr(null,Gn({display:"flex",alignItems:"center",gap:"15px"})),up=kt.map((e,t)=>({value:t,label:e})),hp=Et({}).map(e=>({value:e,label:String(e)}));function pp({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",{...dp,children:[S(cp,{selectedLabel:kt[r],options:up,onSelect:e=>a(n,e)}),S(cp,{selectedLabel:String(n),options:hp,onSelect:e=>a(e,r)})]})}const gp=cr(null,Gn({background:"surface.foreground",padding:"25px",gap:"15px"})),mp=cr(null,Gn({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),vp=cr(tr["date-picker-nav-button"],Gn({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"}}),Ji),bp=cr(null,Gn({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),fp=cr(null,Gn({padding:"8px",textAlign:"center"})),yp=cr(tr["date-picker-day-button"],Gn({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"}}),Ji),xp=cr(null,Gn({color:"typography.base"}));function Cp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&At(e,t),l=It(e),s=e.getMonth()!==n,c=!!a&&St(e,a),d=!!o&&St(o,e);return S("button",{...yp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:S(vo,{stylists:s||c||d?[xp]:[],children:e.getDate().toString()})})}function Tp({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=cc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=it(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&&St(a,u),g=nr(o)||d.length>0&&St(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",{...gp,children:[R("div",{...mp,children:[S("button",{...vp,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:S(rl,{Component:Gi})}),S(pp,{currentMonthYear:l,onMonthYearChange:r}),S("button",{...vp,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:S(rl,{Component:Qi})})]}),R("div",{...bp,children:[wt.map(e=>S("div",{...fp,children:S(fo,{children:e})},e)),d.map(t=>S(Cp,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const wp=cr(null,mr({label:"default"}),Gn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),kp=cr(null,mr({label:"default"}),Gn({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 Ep(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant"}),e.current.setAttribute("data-hasscrolled","true"))}async function Ap(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 Ip=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),Sp=[...Ip].map(e=>`.${e}`).join(","),Np=/* @__PURE__ */new Set(["xls","xlsx","csv"]),Rp={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...Ip].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."},Dp={"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 Pp(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 Mp(e,t,n){return Pp(e,null,e.name,t,!1,!0,n)}async function Lp(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||!Ip.has(r))return Rp.unsupportedFileType;if(e.size>52428800)return Np.has(r)?Rp.fileTooLargeSpreadsheet:Rp.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await Ap(e);for(const e of a)if(await Ap(e.file)===t)return Rp.duplicate}return null}(e,t);return n?Mp(e,n):Pp(e,null,e.name,Rp.pendingUpload,!0,!1)}const Fp=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Na(n).getUrl(`/files/upload/${a}`),s=Cr(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 Op(){return ch({mutationFn:Fp,onSuccess:async()=>Ir.invalidateQueries({queryKey:["files/attachments"]})})}const Vp=async({data:e,accessToken:t,environment:n})=>{const r=Na(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 Bp=Gn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Up=Gn({display:"none"}),Wp=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=Op();return{mutateAsync:d(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 Pp(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return Mp(e.file,Rp.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=d(()=>{r.current?.click()},[]),l=d(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>Lp(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:[S("input",{className:Up,type:"file",multiple:!0,accept:Sp,ref:r,onChange:l}),S(Fs,{type:"button",onClick:i,children:S("span",{className:Bp,children:S(ud,{Component:Oc})})})]})},Hp=I.custom(),zp=I.object({message:I.object({text:I.string(),attachments:I.array(Hp)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),qp=Gn.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),jp=Gn.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"}),_p=Gn(jp,qp),Kp=Gn.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),Yp=Gn(Kp,qp,mr.raw({body:"default"})),Zp=Gn({display:"block",width:"100%"}),Gp=Gn({position:"relative"}),Qp=Gn({display:"flex",justifyContent:"flex-end",gap:"15px"}),Xp=Gn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Jp=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Eh(),c=a(null),{startCallback:d}=yl({delay:50,callback:e=>n(e)});m(l,()=>c.current);const u=!e&&zp.safeParse(s.form.state.values).success;return S(ap,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(Ep(t),void d(!0)),children:R("div",{className:Zp,children:[R("div",{className:Gp,children:[R("pre",{className:_p,children:[s.state.value.text,S("br",{})]}),S("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:Yp,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),R("div",{className:Qp,children:[!i&&S(Wp,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),S(Fs,{disabled:!u,type:"submit",children:S("span",{className:Xp,children:S(ud,{Component:gd})})})]})]})})}),$p=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,eg=i(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function tg(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 ng(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 rg(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 ag(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]=c(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:i,isMousing:s,isScrolling:h}=function(e,t){const n=a(null),[r,o]=c(!0),[i,s]=c(!1),d=l(eg),[h,p]=v(tg,{focusedIndex:null,maxIndex:e});u(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&nr(h.focusedIndex)&&void 0!==d?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,d?.popupNodeId,t.forceRootCascade]);const g=a(null);return u(()=>{p({type:"max",max:e})},[e]),u(()=>{const e=n.current;if(null!==e){const n=e=>{s(!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),s(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>s(!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:i}}(t.size-1,e),p=cc(),g=d((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),m=d(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:b,sortedMap:f}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(ng)),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){u(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=ag(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&&rg(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,b,f,i.focusedIndex,p,e);const{startCallback:y,cancelCallback:x}=yl({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&rg(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return C=i.focusedIndex,u(()=>{const e=E.current;if(null===C||T)return;const{node:t,metadata:n}=ag(C,w,k);return A.lastOpenedIndex!==C&&n?.hasCascading&&(A.closeCurrentCascade(),I({focusedIndex:C,node:t,listElement:e})),()=>S()},[C,T=s,E=r,A=e,S=x,w=b,k=f,I=y]),function(e,t,n,r){u(()=>{const{metadata:a}=ag(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(i.focusedIndex,b,f,e),o(()=>({register:g,unregister:m,map:f,focusedIndex:i.focusedIndex,listRef:r,isMousing:s,isScrolling:h,popupNodeId:p?.nodeId}),[g,m,f,i.focusedIndex,r,s,h,p?.nodeId]);var C,T,w,k,E,A,I,S}const ig=i(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function lg({style:e,children:t,forceNewCascade:n}){const r=cr(tr["popup-list"],rc,e),a=function(e){const[t,n]=c(null),[r,a]=c(!1),[o,i]=c(null),l=d((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=d(()=>{n(null),i(null),a(!1)},[n,i,a]),u=d(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:u,forceRootCascade:e}}(n),o=og(a);return S("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:S(eg.Provider,{value:o,children:S(ig.Provider,{value:a,children:t})})})}function sg({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=Tr(e),h=e=>{n?.(e)};return R(N,{children:[d&&S(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?S(o,{...l??{},onClick:h,searchTerm:e}):S(i,{...l??{},onClick:h})]})}const cg=Xn(mr({body:"default"}),Gn({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function dg({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return u(()=>{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)}},[]),S("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:cg})}function ug({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=cc(),[d,u]=c(""),h=Tr(d),p=l?.(h);return S(xc,{children:S(lg,{style:p,children:S(sg,{searchTerm:d,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:dg,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function hg({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:i,focusedIndex:s,isMousing:c,listRef:u}=l(eg);g(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const h=o(()=>void 0!==i&&null!==t.current?i.get(t.current)?.index??-1:-1,[i]),p=h===s;g(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const m=d(()=>{u?.current?.focus()},[u]),v=o(()=>({onFocus:m,"data-focused":p}),[m,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const pg=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return S("button",{...oc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),gg=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=hg(),l=me([i,r]);return S(pg,{...oc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),mg=Gn({display:"flex",gap:"8px",alignItems:"center"});function vg({promptText:e}){return R("div",{className:mg,children:[S(rl,{Component:xs}),S(Ys,{children:e})]})}function bg({text:e}){return S("div",{...oc,children:e?S(vo,{children:e}):S(jo,{styles:Gn({width:"100%",height:"16px"})})})}const fg=cr(tr["popup-list"],rc),yg=()=>R("div",{...fg,children:[S(bg,{}),S(bg,{}),S(bg,{}),S(bg,{}),S(bg,{})]});function xg({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?S(yg,{}):R(N,{children:[r&&S(gg,{onClick:()=>jl("BankAccountForm"),children:S(vg,{promptText:"Add bank account"})}),e?.map(e=>S(gg,{onClick:()=>t(e),children:S(vo,{wrap:"wrap",children:Gu(e?.name,e?.mask)})},e?.id))]})}const Cg={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Tg={...Cg,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function wg({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ee(e??[],Tg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?S(yg,{}):R(N,{children:[a&&S(gg,{onClick:()=>jl("BanksAndIntegrations"),children:S(vg,{promptText:"Add bank account"})}),0===l.length?S(bg,{text:"No results found"}):l.map(e=>S(gg,{onClick:()=>n(e),children:S(vo,{wrap:"wrap",children:Gu(e?.name,e?.mask)})},e?.id))]})}function kg({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return S(ug,{onClick:e,placeholder:"Search bank accounts...",SearchList:wg,DefaultList:xg,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Eg=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function Ag({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=Gu(n?.name??"",n?.mask??"");return R(sc,{placement:"bottom-start",children:[S(dc,{children:r=>S(ap,{label:e,popupTriggerProps:r,disabled:t,children:S("button",{className:Eg,type:"button",disabled:t,children:rr(n)?S(Ys,{children:i}):S(Ys,{intent:"weak",children:"Select bank account"})})})}),S(kg,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const Ig=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),Sg=e=>{if(nr(e))return!1;const t=e.filter(e=>fh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||rr(e.lastSyncedDate))},Ng=()=>{const e=nh({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 nh({select:e=>{return{...e,plaidItemAccountsReadyToSync:Sg(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>fh(e.apiName)))};var t}})}function Dg(e){return e?.filter(e=>bh(e.apiName)&&"ACTIVE"===e.status)}function Pg(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function Mg(e){return nh({select:t=>({...t,data:Pg(t?.data,e)})})}const Lg=e=>{const{query:t}=nh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data},Fg=()=>["expenses/categories"],Og=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await yi(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 Vg(e){return Rr({...e,queryKey:["expenses/categories"],queryFn:Og})}function Bg(){return Vg({select:e=>({...e,data:e.data?jg(e.data):void 0})})}function Ug(e,t){return(t.get(e)??[]).map(e=>{const n=Ug(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Wg(e){if(0===e.length)return[];const t=zg(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=Ug(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Hg(){return Vg({select:e=>({...e,data:e.data?Wg(e.data):void 0})})}function zg(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 qg(e){if(0===e.length)return[];const t=zg(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function jg(e){if(0===e.length)return[];const t=zg(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function _g(){return xl({prefetchFn:ml(Fg,Og)})}const Kg=e=>({id:e.id,name:e.name});function Yg(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:_u("Category","Categories",n.size,!0),list:[...n].join(", ")}}const Zg=cr(tr.text,mr({label:"strongLabel"}),Gn({maxWidth:"100%"}),ja);function Gg({children:e,stylists:t=[]}){const n=gr([Zg,...t]);return S("div",{...n,children:e})}const Qg={keys:[{name:"name"}],threshold:.1};function Xg(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Jg(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?Xg(a,r,n):o?Xg(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Xg(e,n,t)})}(r,n)}),n}const $g=cr(tr["category-icon"],Gn({objectFit:"contain"})),em=cr(tr["category-icon"],Gn({objectFit:"contain",color:"icon.base"}));function tm(e,t,n){const r=({size:n=24})=>{const{icons:r}=l(li),a=e;return Tr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?S(Ae,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...em}):S("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...$g});var o};return r.displayName=t,r}const nm=cr(null,Gn({whiteSpace:"normal"})),rm=[cr(null,Gn({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function am({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=Vg({select:e=>({...e,data:e.data?qg(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ee(i??[],Qg),[i]),c=o(()=>i?Jg(s.search(e),i):[],[i,e,s]);return a?S(yg,{}):l?S(bg,{text:"No data"}):0===c.length?S(bg,{text:"No results found"}):S(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=tm(n.iconUrl,"Expense Icon");return R(gg,{onClick:()=>t(Kg(n)),children:[S(ud,{Component:a}),S(Gg,{stylists:[nm],children:r?n.name:R(N,{children:[e.name,S(rl,{Component:Qi,stylists:rm}),n.name]})})]},`${e.id}_${n.id}`)})})}const om=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=me([a,t?.ref]);return S(pg,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function im({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=l(ig),{itemRef:o,index:i,itemProps:s}=hg({hasCascading:!0}),{isScrolling:c}=l(eg);return R(sc,{open:n===i,onOpenChange:e=>{c||r(e,i)},placement:"right-start",children:[S(dc,{children:t=>S(om,{itemProps:s,index:i,ref:o,popupTriggerProps:t,children:e})}),S(xc,{initialFocus:a,children:t})]})}const lm=Gn({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),sm=Gn({display:"flex",gap:"8px",color:"icon.base"});function cm({Icon:e,iconUrl:t,displayLabel:n}){const r=t?tm(t,"Icon"):void 0;return R("div",{className:lm,children:[R("div",{className:sm,children:[!nr(e)&&e,nr(e)&&r&&S(ud,{Component:r}),S(vo,{wrap:"wrap",children:n})]}),S(rl,{Component:Qi})]})}function dm({category:e,handleCategoryChange:t}){return S(lg,{children:e.children?.map(e=>{const n=tm(e.iconUrl,"Expense Icon");return R(gg,{onClick:()=>t(Kg(e)),children:[S(ud,{Component:n}),S(vo,{wrap:"wrap",children:e.name})]},e.id)})})}function um({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=Bg(),a=t?.data,o=!r&&n&&void 0===a;return r?S(yg,{}):o?S(bg,{text:"No data"}):S(N,{children:a?.map(t=>{if(t.hasChilds)return S(im,{triggerChildren:S(cm,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:S(dm,{category:t,handleCategoryChange:e})},t.id);const n=tm(t.iconUrl,"Expense Category Icon");return R(gg,{onClick:()=>e(Kg(t)),children:[S(ud,{Component:n}),S(vo,{wrap:"wrap",children:t.name})]},t.id)})})}const hm=({onClick:e})=>{const{query:{data:t}}=Bg();return S(ug,{onClick:e,placeholder:"Search expense categories...",SearchList:am,DefaultList:um,listLength:(t?.data??[]).length})},pm=cr(tr["category-text"],Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",padding:0,outline:"none",border:"none",background:"none",borderRadius:"md",color:"typography.intent.action",flex:"1 1 0",minWidth:0,cursor:"pointer",_supportHover:{color:"typography.intent.action.hover"},"&:focus-visible":{outline:"4px solid",outlineOffset:"2px",outlineColor:"border.layout"},"& .Tight-icon > path":{_supportHover:{stroke:"typography.intent.action.hover"}}}),tl),gm=cr(null,Gn({color:"inherit"})),mm=cr(tr["amount-input-container"],Gn({borderRadius:"md",border:"none",background:"transparent",color:"typography.intent.action",maxWidth:"120px","&:not(:focus-within)":{_supportHover:{color:"typography.intent.action.hover"}},"& .Tight-amount-input, & .Tight-text":{color:"inherit"},"&[data-clicked='true']:focus-within":{outline:"1px solid",outlineOffset:"2px",outlineColor:"border.layout.strong"},"&[data-clicked='false']:has(:focus-visible)":{outline:"4px solid",outlineOffset:"2px",outlineColor:"border.layout"}}),tl);function vm({options:e,onClick:t}){const n=cc();return S(xc,{children:S(lg,{children:e.map((e,r)=>S(gg,{onClick:()=>(t(e),void n.close()),children:S(Ys,{children:e.label})},`${e.label}_${r}`))})})}const bm=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),fm=Gn.raw({color:"typography.base.weak"}),ym=(e,t)=>e===t;function xm({options:e,label:t,isEqual:n=ym,isEmpty:r,disabled:a}){const o=Eh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!nr(o.state.value)&&!r?.(o.state.value);return R(sc,{placement:"bottom-start",children:[S(dc,{children:n=>S(ap,{label:t,popupTriggerProps:n,disabled:a,children:S("button",{...bm,type:"button",children:S(Ys,l?{children:i(e,o.state.value)}:{extraClassNames:[fm],children:`Select ${t.toLowerCase()}...`})})})}),S(vm,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const Cm=Gn({border:"none",outline:"none",backgroundColor:"transparent"},mr.raw({label:"default"})),Tm=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"})),wm=ci(Tm,"Bank",{styleIconKey:"bank"}),km=$n({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 Em({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?Gu(e,t):e;return R("div",{className:km({active:r}),children:[n&&S(fo,{intent:r?"normal":"weak",children:n}),S(Ys,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const Am=e=>["plaidInstitutionLogo",e??{}],Im=Gn({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=kr(),n=Nr();return M({queryKey:Am({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Au({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?tm(i,"Logo"):void 0;return R("div",{className:Im,children:[S(ld,{Component:l&&o?l:wm}),S(Em,{accountName:e,accountNo:t,active:a,syncText:r})]})}const Nm=Gn({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Rm({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return S(Fs,{...r,disabled:n,width:"fill-parent",children:S(Gg,{children:e?Gu(e.name,e.mask):R("div",{className:Nm,children:[S(Ys,{children:t}),S(rl,{Component:xs})]})})})}const Dm="TRIGGER_ACCOUNT",Pm="FORM_SELECTABLE_ACCOUNT",Mm=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Lm({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Mm,children:[R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(Rm,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Dm?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),S(kg,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&S(Vh,{errorMessage:o})]})}const Fm=(e,t,n)=>{if(!n)return;const r=e===Pm?t:n,a=e===Pm?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,fh(c)&&bh(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},Om=Gn({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Vm=Gn({display:{base:"block",sm:"none"}}),Bm=Gn({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Um=Gn({display:"flex",justifyContent:"center",alignItems:"center"}),Wm=Gn({display:{base:"none",sm:"block"}}),Hm=Gn({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:Om,children:[R("div",{className:Bm,children:[o?S(Lm,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Dm,bankAccounts:n,isFilling:r,warningMessage:Fm(Dm,e,t??null)}):S(Rm,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Um,children:[S("div",{className:Wm,children:S(ud,{Component:Qi})}),S("div",{className:Hm,children:S(ud,{Component:lp})})]}),S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),S("div",{className:Vm,children:S(Mh,{alignment:"horizontal"})})]})}function qm({queryKey:e,queryFn:t,...n}){const r=kr(),a=Nr(),o=Tr(r),i=fr(e,r??"",a),l=P(),s=V({...n,queryKey:i,queryFn:o?t:Er,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Ir);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const jm=e=>["vendors",e??{}],_m=e=>["vendors","infinite",e??{}],Km=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Ym=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return Km({queryParams:n,cursor:r,accessToken:a,environment:o})};function Zm(e={},t){return fl({queryKey:jm(e),queryFn:Ym,...t})}const Gm=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return Km({queryParams:n,cursor:o,accessToken:r,environment:a})};async function Qm(e){const{url:t,headers:n}=xa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=ba({extraHeaders:n,authorization:t});ha("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return ha("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),fa(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function Xm(e){return Qm(e)}const Jm=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:mi(n)}),$m=async({data:e,accessToken:t,environment:n})=>Xm({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:mi(n)}),ev=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:mi(n)}),tv=async()=>await Ir.invalidateQueries({queryKey:["vendors"]});function nv(){return ch({mutationFn:Jm,onSuccess:tv})}const rv=Xn(mr({body:"default"}),Gn({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),av=Gn({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),ov=cr(tr["button-inline"],Gn({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function iv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:av,children:[S("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:rv}),S("button",{type:"button",onClick:r,...ov,children:S(fo,{children:"Add"})})]})}function lv({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=c(!1),[i,l]=c(""),s=a(null);return u(()=>{r&&s.current&&s.current.focus({preventScroll:!0})},[r]),S(gg,{onClick:r?void 0:()=>{o(!0)},children:r?S(iv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:s}):S(vg,{promptText:e})})}function sv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ee(e??[],Cg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?S(yg,{}):R(N,{children:[S(lv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?S(bg,{text:"No results found"}):l.map(e=>S(gg,{onClick:()=>n(e),children:S(Ys,{children:e.name})},e.id))]})}function cv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?S(yg,{}):R(N,{children:[S(lv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>S(gg,{onClick:()=>t(e),children:S(Ys,{children:e.name})},e.id))]})}function dv({onClick:e}){const{query:{data:t,isLoading:n}}=Zm({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=nv(),a=t?.data??[];return S(ug,{onClick:e,placeholder:"Search vendors...",SearchList:sv,DefaultList:cv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}function uv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const hv=e=>["customers",e??{}],pv=e=>["customers","infinite",e??{}],gv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:mi(r)},o=await wa(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},mv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return gv({queryParams:n,cursor:r,accessToken:a,environment:o})};function vv(e={},t){return fl({queryKey:hv(e),queryFn:mv,...t})}const bv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return gv({queryParams:n,cursor:o,accessToken:r,environment:a})},fv=async({data:e,accessToken:t,environment:n})=>wa({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:mi(n)}),yv=async({data:e,accessToken:t,environment:n})=>Xm({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:mi(n)}),xv=async()=>await Ir.invalidateQueries({queryKey:["customers"]});function Cv(){return ch({mutationFn:fv,onSuccess:xv})}const Tv={type:"tween",duration:.3},wv={x:"100%"},kv={x:0},Ev={x:"100%"};function Av({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return S(xc,{style:r,modal:!0,forceMount:t,children:e})}const Iv=Gn({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Sv=cr(null,Iv);function Nv({children:e,clickHandler:t}){const n=cc();return t||(t=()=>{n.close()}),S(be,{lockScroll:!0,...Sv,onClick:t,children:e})}const Rv=Gn({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 Dv({children:e,overlay:t=!1}){const n=cc(),r=d(e=>{e.stopPropagation()},[]);return S(Ie,{children:n.context.open&&R(Av,{fadeIn:!1,forceMount:!0,children:[t&&S(Nv,{}),S(Se.div,{transition:Tv,initial:wv,animate:kv,exit:Ev,className:Rv,onAnimationEnd:r,children:e})]})})}const Pv=Gn.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Mv=Gn.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"}),Lv=cr(tr["drawer-header"],Gn(Pv));function Fv({hideDivider:e=!1,children:t}){return R(N,{children:[S("header",{...Lv,children:t}),!e&&S(Mh,{alignment:"horizontal",color:"normal"})]})}const Ov=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Vv({children:e}){return S("div",{className:Ov,children:e})}const Bv=Gn({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),Uv=$n({base:Mv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function Wv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=cc();return R(N,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi,handleClose:()=>{r?.(),i.close()}}),S(vo,{children:o}),!nr(t)&&S("div",{className:Bv,children:t})]})}),S("div",{className:Uv({padChildren:a}),children:n}),e]})}function Hv({overlay:e=!1,...t}){return S(Dv,{overlay:e,children:S(Wv,{...t})})}const zv=ci(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"}),qv=Gn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),jv=cr(tr["drawer-search-bar"],Gn({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"})),_v=Xn(Gn({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"}}),mr({label:"strongLabel"})),Kv=cr(null,Gn({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Yv({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:qv,children:[S(vo,{children:"Search"}),R("div",{...jv,children:[S(ud,{Component:zv}),S("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:_v}),Tr(e)&&S(Fs,{stylists:[Kv],onClick:()=>t(""),children:S(ud,{Component:uc})})]})]})}function Zv({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=c("");return S(sg,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Yv,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function Gv({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:u}){const[h,p]=ic({},a?.selected,i),[g,m]=ic({},a?.expanded,l),v=d((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),b=d((e,t)=>{const n=t??!g[e],r={[e]:n};m({...g,...r})},[g,m]),f=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:()=>u?.(e)??!0,getIsExpanded:()=>g[r]??!1,toggleExpanded:()=>b(r,!g[r])}})})),[e,r,t,n,h,v,g,b,c,u]);return o(()=>{const e={selected:h,expanded:g};return{groups:f,toggleSelected:v,toggleExpanded:b,getState:()=>e}},[f,v,b,g,h])}const Qv=ci(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"),Xv=Gn({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function Jv({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:Xv,children:[S(ud,{Component:Qv}),S(vo,{wrap:"wrap",children:`No ${t} found`}),n&&S(fo,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const $v=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function eb({children:e}){return S("div",{className:$v,children:e})}const tb=cr(tr["list-body"],null);function nb({title:e,children:t}){return R(eb,{children:[e,S("div",{...tb,children:t})]})}const rb=ci(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"),ab=cr(null,Gn({fill:"surface.intent.action.active"}));function ob({selected:e,showEmptyIndicator:t}){return e?S(ud,{Component:pi,stylists:[ab]}):t?S(ud,{Component:rb}):null}const ib=$n({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 lb({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=cr(tr["selector-row"],ib({selected:r}),el);return S("button",{onClick:t,...a,...n,type:"button",children:e})}function sb({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(lb,{handleClick:t,selected:n,children:[e,S(ob,{selected:n,showEmptyIndicator:r})]})}const cb=Gn.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function db(){return S(jo,{styles:Gn(ac,cb)})}const ub=Gn({width:"70px",height:"24px"}),hb=Gn({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function pb(){return R("div",{className:hb,children:[S(jo,{styles:ub}),R(eb,{children:[S(db,{}),S(db,{}),S(db,{})]}),S(jo,{styles:ub}),R(eb,{children:[S(db,{}),S(db,{}),S(db,{})]})]})}function gb({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ee(e,Cg),[e]),s=Gv({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?S(pb,{}):0===s.groups.length?S(Jv,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):S(nb,{title:S(Ys,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return S(sb,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:S(Ys,{children:t.value.name})},t.key)})})}const mb=Gn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),vb=Gn({width:"100%"});function bb({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=c(!1),[i,l]=c(""),s=a(null);u(()=>{r&&s.current&&s.current.focus({preventScroll:!0})},[r]);const d=()=>{l(""),o(!1)};return R("div",{className:vb,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d()},children:[S(Mh,{alignment:"horizontal"}),S(lb,{handleClick:r?void 0:()=>{o(!0)},children:r?S(iv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:d,inputRef:s}):S(vg,{promptText:e})})]})}function fb({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=Gv({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?S(pb,{}):R(eb,{children:[S(bb,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n}),R("div",{className:mb,children:[S(Ys,{children:"Customers"}),S("div",{children:i.groups.map(e=>{const[t]=e.getRows();return S(sb,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:S(Ys,{children:t.value.name})},t.key)})})]})]})}function yb({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=vv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(uv)})}),{mutateAsync:a}=Cv(),o=cc(),i=n?.data??[],[l,s]=c(t?{[t.id]:!0}:{}),d=!l[t?.id??""];return S(Hv,{title:"Back",Footer:S(Uh,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!d}),onClose:()=>s(t?{[t.id]:!0}:{}),children:S(Zv,{placeholder:"Search customers...",onClick:e=>{nr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:gb,DefaultList:fb,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 xb({frequencies:e,onClick:t}){const n=cc();return S(xc,{children:S(lg,{children:e.map(e=>S(gg,{onClick:()=>(t(e),void n.close()),children:S(vo,{children:e.name})},e.value))})})}const Cb=$n({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%"}},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 Tb({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=cr(tr["button-group"],Xn(Cb({width:a,backgroundColor:o,active:t,corners:i}),Es,Ts,Gn(Ds),Ji));return S("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?S(vo,{wrap:"wrap",textAlign:"center",children:e.label}):S(Ys,{wrap:"wrap",alignment:"center",children:e.label})})}const wb=$n({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"}}}});function kb({width:e,children:t}){return S("div",{className:wb({width:e}),children:t})}function Eb({options:e,handleClick:t,selectedIndex:n}){const[r,a]=c(null);return S(kb,{width:"full",children:e.map((e,o)=>R(b,{children:[0!==o&&S(Mh,{color:o!==n&&o!==n+1||r===n?"normal":"active"}),S(Tb,{option:e,isActive:o===n,handleClick:()=>t(o),onHoverChange:e=>a(e?o:null),width:"full",backgroundColor:"foreground",corners:"rounded"})]},e.value))})}const Ab=ci(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"),Ib=Gn({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}"},Wh,Hh,$i),Sb=cr(null,Gn({color:"icon.base"})),Nb=cr(tr["attachment-dropzone"],Ib);function Rb({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return R("div",{...a,...e({className:Nb.className,onMouseDown:r,onBlur:n}),children:[S("input",{...t()}),S(ud,{stylists:[Sb],Component:Ab}),S(Ys,{children:"Add Files"})]})}const Db=Gn({display:"flex",flexDirection:"column",gap:"8px"}),Pb=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"});function Mb({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return R("div",{className:Db,children:[o&&S("div",{className:Pb,children:S(Ys,{children:o})}),S(Rb,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&S(Vh,{errorMessage:i})]})}const Lb=Gn({display:"flex",justifyContent:"start",width:"100%"}),Fb=Gn({display:"flex",alignItems:"center",gap:"9px"}),Ob=Gn({width:"100%"}),Vb=$n({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function Bb(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Ub({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||!Bb(n)}),[e,t]),s=o(()=>new Ee(l,Cg),[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 S(Jv,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return R(N,{children:[S("div",{className:Lb,children:S(Ys,{children:"Search Results"})}),S("div",{className:Vb({nested:u}),children:d.map(e=>S("div",{className:Ob,children:e.map(e=>S(lb,{handleClick:()=>i(e),selected:r[e.id],children:R("div",{className:Fb,children:[S(ob,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),S(Ys,{children:e.name})]})},e.id))},e[0].id))})]})}const Wb=ci(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"),Hb=$n({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"}}}}),zb=Gn({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"}}),qb=Gn({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 jb({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=cr(tr["selector-row"],Hb({active:r,expanded:a}),el);return R("div",{...i,children:[o?R("button",{type:"button",className:zb,onClick:t,children:[S(ob,{selected:r,showEmptyIndicator:!r}),e]}):S("div",{className:zb,children:e}),!nr(n)&&S("button",{type:"button",className:qb,onClick:n,children:S(ud,{Component:a?Wb:lp})})]})}function _b({dimensionValueRows:e,onClick:t}){return e.map(e=>S(lb,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:Fb,children:[S(ob,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),S(Ys,{children:e.value.name})]})},e.key))}function Kb({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=Gv({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||!Bb(t)}}),c=s.groups.some(e=>e.getRows().length>1);return R(N,{children:[S("div",{className:Lb,children:S(Ys,{children:e})}),S("div",{className:Vb({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return R("div",{className:Ob,children:[(c||0===t)&&S(Mh,{alignment:"horizontal"}),S(jb,{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:S(Ys,{children:n.value.name})}),n.expanded&&R(N,{children:[S(Mh,{alignment:"horizontal"}),S(_b,{dimensionValueRows:r,onClick:i})]})]},e.key)}return S(_b,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function Yb({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=d(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 S(Zv,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Ub,DefaultList:Kb,listLength:t.flatDimensionValues.length,extraProps:t})}function Zb({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||!Bb(n)}),[n,r]),[l,s]=c(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),d=o(()=>i.flat(),[i]),u=cc(),h=Object.values(l).some(Boolean);return S(Wv,{title:"Back",Footer:S(Uh,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=d.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:S(Yb,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:d,selectedRow:l,setSelectedRow:s})})}function Gb(e){const t=cc();return S(Dv,{children:t.open&&S(Zb,{...e})})}const Qb=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),Xb=Gn.raw({color:"typography.base.weak"});function Jb(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 $b=/\D/g,ef=Gn({border:"none",outline:"none",backgroundColor:"transparent"},mr.raw({label:"default"})),tf=Gn({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),nf=$n({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:"14px",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),rf=Gn({border:"none",background:"none",padding:0,cursor:"pointer"}),af=Gn({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function of({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return R("div",{...cr(tr.pill,n,nf({disabled:r})),children:[S("div",{className:af,children:e}),S("button",{className:rf,onClick:t,disabled:r,children:S(hc,{Component:uc,stylists:[cr(null,tf)]})})]})}const lf=I.email(),sf=Gn({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),cf=Gn({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},mr.raw({label:"default"})),{useAppForm:df,withForm:uf,withFieldGroup:hf}=we({formContext:wh,fieldContext:kh,formComponents:{SaveButton:Nh,FormSaveButton:Dh,FormFooter:Uh},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Eh();return S(Gh,{inputRef:t,label:e,children:S(tp,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Eh();return S(ap,{inputRef:r,label:e,hasErrorStyles:t,children:S(tp,{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=Eh(),s=Te(l.store,e=>e.meta.isDefaultValue),d=a(null),[u,h]=c(()=>l.state.value?Pt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Pt(l.state.value):null,[g,m]=c(""),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=Dt(r);if(a){let e=a;t&&n?e=Ft(Lt(a,t),n):t?e=Lt(a,t):n&&(e=Ft(a,n)),l.handleChange(Mt(e)),h(e)}else l.handleChange("")},b=g||(p?Nt(p):""),[f,y]=c(!1),x=e=>{f&&(()=>{if(p&&!s){const e=Dt(g);(t&&e&&St(e,t)||n&&e&&St(n,e))&&m(Nt(p))}})(),y(e)},C=e=>{"Enter"===e.key&&(e.preventDefault(),x(!f))},T=o?ap:Gh;return R(sc,{placement:"bottom-start",onOpenChange:x,open:f,children:[S(dc,{children:t=>S(T,{label:e,inputRef:d,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:S("input",{...wp,ref:d,type:"text",id:l.name,value:b,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:C,autoComplete:"off"})})}),S(xc,{initialFocus:!1,children:S(Tp,{selectedDate:p,onDateSelect:e=>{l.handleChange(Mt(e)),m(Nt(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=Eh(),i=a(null);return S(ap,{label:e,inputRef:i,children:S("textarea",{...kp,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:Jp,SplitExpenseCategoryField:function({value:e,onChange:t}){const n=e?.iconUrl?tm(e.iconUrl,"Expense Icon"):void 0;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>R("button",{...pm,...t,type:"button",children:[n&&S(ud,{Component:n}),S(vo,{stylists:[gm],children:e?.name||"Uncategorized"})]})}),S(hm,{onClick:t})]})},SplitExpenseAmountField:function({value:e,onChange:t,onBlur:n}){const[r,a]=c(!1);return S("div",{...mm,"data-clicked":r,children:S(tp,{value:e,onChange:t,onClick:()=>a(!0),onBlur:()=>(a(!1),void n())})})},ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Eh(),a=Lg(t?.id??""),{query:{data:o},isFilling:i}=nh({select:e=>({...e,data:Dg(e?.data)})}),l=o?.data,s=rr(e)&&!$p(e);return S(Ag,{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=Eh(),r=t.findIndex(e=>e.value===n.state.value);return S(ap,{label:e,disableHover:!0,children:S(Eb,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:xm,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Eh(),l=a(null);return S(ap,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:S("input",{className:Cm,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?ap:Gh,{handleBlur:l}=Eh();return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(i,{inputRef:o,label:e,popupTriggerProps:t,children:S(Ys,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})}),S(dv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?ap:Gh;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(i,{inputRef:o,label:e,popupTriggerProps:t,children:S(Ys,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})}),S(yb,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??Gl[0].name}`;return R(sc,{placement:"bottom-start",children:[S(dc,{children:t=>S(ap,{inputRef:r,label:e,popupTriggerProps:t,children:S(vo,{children:o})})}),S(xb,{frequencies:Gl,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=Dp,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Eh(),{mutateAsync:d}=Op(),[u,h]=c(!0),{dataAttributes:p}=zh({isActive:u,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l}),{getRootProps:g,getInputProps:m}=Ne({maxFiles:e,accept:t,disabled:n,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=>Lp(e,n))),...i.map(e=>Mp(e,Rp.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const u=c.map(async e=>{try{const t=await d({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(u);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 S(Mb,{getRootProps:g,getInputProps:m,dataAttrs:p,onMouseDown:()=>h(!0),onBlur:()=>h(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return R(sc,{children:[S(dc,{children:n=>S(ap,{label:e,popupTriggerProps:n,children:S("button",{className:Qb,type:"button",children:S(Ys,t?{children:t.name}:{extraClassNames:[Xb],children:`Select ${e.toLowerCase()}...`})})})}),S(Gb,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Eh(),o=a(null),i=a(null);return g(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),S(ap,{label:e,disabled:t,inputRef:o,kind:"text",children:S("input",{className:ef,value:Jb(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace($b,"").length,o=t.value.replace($b,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=Jb(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=Eh(),[o,i]=c(""),l=a(null),s=r.state.value,d=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=lf.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 S(ap,{label:e,disabled:t,inputRef:l,kind:"container",children:R("div",{className:sf,children:[s.map(e=>S(of,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:tr["email-pill"],disabled:t},e)),S("input",{ref:l,className:cf,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:d,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),d()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const pf=[cr(null,Gn({"& path":{stroke:"icon.base"}}))];function gf({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(Fs,{type:"button",onClick:n,children:[e&&S(rl,{Component:uc,stylists:pf}),S(vo,{children:t})]})}const mf=Gn({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),vf=Gn({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),bf=Gn({maxWidth:"600px"}),ff=Gn({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),yf=Gn({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),xf=Gn({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Cf=Gn({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Tf=Gn({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),wf=Gn({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),kf=e=>{Qh(e),Xh(e)};function Ef({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=nh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=vh(),a=kr(),o=Nr(),i=rr(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,Zl({queryKey:yr(Jl({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:es,accessToken:n,environment:r}))}),df({defaultValues:l,onSubmit:async e=>{if(await Ch()===Su){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await Th());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=yr(Jl({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await Yl({queryKey:r,queryFn:es,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Pt(e.tranStartDate||""),l=Pt(n||""),s=Pt(e.tranMinStartDate||""),nr(l)?i:rr(s)?Ft(l,s):(rr(i)&&Ft(l,i),i));var i,l,s;return nr(r)?null:Mt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...yh(t),duplicateBankAccountIds:[cs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await Th()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:mf,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:kf,children:[R("div",{className:vf,children:[S(vo,{children:"Merge Accounts"}),S("div",{className:bf,children:S(Ys,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:ff,children:[R("div",{className:yf,children:[S("div",{className:xf,children:S(vo,{children:"Duplicate Account"})}),S("div",{className:Cf,children:S(vo,{children:"Into"})}),S("div",{className:Tf,children:S(vo,{children:"Destination Account"})})]}),S(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>S(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)&&bh(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return S(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))})]}),S("div",{className:wf,children:S(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[S(gf,{showIcon:!1,onClick:()=>n()}),S(sd,{onClick:()=>i.reset(o),disabled:!t,children:S(vo,{children:"Clear Selections"})}),S(Nh,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Af=Gn({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"}),If=ye.createConfirmation(xe(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return S(Lu,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:S("div",{className:Af,children:S(Ef,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Sf({plaidItemAccounts:e,matchingAccountPairs:t}){await If({matchingAccountPairs:t,plaidItemAccounts:e})}const Nf=Gn({display:"flex",flexDirection:"column",gap:"12px"}),Rf=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:Eu(n)},{url:a,headers:o}=xa(r);return vi({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(ha("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(pa({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),Ju("NO_LINK_TOKEN"))}catch(r){return pa({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),Ju("LINK_TOKEN_FAILED")}};async function Df(e,t,n){const r=await async function(e,t){const n=yr(Cu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await Yl({queryKey:n,queryFn:Tu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Pf(e,t,n,r){ha("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||ha("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,Zl({queryKey:yr($u({filter:eh}),{}),queryFn:th,accessToken:r,environment:a});const o=await Df(e,t,n);if(o){const e=await rh(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:Eu(r)},{url:o,headers:i}=xa(a);return await Ca({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(ha("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Ir.invalidateQueries({queryKey:["integrations"]}),Ir.invalidateQueries({queryKey:["banks/accounts",{}]}),Ir.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===lh({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return pa({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 rh(n,r),s=l?.data?.filter(e=>bh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=T(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(pa({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ju({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:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void pa({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 pa({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ju({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Iu,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return pa({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 ju({title:"All set! Ready to track your transactions?",body:R("div",{className:Xu,children:[S(Ys,{wrap:"wrap",children:`Your ${n} ${t} ${_u("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),S(Ys,{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.`}),S("ul",{children:e.map(e=>S("li",{children:S(Ys,{wrap:"wrap",children:Gu(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:Nu,label:"Get Started",type:qu.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:sh(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 ju({title:"Your transactions are being categorized",body:R("div",{className:Nf,children:[S(Ys,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),S(Ys,{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})=>S("li",{children:S(Ys,{wrap:"wrap",children:Gu(e?.name??"",e?.mask??"")})},e?.id)),a&&S("li",{children:S(Ys,{wrap:"wrap",children:"and more..."})})]}),S(Ys,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Iu,label:"No thanks"},{key:Nu,label:"Review",type:qu.SUCCESS}]})===Nu&&await Sf({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(pa({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ju({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${_u("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:Nu,label:"Get started",type:qu.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return pa({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ju({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Chat",type:qu.SUCCESS}]})===Nu&&Qu({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 Mf(e,t,n){return nr(e)?(ha("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(ha("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(pa({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&&(pa({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 ju({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:Iu,label:"Cancel"},{key:"chat",label:"Chat"},{key:Nu,label:"Banks & Integrations",type:qu.SUCCESS}]});"chat"===t?Qu({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==Nu||(e=>{const t=ln.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||jl("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Lf=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Vt(t.lastSyncedDate)}`},Ff=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},Of="PLAID_LINK_NEW",Vf="PLAID_LINK_UPDATE",Bf="PLAID_LINK_UNLINK";function Uf({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}}}const Wf=i({});function Hf({onPlaidLink:e,children:t}){return S(Wf.Provider,{value:{onPlaidLink:e},children:t})}function zf(){return l(Wf)}const qf=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Na(n)};return await ka(r)};function jf(){return ch({mutationFn:qf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})}})}const _f=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Na(t)};return await ka(n)};function Kf(){return ch({mutationFn:_f,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})}})}const Yf=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(cs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Na(n)};return await async function(e){return Qm(e)}(r)};function Zf(){const{mutate:e}=Kf();return ch({mutationFn:Yf,onSuccess:()=>{const e=["integrations"];return Ir.invalidateQueries({queryKey:e})},onError:async t=>{pa({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ju({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Iu,label:"Cancel"},{key:Nu,label:"Try Again",type:qu.SUCCESS}]})===Nu&&e()}})}function Gf(e){return new Promise(t=>{window.Plaid.create({token:e,onSuccess:(e,n)=>t({status:"success",public_token:e,metadata:n}),onExit:(e,n)=>t({status:"exit",metadata:n,error:e}),onEvent:(e,t)=>{ha(`Plaid event: ${e}`,{metadata:t,eventName:e})}}).open()})}async function Qf(e,t,n,r){const a=await Rf(e,t,n);if(!a)return;const o=await Gf(a);if("success"===o?.status){const{public_token:e,metadata:a}=o;ha("Plaid link successful",{public_token:e,metadata:a});const i=await Pf(e,a,t,n);if(i.relinkPlaidItemId)return Qf(i.relinkPlaidItemId,t,n,r)}else if("exit"===o?.status){const{metadata:e,error:t}=o;ha("Plaid link exited",{metadata:e,error:t}),await Mf(t,e,a)&&r()}else pa({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:o,token:a}})}function Xf(){const[e,t]=xu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=kr(),r=Nr(),{mutate:a}=Kf(),{onPlaidLink:o}=zf();return{linkPlaid:e=>{if(rr(o)){const t=Uf(e);o(t)}else Qf(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,a)},loading:e||rr(t),hasOnPlaidLinkOverride:rr(o)}}function Jf(){const[e,t]=xu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=kr(),r=Nr(),{mutate:a}=Kf(),{apiPartnerName:o}=l(Lc),{onPlaidLink:i}=zf();return{linkPlaid:e=>{if(rr(i)){const t=Uf(e);i(t)}else!async function(e,t,n,r,a){const o=await Rf(e,t,n);if(!o)return;const i=await Gf(o);if("success"===i?.status){const{public_token:e,metadata:o}=i;ha("Plaid link from search successful",{public_token:e,metadata:o});const l=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Df(t.institution.institution_id,n,r);if(i)return pa({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ju({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:Iu,label:"Cancel"},{key:Nu,label:"Relink",type:qu.SUCCESS}]}))===Nu?{relinkPlaidItemId:cs(i.id)}:{}}var o;return ha("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Pf(e,t,n,r)}(e,o,t,n,r);l.relinkPlaidItemId&&Qf(l.relinkPlaidItemId,t,n,a)}else if("exit"===i?.status){const{metadata:e,error:t}=i;ha("Plaid link from search exited",{metadata:e,error:t}),await Mf(t,e,o)&&a()}}(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,o,a)},loading:e||rr(t),hasOnPlaidLinkOverride:rr(i)}}const $f=cr(null,Ts,Gn({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"}}}}),Ji);function ey(){const{linkPlaid:e,loading:t}=Xf();return R("button",{onClick:()=>e({plaidEvent:Of,message:"Tile Plaid Link button pressed"}),...$f,disabled:t,children:[S(ud,{Component:vu}),S(Ys,{intent:"primary",children:"Link Account"})]})}const ty=Gn({width:266,minHeight:32});function ny(){return S(jo,{styles:ty})}const ry=cr(tr.text,Gn({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function ay({children:e}){return S("div",{...ry,children:e})}const oy={SUCCESS:Gn({backgroundColor:"surface.intent.success.highlight"}),DANGER:Gn({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:Gn({backgroundColor:"surface.intent.secondary"})},iy=cr(tr.chip,Gn({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function ly({variant:e,children:t}){return S("div",{className:Xn(iy.className,oy[e]),children:S(ay,{children:t})})}const sy=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function cy({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${co(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return S(ly,{variant:sy(r,n,t),children:a})}const dy=Gn({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function uy({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:dy,children:[S(ro,{title:e,label:t}),rr(n)&&S(cy,{difference:n,invertDirection:r})]})}const hy={netIncome:0,income:0,expenses:0,absoluteSum:0},py=e=>{if(nr(e))return hy;const t=e.income?.total??0,n=e.expenses?.total??0,r=U(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},gy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(py):[]},my=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function vy({defaultRange:e=gt.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=t?Wt(t):e,{query:{data:i},isFilling:l}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:gy})}({filter:a,grouping:t?Va:void 0}),{profitLossData:s,profitDifference:c}=o(()=>{if(n)return{profitLossData:ti,profitDifference:null};if(!i||0===i.length)return{profitLossData:my,profitDifference:null};if(2===i.length){const[e,t]=i;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:i[0],profitDifference:null}},[i,n]);return R(qa,{isSample:n,children:[S(Ua,{title:"Profit + Loss"}),S(Ha,{children:l?R(Ko,{children:[S(ny,{}),S(ny,{})]}):R(N,{children:[S(uy,{title:uo(s.netIncome),label:"Profit",comparison:c}),R(oo,{children:[S(mu,{amount:s.income,total:s.absoluteSum,color:"positive",label:"Income"}),S(mu,{amount:s.expenses,total:s.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&S(Jo,{size:"sm"}),r&&S(ey,{})]})}const by=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],fy=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...Tt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Na(a)};return await ka(o)},yy={moneyIn:0,moneyOut:0,netMoneyIn:0},xy=e=>{if(nr(e)||nr(e.operatingActivities)||!e.operatingActivities.children)return yy;let t=new U(0),n=new U(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(U(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Cy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(xy):[]};const Ty=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function wy({defaultRange:e=gt.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=t?Wt(t):e,{query:{data:i,isFetched:l},isFilling:s}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Rr({queryKey:by({filter:e,grouping:t}),queryFn:fy,select:n})}({filter:e,grouping:t,select:Cy})}({filter:a,grouping:t?Va:void 0}),{cashFlowData:c,difference:d}=o(()=>{if(n)return{cashFlowData:ri,difference:null};if(!i||0===i.length)return{cashFlowData:Ty,difference:null};if(2===i.length){const[e,t]=i;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:i[0],difference:null}},[i,n]),u=n||l?Math.abs(c.moneyIn)+Math.abs(c.moneyOut):0;return R(qa,{isSample:n,children:[S(Ua,{title:"Cash Flow"}),S(Ha,{children:s?R(Ko,{children:[S(ny,{}),S(ny,{})]}):R(N,{children:[S(uy,{title:uo(c.netMoneyIn),label:"Change in Cash",comparison:d}),R(oo,{children:[S(mu,{amount:c.moneyIn,total:u,color:"positive",label:"Money In"}),S(mu,{amount:c.moneyOut,total:u,color:"negative",label:"Money Out"})]})]})}),n&&S(Jo,{size:"sm"}),r&&S(ey,{})]})}const ky=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Ey=Gn({display:"flex",justifyContent:"end"});function Ay({color:e,bulletLabel:t,moneySummary:n}){return R("div",{className:ky,children:[S(Ao,{color:e,label:t}),S("div",{className:Ey,children:S(Ys,{children:n})})]})}const Iy=cr(null,Gn({display:"flex",gap:"10px",alignItems:"center"})),Sy=Gn({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Ny=cr(null,Sy);function Ry({bulletAmount:e=3,shimmer:t=!1}){return S(N,{children:Array.from({length:e},(e,n)=>R("div",{...Iy,children:[S(Ao,{color:To.var("colors.brand.secondary")}),t?S(jo,{styles:Sy}):S("div",{...Ny})]},n))})}const Dy={total:0,children:[]},Py=e=>{return nr(e)||nr(e.expenses)||!e.expenses.children?Dy:{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},My=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Py):[]},Ly=[To.var("colors.brand.primary"),To.var("colors.brand.success"),To.var("colors.brand.action")],Fy=Object.freeze({total:0,children:[]});function Oy({defaultRange:e=gt.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=ln(e=>e.externalOptions).dataVisualizationColors??Ly,l=t?Wt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return Pa({filter:e,grouping:t,select:My})}({filter:l,grouping:t?Va:void 0}),{expenseData:d,expensesDifference:u}=o(()=>{if(r)return{expenseData:ni,expensesDifference:null};if(!s||0===s.length)return{expenseData:Fy,expensesDifference:null};if(2===s.length){const[e,t]=s;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:s[0],expensesDifference:null}},[s,r]),h=void 0===n?"Total Expenses":`${kt[n]} Total`,p=d.children.length>0;return R(qa,{isSample:r,children:[S(Ua,{title:"Expenses"}),S(Ha,{children:c?S(Ko,{children:S(Ry,{shimmer:!0})}):R(N,{children:[S(uy,{title:uo(d.total),label:h,comparison:u,invertDirection:!0}),S(oo,{children:p?d.children.map((e,t)=>S(Ay,{color:i[t],bulletLabel:e.name,moneySummary:uo(e.total)},t)):S(Ry,{})})]})}),r&&S(Jo,{size:"sm"}),a&&S(ey,{})]})}const Vy=cr(null,Gn({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function By({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:it(l=e.year,i,1),endDate:it(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Vy,children:[R(ur,{children:[S(br,{children:"Monthly Review"}),S(nu,{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(au,{children:[S(vy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),S(wy,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),S(Oy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const Uy="Oldest to Newest",Wy="Newest to Oldest",Hy="A-Z",zy="Z-A",qy="Lowest to Highest",jy="Highest to Lowest",_y="A-Z",Ky="Z-A";function Yy(){const[e,t]=c(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 Ql)??!1,n=(e.direction&&e.direction in Xl)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const Zy=Gn({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"}}}),Gy=Gn({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),Qy=Gn({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function Xy({checked:e,onClick:t,Icon:n=Ih}){const[r,a]=c(e??!1),o=void 0===e?r:e;return S("button",{...cr(tr["checkbox-input"],Zy,o?Qy:Gy,el),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&S(hc,{Component:n})})}const Jy=cr(null,Gn({paddingLeft:"20px",paddingRight:"5px"}));function $y({checked:e,onClick:t,Icon:n=Ih}){return S("div",{...Jy,children:S(Xy,{checked:e,onClick:t,Icon:n})})}const ex=cr(tr["date-cell"],Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function tx({date:e,annotation:t}){const n=Nt(Pt(e));return R("div",{...ex,children:[t&&S(ay,{children:t}),S(Ys,{children:n})]})}const nx="Income",rx={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},ax={Expense:[{name:"Expense",value:rx.EXPENSE}],Income:[{name:nx,value:rx.REVENUE}],Transfer:[{name:"Bank Transfer In",value:rx.TRANSFER_IN},{name:"Bank Transfer Out",value:rx.TRANSFER_OUT}]},ox={EXPENSE:"Expense",REVENUE:nx,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},ix=Object.fromEntries(Object.entries(ox).map(([e,t])=>[e,`Add ${t}`])),lx=Object.fromEntries(Object.entries(ox).map(([e,t])=>[e,`Edit ${t}`])),sx=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},cx=e=>e===rx.TRANSFER_IN||e===rx.TRANSFER_OUT,dx=Gn({color:"money.negative"}),ux=Gn({color:"money.positive"}),hx=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>xr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),px=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!nr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:dx};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?ux:dx}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":nx,css:t?dx:ux}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?dx:ux};break;default:t=(e=>({type:e.type,displayName:hx(e.type),css:e.amount<0?dx:ux}))(e)}var n;return t},gx=ci(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"),mx=cr(tr["transaction-date-cell-container"],Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function vx({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=px(e),a=cr(tr["transaction-type-label"],r.css),o=t?S("span",{...a,children:r.displayName}):void 0;return n?R("div",{...mx,children:[S(ud,{Component:gx}),S(tx,{date:e.date,annotation:o})]}):S(tx,{date:e.date,annotation:o})}const bx=Gn({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),fx=Gn({display:"flex",flexDirection:"column",width:"100%"}),yx=Gn({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function xx({label:e,subLabel:t,iconUrl:n}){return R("div",{className:bx,children:[n?S("img",{src:n,className:yx,alt:void 0,width:24,height:24}):S("span",{className:yx}),R("div",{className:fx,children:[S(Ys,{children:e}),S(fo,{children:t})]})]})}function Cx({bankTransaction:e,isChild:t=!1}){return t?S("div",{className:Gn({paddingLeft:"25px"}),children:S(xx,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):S(xx,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}function Tx(e){return ho(Ku(e.amount))}const wx=ci(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"),kx=ci(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"),Ex=Gn({display:"flex",alignItems:"center",gap:"8px"}),Ax=Gn({padding:"6px"});function Ix({row:e}){const t=e.original,n=S(hu,{children:Tx(t)});if(e?.getCanExpand()){const t=e.getIsExpanded();return S(Ic,{ariaLabel:t?"Collapse children":"Expand children",ariaExpanded:t,children:R("div",{className:Ex,children:[S(ud,{Component:t?kx:wx}),n]})})}return S("div",{className:Ax,children:n})}const Sx=ci(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"),Nx=ci(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"),Rx=Gn({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),Dx=Gn({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function Px({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return Sx;case"Deposited to":return Nx;default:return null}})(e);return R("div",{className:Rx,children:[n&&S(ud,{Component:n}),R("div",{className:Dx,children:[e&&S(fo,{children:e}),t&&S(Ys,{children:t})]})]})}const Mx=Gn({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"}}),Lx=Xn(Mx,Gn({padding:"2.5px"})),Fx=Xn(Mx,Gn({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),Ox=Gn({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"}}),Vx=Xn(Ox,Gn({_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"}}})),Bx=Gn({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"}}}),Ux=Xn(Bx,Gn({_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"}}})),Wx=Gn({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"}}),Hx=Xn(Wx,Gn({_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"}}})),zx=Gn({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"}}),qx=Xn(zx,Gn({_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"}}})),jx=Gn({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"}}),_x=Xn(jx,Gn({_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"}}})),Kx=Gn({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"}}),Yx={default:Vx,neutral:Vx,warning:qx,success:Hx,danger:_x,highlight:Ux},Zx=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=gr([cr(tr["selector-button"],Xn(Kx,Yx[e]),el),...n]);return S("button",{ref:a,...o,...r,children:t})}),Gx=()=>["accounting/glAccounts"],Qx=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await yi(n);return $x(r)};function Xx(e){return Rr({...e,queryKey:["accounting/glAccounts"],queryFn:Qx})}function Jx(){return Xx({select:lC})}const $x=e=>e.map(e=>({...e,id:ss({id:e.id,prefix:"GL_ACCOUNT"})}));function eC(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 tC(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>tC(e,t))}const nC=e=>!e.parentAccountNo;function rC(e){const t=eC(e);return e.filter(nC).map(e=>({...e,children:tC(e,t)}))}function aC(e,t){return(t.get(e)??[]).map(e=>{const n=aC(e.accountNo,t);return{...e,children:n}})}function oC(e){const t=eC(e);return e.filter(nC).map(e=>({...e,children:aC(e.accountNo,t)}))}function iC(){return Xx({select:oC})}function lC(e){return rC(e).flatMap(e=>[e,...e.children])}const sC=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function cC(e,t){return o(()=>e?.filter(e=>t.includes(e.type))??[],[e,t])}const dC={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function uC(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function hC(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=>{uC(e,n,t)})}(r,n):a?uC(a,r,n):i&&uC(r,r,n)}),n}const pC=[cr(null,Gn({marginLeft:"6px",marginRight:"6px"}))],gC=cr(null,Gn({whiteSpace:"normal"}));function mC({types:e,onClick:t,searchTerm:n}){const{query:{data:r},isFilling:a}=Jx(),i=cC(r,e),l=o(()=>new Ee(i,dC),[i]),s=o(()=>hC(l.search(n),i),[i,n,l]);return a?S(yg,{}):s.map(({parent:e,child:n})=>S(gg,{onClick:()=>t(n),children:R(Gg,{stylists:[gC],children:[e.name,S(rl,{Component:Qi,stylists:pC}),n.name]})},`${n.accountNo}`))}function vC({types:e,onClick:t}){const{query:{data:n,isFetching:r},isFilling:a}=Xx({select:rC}),o=cC(n,e);return a?S(yg,{}):a||r||void 0!==n?o.map(e=>S(im,{triggerChildren:S(cm,{displayLabel:e.name}),popupChildren:S(bC,{glAccount:e,onClick:t})},e.accountNo)):S(bg,{text:"No data"})}function bC({glAccount:e,onClick:t}){return S(lg,{children:e.children.map(e=>S(gg,{onClick:()=>t(e),children:S(vo,{children:e.name})},e.accountNo))})}const fC=Gn({maxWidth:"420px",width:"fit-content"});function yC({onClick:e,types:t}){const{query:{data:n}}=iC(),r=cC(n,t);return S(ug,{onClick:e,placeholder:"Search revenue accounts...",getSearchActiveStyles:e=>e?fC:void 0,SearchList:mC,DefaultList:vC,extraProps:{types:t},listLength:r.length,forceSearchVisible:!0})}const xC={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 CC(e,t=!0){const n=lh({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 TC(){return wu({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 wC={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",ONBOARDING_FORM:"ONBOARDING_FORM"},kC=e=>["tasks",e??{}],EC={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},AC={filter:{status:{in:["ACTIVE"]}}},IC=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:mi(t[2].environment)},a=await wa(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function SC(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=nr(r=e)||nr(r.data)?[]:[...r.data].sort((e,t)=>EC[e.priority]-EC[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=AC,Rr({...r,queryKey:a?kC(a):["tasks",{}],queryFn:IC}));var r,a;const{query:{data:i},isFilling:l}=Rg(),{query:{data:s},isFilling:c}=ku({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=>CC(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[xC]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const NC=e=>{const t=ji[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},RC=e=>["banks/transactions/summary",e],DC=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:mi(t[2].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},PC=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>FC({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),MC=async({data:e,accessToken:t,environment:n})=>FC({data:{data:e},accessToken:t,environment:n}),LC=async({data:e,accessToken:t,environment:n})=>MC({data:[e],accessToken:t,environment:n}),FC=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:mi(n)};return await wa(r)};function OC(){return ha("mutation successful, invalidating BT queries"),Promise.all([Ir.invalidateQueries({queryKey:["banks/transactions"]}),Ir.invalidateQueries({queryKey:["banks/transactions/summary"]}),Ir.invalidateQueries({queryKey:["tasks"]}),Ir.invalidateQueries({queryKey:["reports"]})]).catch(e=>pa({error:e,severity:"error"}))}function VC(){return ch({onSuccess:()=>OC(),mutationFn:MC})}function BC(){return UC({mutationFn:LC})}function UC(e){return ch({onSuccess:()=>OC(),...e})}const WC=cr(tr["category-selector-table-cell"]);function HC({transaction:e,parentTransaction:t,accountName:n}){const{startPrefetch:r,cancelPrefetch:a}=xl({prefetchFn:ml(Gx,Qx)}),{mutate:o}=BC(),i=void 0!==t,l=nr(e.glAccount?.iconUrl)?void 0:tm(e.glAccount.iconUrl,"Revenue Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{...e,stylists:[WC],onMouseEnter:r,onMouseLeave:a,children:[l&&S(ud,{Component:l}),S(Ys,{children:n})]})}),S(yC,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,glAccountId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{o({id:e.id,glAccountId:t.id})},types:sC})]})}const zC=e=>e>0?"Deposited to":"Withdrawn from",qC=ci(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"),jC=cr(null,Gn({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),_C=cr(null,Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function KC({transaction:e}){const{label:t,list:n}=Yg(e.children);return S(_s,{children:R("div",{..._C,children:[S(ud,{Component:qC}),R("div",{...jC,children:[S(vo,{children:t}),S(fo,{children:n})]})]})})}const YC=cr(tr["category-selector-table-cell"]);function ZC({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=_g(),a=e.category?.name??"",{mutate:o}=BC(),i=void 0!==t,l=nr(e.category?.iconUrl)?void 0:tm(e.category.iconUrl,"Expense Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{...e,stylists:[YC],onMouseEnter:n,onMouseLeave:r,children:[l&&S(ud,{Component:l}),S(Ys,{children:a})]})}),S(hm,{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 GC({transaction:e,parentTransaction:t}){if(e.children.length>0)return S(KC,{transaction:e});switch(sx(e.type)){case"EXPENSE_CATEGORY":return S(ZC,{transaction:e,parentTransaction:t});case"TRANSFER":return S(Px,{annotation:zC(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return pa({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return S(HC,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function QC({name:e}){return S(N,{children:e&&S(Ys,{children:e})})}function XC({onClick:e}){const t=cc(),n=Oi();return S(xc,{children:S(lg,{children:n.map(({status:n,displayName:r})=>S(gg,{onClick:()=>(e(n),void t.close()),children:S(vo,{children:r})},n))})})}const JC=cr(tr["review-status-selector-button"],Gn({width:"151px",justifyContent:"center"})),$C=cr(tr["review-status-dropdown-arrow"],Gn({display:"none"}));function eT({status:e,transactionId:t}){const[n,r]=c(!1),{mutate:a}=BC(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:d}=Bi(e);return t&&((u=t).startsWith(is.TRANSACTION_LINE_ITEM)||u.startsWith(is.PROCESSOR_TRANSACTION))?null:R(sc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[S(dc,{children:e=>R(Zx,{variant:s,...e,stylists:[JC],onClick:i,children:[S(ud,{Component:d}),S(Ys,{children:l}),S("div",{...$C,children:S(rl,{Component:lp})})]})}),S(XC,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function tT({status:e,transactionId:t}){return S(eT,{status:e,transactionId:t},t)}function nT(){return S(ud,{Component:Qi})}function rT(){return S(nT,{})}const aT=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})),oT=ci(aT,"Dash"),iT=cr(null,Gn({stroke:"icon.base.weak"}));function lT({hasConversation:e,hasUnread:t=!1}){return S(N,{children:e?S(Dd,{hasUnread:t}):S("div",{"data-testid":"no-conversations-dash",children:S(hc,{Component:oT,stylists:[iT]})})})}function sT({conversationId:e}){const{query:{data:t}}=Sl(e??null),{startPrefetch:n,cancelPrefetch:r}=Rl(),{startPrefetch:a,cancelPrefetch:o}=gs(),i=rr(t),l=i&&"READ"===t?.readStatus,s=d(()=>{rr(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=d(()=>{rr(e)&&(r(),o())},[e,r,o]);return S("div",{onMouseEnter:s,onMouseLeave:c,children:S(lT,{hasConversation:i,hasUnread:!l})})}const cT=cr(tr["badge-chip"],Lx),dT=cr(null,Za),uT=cr(null,el),hT=cr(tr["neutral-badge"],Ox),pT=cr(tr["highlight-badge"],Bx),gT=cr(tr["success-badge"],Wx),mT=cr(tr["warning-badge"],zx),vT=cr(tr["danger-badge"],tr["critical-badge"],jx);function bT({type:e,children:t}){let n;switch(e){case"danger":n=vT;break;case"warning":n=mT;break;case"neutral":n=hT;break;case"success":n=gT;break;case"highlight":n=pT}const r=gr([cT,dT,n,uT]);return S("div",{...r,children:t})}function fT({reviewStatus:e}){const{variant:t,Icon:n}=Bi(e);return S(bT,{type:t,children:S(ud,{Component:n})})}const yT=Gn({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),xT=Gn({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),CT=Gn({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),TT=Gn({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),wT=Gn({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),kT=Gn({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function ET({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=Yg(e.children);return`${t}: ${n}`}switch(sx(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${zC(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void pa({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:yT,children:[r&&S(ud,{Component:gx}),R("div",{className:wT,children:[R("div",{className:CT,children:[t.iconUrl?S("img",{src:t.iconUrl,className:kT,alt:void 0,width:24,height:24}):S("span",{className:kT}),S(vo,{children:t.description})]}),R("div",{className:TT,children:[S(fT,{reviewStatus:t.reviewStatus}),S(fo,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:xT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[S(Ix,{row:e}),S(rl,{Component:Qi})]})]})}const AT=ci(aT,"Minus");function IT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return S($y,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?AT:Ih})}const ST=X(),NT=[ST.display({id:cn.SELECT,header:({table:e})=>S(IT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?S($y,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),ST.accessor("date",{id:cn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return S(_s,{children:S(vx,{transaction:e.row.original,isChild:t})})},header:()=>S(Dc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:Uy,sortDescDisplay:Wy}),size:130,maxSize:144}),ST.accessor("description",{id:cn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return S(_s,{children:S(Cx,{bankTransaction:e.row.original,isChild:t})})},header:()=>S(Dc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:Hy,sortDescDisplay:zy}),size:180}),ST.accessor("amount",{id:cn.AMOUNT,cell:e=>S(_s,{alignVariant:"flexEnd",children:S(Ix,{row:e.row})}),header:()=>S(Dc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:qy,sortDescDisplay:jy,align:"right"}),size:130,maxSize:130}),ST.accessor("category.id",{id:cn.CATEGORY,cell:({row:e})=>S(GC,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>S(Dc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),ST.accessor(e=>e.dimensionValues[0]?.id,{id:cn.DIMENSION_VALUE,cell:e=>S(_s,{children:S(QC,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>S(Dc,{columnName:"Business"}),size:130}),ST.accessor("reviewStatus",{id:cn.REVIEW_STATUS,cell:e=>S(_s,{children:S(tT,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>S(Dc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:_y,sortDescDisplay:Ky,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),ST.display({id:cn.COMMENTS,cell:e=>{const t=e.row.original;return S(_s,{alignVariant:"center",children:S(sT,{conversationId:t.conversation?.id})})},header:()=>S(Dc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),ST.display({id:cn.EXPAND,cell:()=>S("div",{className:Gn({paddingRight:"20px"}),children:S(rT,{})}),size:40,maxSize:60})],RT=ST.display({id:"MOBILE",cell:e=>S(ET,{row:e.row})}),DT=i(!0);function PT(){return l(DT)}const MT=[];function LT({transactions:e,columns:t}){const n=PT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(cn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[RT]:(i=t)?NT.filter(e=>i.includes(e.id)):NT;var i;return J({data:e??MT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??MT.length,columns:o,getCoreRowModel:$(),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:ee(),paginateExpandedRows:!1,getRowId:e=>e.id,state:{columnOrder:r,columnVisibility:a}})}const FT=[cn.COMMENTS,cn.DATE,cn.DESCRIPTION,cn.AMOUNT,cn.CATEGORY,cn.REVIEW_STATUS];function OT({Component:e,stylists:t}){return S(e,{stylists:[cr(tr["xx-large-icon"],tr.icon),...t??[]],size:50})}function VT(){return R(N,{children:[S(OT,{Component:pi}),S(vo,{wrap:"wrap",children:"All caught up"}),S(fo,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function BT({children:e,stylists:t=[],...n}){return S(Ls,{intent:"warning",stylists:t,...n,children:e})}function UT(){const{linkPlaid:e,loading:t}=Xf();return S(BT,{...cr(tr["zero-state-button"]),onClick:()=>e({plaidEvent:Of,message:"Plaid Link button pressed"}),disabled:t,children:S(vo,{children:"Link your bank"})})}function WT(){return R(N,{children:[S(OT,{Component:wm}),S(br,{children:"Link Bank Account"}),S(fo,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),S(UT,{})]})}const HT=Gn({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function zT(){return R(N,{children:[S("div",{className:HT,children:S(OT,{Component:hi})}),S(br,{children:"Transactions are being processed"}),S(fo,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}const qT=Gn({animation:"linear 1s spin infinite"}),jT={background:"conic-gradient(from 90deg,rgba(255, 255, 255, 0) 0deg,rgba(148, 216, 232, 1) 360deg)",height:"100%",width:"100%",opacity:1};function _T({size:e}){const t=e??15;return S("div",{children:R("svg",{className:qT,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[S("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:S("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:S("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:S("div",{style:jT})})})}),S("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}'}),S("defs",{children:S("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:S("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"})})})]})})}function KT(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,u(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const i=o(()=>{const a=w(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 u(()=>{r.current=w(e,t,n)},[e,t,n]),i}function YT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=c(e),[a,o]=c(!1);u(()=>{r(e)},[e]);const i=KT(d(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const ZT=cr(tr["filter-bar"],Gn({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"}})),GT=cr(tr["filter-search-bar"],Gn({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),QT=cr(null,Gn({color:"icon.base",flexShrink:0,marginRight:"15px"})),XT=cr(null,Gn({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px",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:"16px"}})),JT=Gn({width:25});function $T({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=YT({debouncedValue:t,onChangeDebouncedValue:e});return S("div",{...ZT,children:R("div",{...GT,children:[S("div",{className:JT,children:n||i?S(_T,{}):S(ud,{stylists:[QT],Component:zv})}),S("input",{...XT,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Xh})]})})}const ew=cr(tr["date-amount-header"],Gn({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function tw({formattedDate:e,formattedSum:t}){return R("div",{...ew,children:[S(vo,{wrap:"wrap",children:e}),S(hu,{children:t})]})}function nw(e,t){return jl("BankTransactionForm",{routeProps:{transactionId:e,initialTab:t}})}function rw(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=cx(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();nw(e?.original.id??t.original.id,"conversation")}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();nw(e?.original.id??t.original.id)}}function aw({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=as(),a=d(()=>n({id:e.original.id}),[n,e.original]);return S(ql,{rowData:e,onMouseEnter:a,onMouseLeave:r,onCellClick:rw,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 ow({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=ho(Ku(r.netSumCents)),r.rows.push(n))}else{const r=Pt(e);t.set(e,{date:e,formattedDate:r?Nt(r):e,netSumCents:n.original.amount,formattedSumDollars:ho(Ku(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return S(N,{children:t.map(e=>R(b,{children:[S(tw,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>S(aw,{rowData:e},e.id))]},e.date))})}function iw({table:e,hasSelect:t}){const n=PT();return S(Ol,{children:n?S(ow,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>S(aw,{rowData:e,hasSelect:t},e.id))})}function lw(e){return e?"Search":"Search transactions..."}function sw(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 cw(e,t){return e.get(t)??[]}function dw(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function uw(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function hw(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function pw({buttonText:e,onButtonClick:t}){return R(N,{children:[S(ld,{Component:Qv}),S(vo,{children:"No results"}),S(fo,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&S(Ic,{onClick:t,children:e})]})}const gw=Gn({xl:{minWidth:"900px"}}),mw=Gn({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function vw({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){bd(qi);const c=function({transactions:e}){return function({transactions:e,columns:t}){return LT({transactions:e,columns:t?[...t,cn.EXPAND]:void 0})}({transactions:e,columns:FT})}({transactions:i}),{query:{data:d},isFilling:u}=ts({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=PT(),p=!nr(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=S(pw,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=S(VT,{})):a=S(zT,{}):a=S(WT,{}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:gw,children:[S("div",{id:qi}),R(nl.Provider,{value:o,children:[R(ur,{children:[S(br,{children:"Transactions for review"}),S(yd,{children:S(sl,{})})]}),S(Hs,{dashboard:"financialOverviewDashboard",children:r?S(gl,{}):R(N,{children:[!h&&S("div",{className:mw,children:S($T,{placeholder:lw(h),searchTerm:l,onChange:s,isFetching:a})}),S(zs.Provider,{value:{sortInstance:t,setSortInstance:n},children:S(Ll,{headerGroups:c.getHeaderGroups()})}),nr(g)?S(iw,{table:c,hasSelect:!1}):S(od,{children:g})]})})]})]})}function bw(){const[e,t]=c(""),{sortInstance:n,setSortInstance:r,apiSort:a}=Yy(),o={...(()=>{const e=Wi();return{..._i,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:d}=ts({filter:o,sort:a,limit:10}),u=i?.data??Yi,{hasPlaidLinkedBankAccount:h,isFilling:p}=Ng();return S(vw,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:d,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const fw=cr(tr["button-table-header"]),yw=Gn({height:{xl:"auto",base:"44px"}});function xw(){const e=nh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return S("div",{className:yw,children:R(Fs,{onClick:()=>{jl(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[fw],children:[S(rl,{Component:vu}),S(tc,{children:"Banks & Integrations"})]})})}const Cw=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function Tw({children:e}){return S("div",{...Cw,children:e})}const ww=ci(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"),kw=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:cd,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:di,buttonText:"Review"};case"LINK_BANK":return{Icon:wm,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:wm,buttonText:"Fix"};case"RELINK":return{Icon:wm,buttonText:"Relink"};case"CHAT":return{Icon:ui,buttonText:"Learn more"};case"ONBOARDING_FORM":return{Icon:ww,buttonText:"Complete"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:pi,buttonText:""};default:return{Icon:ui,buttonText:""}}},Ew=cr(tr["banner-title"],Gn({display:"flex",alignItems:"center",gap:"8px"})),Aw=cr(tr["banner-icon"],Gn({width:"20px",height:"20px"}));function Iw({title:e,type:t}){const{Icon:n}=kw(t);return R("div",{...Ew,children:[S(ud,{Component:n,stylists:[Aw]}),S(vo,{wrap:"wrap",children:e})]})}const Sw=cr(null,Gn({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 Nw({title:e,description:t,type:n}){return R("div",{...Sw,children:[S(Iw,{title:e,type:n}),S(fo,{wrap:"wrap",children:t})]})}const Rw=tr["banner-button"],Dw=Gn.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),Pw=cr(tr["banner-button-text"]),Mw=cr(tr["banner-button-icon"]);function Lw({priority:e,type:t,handleClick:n}){const{buttonText:r}=kw(t),a=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return R(Ls,{onClick:n,intent:a,styles:Dw,className:Rw,children:[S(vo,{stylists:[Pw],children:r}),S(rl,{stylists:[Mw],Component:Qi})]})}const Fw=$n({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"}}}}),Ow={HIGH:tr["banner-high"],MEDIUM:tr["banner-medium"],LOW:tr["banner-low"],URGENT:tr["banner-urgent"]};function Vw({task:e,handleClick:t}){const{name:n,description:r,shortDescription:a,type:o,priority:i}=e,l=PT()?a:r,s=cr(tr.banner,Ow[i],Fw({priority:i}));return R("div",{...s,children:[S(Nw,{title:n,description:l,type:o}),S(Lw,{priority:i,type:o,handleClick:t})]})}function Bw(e,t){Qu({message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}})}function Uw(e,t,n,r,a){return()=>ju({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function Ww(e){const{mutateAsync:t}=Zf(),n=kr(),r=Nr(),{apiPartnerName:a}=l(Lc),o=PT(),{linkPlaid:i,loading:s,hasOnPlaidLinkOverride:c}=Xf(),{linkPlaid:d,loading:u}=Xf(),h=lh({apiErrorType:e?.apiErrorType,apiErrorCode:e?.apiErrorCode});if(nr(h)||nr(e))return null;const p="ITEM_LOCKED"===e.apiErrorCode;switch(h.buttonType){case ah.DELETE_OR_RELINK:case ah.RELINK:return s?null:(m=i,v=a,b=o,{alert:Uw(h,(g=e).apiInstitutionName,v,b,[{key:Iu,label:"Cancel"},{key:Nu,label:"Relink",type:qu.SUCCESS}]),actions:{success:()=>{m({plaidEvent:Vf,plaidItemId:g.id,apiAccessToken:g.apiAccessToken,apiErrorCode:g.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case ah.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:Uw(e,t.apiInstitutionName,a,o,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat"},{key:Nu,label:"Unlink and Relink",type:qu.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:"PLAID_LINK_UNLINK_RELINK",plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[ah.CHAT]:()=>Bw(t.apiInstitutionName,t.apiErrorCode)}}}(h,e,t,d,a,o,c);case ah.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l){return{alert:Uw(e,t.apiInstitutionName,i,l,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat"},{key:ah.RELINK,label:"Relink"},{key:Nu,label:"Go To Bank",type:qu.SUCCESS}]),actions:{success:async()=>{const e=await Au({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;window.open(o,"_blank")},[ah.RELINK]:()=>{o({plaidEvent:Vf,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[ah.CHAT]:()=>Bw(t.apiInstitutionName,t.apiErrorCode)}}}(h,e,p,n,r,i,a,o);case ah.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:Uw(e,t.apiInstitutionName,a,o,[{key:Iu,label:"Cancel"},{key:Nu,label:"Unlink",type:qu.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:Bf,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(h,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:Uw(e,t,a,o,[{key:Iu,label:"Cancel"},{key:ah.CHAT,label:"Chat",type:qu.SUCCESS}]),actions:{[ah.CHAT]:()=>Bw(t,r)}}}(h,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var g,m,v,b}const Hw=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){pa({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function zw({task:e}){const{linkPlaid:t,loading:n}=Xf(),{linkPlaid:r,loading:a}=Jf(),o=Ww(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&nr(o);return i||l||s?null:S(Vw,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:Vf,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?(ha("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Of,message:"Plaid Banner Link Bank pressed"})):rr(o)&&(ha("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Hw(o))}})}const qw=cr(tr.banner,tr["banner-default"],Fw({priority:"DEFAULT"}));function jw(){const e=PT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return S("div",{...qw,children:S(Nw,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const _w=cr(tr.banner,tr["banner-default"],Fw({priority:"DEFAULT"}));function Kw(){const e=PT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return S("div",{..._w,children:S(Nw,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Yw=Gn({width:"100%",height:72,minWidth:"300px"});function Zw(){return R(N,{children:[S(jo,{styles:Yw}),S(jo,{styles:Yw}),S(jo,{styles:Yw})]})}function Gw({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?S(Zw,{}):a?e.map(e=>{if(void 0===wC[e.type]||"ONBOARDING_FORM"===e.type&&nr(e.actionLink))return null;if("LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(ah).includes(e.type))return S(zw,{task:e},e.id);const n=e.actionLink,r=rr(n)?()=>window.open(n,"_blank"):()=>t(e.type);return S(Vw,{task:e,handleClick:r},e.id)}):S(n?Kw:jw,{})}function Qw({shouldFilterTasks:e=!1}){const{taskBanners:t,isFilling:n}=SC(e),r=os(),{query:{data:a}}=Rg();return R(N,{children:[R(ur,{children:[S(br,{children:"Action Items"}),S(xw,{})]}),S(Tw,{children:S(Gw,{taskBanners:t,handleScrollAction:NC,isWaitingForPlaidItemAccountsSync:!r&&!0===a?.plaidItemAccountsReadyToSync,isFilling:n})})]})}const Xw=cr(tr["business-owner-dashboard"],Gn({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),Jw=Gn({display:"flex",width:"100%",justifyContent:"center"}),$w={status:{in:["ACTIVE","INACTIVE"]}};function ek({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=c(void 0);return{sortInstance:e,setSortInstance:d(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Cl)??!1,n=(e.direction&&e.direction in Tl)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:i,paginationControls:s}=Al({limit:10,sort:a,filter:Ki}),u=o?.data??Zi,h=PT(),{hasBookkeeper:p}=l(Lc),{initialPageProps:g}=l(vd),{query:{data:m}}=Rg(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=ts({filter:$w,limit:1});return(e?.data?.length??0)>0}(),m),b=/* @__PURE__ */new Date,f={month:b.getMonth(),year:b.getFullYear()};const[y,x]=ic(g?.period??f,e,t),C=(T=y.month,{beginDate:it((w=y.year)-1,T+1,1),endDate:it(w,T+1,0)});var T,w;return S("div",{className:Jw,children:R("div",{...Xw,children:[S(Qw,{shouldFilterTasks:h}),!h&&R(N,{children:[S(By,{period:y,handleDateChange:e=>{var t,n;(t=f).year===(n=e).year&&n.month>t.month||n.year>t.year||x(e)},todayPeriod:f,showSamples:v,showLinkAccountButton:v&&!m?.plaidItemAccountsReadyToSync}),p&&R(N,{children:[S(ur,{children:S(br,{children:"Financial Summary"})}),S(Xd,{isSample:v,period:y})]})]}),!h&&S(N,{children:S(oi,{filter:C,isSample:v})}),p&&S(Td,{sortInstance:n,setSortInstance:r,conversations:u,paginationControls:s,isFilling:i,isMobile:h}),S(bw,{})]})})}function tk(e){return S(ma||N,{children:e.children})}function nk({children:e}){return S(tk,{children:S("div",{className:or(tr.component),children:e})})}function rk(e){return S(nk,{children:S(ek,{...e})})}const ak=Gn({display:"flex",flexDirection:"column"});function ok({task:e}){return S("div",{className:ak,children:S(zw,{task:e})})}const ik=Gn({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),lk=Gn({width:"80px",height:"12px"}),sk=Gn({width:"150px",height:"16px"}),ck=Gn({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),dk=Gn({userSelect:"none",cursor:"pointer"});function uk(){return R("div",{className:ck,children:[R("div",{className:dk,children:[R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]}),R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]})]}),S("div",{className:dk,children:R("div",{className:ik,children:[S(jo,{styles:sk}),S(jo,{styles:lk})]})})]})}const hk=Gn.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function pk({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=PT(),a=n||r?Ic:Fs;return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(a,{extraClassNames:[hk],popupTriggerProps:e,children:S(rl,{Component:Qv,stylists:t})})}),S(xc,{children:e})]})}const gk=ci(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"),mk=$n({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 vk({width:e="lg",children:t}){const n=cr(tr["modal-popup"],mk({width:e}));return S("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const bk=Gn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),fk=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),yk=Gn({display:"flex",flexDirection:"column",gap:"12px"}),xk=Gn({display:"flex",flexDirection:"row",gap:"10px"}),Ck=Gn({display:"flex",flexDirection:"column",gap:"10px"}),Tk=({acknowledged:e,setAcknowledged:t})=>R("div",{className:yk,children:[S(Ys,{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:xk,children:[S(Xy,{checked:e,onClick:()=>t(!e)}),S(Ys,{wrap:"wrap",children:"I understand."})]})]});function wk({bankAccounts:e}){const{apiPartnerName:t}=l(Lc),n=e.reduce((e,t)=>{const n=Pt(t.tranStartDate||""),r=Pt(e.tranStartDate||"");return n&&r&&St(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutate:n}=vh();return df({defaultValues:{tranStartDate:t},onSubmit:t=>{var r,a;ju({title:"Start Date Updated",body:R("div",{className:Ck,children:[S(Ys,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),S(Ys,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:Nu,type:qu.SUCCESS}]}),n((r=e,a=t.value.tranStartDate,r.map(e=>({id:cs(e.id),tranStartDate:a,duplicateBankAccountIds:[]}))))}})})(e,n),a=cc(),o=()=>{a.close()},[i,s]=c(!1),{query:{data:d}}=ku(),u=d?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Pt(e.reduce((e,t)=>{const n=Pt(t.tranMinStartDate||""),r=Pt(e.tranMinStartDate||"");return n&&r&&St(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${Gu(e[0]?.name,e[0]?.mask)} account dating back to ${Bt(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${Bt(h)}.`;return R("form",{className:bk,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit(),a.close()},children:[S(vo,{children:"Set Bank Transaction Start Date"}),S(Ys,{wrap:"wrap",children:p}),S(Ys,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),S(r.AppField,{name:"tranStartDate",children:e=>S(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),S(r.Subscribe,{selector:e=>e,children:e=>{const t=Pt(e.values.tranStartDate||""),r=Pt(n),a=t&&r&&St(t,r);return R(N,{children:[e.isDirty&&a&&S(Tk,{acknowledged:i,setAcknowledged:s}),R("div",{className:fk,children:[S(gf,{showIcon:!1,onClick:o}),S(Nh,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!i})]})]})}})]})}function kk({bankAccounts:e}){return R(sc,{placement:"right-start",children:[S(dc,{children:e=>R(gg,{...e,children:[S(ud,{Component:gk}),S(vo,{children:"Edit Start Date"})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(wk,{bankAccounts:e})})})})]})}const Ek=ci(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"),Ak=ci(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"),Ik={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 Sk(e){const{apiPartnerName:t,unitIntegrationBankName:n}=l(Lc);return"UNIT"===e?n??t??"Unit":Ik[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Nk=Gn({display:"flex",flexDirection:"column",gap:"16px"}),Rk=cr(null,Gn({color:"brand.danger"}));function Dk({integration:e,accounts:t}){const{mutate:n}=Zf(),r=cc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=Xf(),{query:{data:l}}=(s=e.id,wu({},{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}}=Mg(e.id),u=d?.data,h=Sk(e.apiName),p="PLAID"===e.apiName;return R(lg,{children:[p&&!o&&R(gg,{onClick:()=>(a({plaidEvent:Vf,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[S(ud,{Component:xs}),S(vo,{children:"Add Account"})]}),p&&u&&S(kk,{bankAccounts:u}),tt(t)&&R(gg,{onClick:()=>Sf({plaidItemAccounts:t}),children:[S(ud,{Component:Ak}),S(vo,{children:"Merge Accounts"})]}),p&&R(gg,{onClick:()=>(async()=>{let o;var l;o=tt(t)?await(async e=>ju({title:"Remove Institution",body:S("div",{className:Nk,children:S(Ys,{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:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ju({title:"Remove Institution",body:S("div",{className:Nk,children:S(Ys,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]}))(h),r.close(),o===Su&&(p&&i?a({plaidEvent:Bf,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[S(ud,{stylists:[Rk],Component:Ek}),S(vo,{stylists:[Rk],children:"Delete Connection"})]})]})}const Pk=Gn({userSelect:"none"});function Mk({children:e}){return S("div",{className:Pk,children:e})}const Lk=Gn({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 Fk({children:e}){return S("div",{className:Lk,children:e})}const Ok=cr(tr.badge,Fx),Vk=cr(null,Za),Bk=cr(null,el),Uk=cr(tr["neutral-badge"],Vx),Wk=cr(tr["highlight-badge"],Ux),Hk=cr(tr["success-badge"],Hx),zk=cr(tr["warning-badge"],qx),qk=cr(tr["danger-badge"],tr["critical-badge"],_x);function jk({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=qk;break;case"warning":o=zk;break;case"neutral":o=Uk;break;case"success":o=Hk;break;case"highlight":o=Wk}const i=gr([Ok,Vk,o,Bk]);return S("button",{...i,onClick:n,disabled:r,...a,children:t})}function _k({plaidItem:e}){const t=Ww(e);return R(jk,{type:"danger",onClick:n=>{n.stopPropagation(),t&&(ha(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Hw(t))},disabled:nr(t),children:[S(ud,{Component:ui}),S(fo,{children:"Fix Bank Error"}),S(rl,{Component:Qi})]})}const Kk=$n({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"}}}}}),Yk=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function Zk({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=Xn(Kk({active:a}),el);return R("button",{className:l,onClick:t=>{t.stopPropagation(),jl("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:Yk,children:[S(ud,{Component:i?gx:wm}),S(Em,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&S(ud,{Component:Qi})]})}const Gk=Gn({display:"flex",flexDirection:"column",gap:"4px"}),Qk=Gn({display:"flex",alignItems:"center",gap:"8px"}),Xk=cr(null,Gn({color:"brand.primary.weak"})),Jk=Gn({overflow:"hidden"});function $k({integration:e,isCompact:t=!1}){const{query:{data:n}}=Mg(e.id),r=n?.data,a="PLAID"===e.apiName,o=Sk(e.apiName);if(!tt(r))return null;const i=e.iconUrl?tm(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(Mk,{children:[R(Fk,{children:[R(Vv,{children:[S(ld,{Component:i??wm}),R("div",{className:Gk,children:[S(Ys,{children:e.apiInstitutionName??o}),S(fo,{children:Lf(r)})]})]}),R("div",{className:Qk,children:[a&&rr(e.apiErrorCode)&&S(_k,{plaidItem:e}),S(pk,{stylists:[Xk],shouldUseButtonDiscreteStyles:t,children:S(Dk,{integration:e,accounts:r})})]})]}),S("div",{className:Jk,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return S(Zk,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Ff(t),active:n,integration:e},t.id)})})]})}const eE=tm("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAGttJREFUeAHFnFuMXVd5x9c5c/GMZxxf4sTxNfcmJDSQFGhSkGhRCFChSqWIoqqtkJoXitQHXoqqVkKVWlFVQuIBIdo8oD4g1BYqFVTahLqg0JYSriExARInsXGwncSJPb7N7Uz/v/+3vnX2OR7HpiB1Zc5ea32X/3fZ31577X1O3Ctj7ba3/c3tvcmJ+0u/3LdWyr5SevO9Xs9SdGulV3r9mK9FV+CvVRlNpKK/Oh90xiX1hLa2JiTJpBx9VzaxJRjYFS/lm9uiS8I445gNowkPB4kj3dOl9A+pf7A3WH3gwN+++/GhlEOJ6e23f3h6sHf3R3sTvff31ZQcmR0GipR97PcZyukhL5OD0aQ351CyIgCBiX46yNh8ywWuaXloulKuzXbCO2NCbngdG135HBOTlYZwySLRAwXwie+fWPpg+Yf3LFXJUkjO2r7dX+z1+2+hOsaTYywczQrQ0A5V520UIc3tvMYtualT3WiBaE5ix6uxigWPSbVhOjZcnp6FDzH0ianDoEsvkpHUC/t2EsdYqsT9T7y4/A6S5HKIyonkINuCY1IDH08OwSHXZAk2nWJMpV0sOSRQfJ8Mxg4cY4w1gUfPh0YHlnHDTjsR8Kpsr4fNvjG6yQF/vQ8Y6310Ab3l1u3TH7XpfW/8s9vnt1z7KJfVAIqanfPAUwebQYRjeFVbTQJOIiOTNRg5VUUanuZrKZ99leleppUUgQvF+iRBLf1gHLhhl3m2rgy0rv2U6fbr8XWtDc4cfeqOycl+//5IDg5UZ9AOfyI5TJuDwWDeHMkxrBr4xZLTcLChtl5ijA0TPKpC/TheVjBi2dKftJF0+nEaeCnPeJyPYSXn/knZ5m7lNi7kywROBl2ThJzB65xxo0l83CA87lASak4By7zZBEP/gWV/uvNqB4hMqPU9jxE48LutYYsY9uEOpXLUbHaU7cNE775JyetWjq823/QzOQ5e/HQMOWjdYL3QVgdHkiM56yUvPTJGJ6DEa36gp4/m2PFHQ8+hqdmvihsUHS0q/+wEMhpXJibsdxMGD2q2qoQGNgFZK/smxZ5PVsqPJAcjKNDQY2iaKSpEESrfOCOyUSHQE9u6mnJ3CIfRBwLgaGkDSrPtcfCRhZcaKZN69KEb8hxHklH5Q27lQ19jkV+Tf77JzKuC4m4SwjKsgB2QeldLoqDMnUk9i7k6RdlZH3BaitDtMPoeI4gDatyd1DV6JqXazKnvRlUnk9uSgpCIAxlDjk1iS7SQCY7WEiLxxK2WxcWD6qdHQ05gkSRFKUUqKMTREcHZr4hhKujtlmyFalUdMu3sK19rOB32DUyyAjqITnrlXzhORXAwFNiJjy3TxSM5XldAt9PVW3z3nw6tRVwx7dBrnNBJdLd5Jr4TRGIyOSmUZQs9A0HJzuqM09qciUhOBqxg13mdWGboaGJGLzp8tW5imKOdNObNT4h2QAeEXLFDW81/K1VRJyQtgVWZ7jRpcwZxdUwaWIqplg6HDskROJUBgckrJmeIE8lqFpueEywoMKmttAu8C8FBMMOc9CuEA2ZcE5N+9byaWdxY3oCywBpniD7EaoCh1D0OxUNfGK4g6OlcZj4SBb0God4LMrL6ZKDgh/MpZ2bjJw5yo2PWj2jYpiWm5TSPh9eKXxPT8oE/1kIuRhw9ykGlOzhk06D4LeEVgy7tpyAm2QcZNZz3bBiIDDhxoc3xwuRQUekI6ozrPDCtNsS0yLByjJ/6lReJAae6SmCqONowiEhMqjpdeZewYioLo1Z9IFQXczLSZwYhgqgKwkECGq8cHLGjGHMS1k+OkxB4xmgBGHMYUEsEdMnzoSIxT8u7Tiy8lR8s20/cVi1SzKREj7CI9YxmXKamkcRrVoNg2cbTABjdxKDrNh9OOncVH9mcGws6epJ1s5z0arDhV8yDLwH+qrx9RjbnElrROrG8uOrcT0/2y8yGiTI9NaF5T7xSllcHZWllUBZX18pAc7YYExP9MjnBGD8gYk24MuAhVJKObVit1Zk64qClbx6bMnowhg6+xNJxI1uDYCqIhADtAiJ/OckBI+AiOeCcX1kt0wrill2byht+YXt5zfXbyr6r58rW+ekyM60EibeqpJxfXi2nzi6XYyfPlWeOnylPHFko3z9yqjx74lw5s7SqRPXLlD72q95EHFSY1JEALkxIdclS3ZiC0JRDkQQRbDcBnoNta124UHYyMcwHUt38mZvrhII0pvmMe64INN7+2h3l937txnLXzdvLhqnYZVj3Mg7nl5fLwaOny1efeKF88dGj5fHnTstPVRa+ZmvxRAw9n6XqjcU0lk71PrSaehs4Puf4xrf+xdrslmt9nQNjPJdpBAmCq8UJ8wSSy9zJ8qQehO8NJXwctb1eWVwelD3bpsufvveOcu9dexF24xXpT9O6Z3xJlfiVx4+VP/nHA+XU0qAmSZXtk4RhsMOHuACrrZrAS9lFevHYk6xBxrG8IZ2I8eRUGXg0dS05ngfdSYE9lpxbd28sH//De8q1O66Q4vieFYDLa92ETmkxuvmaTWVVier1WJh49AAnkxJVkknNmwASNVUM1aQU7se00rTyiV73QUi0W6uqJ5vBmWLZn+CQnCZV5TMp2YOpwim7tkyVv77/9U7OYCDCz6lRfAePL5RT51fKhlkuVXzMLrwbiMBoJCHd+MwNHR07rQGxUayXAgmoyq2SqoqDrmMnB1la7YdJgWaGL6+11dXywXe9uty8a2v5eSYHCwNliMV7RQY3dILG95GE4GO6a9fqhLFaW0s1Jo5s3BnJh1dJqqeurwGecupbteR4LCnd5GQiwV5cXiv33Ly13HvnXq0P//fLKh0e7ynGp188I8fD825i0ifXj3zRX2veZymGHpc6vThdfhOsA69BjtmGIvepAABVYuMWCq3mwDq0rLC1wWp55xv26NY9qauZ1xyRJLBZD4bzsNbzGpKWR90caCOED8FlrCf5tdXy7PPnSl9rUbtw7S+CETgK5jHvJMToTWZ9m7YmVtxnAVazEx7Kfcq20mvX5nF3sopLNBMWoNIV0Ja5iXLnTVeVCSWejV4uktigdeeYYlP49SeO6bI55URsmdtQdl25qey9aq5ctWU2lHQcqATw58z55XLk5KI3j2k/e2xkdaAYIaHnEaRhu4BUCSpMMOpdjPOZ8UsAmVRUn5Vk1EpPZ7JHgcTBXlFGdmyecWCZEOuuc8Dnc4vL5Y8++d/lX793vKx5qxzP6Gwot2oBvumajeVNt1xdfvUXd5bb9m31bvuF0+fLC9pITkyyjIZTnFTHITtBgZUjTkqlm1TpQ3Z4l/JKELqjjxqISIGXXtkyOVBcOWwMLcMaprtfdYXXF35fKCcHelbYNj/lnTHV9EqN6vnBkZfLQ98/UTZt3xwBicZFguqCkv0/RxfLV599unzsSwfLa/deUX73TdcpMf1yVuvc5GzIZcVIlciGJrvDSgebv3HXPE95TVoFwQhdqiCUAYCYZ8AOEI2a5WsAJiAHXQd4LIQTE9CEd4kMDaS068q5ct018+XQwkqZ1ZplNGHQT+hhaHZyuszOTvtS/cbxxfL1zzxWtm2aLv2ZqXRckmoRBCOUfchXNMx8gh14+AnNrepZhQDUkGVdjJcyVSCSY7EQ8lEHSJUciiQSI9HDi0R64N00d7EBj8SXaCzAO7ZsLB97353ljl1z5ezSitcjgg0bCaDLTtU7s1HJ2iK5CSVIc8eD//5IVr2TUntj4CsfsektA79+uBL4GIMi0Mn1WFeSX96jY8W8skRwxaBEq0CW0bQm2TpZYZFEgLnz9soLp5fKWW3iGt9A6x9W9HD62uuuLJ/+wN3lI+++tdyxZ66saId8Tg+lYnEt+8NlnL64mKtfoGbgzQ8JQHNSEKiymZTEpLecZEMX0VhGmHujiL4BRMngTTO9jgBQw0AAxhmoRN9OxXLjtcQx3WGOvHC2bNNifSFoyHWPJGl2eqq8957ryrtev7d865mX9EB6rHz5RyfK4ZcXVRX9Mq2nfbc0lAAKkgpwMuRDxuBkSCZPkpOouflg1Msf/nitR3In4jY/qig9KSSoE1eNQwvZmolqPDdfycPZ03rOePjAkXLbdXHXyVheqWd3rO2TtwZ337S98DlxZql85Ynj5e+/ebQ8cnjBvk3He1BXVfqZyQE/aelvN2HeUYnQkiT55Kdvba4wfVEpHa4gl9iYASvVfGQC6NOJ4ENglH0pU1pAP/e1I+VFvc/x9W3ByztwYqkoPptnp8pv/tKe8nd/cGf55O+8qty1e86Xnt8s6kTQOEH2SWP8sm/10oGfNKok1s3Q6/IkpGxwK6avY3UTW2+598OTG7eC4vhGqkeCgLeESMQLeTWKjpMGYE0OyWY/wmV2fGGpLJ47X950+464BNqpwbVLN8QJatWXQq/cfPWm8huv2VHmp/vlG8+eLPzCKe9SToIDizicJPsnfyTXNW0esuK3BZ0xpP6Ee5I0WDhRJrbd8tYPTyhBMEeSY2kwAMnEdIxjtBpx9SAHTcKRUFWRbtnfPvhSmemtlrtvvUZM/0nq0s1BAdhpJIobwC/rLeQN2zaUh596qSwqg95SyL5Pnv0OxZYU3IbeSQqJMU34PsmW0QRVX1eq4oUXI0GTs1QQzKrUGYcy2gAFH7ZlbdCTmCNkw5WveV8L78MHjpWzZ86V1998VTyb8exxGc2xAtX5oEaibrp6vuzWXujff3iCRSuExMsKRw7FqBDdlWpCYh5JcYJshLjAqJZq7wraeut9usS2tOANXMEyOchnctIwX9DZc3vBUCWJIBtEEqc5On3NJ6any3/+6MXyX489V3ZvmynX79jkS/CVNpHVVdDX/VCNNypJzy8slm8fOV14gWYfkeZP/kUy8Kf6qs5JkF+8ZIuYhrTkZaJWuMS2tksMVxAO8DYWWFwyMACO3uUKw7arTFaPiMPkItMrMzPT5bmF5fJPXz9cHn3qeS++u66c9XtpFnHuYD9t4130ns3T5V8OvFgWpc7lZ3+UEC7/8DViwnc/QkmEsQPVMWJLmejh4vPg9Iv1i0MI2awcigGqsbLWrlfJOXjktRXHEMduhYVRmbEldcIElseFtdkNZf8zZ8r+H32zvPqaufLOu3aVt75mZ7nhmisst6Q71+Xmiiv12ivny+v2zpeHDp7SY4kePeRNC1oz+8fl023VL0gR1zA+aPGmAZyJugbNbYMeATmYCC7PQPSdM8KZwgvOEgny2UIfy+iKap9qZVVMJ1bjKW34JlVRx84Pyn/oG4rPPfLj8s0nXyhT0rlWrzc26PsxfS12WW1Ctp/TVuKrzy6UKQDsC37gouZ2RJm0azrA9yXH3QpfqXZO8vATwtpmaJH2N6tRB+EPShmIexSNO6RbkhdccX1VRXWSA4ueA3rg4YebHRmON+gut0H7JRVN2X/4TPnSU98rd+58pvzxO28p9+j1BtV0qQb2Hj3LeSeNLSnE2whGynKtchhOCJc/MpbjoJF5GrcWdsEmxY08jGRIdZCSiQW1Jikit15s2DQELXAbDMiL+gJQ78J85qxgUZIWWKiwdmzU5Te/ZVN59ORKed+nvlO+cuBomeah8RKN+DaqIlN0EKUrf2RUuHbGVcWbR24k7KV1cvVTeVxGvK9LSbcSWeLbkfqpVeZXOPah60t1XtLNvSjDzEDtxe1WCDK2Kr1zSszbbruyfOjXbyz7tkyXs3opdl6ZilLmLNez2CwApmC1cz4/NVU+/chz5nBiXukT6iQb2/UhU0HjR9y6dbcSMOcoaKITvJLhpPhuxnoD338RAhM1v3J16cGsiYGVKTBPwtj3xhAk152McoZsHiaG1dtRTfVW/VU7N5X3vfkGPXzuKQ89frx84bvHyqP6Cpkv+np64cXXx6whblWXQPQ4VjbrlWvlBP8iR8zxiiSeBxEKX+njZZ4iYTlAEJ7+czLkN0mNeUZLNBaLgVScIJecRMcbQKbqEKAoAyEjHJ0MjapqysObVMB7t885fXO6fH777n3lt163uxx8/nT5mnbAX3vmZPmBvrZ5/vRyOae1Rt8QGXdK18qvXLu5vP/N1/nVLdSLNZ9QGWORDnUcDt/wAb8iMVwokZgunbHnPuMEwawGQ6ePnov1H5kEWAT3iFaaxSuvZgWNMmD3SvjwUFRCkI1E9sqcfq2xc+us7kZxifBuh3bD1VeUW3ZuLr//xrVy8px+nLBwvhw7tVReOrvitWj35g3lVr1dZOPHw+orNS49RB47dlYbUu5K+oIABVcM8eERcUmonli569b2RDEd0mrKIHDF6C426oRniYKQkyNq/GYuEsLlIOfaesjUJnAnHgW2zk2V7XoUSHpl+0cMy7oekJvRY8gNV03pIZT3OSHBgr6iy3M8OeM4SHNyjp86X779kzO6xWsRrrEEemxWI5Q4+eiQGGNVewIxjvE42DMPTI8XZhKORS4YFgvkSki0mGIA54ylknHuEDFNv+/RJmbXlg1lXgsuibygsfCKSAXwBeDyBQJjhBFfhjzuXPv1CHP4jN5l64QI0Xckx6Kxq7u6Pqyuqi9MxzCEUw46E9AkE1/7pA5EM2rs0FNJZycBg+Q0IaGWQpEjvmbed+VGb/jWy0/o/GxHtgY/OXm2fOqRo2ViJs6zlvw40S05+IXfUU0ahKc14eMJyfjsmVTRlpkILqBEiWnIAOQ5h/hw53JNcE10qwe+DUMv5Xr9KCr3JgYb90ZE45gZB+Zdmsc1mI6Y1yr2Vx/50tPl4Dn9eEF3xNjH1KrAR7tDddffUwvHCah46Q60/AxtSFltWEERU/Dl1ahPWBoSrRr6IR8ZrOPoyB1vAjlzkxPasut7Mi6ndURHEpIgTkydWK+OCYS73LJe6P/5vzxZvnDwdNmoX6ax7+BExzIR2lk16JhSg+omJu3RewuTBMkSIrq+zUMPIAWi6BiPt1FKnalLUQxzXwOZF2V/9fknyrf0fPWuu/eUV+/bXuZ0GSwrSSy+3aDH7aw3xwY/t6MiDzx3qvzlQ0+Xh4+eV3K0VxIzkiPT2h2TjExOJjrjcVXhoP5okVANPA/i8ChtTVqCrJHRegJA6OoqNgrJCwd01Mpcb2zmRYKRV7ErkrODqfKZ7z5fPqfN4W0758q9t+0od99yVblxx3y5Ym7aL+a9SAuKp/JMmi0RtD6xk1grZxZXyvcOv1w++92j5fM/OFnO9CfLnJLDbRR5V4UG+Gk/AsRjQjEfLzM+ZCkE/ed4kEFQLfsctwR1GTANJsAEh0YLugZWwJNozbgYOMqLsvlNsxZ77MRK+db+Q2Xmy8+WnVdwW5/Xr8Pmy/VXzetLw1lfjvyAk531qhb4c/pG5KUzy+XwS+fKgaML5Tv6LeKTLy+VJe2NNs7NlFmu4fhryYl59ZdE1GSk//gXiUxd9bURytD/SpQ8tJYgDNBSzRuuIKUtzyL8kApQUbxn5G4BPRHU23IpGzZMlhntpsE8qnI5/OOz5d+eWRBf361LbFoLKV8x89ihH9RpH6R1RrIrnGUlZUr601fo5RoLLvjcUX1B0wvGdscWY9N1UMMv+8haJV20siDgNQwGNDFJZizSpgQHYgQpImPLVp6cbZmWoGWDIjmyHToGBrMzt4OVRJVMKuiZ/pRuoXH7BRdnVtCTnUnRp9SD4RTUm0SOgY6kSNNy4Q9O2BYCahlLd12NlAKt/5oN7HQadIzrzxXkwDt8A8sYwXZb0EWxwhizK6gxDtB89B2sJjVxhZH4fuVq4QyQs0yLXS92+aRZsC3R6ENbiWlfhTCaHPkjHTfwGOYcoub2O56izKsbxapkzTiEg6FkzQ6vO8RIaHcwMKq/dFYbF6s054DtODZuK1iZELgkioA40gceNjBkH2wzfEjsNa2DDlhSkdzgk5TUSR+bDiIVl94VlMzsm8PYb03nTAo26B7G0AFmlP36unBHG7bSOThhG88cSnUydCyLjD/VRvoSIqlVZ0LRZdJNTmNkcsTvJs2+dDEZS3a4SDcEAg1n/P9AaAxQnDsmEZh0o3FW6yRJ6yZJzAwUxZSJtSTskYFm2+iSIiDkbSf4ZmFMPN4D2X76UHvLoFcHKWP8iml/wFHLV7YhDzEKotZqx7DF67wq44gNVB5dGq6hmeNANOr62OSqU5kAFMBME9C5lMIOE334M5iZmuIuxDhdaNDSRtyp8D10k2472K944z18Xh2nvDElixweYbK1cKhNO4OO+piOne5IMo+ANarrzyg7LObmcMjTRmD8kQSzSog/KSj7+J3Vg88WS7vKY0aVyUnZlhxg0asfoO2z5nlnZCPqS6y750EwDVqJuT6cs/FmYyZSjpVPf6HoiCr4yGTKPa9KQasAknMA0ibgCG7Ul0iMBaqN0E1siG2M2fSTNaiOnRgEsYd8NU9Pzerfz7lYi1IOBalWxWYk1QR8AS156/TcosOR6hAywrYdO40hJOir0TpGM7litpb2UR+vnoZr7LCT8hGbYMRjzAee+b2100rQ2qFmRQPcaq0Ctrm0DcJl0BzXUFMooRvHplMHGEzjySNQWutxzBRhJNHzcNpD0e2D+gyE+QivTunMg19l0gf7mxhUk5YClgMvCZQNvqz1D/UV64MAOWNDHEhuBtKoOVHpF+sSB35LFcnpKGQakhS8TpSVMY4V86F2FxMVB18zgSyflEkt00RHLMboJTc9arwH+ytryw/oFjq+DFkyXWZiiC4Bmo1Y9Gc7JK4rE6gAJjhfUizSjMWPUEKBAGktEXVuog7tpNrRzhwBQQY+E+zRq1M1EZgsDXrL/Qf6hz77oceF9Ilgh5LHDT056/UVdYyFaoQ0xrjINIKu69K6Mq55cxI3k5PzDLDNJc0YufTSvYOHEZ/E0cy0ptMrnzj0obc/juXyBP9m11rZn2A2Us8a/GiimpHzS/cjxi8iHjJdYMZZ0BlaVb7Ap4uAdsgjWwkqSS0TFWKaVTOO3zJr+3+4tPBB+E4Q/1bXgRcW36Evhj/Ov7xU5UO/HYdAjfT/Mugms8V22Z6ManfOucLTmxi+G//4DxdPv6O85/bhP/LWRb/tA/98u3ak9yt39+ndyT49GM77uaZdm5KmbMm0aFklyGCca7iNkckPdE9Dx1dw8kRHzrTcWEqeHxJ4DfJY59IbRt5kVlwcl55tggG9lkP6F5iSgS5+2/t4jHT/tOI9JOwHy2r/gSfffe3IPxP4vzL3JrQKxzmrAAAAAElFTkSuQmCC","Stripe"),tE=tm("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"),nE=tm("data:image/png;base64,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","Shopify"),rE=tm("data:image/png;base64,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","Gusto"),aE=tm("data:image/png;base64,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","Freshbooks"),oE=tm("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAABlNJREFUeAHtnN0vH0sYx586nL5qvFRflHoXOYSkTSsu3IpWpHdSDeGCK3Evxx9xQuqllaC3biTSlpIjlbghLuQkTuIlNKVatKmEaqOYPt9frO4P+/vtzL5Q9knmt7uz88zM89mZ3dln5rdEByWTo/7hMMFhjYM44QE2wlbYDNsN5U8+84TDNoeTDsXIPtgOBmDhJ4j4l4OR4mmLBws/SKB22iAEsxdM6AwH9Lv/OIRw8OQXgR3ezf6Df/7mkPcr3tvbJYDGs4kf3MH/2o30Nv4E/gcgPOYu+cd7R7sE1gEINytPDAh4N2YDMFq0B0gjYbD1ABmA0aJDtR23t1FRUZSamkrp6emUkJBAMTExdOHCBV81vn79Sp8+faK3b9/S1NQUzczM0JcvX9yuoq88VwHdunWL7t+/Tw8ePKA7d+5QbGwsnTmD54SxCCHo/fv3NDY2Rq9evaLe3l5aWFgwVnDgTLAht+Xzd+/eFe3t7YJbBdtrTVZWVkRbW5u4ffu25XoxSzN5mEpkJqMDaVJSUnxgvn//bo3KIdobGxvi2bNnIjEx8UC5Jg03q+cMoOrqavHx48dDTLM3irufqKysNGusSjp7AV2+fFl0dHTYS8FEbk+fPhUXL15UARBMxz5AN27cEG/evDFhjjNJ+vv7xdWrV4MZLHveHkCAMzo66ozlErkODw8LHjLIQgiU3jogdKuhoSEJM5xNipZkY3ezBojHMaKzs9NZixVyb21tDdQqZM5ZA1RVVaVQfXdUysrKZEAYpVUHlJSUJDBwO66yuLgo4uLijAw3G68O6Dh2rf0Xq6WlxSwIo3RqgDDUd2KEvN9Aq8f84iuysrKMjA8ar+zuqK2tpbNnzzrwamhvlvAQ1NTUWMo0KMX97zbo1+x+sHpxXdNfXl4W165dk7YTdiu5O4qKiigiIkL5qqytrRG/p0np80CULl1Sm1uAr6mwsJCeP38uVaaWWJpsT0+P8tVfXV0Vubm54vz581IhPz9fMFjlcru6uqTtZEDQkbtJR0ZGCjw+VWVyclKEhYVJVxZA5+bmVIsV7J0U4eHh0uVK36TT0tKI+7PW+qS38CCGhsr3bOgE8z4GqszNmzcpOTk5UJJDz0kDyszMpJAQabW9wrkl7O27uQPAuLiyIn0pl5aWiP09suXspYf+9jaW4bgvmByQFWlAcJwj/I5y5coV6Wqr9xXpoo5eQZtWkqnJqQIkA0ZLe6oA8UyIZrfprfQ9qLi4mB4/fkw8IDFdiD4hRtB1dXW0ubmpj3ZlH7O1siINKDo6mh49eiRbzl76+fl5qq+v3zt2cwdT2bIi3cUmJiZoZwfL99SEXSRqiha1tra2aHp6WjoXaUAo5MOHD9IFaQromj9+/NAOTW9VdPSZYz5/dnZWH2VqX7qL8cumbyEBhu4qcv36dcrLy6Px8XEp9Xv37pHKOEYrZGRkhNbX17VD01tpQMj5xYsX9PDhQ9OF6BPyFBH19fUR+7L10QH38Q7GE4J07ty5gOkCnUSdVUX6DZeXrYjPnz8rv1m7rYg1AqqTidL3IFwFdndQd3e36gVxXY99QVItdn8FpVsQZyBycnLEt2/f3G4M0uXxfUdkZGQo2Qg7AUtZGQuZjrs0NjYq22cZEC+pc2UNkOpF4EGpwKIKK43AUgtCwRUVFar1d1SPB7OipKTEKhzoq3cxTRdL4Y6b2NC1NLjWAfF0jBgYGDg2jHjM45sx0S6gxa11QKgAxhlYvHTUMjg4KHgNtnb17djaA0iD9Pr16yNjhJZjMxx77kH6JoyVXVhR4bY0NDTY2a30Lc++FqQHVV5eLvCYdVowIVhaWqo3yO59ZwABVnx8vGhubhYYzdotmIbGk4q9CnYD2Z+fc4C0FpWdnS2ampoE+5Esc8K0N8DwBOZ+Qxw5dvUfh1ihUVBQ4PszC/w7vIwm6DQ0HGVw0/ISY3r58iXxcIIw+eiWuApIbxT8Qpgrx1+iMOMJZ5g2b6X/OxT+CgVPoIqzS1+e6v6RAVKtsNt6Sv4gtyt5lOV5gILQ9wCZACTv6g+S6Qk6vY4W9O4EGWS3Ke8AqN/uXE9Qfv14zHufxzn8ivo+j6OdesI7jgzVf+N8wWRPvE90+TeQA5/oAilAAjWssDytrQm2g4Hf98v42E9wT8In87zPBDKEn02Y0wmZAdg6AAAAAElFTkSuQmCC","Uber"),iE=tm("data:image/png;base64,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","Bank"),lE={GUSTO:rE,FRESHBOOKS:aE,FRESHBOOKS2:aE,SHOPIFY:nE,STRIPE:eE,SQUARE:tE,UBER:oE};function sE(e){return lE[e]??iE}const cE=Gn({display:"flex",flexDirection:"column",gap:"4px"});function dE({integration:e,isCompact:t}){const n=Sk(e.apiName),r=function(e){if(e)return`Last synced ${Vt(e)}`}(e.lastSyncedDate),a=sE(e.apiName);return S(Mk,{children:R(Fk,{children:[R(Vv,{children:[S(ld,{Component:a}),R("div",{className:cE,children:[S(Ys,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&S(fo,{intent:"normal",children:r})]})]}),S(pk,{shouldUseButtonDiscreteStyles:t,children:S(Dk,{integration:e})})]})})}const uE=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),hE=Gn.raw({color:"typography.base.weak"}),pE=Gn({overflow:"hidden"});function gE({manualBankAccounts:e,isCompact:t=!1}){const n=PT(),r=t||n?Ic:Fs;return R(Mk,{children:[R("div",{className:uE,children:[S(Ys,{extraClassNames:[hE],children:"Manually Tracked Accounts"}),S(r,{onClick:()=>jl("BankAccountForm"),active:!1,children:S(rl,{Component:xs})})]}),S("div",{className:pE,children:e.map(e=>S(Zk,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const mE=cr(tr["selector-row"],Xn(Gn(Is,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),Ji)),vE=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),bE=Gn({display:"flex",alignItems:"center",gap:"8px"}),fE=Gn({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),yE=cr(null,Gn({width:"20px",height:"20px"}));function xE(){const{linkPlaid:e,loading:t}=Jf();return S("button",{...mE,disabled:t,onClick:()=>{ha("Add New Connection button pressed"),e({plaidEvent:Of,message:"Add New Connection button pressed"})},children:R("div",{className:vE,children:[R("div",{className:bE,children:[S(ld,{stylists:[yE],Component:wm}),R("div",{className:fE,children:[S(Ys,{children:"Connect your bank"}),S(fo,{children:"Find your banking institution with Plaid"})]})]}),S(ud,{Component:Qi})]})})}const CE=Gn({paddingInline:"16px",paddingBottom:"8px"}),TE=Gn.raw({color:"typography.base.weak",fontWeight:"label"});function wE({title:e,children:t}){return R("div",{children:[S("div",{className:CE,children:S(Ys,{extraClassNames:[TE],children:e})}),t]})}const kE=Gn({minWidth:"100%",height:"45px"});function EE(){return R(N,{children:[S(jo,{styles:kE}),S(jo,{styles:kE}),S(jo,{styles:kE})]})}const AE=cr(tr["selector-row"],Xn(Gn(Is,{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"}),Ji)),IE=Gn({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),SE=Gn({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),NE=Gn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function RE({integration:e}){const{linkPlaid:t,loading:n}=Xf(),r="PLAID"===e.apiName,a=Sk(e.apiName),o=e.iconUrl?tm(e.iconUrl,"Institution Icon"):wm;return S("button",{...AE,disabled:n||!r,onClick:()=>{ha(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:Vf,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:IE,children:[R("div",{className:SE,children:[S(ld,{Component:o}),S(Ys,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:NE,children:[S(rl,{Component:vu}),S(Ys,{children:"Relink"})]})]})})}const DE=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"}))),PE=cr(tr["selector-row"],Xn(Gn(Is,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),Ji)),ME=Gn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),LE=Gn({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),FE=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),OE=Gn({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:{sm:"16px",base:"18px"},padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),VE=Gn({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function BE(){const e=cc(),{mutateAsync:t}=jf(),[n,r]=c("");return R("div",{className:LE,children:[S(vo,{children:"Enter your shop name"}),S("div",{className:VE,children:S(DE,{})}),S(Ys,{children:"Please enter the name of your shop below."}),S("input",{className:OE,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:FE,children:[S(gf,{showIcon:!1,onClick:()=>{e.close()}}),S(Sh,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:S(vo,{children:"Connect"})})]})]})}function UE(){const e=sE("SHOPIFY")??vu;return R(sc,{placement:"bottom",children:[S(dc,{children:t=>R("button",{...PE,...t,children:[R("div",{className:ME,children:[S(ld,{Component:e}),S(Ys,{children:"Shopify"})]}),S(ud,{Component:Qi})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(BE,{})})})})]})}const WE=cr(tr["selector-row"],Xn(Gn(Is,{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"}),Ji)),HE=Gn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function zE({apiName:e}){const{mutateAsync:t}=jf(),n=Sk(e);if("SHOPIFY"===e)return S(UE,{});const r=sE(e)??vu;return R("button",{...WE,onClick:async()=>{const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:HE,children:[S(ld,{Component:r}),S(Ys,{children:n})]}),S(ud,{Component:Qi})]})}const qE=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function jE(e){return qE.includes(e)}const _E=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],KE=Gn({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),YE=Gn({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function ZE(){const{query:{data:e},isFilling:t}=TC(),n=e?.multiAccountIntegrations,r=e?.integrations,a=rr(n)&&n.length>0||rr(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=l(Lc),n=ln(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(jE),a=e?.map(e=>e.apiName)||[];let o=r??_E;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:KE,children:[(t||a)&&S(wE,{title:"Already Connected",children:t?S(EE,{}):R(N,{children:[n?.map(e=>S(RE,{integration:e},e.id)),r?.map(e=>S(RE,{integration:e},e.id))]})}),S(wE,{title:"Available Banks",children:S(xE,{})}),o&&o.length>0&&S(wE,{title:"Integrations",children:S("div",{className:YE,children:o.map(e=>S(zE,{apiName:e},e))})})]})}const GE=Gn({marginTop:"16px"}),QE=Gn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),XE=Gn.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function JE({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?S(ZE,{}):t?R(N,{children:[R("div",{className:GE,children:[S(Ys,{extraClassNames:[XE],children:"Connected Accounts"}),r?.map(t=>S($k,{integration:t,isCompact:e},t.id)),a?.map(t=>S(dE,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&S(gE,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?S(gE,{manualBankAccounts:o}):R("div",{className:QE,children:[S(ld,{Component:wm}),S(vo,{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 $E=cr(null,Gn({color:"typography.base.weak"})),eA=cr(tr["drawer-header"],Gn({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Pv)),tA=Gn({display:"flex",gap:"8px"}),nA=Gn({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),rA=$n({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),aA=Gn({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),oA=Gn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),iA=cr(null,Gn({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),lA=$n({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function sA({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=PT()||e,{query:{data:a},isFilling:o}=TC(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=nh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>fh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:Dg(e?.data)};var t}}),{mutate:c,isPending:d}=Kf(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&CC(p,!1),m="connected"===ln(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,b=m?"Add New Connection":"Add New Account",f=()=>{jl(m?"NewConnection":"BankAccountForm")},y=r?Ic:Fs;return R(Hf,{onPlaidLink:n,children:[R("div",{...eA,children:[R(Vv,{children:[t&&S(Vu,{}),r?S(vo,{children:"Banks & Integrations"}):S(br,{stylists:[$E],children:"Banks & Integrations"})]}),R("div",{className:tA,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[S(ud,{Component:vu,stylists:[cr(null,lA({refreshLoading:d}))]}),!r&&S(Ys,{children:"Sync Accounts"})]}),R(y,{onClick:()=>f(),active:!1,children:[S(ud,{Component:xs}),!r&&S(Ys,{children:"Add New Connection"})]})]})]}),g&&S("div",{className:oA,children:S(ok,{task:g})}),o?S(uk,{}):R(N,{children:[S("div",{className:rA({height:v?"fill":void 0,background:v?"foreground":void 0}),children:S("div",{className:nA,children:S(JE,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&S("div",{className:aA,children:R(Fs,{stylists:[iA],onClick:()=>f(),children:[S(ud,{Component:xs}),S(vo,{children:b})]})})]})]})}const cA=Gn({display:"flex",justifyContent:"center"}),dA=Gn({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 uA({onPlaidLink:e}){return S(nk,{children:S("div",{className:cA,children:S("div",{className:dA,children:S(sA,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})}function hA(e){return nt({key:"customer",name:"Customer",possibleValues:e})}function pA(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 gA=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function mA({children:e}){return S("div",{className:gA,children:e})}function vA({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(sc,{children:[S(dc,{children:e=>R(lb,{popupTriggerChildrenProps:e,children:[R(mA,{children:[t&&S(ud,{Component:tm(t,"")}),S(Ys,{wrap:"wrap",children:i})]}),S(ud,{Component:Qi})]})}),S(Hv,{title:r,Footer:o??null,children:a})]})}function bA(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ee(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 fA({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return S(N,{children:e.map((e,o)=>S(r,{groupIndex:o,children:e.map((e,n)=>S(a,{item:e},t(e,n)))},n(e,o)))})}const yA=Gn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),xA=cr(tr["list-body"],Gn({display:"block"}));function CA({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return R("div",{className:yA,children:[e&&S(Ys,{intent:"weak",children:e}),n?S(Jv,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):S("div",{...xA,children:t})]})}const TA=Gn({display:"flex",flexDirection:"column",gap:"16px"});function wA({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return S(sb,{handleClick:t,selected:n,isMultiSelect:r,children:R(mA,{children:[e.iconUrl&&S(ud,{Component:tm(e.iconUrl,"")}),S(Ys,{wrap:"wrap",children:e.name??""})]})},e.id)}function kA({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 S(eb,{children:S("div",{className:TA,children:S(fA,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>S(wA,{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 S(CA,{label:r,children:e})}})})})}function EA({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=bA(e,{items:n,fuseOptions:Qg,processResults:Jg});return r?S(pb,{}):0===Object.keys(i).length?S(Jv,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):S(kA,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function AA(e,t){return hC(e,t).map(e=>({parent:e.parent,child:e.child}))}function IA({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=bA(e,{items:n,fuseOptions:dC,processResults:AA});return r?S(pb,{}):0===Object.keys(i).length?S(Jv,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):S(kA,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function SA(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...SA(n));return t}function NA(e,t){return e.value?.[t]?.value?.id?.in??[]}function RA(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&NA(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{NA(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function DA(e,t){const n=[];return e.forEach(e=>NA(e,t).forEach(e=>n.push(e))),new Set(n)}function PA(e,t,n,r){return d(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!NA(t,e).some(e=>n.includes(e)));return dw(t,e,r)})},[t,r,e])}const MA=Gn.raw({width:"100%",justifyContent:"center"}),LA=Gn({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 FA({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:LA,children:[R(sd,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[S(Ys,{children:"Apply"}),S(rl,{Component:Ih})]}),S(Fs,{onClick:e,styles:MA,children:S(Ys,{children:"Clear All"})})]})}function OA({onApply:e,onClearAll:t}){const n=cc();return S(FA,{onApply:()=>{e(),n.close()},onClearAll:t})}function VA({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}){const p=o(()=>SA(e),[e]),g=d(()=>{i(p)},[p,i]),m=d(()=>{if(p&&l&&s){const e=cw(s,"category"),t=RA(l,e,p,"category");u(t)}},[p,l,s,u]),v=S(OA,{onApply:m,onClearAll:g});return S(vA,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:S(Zv,{placeholder:"Search expense categories...",onClick:a,SearchList:EA,DefaultList:BA,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:u,isMultiSelect:h}})})}function BA({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?S(pb,{}):S(nb,{title:S(vo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=SA(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return S(VA,{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 S(sb,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(mA,{children:[e.iconUrl&&S(ud,{Component:tm(e.iconUrl,e.name??"")}),S(Ys,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const UA=[];function WA({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Hg(),s=i?.data??UA,c=DA(cw(t,"category"),"category"),u=d(e=>{const t=HA(e);n(t)},[n]),h=PA("category",r,0,a);return a&&o?S(Zv,{placeholder:"Search expense categories...",onClick:u,SearchList:EA,DefaultList:BA,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:u,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function HA(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 zA(){const{query:{data:e},isFilling:t}=Vg(),n=e?.data,r=o(()=>n?.map(HA),[n]);return d(()=>({values:r??[],isFilling:t}),[r,t])}function qA(e){return nt({key:"category",name:"Category",NestedListComponent:WA,possibleValues:e})}const jA=[{value:"in",label:"In"}];function _A(e){return nt({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:jA})}function KA(){const e=function(){const e=Ui();return(e?Ri:Di).map(t=>Vi(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 d(()=>({values:t,isFilling:!1}),[t])}function YA(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const ZA=I.object({minAmount:I.number().nullable(),maxAmount:I.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 GA(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:rr((a=t).greaterThanEqual)?Ku(a.greaterThanEqual):null,maxAmount:rr(a.lessThanEqual)?Ku(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const QA=Gn({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function XA({children:e,title:t}){return S(Hv,{title:t,padChildren:!1,children:S("form",{onSubmit:e=>{e.preventDefault()},className:QA,children:e})})}const JA=Gn({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),$A=Gn({display:"flex",flexDirection:"column",flex:1}),eI=Gn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function tI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return S(XA,{title:"Amount",children:S(nI,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function nI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=cc();return df({defaultValues:GA(0,r),validators:{onChange:ZA},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=co(e,{dollarSign:!0,signage:"default"}),a=Yu(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=co(t,{dollarSign:!0,signage:"default"}),r=Yu(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:[S("div",{className:eI,children:R(eb,{children:[R("div",{className:JA,children:[S("div",{className:$A,children:S(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>S(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),S(vo,{children:"To"}),S("div",{className:$A,children:S(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>S(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&S(Vh,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),S(FA,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const rI=[{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 aI(){return nt({key:"amount",name:"Amount",operators:rI,ModalComponent:tI})}function oI(){const{query:{data:e},isFilling:t}=nh(),n=e?.data,r=function({institutionIds:e}){const t=kr(),n=Nr(),r=[...new Set(e)],a=O({queries:r.map(e=>({queryKey:Am({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Au({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=>rr(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=Gu(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return d(()=>({values:a??[],isFilling:t}),[a,t])}function iI(e){return nt({key:"bankAccount",name:"Bank Account",possibleValues:e})}const lI=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:[],sI=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:mi(t[1].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function cI(e){return Rr({queryKey:["dimensionValues"],queryFn:sI,...e})}function dI(){const{query:{data:e},isFilling:t}=vv({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 d(()=>({values:r??[],isFilling:t}),[r,t])}function uI(e){return nt({key:"vendor",name:"Vendor",possibleValues:e})}function hI(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 nt({key:"type",name:"Type",possibleValues:()=>({values:t})})}const pI=ci(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"),gI=cr(null,Gn({fill:"surface.intent.action.active"}));function mI({isSelected:e}){return S(ud,e?{Component:pI,stylists:[gI]}:{Component:rb})}function vI({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 S(nb,{title:S(fo,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?xI(l.value.status?.value):a.some(e=>C(e.value,l.value)));var l;return R(lb,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[S(mA,{children:S(Ys,{wrap:"wrap",children:r.name})}),S(mI,{isSelected:i})]},`${r.name}_${o}`)})})}const bI="status",fI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function yI(){const e="in";return{values:fI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function xI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function CI(e){return xI(e.value.status?.value)}function TI(){return nt({key:bI,name:"Status",possibleValues:yI,singleSelect:!0,SimpleListComponent:vI})}const wI=(kI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(kI));var kI;function EI({onApply:e,onClearAll:t}){const n=cc();return S(FA,{onApply:()=>{e(),n.close()},onClearAll:t})}function AI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:u,isMultiSelect:h}){const p=o(()=>SA(e),[e]),g=d(()=>{i(p)},[p,i]),m=d(()=>{if(p&&l&&s){const e=cw(s,"glAccount"),t=RA(l,e,p,"glAccount");u(t)}},[p,l,s,u]),v=S(EI,{onApply:m,onClearAll:g});return S(vA,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:S(Zv,{placeholder:"Search GL accounts...",onClick:a,SearchList:IA,DefaultList:II,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:u,isMultiSelect:h}})})}function II({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?S(pb,{}):S(nb,{title:S(vo,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=SA(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return S(AI,{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 S(sb,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:S(mA,{children:S(Ys,{wrap:"wrap",children:e.name})})},e.id)})})}const SI=[];function NI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=iC(),s=i??SI,c=DA(cw(t,"glAccount"),"glAccount"),u=d(e=>{const t=RI(e);n(t)},[n]),h=PA("glAccount",r,0,a);return a&&o?S(Zv,{placeholder:"Search GL accounts...",onClick:u,SearchList:IA,DefaultList:II,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:u,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function RI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function DI(e){return nt({key:"glAccount",name:"GL Account",NestedListComponent:NI,possibleValues:e})}function PI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(vt(e)){const t=Tt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(ft(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,pA(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 pA(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return pA(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return pA(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 pA(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return pA(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function MI(e,t){const n=e.reduce(PI,{});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 LI=e=>{const t=ln(e=>e.transactionsDashboardFilters),n=ln(e=>e.expenseDashboardFilters),r=ln(e=>e.incomeDashboardFilters),a=ln(e=>e.setTransactionsDashboardFilters),o=ln(e=>e.addTransactionsDashboardFilters),i=ln(e=>e.removeTransactionsDashboardFilter),l=ln(e=>e.hasInitializedTransactionsDashboardFilters),s=ln(e=>e.setExpenseDashboardFilters),c=ln(e=>e.addExpenseDashboardFilters),d=ln(e=>e.removeExpenseDashboardFilter),u=ln(e=>e.hasInitializedExpenseDashboardFilters),h=ln(e=>e.setIncomeDashboardFilters),p=ln(e=>e.addIncomeDashboardFilters),g=ln(e=>e.removeIncomeDashboardFilter),m=ln(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 FI(){return{getCategories:zA(),getBankAccounts:oI(),getCustomers:dI(),getVendors:function(){const{query:{data:e},isFilling:t}=Zm(),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 d(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=cI(),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 d(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=Jx(),n=o(()=>e?.map(e=>RI(e)),[e]);return d(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:KA()}}function OI(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 VI=Gn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function BI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return S(XA,{title:"Back",children:S(UI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function UI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=cc();return df({defaultValues:{[e.key]:OI(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:[S("div",{className:VI,children:S(eb,{children:S(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=>S(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),S(FA,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const WI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function HI(){return nt({key:"description",name:"Description",operators:WI,ModalComponent:BI})}const zI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function qI(){return nt({key:"notes",name:"Notes",operators:zI,ModalComponent:BI})}const jI=[{name:"Expense",types:ax.Expense},{name:"Income",types:ax.Income},{name:"Transfer",types:ax.Transfer}];function _I(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:u,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:_A(h),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(c),date:qt,description:HI(),glAccount:DI(u),notes:qI(),status:TI(),vendor:uI(s),type:hI(jI),search:at}),[l,i,s,c,u,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(()=>MI(e,void 0),[e,m]),b=d(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:b,hasUserConfiguredFilters:a}}function KI(e,t,n,r,a){const o=ln(e=>e.initializeTransactionsDashboardFilters),i=ln(e=>e.initializeExpenseDashboardFilters),l=ln(e=>e.initializeIncomeDashboardFilters),s=ln(e=>e.hasInitializedTransactionsDashboardFilters),c=ln(e=>e.hasInitializedExpenseDashboardFilters),d=ln(e=>e.hasInitializedIncomeDashboardFilters),h=Wi(),p="transactionsDashboard"===e?s:"expenseDashboard"===e?c:d;u(()=>{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 YI=i(void 0);function ZI(){const e=l(YI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function GI({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!==rt&&l.modelKey!==Ht&&(l.modelKey!==bI||!CI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(nr(n)&&rr(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(nr(r)&&rr(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=co(Ku(n),{dollarSign:!0,signage:"default"}),i=co(Ku(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=>S(of,{text:e.text,additionalValidClassName:tr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const QI=ci(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"),XI=Gn({width:"17px",height:"17px",borderRadius:"sm"});function JI({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:XI}),S("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:17})}const $I=Gn({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),eS={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function tS(){const e=PT(),{dashboardKey:t}=ZI();return S(Fs,{onClick:()=>{jl(eS[t],{routeProps:{}})},stylists:[cr(null,$I)],children:e?S(JI,{Component:QI}):R(N,{children:[S(rl,{Component:QI}),S(Ys,{children:"Filters"})]})})}const nS=I.object({beginDate:I.string().nullable(),endDate:I.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Pt(e.beginDate),n=Pt(e.endDate);if(t&&n)return!St(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),rS=Gn({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),aS=Gn({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),oS=cr(null,Gn({marginTop:"22px"}));function iS({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,df({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:nS},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:rS,children:[R("div",{className:aS,children:[S(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>S(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),S(ld,{Component:AT,stylists:[oS]}),S(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>S(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&S(Vh,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const lS={width:"fit-content"};function sS({onDateRangeChange:e}){const{filters:t}=ZI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Ht);if(void 0!==t){const e=t.value.date?.value;if(ft(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return S(im,{triggerChildren:S(cm,{displayLabel:"Custom"}),popupChildren:S(xc,{style:lS,children:S(iS,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const cS=Gn({width:200,minWidth:200});function dS({dateFilter:e,addFilter:t}){return S(gg,{onClick:()=>t(e),children:S(vo,{children:mt[e]})})}function uS({getModel:e,addFilters:t}){const{setOpen:n}=cc(),r=r=>{const a=e(Ht);if(void 0===a)return;const o=a.createFilter({name:mt[r],value:{[a.key]:{name:mt[r],value:r}}});t([o]),n(!1)};return S(xc,{children:R(lg,{style:cS,children:[S(dS,{dateFilter:gt.ALL_TIME,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_MONTH,addFilter:r}),S(dS,{dateFilter:gt.LAST_MONTH,addFilter:r}),S(dS,{dateFilter:gt.LAST_3_MONTHS,addFilter:r}),S(dS,{dateFilter:gt.LAST_12_MONTHS,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_QUARTER,addFilter:r}),S(dS,{dateFilter:gt.LAST_QUARTER,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(dS,{dateFilter:gt.THIS_YEAR,addFilter:r}),S(dS,{dateFilter:gt.LAST_YEAR,addFilter:r}),S(Mh,{alignment:"horizontal"}),S(sS,{onDateRangeChange:n=>{const r=e(Ht);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const hS=[cr(null,$I)];function pS({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Ht);let n=mt[gt.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=vt(e)?mt[e]:ft(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Pt(e.beginDate):null,n=e.endDate?Pt(e.endDate):null;return t&&!n?`After ${Bt(t)}`:!t&&n?`Before ${Bt(n)}`:t&&n?`${Nt(t)} - ${Nt(n)}`:"Custom"}(e):t.name}return n})(e);return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(Fs,{stylists:hS,popupTriggerProps:e,children:S(Ys,{children:r})})}),S(uS,{getModel:t,addFilters:n})]})}const gS=Gn({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),mS=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function vS({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=cc();return S(gg,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:R("div",{className:gS,children:[R("span",{className:mS,children:[n&&S(ud,{Component:n}),S(vo,{children:e})]}),o&&S(ud,{Component:Qi})]})})}const bS=[{label:ox[rx.EXPENSE],type:rx.EXPENSE},{label:ox[rx.REVENUE],type:rx.REVENUE},{label:ox.BANK_TRANSFER,type:"TRANSFER_IN"},{label:ox.BANK_TRANSFER,type:"TRANSFER_OUT"}],fS=cr(null,$I);function yS({manualTransactionOptions:e}){const t=bS.filter(t=>e.includes(t.type)),n=PT();return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(Fs,{stylists:[fS],popupTriggerProps:e,children:n?S(JI,{Component:xs}):R(N,{children:[S(rl,{Component:xs}),S(Ys,{children:"Add Transaction"})]})})}),S(xc,{children:S(lg,{children:t.map(({label:e,type:t})=>S(vS,{closeOnClick:!0,onClick:()=>jl("BankTransactionForm",{routeProps:{initialType:t}}),children:e},t))})})]})}const xS=ci(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"),CS=Gn.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function TS(){return S(Fs,{styles:CS,onClick:()=>jl("TransactionSettingsDrawer"),children:S(ud,{Component:xS})})}const wS=Gn.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function kS({children:e,styles:t}){return S("div",{className:Gn(wS,t),children:e})}const ES=cr(tr["dashboard-header"],Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),AS=cr(null,Gn({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),IS=Gn.raw({paddingLeft:"15px",paddingRight:"15px"}),SS=Gn({display:"none",xl:{display:"flex"}});function NS({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=ZI(),l=PT(),s=o(()=>nr(n)?"":n.find(e=>e.modelKey===rt)?.value.search?.value??"",[n]);return R("div",{...ES,children:[R("div",{...AS,children:[S($T,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(rt);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:lw(l)}),S(tS,{}),S(yS,{manualTransactionOptions:t}),!l&&S(pS,{filters:n,getModel:a,addFilters:i}),S(TS,{}),S("div",{className:SS,children:S(sl,{})})]}),n.length>0&&S(kS,{styles:IS,children:S(GI,{filters:n,removeFilter:r})})]})}const RS=dn.filter(e=>e!==cn.COMMENTS&&e!==cn.DIMENSION_VALUE),DS=cr(null,Gn({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function PS(){return S("div",{...DS,children:S(sl,{})})}const MS=Gn.raw({gap:"6px"});function LS({Icon:e,label:t,children:n,onClick:r}){return n?R(sc,{placement:"bottom-start",children:[S(dc,{children:n=>R(Ic,{popupTriggerProps:n,extraClassNames:[MS],children:[e&&S(rl,{Component:e}),S(Ys,{children:t})]})}),n]}):R(Ic,{onClick:r,extraClassNames:[MS],children:[e&&S(rl,{Component:e}),S(Ys,{children:t})]})}const FS=ci(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"),OS=cr(null,Gn({whiteSpace:"normal"}));function VS({transactions:e,id:t,label:n,resetSelected:r}){const{mutate:a}=VC(),o=cc();return Hi(t)?S(gg,{onClick:()=>(t=>{if(e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));a(r)}var n;o.close(),r&&r()})(t),children:S(Gg,{stylists:[OS],children:n})}):null}const BS={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},US=e=>e.map(e=>({id:e.id,status:BS.INACTIVE})),WS=ci(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"),HS=[{id:"delete",label:"Delete",Icon:FS,component:function({transactions:e,resetSelected:t,...n}){const{mutate:r}=VC(),a=()=>{const n=US(e);r(n),t&&t()};return S(LS,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ju({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Delete",type:qu.DANGER}]}).then(e=>{e===Su&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:WS,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=VC(),o=e.length;return o>0&&S(LS,{label:`${t} ${_u("Expense","Expenses",o,!0)}`,...r,children:S(hm,{onClick:function(t){var r,o;t?.id&&(a((r=e,o=t.id.toString(),r.map(e=>({id:e.id,categoryId:o})))),n&&n())}})})}},{id:"recategorize-revenues",label:"Recategorize",Icon:WS,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=VC(),o=e.length;return S(LS,{label:`${t} ${_u("Revenue","Revenues",o,!0)}`,...r,children:S(yC,{onClick:function(t){var r,o;a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:sC})})}}];function zS({subActionList:e}){return S(lg,{children:e})}function qS({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?S(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return S(LS,{label:n,Icon:r,children:S(xc,{children:i.length>0?S(zS,{subActionList:i}):S(gg,{children:S(Ys,{children:"No Actions Available for Selection"})},"no-actions")})})}const jS=cr(tr["bulk-select"],Gn({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function _S({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=Oi();return o(()=>[...HS,{id:"review",label:"Change Review Status",Icon:pi,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:VS}))}],[e])})(),s=()=>e.resetRowSelection(!0);return R("div",{...jS,children:[S(IT,{table:e}),S(vo,{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?S(qS,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&S(t,{transactions:d,resetSelected:s,...c},i)})]})}function KS({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r}){const o=PT(),i=function({transactions:e,columns:t}){const n=PT(),r=LT({transactions:e,columns:t?[cn.SELECT,...t,cn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!nr(t.getColumn(sn.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:l}=ZI(),s=i.getIsAllRowsSelected(),c=i.getIsSomeRowsSelected(),d=s||c;let u;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?u=S(pw,{buttonText:"Clear Filters",onButtonClick:()=>l([])}):r&&0===e?.length&&(u=S(zT,{})):u=S(WT,{});const h=d&&nr(u)&&!o;return R(Hs,{dashboard:"transactionDashboard",children:[h?S(_S,{table:i}):S(Ll,{headerGroups:i.getHeaderGroups()}),nr(u)?S(iw,{table:i}):S(od,{children:u})]})}const YS={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"}},ZS=(e={})=>{const t=Wn(YS,e);return YS.transform(t,Un)},GS=e=>Gn(ZS(e));GS.raw=ZS;const QS={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},XS=(e={})=>{const t=Wn(QS,e);return QS.transform(t,Un)},JS=e=>Gn(XS(e));JS.raw=XS;const $S={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},eN=(e={})=>{const t=Wn($S,e);return $S.transform(t,Un)},tN=e=>Gn(eN(e));tN.raw=eN;const nN={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},rN=(e={})=>{const t=Wn(nN,e);return nN.transform(t,Un)},aN=e=>Gn(rN(e));aN.raw=rN;const oN=Gn({display:"flex",padding:"16px 12px",border:"0.75px",borderStyle:"solid",borderRadius:"lg",borderColor:["border.layout"]}),iN=cr(tr.card,oN,Gn({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function lN({children:e}){return S("div",{...iN,children:e})}const sN=cr(tr["card-header"],Gn({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function cN({children:e}){return S("div",{...sN,children:e})}const dN=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function uN({children:e}){return S("div",{className:dN,children:e})}const hN=$n({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 pN({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}=ZI();if(!d(t))return null;const h="active"===r,p=cr(tr["card-button"],hN({filterStatus:r}),a);return S("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 gN=$n({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"}}),mN=Gn({minWidth:"200px"}),vN=Gn({marginLeft:"auto"});function bN({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=ZI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Rr({queryKey:RC({groupBy:e,filter:t}),queryFn:DC})}({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)||!Hi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,cr(tr["card-button-icon-container"],gN({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Hi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return R(pN,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:mN,isZeroState:t,filterEffectiveValueExtractor:YA,children:[S("div",{...l,children:S(ud,{Component:e.Icon})}),!t&&i&&R(N,{children:[S(vo,{children:e.text}),S("div",{className:vN,children:S(hu,{children:s})})]}),!t&&!i&&R(N,{children:[S(Ys,{children:e.text}),S("div",{className:Gn({marginLeft:"auto"}),children:S(hu,{children:s})})]}),t&&R(N,{children:[S(Ys,{intent:"weak",children:e.text}),S("div",{className:Gn({marginLeft:"auto"}),children:S(hu,{children:s})})]})]},e.text)}function fN({isZeroState:e}){const t=function(){const e=Ui();return(e?Pi:Mi).map(t=>Vi(t,e))}();return R(lN,{children:[S(cN,{children:S(Ys,{intent:"weak",children:"Review Status"})}),S(uN,{children:t.map(t=>S(bN,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const yN=Gn({width:"20px",height:"20px",borderRadius:"sm"});function xN({imageUrl:e,Component:t,stylists:n}){const[r,a]=c(!1);return rr(e)?R(N,{children:[!r&&S(jo,{styles:yN}),S("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):S(t,{stylists:[cr(tr["medium-icon"],tr.icon),...n??[]],size:20})}const CN=Gn({minWidth:"269px"}),TN=Gn({marginLeft:"auto"});function wN({account:e,isZeroState:t}){const{apiFilters:n}=ZI(),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=Cr(e.mask)?void 0:Zu(e.mask),c=co(null!=(d=e.accountBalance)?Ku(d):0,{dollarSign:!0});var d;return R(pN,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:CN,isZeroState:t,filterEffectiveValueExtractor:lI,children:[e.iconUrl&&S(xN,{imageUrl:e.iconUrl,Component:wm}),!t&&a&&R(N,{children:[S(vo,{children:o}),s&&S(Ys,{wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]}),!t&&!a&&R(N,{children:[S(Ys,{children:o}),s&&S(Ys,{wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]}),t&&R(N,{children:[S(Ys,{intent:"weak",children:o}),s&&S(Ys,{intent:"weak",wrap:"wrap",children:s}),S("div",{className:TN,children:S(hu,{children:c})})]})]},e.id)}const kN=[{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 EN({isZeroState:e}){const{query:{data:t}}=nh({params:{filter:{apiName:{in:[...Ig]}}}}),n=(r=t?.data??[],e?kN: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(lN,{children:[S(cN,{children:S(Ys,{intent:"weak",children:"Account Balances"})}),S(uN,{children:n.map((t,n)=>S(wN,{account:t,isZeroState:e},n))})]})}const AN=Gn({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),IN=Gn({display:{"@page/xl":"flex",base:"none"}}),SN=Gn({display:{"@page/xl":"none",base:"flex"}}),NN=Gn({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 RN({showZeroStates:e,Chart:t}){return R("div",{className:NN,children:[S("div",{className:IN,children:S(fN,{isZeroState:e})}),S("div",{className:IN,children:S(EN,{isZeroState:e})}),S("div",{className:AN,children:S(t,{})}),S("div",{className:SN,children:S(fN,{isZeroState:e})}),S("div",{className:SN,children:S(EN,{isZeroState:e})})]})}const DN=Gn({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),PN=aN({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),MN=Gn({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),LN=Gn({paddingTop:"8px"}),FN=Gn({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),ON=Gn({display:"flex",flexDirection:"column",gap:"10px"});function VN({columns:e=RS,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1}){const{filters:d}=ZI(),{hasPlaidLinkedBankAccount:u}=Ng(),h=u??!1,p=PT();if(a)return S("div",{children:`Error: ${o?.message}`});if(r)return S(gl,{});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===d.length&&rr(d[0].value?.date)?0:d.length,t.length);return S("div",{className:PN,children:R("div",{className:DN,children:[p&&c&&S("div",{className:ON,children:S(Qw,{})}),S(RN,{Chart:l,showZeroStates:!i}),R("div",{className:MN,children:[S("div",{className:LN,children:S(NS,{isFetching:n,manualTransactionOptions:s})}),S("div",{className:FN,children:S(KS,{hasLinkedBankAccount:h,filterState:r,transactions:t,columns:e})})]}),S(PS,{})]})})}return"zero state"}const BN=Gn({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),UN=cr(tr.card,oN,BN);function WN({children:e}){return S("div",{...UN,children:e})}const HN=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function zN({children:e}){return S("div",{className:HN,children:e})}const qN=cr(tr["card-header"],Gn({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function jN({children:e}){return S("div",{...qN,children:e})}const _N=Gn({minWidth:"300px"});function KN({options:e,handleClick:t,selectedIndex:n}){return S("div",{className:_N,children:S(Eb,{options:e,handleClick:t,selectedIndex:n})})}function YN(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=pt(e);return{beginDate:ht(it(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:ot(it(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:st()}:"LAST_12_MONTHS"}const ZN=To.var("colors.border.layout"),GN=cr(tr["profit-loss-graph"],Gn({"& .recharts-surface":{outline:"none"}})),QN=To.var("colors.money.positive.weak"),XN=To.var("colors.money.positive"),JN=To.var("colors.money.negative.weak"),$N=To.var("colors.money.negative"),eR=To.var("colors.surface.intent.action"),tR=To.var("colors.surface.intent.action.active"),nR=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],rR=()=>{const[e,t]=c(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Pa({accountingMethod:"CASH",filter:YN(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=Pt(e??"");return{longLabel:t?Ot(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:La(e)}}(e):"QUARTERLY"===t?function(e){const t=lt(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=lt(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??[]}(nR[e].value)}};function aR({selectedIndex:e,onSelect:t}){return S(KN,{options:nR,handleClick:t,selectedIndex:e})}const oR={top:20,right:20,left:20,bottom:5},iR={fill:To.var("colors.typography.base"),fontSize:To.var("fontSizes.metric.sm")};function lR({data:e,children:t,tooltip:n}){return S(W,{width:"100%",height:"100%",...GN,style:{flexGrow:1},children:R(H,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:oR,children:[S(j,{dataKey:"label",interval:0,tickLine:!1,stroke:ZN,tick:iR}),S(K,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const sR=Gn({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function cR(){return R("div",{className:sR,children:[S(Ao,{color:QN,label:"Income",diameter:10}),S(Ao,{color:JN,label:"Expense",diameter:10})]})}const dR=cr(null,Gn({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),uR=cr(null,Gn({width:"100%",height:"1px",backgroundColor:"border.layout"})),hR=cr(null,Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),pR=To.var("colors.money.positive"),gR=To.var("colors.money.negative");function mR({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",{...dR,children:[S(vo,{children:a}),S("div",{...uR}),R("div",{...hR,children:[S(Ao,{color:pR,label:"Income",diameter:12}),S(hu,{children:uo(Number(o))})]}),R("div",{...hR,children:[S(Ao,{color:gR,label:"Expense",diameter:12}),S(hu,{children:uo(Number(i))})]})]})}function vR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",children:"All Transactions"}),S(ro,{title:uo(r),label:void 0})]}),R(jN,{children:[S(aR,{selectedIndex:e,onSelect:t}),S(cR,{})]})]}),R(lR,{data:n,tooltip:({active:e,payload:t})=>S(mR,{active:e,payload:t}),children:[S(Y,{name:"Income",dataKey:"income",minPointSize:2,fill:QN,isAnimationActive:!1,activeBar:{fill:XN}}),S(Y,{name:"Expense",dataKey:"expense",minPointSize:2,fill:JN,isAnimationActive:!1,activeBar:{fill:$N}})]})]})}function bR({columns:e,limit:t=100}){const n=_I(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return KI("transactionsDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:vR,manualTransactionOptions:[rx.EXPENSE,rx.REVENUE,"TRANSFER_IN"]})})})})}const fR=e=>S(nk,{children:S(bR,{...e})}),yR={in:["EXPENSE","TRANSFER_OUT"]},xR=[{name:"Expense",types:ax.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:rx.TRANSFER_OUT}]}];function CR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:u,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:_A(h),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(c),date:qt,description:HI(),glAccount:DI(u),notes:qI(),status:TI(),vendor:uI(s),type:hI(xR),search:at}),[l,i,s,c,u,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(()=>MI(e,yR),[e,m]),b=d(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:b,hasUserConfiguredFilters:a}}const TR=cr(tr.text,Gn({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),ja);function wR({children:e}){return S("div",{...TR,children:e})}const kR=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function ER({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:kR,children:[S(ay,{children:n}),S(wR,{children:po(r)})]})}const AR=Gn({width:"160px",height:"32px"}),IR=Gn({width:"54px",height:"32px"}),SR=({y:e,payload:t})=>S("foreignObject",{x:0,y:e-10,className:AR,children:S(Ys,{children:String(t.value)})}),NR=({x:e,y:t,payload:n})=>{return S("foreignObject",{x:e,y:t-10,className:IR,children:S(Ys,{alignment:"right",children:(r=n.value,co(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},RR=({active:e,payload:t})=>S(ER,{active:e,payload:t});function DR({data:e}){return S(W,{width:"100%",height:44*(e?.length??0)+12,...GN,children:R(H,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[S(j,{type:"number",hide:!0,domain:[0,"dataMax"]}),S(_,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:SR,width:172}),S(_,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:NR,width:66}),S(K,{content:RR,isAnimationActive:!1,cursor:{fill:"transparent"}}),S(Y,{dataKey:"total",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR},barSize:32})]})})}const PR=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):[]},MR=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function LR(){const[e,t]=c(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Mt(n),endDate:Mt(t)}})(MR[e].value),{query:{data:r}}=Pa({filter:n,select:PR}),a=n?`${Nt(Pt(n.beginDate))} - ${Nt(Pt(n.endDate))}`:"";return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&S(Ys,{intent:"weak",wrap:"ellipsis",children:a})]}),S(KN,{options:MR,handleClick:e=>t(e),selectedIndex:e})]}),S(DR,{data:r})]})}function FR({columns:e,limit:t=100}){const n=CR(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return KI("expenseDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:LR,manualTransactionOptions:[rx.EXPENSE,"TRANSFER_OUT"],showTasks:!0})})})})}const OR=e=>S(nk,{children:S(FR,{...e})}),VR={in:["REVENUE","TRANSFER_IN"]},BR=[{name:nx,types:ax.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:rx.TRANSFER_IN}]}];function UR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:u}=FI(),h=o(()=>({reviewStatus:_A(u),amount:aI(),bankAccount:iI(l),category:qA(i),customer:hA(s),date:qt,description:HI(),glAccount:DI(c),notes:qI(),status:TI(),type:hI(BR),search:at}),[l,i,s,c,u]),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(()=>MI(e,VR),[e,g]),v=d(e=>h[e],[h]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:p,setFilters:t,addFilters:n,removeFilter:r,apiFilters:m,getModel:v,hasUserConfiguredFilters:a}}function WR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income,0);return R(WN,{children:[R(zN,{children:[R(jN,{children:[S(Ys,{intent:"weak",children:"Total Income"}),S(ro,{title:uo(r),label:void 0})]}),S(jN,{children:S(aR,{selectedIndex:e,onSelect:t})})]}),S(lR,{data:n,tooltip:({active:e,payload:t})=>S(ER,{active:e,payload:t}),children:S(Y,{name:"Revenue",dataKey:"income",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR}})})]})}function HR({columns:e,limit:t=100}){const n=UR(),{userRole:r}=l(Lc),{sortInstance:a,setSortInstance:o,apiSort:i}=Yy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ts({limit:t,sort:i,filter:{...n.apiFilters}}),g=d?.data,m=os();return KI("incomeDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),S(YI.Provider,{value:n,children:S(nl.Provider,{value:c,children:S(zs.Provider,{value:{sortInstance:a,setSortInstance:o},children:S(VN,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:WR,manualTransactionOptions:[rx.REVENUE,"TRANSFER_IN"],showTasks:!0})})})})}const zR=e=>S(nk,{children:S(HR,{...e})});function qR(){return S(Mh,{color:"weak",alignment:"horizontal"})}const jR=$n({base:{display:"flex",padding:"12px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...$i,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),_R=$n({base:{...Ga},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}}),KR=$n({base:{textWrap:"wrap",...Xa},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function YR({description:e,name:t,disabled:n,onClick:r}){const a=n?void 0:r,o=n?void 0:(i=r,e=>{"Enter"!==e.key&&"Space"!==e.code||(e.preventDefault(),i?.(e))});var i;return R("div",{className:jR({disabled:n}),role:"button",tabIndex:n?-1:0,onKeyDown:o,onClick:a,children:[R("div",{className:JS({alignItems:"flex-start",gap:"4px"}),children:[S("div",{className:_R({disabled:n??!1}),children:t}),S("div",{className:KR({disabled:n??!1}),children:e})]}),!n&&S(ud,{Component:Qi})]})}const ZR=Gn({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),GR=Gn({display:"flex",alignItems:"center",padding:"16px 12px",width:"100%"}),QR=Gn(Ga,{color:"typography.base.weak"});function XR({label:e,children:t}){return R("div",{className:ZR,children:[S("div",{className:GR,children:S("div",{className:QR,children:e})}),t]})}const JR={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}}};function $R(){const e=function(){const e=Re();return d(t=>{e(JR[t].route)},[e])}();return R(XR,{label:"Accounting",children:[S(qR,{}),S(YR,{name:"Profit & Loss",description:"How much money you made or lost over a period",onClick:()=>e("profit-and-loss")}),S(qR,{}),S(YR,{disabled:!0,name:"Balance Sheet",description:"What your business owns and owes at a point in time"}),S(qR,{}),S(YR,{disabled:!0,name:"Cash Flow Statement",description:"Where your cash came from and where it went"}),S(qR,{}),S(YR,{disabled:!0,name:"Trial Balance",description:"All account balances to verify your books are in order"})]})}function eD(){return R(XR,{label:"Taxes",children:[S(qR,{}),S(YR,{disabled:!0,name:"Schedule C",description:"Sole proprietor profit or loss for your U.S. tax return"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1065",description:"Income and deductions for partnership tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1120-S",description:"Income and deductions for S-Corp tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Form 1120",description:"Income and deductions for C-Corp tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"T2125",description:"Business income and expenses for Canadian tax filing"}),S(qR,{}),S(YR,{disabled:!0,name:"Tax Details for Filing",description:"Summary of income and deductions to share with your CPA"})]})}function tD(){return R(XR,{label:"Operations",children:[S(qR,{}),S(YR,{disabled:!0,name:"Accounts Receivable Aging",description:"Who owes you money and how long it's been outstanding"}),S(qR,{}),S(YR,{disabled:!0,name:"Accounts Payable Aging",description:"What you owe others and when payments are due"}),S(qR,{}),S(YR,{disabled:!0,name:"Expense Analysis",description:"Where you're spending money and how it's trending"}),S(qR,{}),S(YR,{disabled:!0,name:"Income Analysis",description:"Where your revenue comes from and how it's trending"}),S(qR,{}),S(YR,{disabled:!0,name:"Mileage Analysis",description:"Business miles driven for tax deduction tracking"}),S(qR,{}),S(YR,{disabled:!0,name:"Time & Task Analysis",description:"Hours worked and billable time by project or client"})]})}const nD=GS({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),rD=JS({gap:"16px",width:"100%"}),aD=tN({gap:"8px",alignItems:"center"}),oD=Gn(Ga,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),iD=Gn(Ga,{color:"typography.base"});function lD(){const e=De(),t=Re(),n=e.flatMap(e=>function(e){try{return IP.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:S("nav",{className:aD,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return R(b,{children:[r>0&&S(rl,{Component:Qi}),a?S("span",{className:iD,"aria-current":"page",children:e.label}):S("button",{type:"button",className:oD,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const sD=JS({gap:"16px",alignItems:"flex-start",width:"100%"}),cD=e=>["reports","profitAndLoss",e],dD=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result?r.data:void 0};function uD(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function hD(e){if(!nr(e))return co(Ku(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function pD(e){if(!nr(e))return co(e,{cents:"always",decorator:"%",signage:"parens"})}function gD(e){const t=e?.json;if(void 0===t)return[];const n=function(e){return(t,n)=>{const r=n((l=e,l[0]?.data?.[0]??{})),a=r?.name,o=uD(e,e=>{const t=n(e)?.total;return hD(t)}),i=[...(r?.children??[]).map((r,a)=>{const o=uD(e,e=>{const t=n(e)?.children?.[a].total;return function(e){if(void 0!==e)return co(Ku(e),{cents:"always",signage:"parens"})}(t)});return{key:`${t}.${a}`,label:r.name,level:1,values:o}}),{key:`${t}.total`,label:`Total ${a}`,level:0,type:"expandTotal",values:o}];var l;return{key:t,label:a,level:0,values:o,subrows:i}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,level:0,type:a,values:uD(e,r)})}(t);/* @__PURE__ */
2
- return function(){const e=[];return{caboose:()=>[...e],car(t){return e.push(t),this}}}().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>hD(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>pD(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>hD(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>pD(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>hD(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}const mD=ci(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 vD({expanded:e,canExpand:t=!0}){return S(hc,{Component:t?e?lp:Qi:mD})}const bD=$n({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:Ga,bold:Qa},clickable:{true:{cursor:"pointer"},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 fD({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return S("td",{rowSpan:e,onClick:n,className:bD({clickable:r??void 0!==n,...a}),children:t})}function yD({children:e,colspan:t,...n}){return S("th",{colSpan:t,className:bD({...n}),children:e})}const xD=X();function CD(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const TD=Gn({alignItems:"center",display:"flex",gap:8}),wD=xD.accessor("label",{id:"label",header:e=>{const t=e.table.getIsAllRowsExpanded();return S(fD,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:R("div",{className:TD,children:[S(vD,{expanded:t}),t?"Collapse All":"Expand All"]})})},cell:e=>S(fD,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:R("div",{className:TD,children:[S(vD,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})});const kD={[gt.LAST_6_MONTHS]:"Last 6 Months",[gt.LAST_12_MONTHS]:"Last 12 Months (TTM)",[gt.LAST_QUARTER]:"Last Quarter",[gt.LAST_YEAR]:"Last Year",[gt.THIS_QUARTER]:"This Quarter",[gt.THIS_YEAR]:"This Year"},ED=[gt.LAST_6_MONTHS,gt.LAST_12_MONTHS,gt.LAST_QUARTER,gt.LAST_YEAR,gt.THIS_QUARTER,gt.THIS_YEAR];const AD=Gn({width:"200px",minWidth:"200px"}),ID={width:"fit-content"};function SD({onPresetSelect:e,onCustomSelect:t}){const{close:n}=cc();return S(xc,{children:R(lg,{style:AD,children:[ED.map((t,r)=>R(b,{children:[S(gg,{onClick:()=>(e(t),void n()),children:S(vo,{children:kD[t]})}),(1===r||3===r)&&S(Mh,{alignment:"horizontal"})]},t)),S(Mh,{alignment:"horizontal"}),S(im,{triggerChildren:S(cm,{displayLabel:"Custom"}),popupChildren:S(xc,{style:ID,children:S(iS,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function ND({value:e,onChange:t}){const n=function(e){const t=Pt(e.endDate),n=Pt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:Nt(n)} - ${null===t?e.endDate:Nt(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${Nt(n)} - ${Nt(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?Ot(n,{abbreviateMonth:!0}):`${Ot(n,{abbreviateMonth:!0})} - ${Ot(t,{abbreviateMonth:!0})}`}(e);return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:gk}),S(Ys,{wrap:"nowrap",children:n})]})}),S(SD,{onPresetSelect:e=>{t(Tt(e))},onCustomSelect:e=>{t(e)}})]})}const RD={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},DD={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},PD=["NONE","MONTHLY","QUARTERLY","YEARLY"],MD=Gn({width:"200px",minWidth:"200px"});function LD({onSelect:e}){const{close:t}=cc();return S(xc,{children:S(lg,{style:MD,children:PD.map(n=>S(gg,{onClick:()=>(e(n),void t()),children:S(vo,{children:RD[n]})},n))})})}function FD({value:e,onChange:t}){const n=DD[e];return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:jd}),S(Ys,{wrap:"nowrap",children:n})]})}),S(LD,{onSelect:t})]})}const OD=[{label:"Accrual",value:"ACCRUAL"},{label:"Cash",value:"CASH"}],VD=Object.fromEntries(OD.map((e,t)=>[e.value,t])),BD=Gn({width:"200px"});function UD({accountingMethod:e,onChange:t}){const n=VD[e],r=d(e=>{t(OD[e].value)},[t]);return S("div",{className:BD,children:S(Eb,{options:OD,selectedIndex:n,handleClick:r})})}const WD=ci(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:"white"})))),"DimensionValue"),HD=Gn({width:"200px",minWidth:"200px"});function zD({labels:e,onSelect:t}){const{close:n}=cc(),r=e=>{t(e),n()};return S(xc,{children:R(lg,{style:HD,children:[S(gg,{onClick:()=>r(void 0),children:S(vo,{children:"None"})}),e.map(e=>S(gg,{onClick:()=>r(e.id),children:S(vo,{children:e.name})},e.id))]})})}function qD(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(nr(e)||n.has(e))continue;const i=r.children.find(e=>!nr(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 jD(){return cI({select:qD})}function _D({value:e,onChange:t}){const{query:{data:n=[]}}=jD();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:WD}),S(Ys,{wrap:"nowrap",children:a})]})}),S(zD,{labels:n,onSelect:t})]})}function KD({popupTriggerProps:e,text:t}){return R(lb,{popupTriggerChildrenProps:e,children:[S(mA,{children:S(Ys,{wrap:"wrap",children:t})}),S(ud,{Component:Qi})]})}function YD({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=cw(n,e.key),i=hw(e.name,o,1);return R(sc,{children:[S(dc,{children:e=>S(KD,{popupTriggerProps:e,text:i})}),e.ModalComponent&&S(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>dw(n,e.key,t))},filters:a})]})}const ZD=ci(Tm,"Bank");function GD({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?S(mI,{isSelected:n}):S(ob,{selected:n,showEmptyIndicator:!0});return R(lb,{handleClick:t,selected:n,children:[R(mA,{children:[o&&S(ld,{imageUrl:e.iconUrl,Component:ZD}),S(Ys,{wrap:"wrap",children:e.name})]}),i]})}function QD({values:e,model:t,pendingFilters:n,onClick:r}){return S(nb,{title:S(fo,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=cw(n,t.key),i=(l=e,o.some(e=>C(e.value,l.value)));var l;return S(GD,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):S(Jv,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function XD({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ee(e,Cg),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return S(QD,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function JD({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return S(Zv,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:XD,DefaultList:QD,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function $D({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=cc();return S(Hv,{title:"Back",Footer:S(FA,{onClearAll:()=>{a(e=>dw(e,t.key,[]))},onApply:()=>{const e=cw(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?S(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):S(JD,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function eP({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=cc();return S(FA,{onApply:()=>{n(uw(e)),a()},onClearAll:()=>{t(e=>dw(e,r,[]))}})}function tP({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=cw(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 dw(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=S(Hv,{title:"Back",Footer:S(eP,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:S(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(nr(l)||!tt(l))return null;if(s)return S(db,{});i=S($D,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=cw(n,e.key),s=hw(e.name,l);return R(sc,{children:[S(dc,{children:e=>S(KD,{popupTriggerProps:e,text:s})}),i]})}const nP=Gn({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function rP({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=PT();return S("div",{className:nP,children:S(nb,{title:S(fo,{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 nr(o)&&void 0===t.SimpleListComponent?S(YD,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):S(tP,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function aP(e){return!nr(e)&&e.startsWith("dimension_")}const oP=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:mi(t[1].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function iP(){return Rr({queryKey:["dimensions"],queryFn:oP})}function lP({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=iP(),{query:{data:i}}=cI(),l=aP(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||!Bb(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 S(Yb,{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=>dw(e,l,n))},allowMultiselect:!0})}function sP(e,t){return nt({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>S(lP,{...e,dimension:t})})}function cP({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=dI(),t=function(){const{query:{data:e}}=jD();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,sP(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:hA(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=cc(),[a,i]=c(()=>sw(e,n));return S(Wv,{title:"Filter By",padChildren:!1,Footer:S(FA,{onApply:()=>{t(uw(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:S(rP,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function dP({filters:e,setFilters:t}){const{open:n}=cc();return S(Dv,{overlay:!0,children:n&&S(cP,{filters:e,setFilters:t})})}function uP({filters:e,setFilters:t}){return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:QI}),S(Ys,{wrap:"nowrap",children:"Filters"})]})}),S(dP,{filters:e,setFilters:t})]})}function hP({filters:e,setFilters:t}){return e.map((n,r)=>S(of,{text:n.name,onClickRemove:()=>t(et(e,r)),additionalValidClassName:tr["filter-pill"]},n.id))}const pP=ci(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 gP(){return R(Fs,{disabled:!0,children:[S(rl,{Component:pP}),S(Ys,{children:"Export Report"})]})}function mP(){return R(Fs,{disabled:!0,children:[S(rl,{Component:gd}),S(Ys,{children:"Send Report"})]})}const vP=[],bP=$n({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:Ga,bold:Qa},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"}}),fP=Gn({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),yP=tN({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),xP=tN({gap:"8px",flexWrap:"wrap"}),CP=aN({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"}),TP=Gn({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),wP=Gn({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),kP=Gn({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function EP(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function AP(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!aP(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}))}const IP=I.object({label:I.string()}),SP=Me([{path:JR["/"].path,errorElement:S(N,{}),element:S(Pe,{}),handle:JR["/"].handle,children:[{index:!0,Component:function(){return R("div",{className:nD,children:[R("div",{className:rD,children:[S($R,{}),S(eD,{})]}),S("div",{className:rD,children:S(tD,{})})]})}},{Component:function(){return R("div",{className:sD,children:[S(lD,{}),S(Pe,{})]})},children:[{path:JR["profit-and-loss"].path,Component:function(){const[e,t]=c(()=>Tt(gt.LAST_6_MONTHS)),[n,r]=c("MONTHLY"),[i,l]=c("ACCRUAL"),[s,u]=c(void 0),h=a(null),[p,g]=c([]),m=ln(e=>e.FEATUREFLAG_REPORT_FILTERS),v=d(()=>{const e=f.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[f=h]);var f;const{query:{data:y},isFilling:x}=(C={filters:{...e,dimensionValues:AP(p),customerIds:EP(p)},grouping:{period:n,dimensionId:s},accountingMethod:i},T={placeholderData:L},Rr({queryKey:cD(C??{}),queryFn:dD,...T}));var C,T;const w=o(()=>gD(y),[y]),k=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)=>xD.accessor(`values.${c}[${t}]`,{header:t=>S(yD,{border:CD(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 S(fD,{border:CD(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?xD.group({id:`valueRecord.${a}`,header:t=>S(yD,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[wD,...a]}(y),[y]),E=J({data:w??vP,columns:k,getCoreRowModel:$(),getExpandedRowModel:ee(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:!0,columnPinning:{left:["label"]}}}),A=E.getExpandedRowModel().rows;return R("div",{className:fP,children:[R("div",{className:yP,children:[R("div",{className:xP,children:[S(ND,{value:e,onChange:t}),S(FD,{value:n,onChange:r}),m&&S(uP,{filters:p,setFilters:g}),S(_D,{value:s,onChange:u})]}),R("div",{className:xP,children:[S(UD,{accountingMethod:i,onChange:l}),S(gP,{}),S(mP,{})]})]}),S(kS,{children:S(hP,{filters:p,setFilters:g})}),!x&&S("div",{className:CP,ref:h,onScroll:v,children:R("table",{className:TP,children:[S("thead",{className:wP,children:E.getHeaderGroups().map(e=>S("tr",{className:kP,children:e.headers.map((e,t)=>e.isPlaceholder?S(yD,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):Q(e.column.columnDef.header,e.getContext()))},e.id))}),S("tbody",{children:A.map((e,t)=>{const n=e.getCanExpand(),r=n?()=>e.toggleExpanded():void 0,a=e.original.type,o=n||"expandTotal"===a?"bold":"regular",i=t<A.length-1;let l=e.original.type;if(i){const e=A[t+1];"sectionEnd"===a&&"reportTotal"===e.original.type&&(l=void 0)}return S("tr",{className:bP({rowType:l,expandable:n,weight:o}),onClick:r,children:e.getVisibleCells().map(e=>S(b,{children:Q(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})]})},handle:JR["profit-and-loss"].handle}]}]}]);function NP(){return u(()=>()=>{SP.navigate(JR["/"].route)},[]),S(Le,{router:SP})}function RP(){return S(nk,{children:S(NP,{})})}const DP=Ue("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),PP={queryClient:Ir,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await DP).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await DP).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await DP).delete("queryClient",e)}(e)}}}(),maxAge:Ar,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function MP({children:e}){return S(We,{client:Ir,persistOptions:PP,children:e})}const LP=Gn({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"}}),FP=Gn({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:{base:"transparent",xl:"overlay"},overscrollBehavior:{base:"contain",xl:"none"}}),OP=cr(null,tr.component,LP);function VP({children:e}){const t=a(null),n=a(null),r=PT();return g(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),S(ve,{children:S(be,{lockScroll:!0,className:FP,children:S("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,ln.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...OP,children:e})})})}const BP=i({closingQueue:[],drawerHistory:[]});function UP({children:e}){const t=ln(e=>e.drawerHistory),n=ln(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return S(BP.Provider,{value:r,children:a&&S(VP,{children:e})})}const WP=i({isActive:!0,isClosing:!1});function HP({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=l(BP),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),i=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==i,d=(o&&o[t])??(i&&i[t]);return S(WP.Provider,{value:{isActive:s,isClosing:c},children:d&&S(e,{...d.routeProps})})}const zP=cr(tr.drawer,Gn({position:"absolute",display:"flex",right:0,top:0,left:{base:0,sm:"auto"},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"}})),qP=Gn({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function jP({children:e}){const t=a(null),{isActive:n,isClosing:r}=l(WP),{onExitAnimationEnd:o,onInitialAnimationComplete:i}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=c(!0),o=d(()=>{ln.getState().confirmCloseDrawer()},[]),i=d(()=>{a(!1)},[a]);return u(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:n,isClosing:r,focusRef:t}),{context:s,refs:h}=ne({open:n&&!r}),p=me([t,h.setFloating]);return S(Ie,{onExitComplete:o,children:!r&&S(fe,{context:s,modal:!0,initialFocus:-1,children:R(Se.div,{tabIndex:-1,ref:p,onAnimationComplete:()=>i(),transition:Tv,initial:wv,animate:kv,exit:Ev,...zP,children:[e,!n&&S("div",{className:qP})]})})})}const _P=$n({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 KP({background:e,children:t}){return S("div",{className:_P({background:e}),children:t})}const YP=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function ZP(e){return void 0!==YP[e]}function GP(e){return YP[e]}const QP=ci(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"),XP=Gn({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function JP({cldrShortName:e}){return S("div",{className:XP,children:GP(e)})}const $P=$n({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),eM=Gn({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 tM({reactions:e,type:t,handleClick:n}){return S("div",{className:eM,children:e.map((e,r)=>S("button",{className:$P({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:S(JP,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const nM=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:mi(n)};return await wa(o)},rM=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:mi(n)};return await Xm(o)};function aM(e,t,n){return fr(ds({id:e}),t,n)}async function oM(e){const t=ds({id:e});return ha("mutation successful, invalidating messages queries"),Ir.invalidateQueries({queryKey:t}).catch(e=>pa({error:e,severity:"error"}))}function iM(e,t,n){const r=[...e];return r[n]=t,r}const lM=Gn({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),sM=Object.keys(YP).filter(ZP).map(e=>({emojiCode:e,authorInfo:[]}));function cM({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:i}=l(Lc),{mutate:s}=function(e){const{userId:t,userEmail:n}=l(Lc);return ch({mutationFn:nM,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=aM(n,t,r);await Ir.cancelQueries({queryKey:i});const l=Ir.getQueryData(i);return Ir.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:iM(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:()=>oM(e)})}(e);return R(sc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[S(dc,{children:e=>S("button",{className:lM,...e,children:S(ud,{Component:QP})})}),S(xc,{type:"reaction",children:S(tM,{reactions:sM,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===i);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const dM=$n({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function uM({reactions:e,type:t,handleClick:n}){const r=dM({type:t});return S("div",{className:r,children:S(tM,{reactions:e,handleClick:n,type:t})})}const hM=$n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),pM=$n({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"}}}}),gM=Gn({position:"relative",display:"flex",flexDirection:"column"});function mM({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const i=a(null),{isHover:s,setIsHover:d,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=c(!1),[r,a]=c(!1);return u(()=>{if(null===o.current||!i||s)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,s=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,s}(i),{mutate:g}=function(e){const{userId:t}=l(Lc);return ch({mutationFn:rM,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=aM(n,t,r);await Ir.cancelQueries({queryKey:o});const i=Ir.getQueryData(o);return Ir.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return nr(r)||0===r.reactions.length?t:iM(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:()=>oM(e)})}(e),m=n?"sent":"received",v=o.filter(e=>ZP(e.emojiCode)),b=v.length>0,f="sent"===m?tr["message-sent"]:tr["message-received"],y=cr(tr[f],pM({type:m}));return R("div",{className:hM({type:m,hasReactionsOnMessage:b}),ref:i,onMouseEnter:()=>"received"===m&&d(!0),children:[R("div",{className:gM,children:[S("div",{...y,children:r}),b&&S(uM,{reactions:v,type:m,handleClick:e=>g({id:t,emojiCode:e})})]}),s&&S(cM,{conversationId:e,messageId:t,type:m,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const vM=$n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),bM=Gn({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}),fM=Gn({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),yM=Gn({textDecoration:"none",color:"inherit",cursor:"pointer"});function xM({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=PT();return S("div",{className:vM({type:e?"sent":"received"}),children:S("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 pa({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:yM,children:R("div",{className:bM,children:[R("div",{className:fM,children:[S(Ys,{children:n}),S(fo,{children:`${r}`})]}),S(ud,{Component:pP})]})})})}const CM=cr(null,Gn({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function TM({children:e}){return S("div",{...CM,children:e})}const wM=cr(null,Gn({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"})),kM=Gn({minHeight:1,width:"100%"}),EM=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=d(()=>{t&&rr(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){u(()=>{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,...wM,ref:i,children:[S("div",{className:kM,ref:o}),e]})}),AM=Object.freeze({message:{text:"",attachments:[]}}),IM=Gn({width:"24px",height:"24px",objectFit:"contain"});function SM({iconUrl:e,fileName:t}){return S("img",{src:e,alt:`${t} icon`,className:IM})}const NM=Gn({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"}),RM=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),DM=Gn({display:"grid",flexDirection:"column",minWidth:0}),PM="LOADING",MM="LOADED",LM="ERROR";function FM({attachment:e,onRemove:t}){const n=e.hasError?LM:e.isPending?PM:MM;return R("div",{className:NM,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:RM,children:[e.iconUrl&&S(SM,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:DM,children:[S(Ys,{children:e.displayFileName}),n===PM&&e.displayText&&S(fo,{accent:"strongest",children:e.displayText}),n===MM&&e.fileSize&&S(fo,{children:e.fileSize}),n===LM&&S(fo,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&S(Ic,{onClick:async n=>{n.stopPropagation(),await ju({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Remove",type:qu.DANGER}]})===Su&&t(e)},children:S(rl,{Component:uc})})]})}const OM=Gn({width:"100%"});function VM({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:df({defaultValues:t??AM,onSubmit:t=>{zp.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),u=a(null),h=d(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=d(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:g}=ch({mutationFn:Vp,onSuccess:async()=>{await Ir.invalidateQueries({queryKey:["files/attachments"]}),await Ir.invalidateQueries({queryKey:["conversations"]})}}),m=d(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 S("form",{className:OM,ref:u,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,u.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:S(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>S(FM,{attachment:e,onRemove:m},e.localId)),S(c.AppField,{name:"message",children:t=>S(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function BM(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 UM(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return ha("mutation successful, invalidating messages queries"),Promise.all([Ir.invalidateQueries({queryKey:e}),Ir.invalidateQueries({queryKey:t}),Ir.invalidateQueries({queryKey:n})]).catch(e=>pa({error:e,severity:"error"}))}const WM=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Nl({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),HM=async({data:e,accessToken:t,environment:n})=>Nl({data:{data:[e]},accessToken:t,environment:n}),zM=Gn({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),qM=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),jM=Gn({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),_M="Marked As Resolved";function KM({resolver:e}){const t=e?`${e} ${_M}`:_M;return R("div",{className:qM,children:[S("div",{className:zM}),S("div",{className:jM,children:t}),S("div",{className:zM})]})}const YM=$n({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 ZM({width:e="md",height:t="md"}){return S(jo,{styles:YM({width:e,height:t})})}const GM=Gn({display:"flex",flexDirection:"row-reverse"});function QM(){return R(N,{children:[S(ZM,{width:"lg",height:"lg"}),S("div",{className:GM,children:S(ZM,{width:"md",height:"lg"})}),S("div",{className:GM,children:S(ZM,{width:"lg",height:"xl"})}),S(ZM,{width:"md",height:"lg"})]})}const XM=Gn({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function JM({isConversationLoading:e,isFilling:t,message:n}){return e?n?S(TM,{children:S(mM,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?S(TM,{children:S(QM,{})}):R("div",{className:XM,children:[S(vo,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),S(Ys,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const $M=cr(null,Gn({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 eL({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:i,defaultValues:s,defaultSubject:d}){const{userId:h}=l(Lc),{mutate:p}=function(){const{userId:e}=l(Lc);return ch({mutationFn:ps,onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=fr(ds({id:e.conversationId}),t,n);await Ir.cancelQueries({queryKey:a});const o=Ir.getQueryData(a);return Ir.setQueryData(a,t=>[BM(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:UM})}(),{query:{data:g},isFilling:m}=function(e){const t=rr(e);return Rr({queryKey:ds({id:e??""}),queryFn:hs,select:us,enabled:t})}(e),{mutate:v,isPending:b,variables:f}=(k=t,E=i,ch({mutationFn:HM,onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(nr(e)||nr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(rr(E)){const e={id:E};ls(E,is.BANK_TRANSACTION)?o=async()=>{const t=$l(e);return await Ir.invalidateQueries({queryKey:t})}:ls(E,is.FINANCIAL_SUMMARY)&&(i=async()=>await Ir.invalidateQueries({queryKey:a}))}return ha("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Ir.invalidateQueries({queryKey:n}),Ir.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>pa({error:e,severity:"error"}))}})),{mutate:y}=ch({mutationFn:WM,onSuccess:async()=>{const e=["conversations"],t=["tasks"];return ha("mutation successful, invalidating conversations queries"),Promise.all([Ir.invalidateQueries({queryKey:e}),Ir.invalidateQueries({queryKey:t})]).catch(e=>pa({error:e,severity:"error"}))}}),[x,C]=c(!1),T=a(null),w=a(null);var k,E;u(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),u(()=>{Ep(w)},[g,w]);const A=nr(e)||nr(g)||m;return R(N,{children:[A?S(EM,{ref:w,inputRef:T,activeKeyboard:x,setActiveKeyboard:C,children:S(JM,{isConversationLoading:b,isFilling:m,message:f?.message?.text})}):R(EM,{ref:w,activeKeyboard:x,setActiveKeyboard:C,inputRef:T,children:[n&&S(KM,{resolver:"Conversation"}),g.map((t,n)=>{const r=t[0].author.userId===h;return S(TM,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!nr(e)).map(e=>S(xM,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&S(mM,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),S("div",{...$M,children:S(VM,{scrollRef:w,inputRef:T,conversationId:e,blockSubmit:b,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),l=o.map(e=>`att_${e.id}`),s=a.length>0,c=l.length>0;if(s||c)if(nr(e)){const e=function(e,t,n){let r="";return rr(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(d,a,o[0]?.displayFileName),t=(u=a,h=l,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...rr(g=i)&&{attachedEntityId:g},message:{text:u,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:l}});var u,h,g},setActiveKeyboard:C,defaultValues:s})})]})}function tL({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=c(e),{query:{data:o}}=Sl(r),i="CLOSED"===o?.resolutionStatus;return R(KP,{children:[S(Fv,{}),S(eL,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const nL=cr(tr["form-body"],Gn({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 rL({children:e}){return S("div",{...nL,children:e})}const aL=cr(null,Gn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),oL=cr(null,Gn({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),iL=Gn({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),lL=e=>{Qh(e),Xh(e)},sL=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:a,conversationId:o,transactionId:i,transaction:l})=>S(jP,{children:R("div",{...aL,children:[S(KP,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:lL,...oL,children:[n,S(rL,{children:e}),r]})}),null!==a&&S("div",{className:iL}),"conversation"===a&&i&&S(tL,{conversationId:o,attachedEntityId:i,defaultSubject:l?.description})]})}),cL=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],dL=["FEDERAL","STATE","SALES"],uL=["Q1","Q2","Q3","Q4"],hL=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function pL(e){if(!nr(e))return hL.find(t=>t.value===e)?.name}const gL=I.object({id:I.string(),type:I.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:I.enum(Object.values(Ei)),amount:I.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:I.string("Required").refine(e=>(function(e,t){const n=it(e.getFullYear(),e.getMonth(),e.getDate()),r=it(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||At(new Date(e),/* @__PURE__ */new Date))&&St(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),customer:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),frequency:I.union([I.object({name:I.string(),value:I.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),I.undefined()]),category:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).nullable(),dimensionValues:I.array(I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).optional()),bankAccount:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:I.string().nullable(),itemizedByOptions:I.object({category:I.boolean(),customer:I.boolean()}).optional(),attachments:I.array(Hp)}),mL=I.object({id:I.string(),name:I.string().optional(),requiredness:I.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),vL=I.object({id:I.string(),name:I.string().optional(),dimension:mL.optional()}),bL=vL.extend({child:vL.optional()}),fL=I.object({id:I.string().optional(),lineItemType:I.literal("itemized"),category:I.object({id:I.string(),name:I.string().optional()}).nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}).optional(),dimensionValues:I.array(bL),customer:I.object({id:I.string(),name:I.string().optional()}).nullable(),amount:I.number()}),yL=I.object({lineItemType:I.literal("invoice"),amount:I.number().nullable(),invoice:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string()})}),xL=I.object({lineItemType:I.literal("bill"),amount:I.number().nullable(),bill:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string()})}),CL=I.object({lineItemType:I.literal("fee"),amount:I.number()}),TL=I.object({lineItemType:I.literal("payment"),amount:I.number(),payment:I.object({id:I.string(),amount:I.number(),date:I.string(),name:I.string(),bankAccount:I.object({id:I.string(),displayName:I.string()})})}),wL=I.discriminatedUnion("lineItemType",[fL,yL,CL,xL,TL]),kL=gL.extend({children:I.array(wL),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}).nullable()});kL.extend({tax:I.object({paymentInfo:I.object({region:I.enum(dL).optional(),year:I.number().optional(),quarter:I.enum(uL).optional()}).nullable().optional()}).optional()});const EL=gL.extend({id:I.string(),type:I.literal(Object.values(rx)),description:I.string(),displayName:I.string(),iconUrl:I.string(),status:I.literal(Object.values(BS)),reviewStatus:I.literal(Object.values(Ei)),apiName:I.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:I.string().nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()},{message:"Required"}),customer:I.object({id:I.string(),name:I.string().optional(),email:I.string().optional()}).nullable(),vendor:I.object({id:I.string(),name:I.string().optional()}).nullable(),invoice:I.object({id:I.string(),name:I.string(),date:I.string(),lineItems:I.array(I.object({id:I.string(),amount:I.number()}))}).nullable(),bill:I.object({id:I.string(),name:I.string().optional()}).nullable(),payroll:I.object({id:I.string(),date:I.string().optional(),checkDate:I.string().optional(),description:I.string().optional()}).nullable(),apiItemId:I.string().nullable()}),AL=I.looseObject({amount:I.number().nullable(),category:I.object({id:I.string(),name:I.string().optional()}).nullable(),customer:I.object({id:I.string(),name:I.string().optional()}).nullable()}),IL=I.object({children:I.array(AL),itemizeByOptions:I.record(I.string(),I.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"]})})}),SL=kL.extend({type:I.literal("EXPENSE"),vendor:I.object({id:I.string(),name:I.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:I.object({id:I.string(),name:I.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&&Cr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),NL=kL.extend({type:I.literal("BANK_TRANSFER"),reconciliationMatch:I.object({id:I.string(),description:I.string().optional(),amount:I.number().optional(),date:I.string().optional(),apiInstitutionId:I.string().nullable().optional(),apiName:I.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!!nr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>NL.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),RL=EL.extend({}),DL=I.looseObject({amount:I.number().nullable(),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.string().optional()}),customer:I.object({id:I.string(),name:I.string().optional()}).nullable()}),PL=I.object({children:I.array(DL),itemizeByOptions:I.record(I.string(),I.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"]})})}),ML=kL.extend({type:I.literal("REVENUE"),glAccount:I.object({id:I.string(),name:I.string().optional(),accountNo:I.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 LL(e){return e.reduce((e,t)=>new U(e).plus(t??0).toNumber(),0)}function FL(e,t){const n=new U(e).times(100).round(0),r=new U(t).times(100).round(0);return!n.eq(r)}function OL(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(Cr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function VL(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function BL(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function UL(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function WL(e){return"EXPENSE"!==e.type||nr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function HL(e,t,n){if(e(t))return n}const zL={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function qL(e){return Cr(e)?void 0:e}function jL(e,t,n){const r=(e,t)=>HL(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:qL((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:qL(e.id),amount:e.amount?Yu(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:qL(e.id),amount:Yu(e.amount)}}(e);case"bill":return function(e){return{id:qL(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:qL(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?Yu(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=>!nr(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 nr(t)?e:{...e,glAccountId:ss({id:t,prefix:"GL_ACCOUNT"})}});return nr(r)?nr(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 _L(e=null){const{mutate:t}=BC(),{mutate:n}=UC({mutationFn:PC}),{query:{data:r}}=Vg();return(a,o,i)=>{const l=r?.data??[];var s;e?(t(function(e,t,n,r){return{...jL(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()):(n({...jL(s=a,l,()=>!0),amount:s.amount?Yu(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||zL[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}),_l())}}const KL=kL.extend({type:I.literal("TAX_PAYMENT"),tax:I.object({paymentInfo:I.object({region:I.enum(dL,{message:`Tax region must be one of: ${dL.join(", ")}`}),quarter:I.enum(uL,{message:"Required"}),year:I.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: ${dL.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))}),YL={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Mt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:Gl[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function ZL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.bill)||!nr(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 GL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(n.invoice)||!nr(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 QL(e){const t=/* @__PURE__ */new Map;for(const n of e){if(nr(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 XL(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function JL(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(nr(e.paymentId)&&nr(e.bill)&&nr(e.invoice)||XL(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...ZL(r),...GL(r),...QL(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=>!(nr(e.invoice)&&nr(e.payroll)&&nr(e.bill)&&nr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return nr(e.paymentId)||XL(e,n)?t&&XL(e,n)?(r=e,{...r,lineItemType:"fee",amount:Ku(r.amount)}):nr(e.invoice)?nr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:Ku(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return nr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:Ku(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:Ku(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:Ku(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:Ku(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=Ku(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 $L({value:e}){return{fields:eF(function(e){switch(e){case"EXPENSE":return SL;case"TAX_PAYMENT":return KL;case"BANK_TRANSFER":return NL;case"REVENUE":return ML}}(e.type).safeParse(e))}}function eF(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 tF(e,t,n){const r=_L(e),{query:{data:a}}=Xx({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=e?(l=t,s=a,{id:(i=e).id,type:WL(i),reviewStatus:i.reviewStatus,amount:Ku(i.amount),category:i.category,date:i.date,vendor:i.vendor,customer:i.customer,frequency:i.frequency,bankAccount:i.bankAccount,glAccount:i.glAccount,notes:i.notes,dimensionValues:OL(i.dimensionValues,l),children:JL(i,s),reconciliationMatch:i.reconciliationMatch?{...i.reconciliationMatch,amount:Ku(i.reconciliationMatch.amount??0)}:void 0,tax:i.tax,attachments:i.attachments?i.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{...YL,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var i,l,s;return df({defaultValues:o,canSubmitWhenInvalid:!0,validators:{onBlur:$L,onSubmit:$L},onSubmit:e=>r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),onSubmitInvalid:()=>{}})}function nF({transaction:e}){const{mutate:t}=VC(),n=()=>t(US([e]));return S(vS,{onClick:()=>{return e=n,void ju({title:"Delete transaction",body:"Are you sure you want to delete this transaction?",buttons:[{key:Iu,label:"Cancel"},{key:Su,label:"Delete",type:qu.DANGER}]}).then(t=>{t===Su&&e()});var e},Icon:FS,children:"Delete"})}function rF({transaction:e}){const{mutate:t}=VC();return S(vS,{onClick:()=>{t([e].map(e=>({id:e.id,status:BS.ACTIVE})))},children:"Restore"})}const aF=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"})),oF=ci(aF,"Bill");function iF({onClick:e,error:t,validate:n}){return S(Uh,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const lF=Gn({display:"flex",flexDirection:"column",width:"100%"}),sF=cr(tr["value-comparison-summary"],Gn({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),cF=Gn({display:"flex",flexDirection:"column",gap:"8px"});function dF({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return S("div",{className:lF,children:R("div",{...sF,children:[R("div",{className:cF,children:[S(Ys,{intent:"weak",children:"Selected Total"}),S(vo,{children:go(Ku(e),r)})]}),R("div",{className:cF,children:[S(Ys,{intent:"weak",children:`${n} Total`}),S(vo,{children:po(t)})]})]})})}const uF=Gn.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),hF=cr(null,Gn({color:"icon.base"}));function pF({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=YT({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return S("div",{className:qv,children:R("div",{...jv,children:[l?S(_T,{}):S(ud,{stylists:[hF],Component:zv}),S("input",{className:_v,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Xh}),Tr(e)&&S(Fs,{styles:uF,onClick:()=>o(""),children:S(ud,{Component:uc})})]})})}const gF=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function mF({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return R("div",{className:gF,children:[S(Ys,{intent:"weak",children:"Search"}),S(pF,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function vF(e,t,n){return`${e} | ${Nt(Pt(t))} | ${po(Ku(n))}`}const bF=cr(tr["linked-entity-row"],Gn({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"}})),fF=Gn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),yF=cr(null,Gn({color:"icon.base"}));function xF({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return R("button",{type:"button",...bF,onClick:o,children:[R("div",{className:fF,children:[S(ud,{stylists:[yF],Component:r}),S(Ys,{wrap:"wrap",children:vF(t,n,e)})]}),S(ob,{selected:a,showEmptyIndicator:!0})]})}const CF={root:null,threshold:1};function TF({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=d(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return u(()=>{const e=new IntersectionObserver(o,CF);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return S("div",{ref:n})}function wF({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return S(N,{children:t.groups.map(t=>R(CA,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>S(xF,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),S(TF,{onIntersect:a,enable:!r&&o})]},t.key))})}function kF(e){return co(e,{cents:"always",dollarSign:!0})}function EF(e){return kF(Math.abs(e))}function AF({title:e,body:t}){return ju({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 IF(e,t,n){const r=EF(e);return`The selected bills total of ${EF(t)} is less than the expense total of ${r}. Was there a fee of ${EF(n)}?`}const SF=Gn(Mv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function NF({children:e}){return S("div",{className:SF,children:e})}function RF({transactionTotal:e,bills:t,onSubmit:n,fetchNextPage:r,hasNextPage:a,isFetching:o,isFetchingNextPage:i,searchTerm:l,onSearchChange:s}){const[d,u]=c({}),h=Gv({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:u,hasMultiSelect:!0,state:{selected:d}}),p=t.filter(e=>d[e.id]).reduce((e,t)=>e+t.amount,0),g=o&&!i;return S(Wv,{title:"Link Bill",Footer:S(iF,{onClick:()=>{const r=new U(p).div(100).times(-1).toNumber(),a=new U(e).sub(r).toNumber(),o=t.filter(e=>d[e.id]);r>e&&o.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AF({title:"Bill Payment",body:IF(n,e,t)})}({selectedTotal:r,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=a),n(o,t)}).catch(()=>{}):n(o,0)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:p,transactionTotal:e,transactionTypeLabel:"Expense"}),S(mF,{searchTerm:l,onChange:s,isFetching:g,searchPlaceholder:"Search bills..."}),S(wF,{listLabel:"Bills",glSourceList:h,icon:oF,fetchNextPage:r,hasNextPage:a,isFetching:o,pluralNoun:"bills",singularNoun:"bill"})]})})}const DF=e=>["bills/bills","infinite",e??{}],PF=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:mi(n)},o=await wa(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})},MF=[];function LF(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 FF(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return nr(e)||(t.search=e),t}function OF(e){const[t,n]=c(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(d=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:d}),limit:10,filter:FF(t)},qm({queryFn:PF,queryKey:DF(s)}));var s,d;const u=(r?.pages??MF).flatMap(e=>(e.data??[]).map(LF));return S(RF,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function VF(e){const t=cc();return S(Dv,{children:t.open&&S(OF,{...e})})}function BF(e){return{lineItemType:"fee",amount:e}}function UF(e){return{lineItemType:"bill",amount:Ku(-e.amount),bill:{id:e.id,amount:Ku(e.amount),date:e.date,name:e.name}}}function WF(e){return e.map(UF)}function HF(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function zF(e){return`Remove ${e}?`}function qF(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function jF({action:e,titleName:t,entityName:n}){return ju({title:zF(t),body:qF(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 _F={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},KF={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function YF(e,t){const n=KF[t];return jF({titleName:n,entityName:n.toLowerCase(),action:_F[e]})}const ZF="bill",GF=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType);return R(sc,{open:t,onOpenChange:n,children:[S(vS,{onClick:async()=>{const t=HF(ZF,e.state.values.children);ZF!==t?"YES"===await YF(ZF,t)&&n(!0):n(!0)},Icon:oF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),S(VF,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=WF(t);0!==r&&a.push(BF(r)),e.setFieldValue("children",a),n(!1)}})]})}}),QF=ci(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})),"Payroll");function XF(e,t,n){const r=EF(e);return`The selected invoice total of ${EF(t)} is greater than the transaction total of ${r}. Was there a fee of ${EF(n)}?`}const JF=e=>["payments/payments","infinite",e??{}],$F=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:mi(n)},o=await wa(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})},eO=Gn({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),tO=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),nO=Gn({marginLeft:"auto"});function rO({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:eO,children:[R("div",{className:tO,children:[S(Ys,{children:e}),t&&S(Ys,{wrap:"nowrap",children:ho(t)})]}),R("div",{className:tO,children:[n&&S(fo,{children:n}),S("span",{className:nO,children:r&&S(fo,{wrap:"nowrap",children:Nt(Pt(r))})})]})]})}function aO({payment:e,selected:t,onClick:n}){return S(sb,{handleClick:n,selected:t,isMultiSelect:!0,children:S(rO,{description:e.description,amount:Ku(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}const oO=[];function iO(e){return e}function lO(e){return e.pages.flatMap(e=>(e.data??[]).map(iO))}function sO(e){return Object.values(e).some(e=>e)}function cO(e,t){return e===Yu(t)}function dO(e,t){return(t??[]).filter(t=>e[t.id]).reduce((e,t)=>e+t.amount,0)}function uO(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:xr(t)?void 0:t}}function hO({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const[r,a]=c(""),{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:u}}=(h={filter:uO(n,r)},p={select:lO},qm({queryFn:$F,queryKey:JF(h),...p}));var h,p;const[g,m]=c({}),v=dO(g,o),[b,f]=c(void 0),y=d(e=>{const n=dO(e,o),r=sO(e);void 0===b||!cO(n,t)&&r||f(void 0),m(e)},[o,t,b]),x=Gv({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:g},onSelectedChange:y}),C=l&&!u;return S(Wv,{title:"Link Transactions",Footer:S(iF,{validate:()=>{const e=cO(v,t),n=sO(g),r=e||!n;return r||f("The selected total must equal the income amount."),r},error:b,onClick:()=>{e(o?.filter(e=>g[e.id])??oO)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:v,transactionTotal:t,transactionTypeLabel:nx,selectedAmountSignage:"default"}),S(mF,{searchTerm:r,onChange:a,isFetching:C,searchPlaceholder:"Search transactions..."}),x.groups.map(e=>{const t=e.getRows();return S(CA,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return S(aO,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),S(TF,{onIntersect:i,enable:!l&&s})]})})}function pO({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const r=cc();return S(Dv,{children:r.open&&S(hO,{transactionTotalDollars:t,parentBankAccountId:n,onSubmit:e})})}function gO({transactionTotal:e,invoices:t,onInvoiceSubmit:n,onPaymentSubmit:r,hasExistingInvoices:a,parentBankAccountId:o,fetchNextPage:i,hasNextPage:l,isFetching:s,isFetchingNextPage:d,searchTerm:u,onSearchChange:h}){const[p,g]=c({}),[m,v]=c(!1),b=Gv({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:g,hasMultiSelect:!0,state:{selected:p}}),f=t.filter(e=>p[e.id]).reduce((e,t)=>e+t.amount,0),y=s&&!d;return S(Wv,{title:"Link Invoice",HeaderRightAction:S(pk,{shouldUseButtonDiscreteStyles:!0,children:S(lg,{forceNewCascade:!0,children:R(sc,{open:m,onOpenChange:v,children:[S(vS,{onClick:async()=>{const e=t.some(e=>p[e.id]);if(a){if("YES"!==await YF("payment","invoice"))return}else if(e&&"YES"!==await async function(){return jF({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;v(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),S(pO,{transactionTotalDollars:e,parentBankAccountId:o,onSubmit:r})]})})}),Footer:S(iF,{onClick:async()=>{const r=Ku(f),a=t.filter(e=>p[e.id]);if(r>e&&a.length>0){const t=new U(r).sub(e),o=t.toNumber(),i=t.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AF({title:"Invoice Payment",body:XF(n,e,t)})})({selectedTotal:r,transactionTotal:e,suggestedFee:o}).then(e=>{let t=0;"FEE"===e&&(t=i),n(a,t)}).catch(()=>{})}else n(a,0)}}),padChildren:!1,children:R(NF,{children:[S(dF,{selectedAmount:f,transactionTotal:e,transactionTypeLabel:nx}),S(mF,{searchTerm:u,onChange:h,isFetching:y,searchPlaceholder:"Search invoices..."}),S(wF,{listLabel:"Invoices",glSourceList:b,icon:QF,fetchNextPage:i,hasNextPage:l,isFetching:s,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const mO=e=>["invoicing/invoices","infinite",e??{}],vO=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:mi(r)},o=await wa(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})},bO=[];function fO(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return xr(e)||(t.search=e),t}function yO(e){const[t,n]=c(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return qm({queryFn:vO,queryKey:mO(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:fO(t)}});var s;const d=(r?.pages??bO).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return S(gO,{...e,invoices:d,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function xO(e){const t=cc();return S(Dv,{children:t.open&&S(yO,{...e})})}function CO(e){const t=Ku(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const TO=(e,t)=>{const n=e.map(CO);return 0!==t&&n.push(BF(t)),n};function wO(e){const t=Ku(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 kO(e){return e.map(wO)}const EO="invoice",AO=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType);return R(sc,{open:t,onOpenChange:n,children:[S(vS,{onClick:async()=>{const t=HF(EO,e.state.values.children);EO!==t?"YES"===await YF(EO,t)&&n(!0):n(!0)},Icon:QF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),S(xO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=TO(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:t=>{const r=kO(t);e.setFieldValue("children",r),n(!1)},hasExistingInvoices:r,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),IO=Gl.filter(e=>"ONE_TIME"!=e.value);function SO({onClick:e}){const t=cc();return S(im,{triggerChildren:S(cm,{displayLabel:"Make recurring"}),popupChildren:S(xb,{frequencies:IO,onClick:n=>{e(n),t.close()}})})}function NO({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return S(Ic,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:S(ld,{Component:t})})}function RO({activeTab:e,onClick:t,popupTriggerProps:n}){return S(NO,{active:"conversation"===e,onClick:()=>t("conversation"),icon:cd,ariaLabel:"conversation-tab",popupTriggerProps:n})}const DO=Gn({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function PO({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=cc(),[a,o]=c(e),{query:{data:i}}=Sl(a),l="CLOSED"===i?.resolutionStatus;return S(Av,{children:R("div",{className:DO,children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi,handleClose:()=>r.setOpen(!1)}),S(vo,{children:"Back"})]})}),S(eL,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const MO={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:nx},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},LO=Object.values(MO);function FO({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=_e();return a?S(pb,{}):S(nb,{title:R(N,{children:[s&&t&&S(vo,{children:"Suggested"}),S(vo,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?S(vA,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:S(BO,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):S(sb,{handleClick:()=>e(t),selected:n,children:R(mA,{children:[t.iconUrl&&S(ud,{Component:tm(t.iconUrl,t.name??"")}),S(Ys,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const OO="Search expense categories...",VO=[];function BO({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=Hg(),s=r??i?.data??VO,c=cc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return S(Zv,{placeholder:OO,onClick:d,SearchList:EA,DefaultList:FO,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function UO({onClick:e,showSuggestedCategories:t,glAccounts:n,listLabel:r,isFilling:a,glAccount:o,handleConversion:i,parentOnClick:l,selectedIds:s}){const c=_e();return a?S(pb,{}):R(N,{children:[c&&t&&S(nb,{title:S(vo,{children:"Suggested"})}),S(nb,{title:S(vo,{children:r}),children:n?.map(t=>{const n=s.has(t.id);return t.hasChilds?S(vA,{text:t.name,iconUrl:t.iconUrl,title:"All Categories",children:S(zO,{headerLabel:"All Categories",listLabel:t.name,nestedGlAccounts:t.children,handleConversion:i,glAccount:o,parentOnClick:l})},t.id):S(sb,{handleClick:()=>e(t),selected:n,children:S(mA,{children:S(Ys,{wrap:"wrap",children:t.name})})},t.id)})})]})}const WO="Search income categories...",HO=[];function zO({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,nestedGlAccounts:r,parentAccount:a,glAccount:o,parentOnClick:i}){const{query:{data:l,isFetched:s},isFilling:c}=iC(),d=r??l??HO,u=cC([...d],sC),h=cc(),p=o?.id?/* @__PURE__ */new Set([o.id]):/* @__PURE__ */new Set,g=e=>{i?i(e):t({type:"REVENUE",value:e}),h.close()};return S(Zv,{placeholder:WO,onClick:g,SearchList:IA,DefaultList:UO,listLength:d.length,extraProps:{glAccounts:u,listLabel:e,isFetched:s,isFilling:c,showSuggestedCategories:n,parentAccount:a,glAccount:o,handleConversion:t,parentOnClick:g,selectedIds:p},forceSearchVisible:!0})}function qO({list:e,onClick:t,NestedChildList:n}){return S(eb,{children:e.groups.map(e=>S(CA,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return S(vA,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:S(n,{row:e})},e.key);const r=e.getIsSelected();return S(sb,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(mA,{children:[e.value.iconUrl&&S(ud,{Component:tm(e.value.iconUrl,e.value.name)}),S(Ys,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const jO="All Tax Categories";function _O({handleConversion:e,region:t}){const n=cc(),r=Gv({data:[hL],groups:[{label:jO,key:jO}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return S(qO,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function KO({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?S(pb,{}):R(eb,{children:[a&&S("div",{children:S(lb,{handleClick:t,children:S(Ys,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&S(vo,{children:"Suggested"}),!d&&R(N,{children:[S(vo,{children:o}),S("div",{children:r?.map(t=>{const n=s?.id===t.id;return S(sb,{handleClick:()=>e(t),selected:n,children:S(rO,{description:t.description,amount:Ku(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const YO={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function ZO({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ee(n??[],YO),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?S(pb,{}):0===l.length?S(Jv,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):S(eb,{children:S("div",{children:l.map(e=>{const n=a?.id===e.id;return S(sb,{handleClick:()=>t(e),selected:n,children:S(rO,{description:e.description,amount:Ku(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const GO=[];function QO({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Pt(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:Mt(Ut(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Mt(Ut(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??GO,{query:{data:v}}=Xx({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),b=cc();return S(Zv,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),b.close()},SearchList:ZO,DefaultList:KO,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}}),b.close()},reconciliationMatch:i}})}function XO({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=c(function(e){switch(e){case"EXPENSE":return LO.indexOf(MO.EXPENSE);case"REVENUE":return LO.indexOf(MO.REVENUE);case"TAX_PAYMENT":return LO.indexOf(MO.TAX_EXPENSE);default:return LO.indexOf(MO.TRANSFER)}}(e)),{category:d,glAccount:u,tax:h,date:p,bankAccount:g,reconciliationMatch:m,amount:v}=o,b=h?.paymentInfo?.region,f=g?.id;return R(Hv,{title:t,children:[!i&&S(Eb,{options:LO,handleClick:e=>s(e),selectedIndex:l}),S(()=>{switch(LO[l].value){case"EXPENSE":return S(BO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:d});case"REVENUE":return S(zO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return S(_O,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:b});case"BANK_TRANSFER":return S(QO,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:f,transactionAmount:v??0,transactionDate:p,reconciliationMatch:m})}},{})]})}const JO=Gn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function $O({children:e}){const{startPrefetch:t,cancelPrefetch:n}=_g();return S("button",{className:JO,type:"button",onMouseEnter:t,onMouseLeave:n,children:e})}const eV=Gn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function tV({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!nr(o)&&""!==o.id,l=nr(o?.iconUrl)?void 0:tm(o.iconUrl,"Expense Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[i?R("div",{className:eV,children:[l&&S(ud,{Component:l}),S(Ys,{wrap:"wrap",children:o.name})]}):S(Ys,{intent:"weak",children:"Select category"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function nV(){const{query:{data:e}}=cI(),{query:{data:t=[]}}=jD(),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 rV=Gn({display:"flex",gap:"8px",alignItems:"center"});function aV({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!nr(o)&&""!==o.id,l=nr(o?.iconUrl)?void 0:tm(o.iconUrl,"Revenue Icon");return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[i?R("div",{className:rV,children:[l&&S(ud,{Component:l}),S(Ys,{children:o.name})]}):S(Ys,{intent:"weak",children:"Select category"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function oV(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 iV=(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=>!nr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},lV={id:"customer",name:"Customer"};function sV(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function cV(e){return oV({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function dV(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 uV=cr(tr["line-item-card"],Gn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),hV=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),pV=Gn({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),gV=uf({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}=nV(),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",{...uV,children:[R("div",{className:hV,children:[S(Ys,{children:`Line Item #${t+1}`}),R(Ic,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[S(Ys,{children:"Remove"}),S(ud,{Component:FS})]})]}),R("div",{className:pV,children:[S(e.AppField,{name:`children[${t}].amount`,children:e=>S(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&S(tV,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&S(aV,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),S(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=>!nr(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:VL(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,lV.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>S(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>S(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(BL(t))})},r[0][0].id))}),S(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&S(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),mV=Gn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function vV({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=cc();return S(xc,{children:R(lg,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return S(gg,{onClick:()=>{n(e.id,!r)},children:R("div",{className:mV,children:[S(Ys,{children:a(e)}),S(ud,{Component:r?pi:rb})]})},e.id)}),!nr(r)&&S(gg,{onClick:()=>{r?.(),o.setOpen(!1)},children:S(Ys,{children:"Confirm Selection"})})]})})}const bV=e=>Object.keys(e).filter(t=>e[t]);function fV({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return R(sc,{placement:"bottom-end",children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Itemize By"}),S(ud,{Component:lp})]})}),S(vV,{items:[...e,lV],selectedIds:bV(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const yV=Gn({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),xV=Gn({display:"flex",justifyContent:"space-between",alignItems:"center"}),CV=Gn.raw({color:"surface.intent.danger.active"}),TV=Gn({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function wV({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=LL(n),i=FL(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:yV,children:[R("div",{className:xV,children:[S(Ys,{children:`${ox[e]} amount`}),S(Ys,{children:kF(t)})]}),R("div",{className:xV,children:[S(Ys,{children:"Line items total"}),S(Ys,{children:kF(o)})]}),R("div",{className:xV,children:[S(Ys,{extraClassNames:l?[CV]:void 0,children:"Difference"}),S(Ys,{extraClassNames:l?[CV]:void 0,children:(d=t,u=o,go(new U(d).minus(u).toNumber(),"default"))})]}),l&&R("div",{className:TV,children:[S(rl,{Component:ui}),S(Ys,{extraClassNames:[CV],children:c})]}),s&&R("div",{className:TV,children:[S(rl,{Component:ui}),S(Ys,{extraClassNames:[CV],children:"At least 2 line items are required"})]})]});var d,u}function kV({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return S(Uh,{onSave:e,children:S(wV,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const EV=Gn({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function AV(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}=nV(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new U(r).div(2).round(2,U.roundDown),n=new U(r).sub(t);return[oV({amount:t.toNumber(),...structuredClone(c)}),oV({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=cc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return IL;case"BANK_TRANSFER":return RL;case"REVENUE":return PL}}(r);return df({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=eF(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=LL(e.children.map(e=>e.amount));return FL(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:iV(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,oV({...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===lV.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(nr(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=S(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>S(fV,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=S(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>S(kV,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(Wv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[S(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>S(gV,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),S(t.Subscribe,{selector:e=>e.values.children,children:e=>S("div",{className:EV,children:e.length<10&&R(Ic,{onClick:r,active:!1,children:[S(Ys,{children:"Add Line Item"}),S(rl,{Component:xs})]})})})]})}function IV(e){const t=cc();return S(Dv,{children:t.open&&S(AV,{...e})})}function SV({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=cc();return R(sc,{children:[S(dc,{children:e=>S(vS,{Icon:qC,popupTriggerProps:e,children:"Itemize"})}),S(IV,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(sV)),r.close()}})]})}const NV=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(sc,{children:[S(dc,{children:e=>S(RO,{onClick:n,activeTab:t,popupTriggerProps:e})}),S(PO,{conversationId:r,attachedEntityId:a})]}):S(RO,{onClick:n,activeTab:t}),RV=uf({defaultValues:YL,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=je(),s=PT(),c=!nr(n)&&$p(n)&&"EXPENSE"===n.type,u=d(t=>{dV(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return S(Fv,{children:R(Vv,{children:[S(Vu,{}),S(vo,{children:t}),i&&S(NV,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[S(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)&&S(GF,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&S(AO,{form:e}),0===t.length&&S(SV,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:u}),UL(t)&&S(vS,{Icon:qC,onClick:()=>u([t[0]]),children:"Unitemize"})]})}),c&&S(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&S(SO,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===BS.ACTIVE&&S(nF,{transaction:n}),n?.status===BS.INACTIVE&&S(rF,{transaction:n})]})})]})})}});function DV(e){return 0===e.length||UL(e)&&e.every(e=>null===e.customer)}const PV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=je();return R(N,{children:[S(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&&S(e.AppField,{name:"vendor",children:e=>S(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),S(e.Subscribe,{selector:e=>DV(e.values.children),children:t=>t&&S(e.AppField,{name:"customer",children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),S(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)&&S(e.AppField,{name:"frequency",children:e=>S(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"category",children:t=>S(tV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}}),MV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[S(e.Subscribe,{selector:e=>DV(e.values.children),children:t=>t&&S(e.AppField,{name:"customer",children:e=>S(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"glAccount",children:t=>S(aV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}});function LV({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===zC(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:a,popupTriggerProps:e,children:R($O,{children:[r?S(rO,{description:r.description||"",amount:r.amount||0,date:r.date||Nt(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):S(Ys,{intent:"weak",children:"Needs Match"}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const FV=uf({defaultValues:YL,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})}),S(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&S(e.AppField,{name:"reconciliationMatch",children:()=>S(LV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function OV({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(sc,{placement:"bottom-start",children:[S(dc,{children:e=>S(ap,{label:"Category",popupTriggerProps:e,children:R($O,{children:[S(Ys,{children:pL(r?.paymentInfo?.region)??"Select region..."}),S(ud,{Component:Qi})]})})}),S(XO,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const VV=uf({defaultValues:YL,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[S(e.AppField,{name:"tax.paymentInfo.region",children:()=>S(OV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),S(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>S(e.ButtonGroupField,{label:"Quarter",options:cL})}),S(e.AppField,{name:"tax.paymentInfo.year",children:e=>S(e.GenericSelectorField,{label:"Year",options:Et({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&S(e.AppField,{name:"bankAccount",children:e=>S(e.ManualBankAccountField,{transaction:t})})]})}}),BV=uf({defaultValues:YL,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 rr(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:Ku(t.value.transfer.amount)}),rr(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 S(N,{children:S(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return S(PV,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return S(MV,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return S(FV,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return S(VV,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),UV=cr(null,Gn({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function WV({transaction:e,bankAccount:t}){const n=e?e.description:"",r=nr(t)||nr(e)?"":((e,t)=>{const n=cx(t.type),r=zC(t.amount);return`${n?`${r} `:""}${Gu(e.name,e.mask)}`})(t,e);return R("div",{...UV,children:[S(vo,{wrap:"wrap",children:n}),t&&S(fo,{children:r})]})}const HV=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),zV=Gn({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function qV({attachments:e,onRemove:t}){return S("div",{className:HV,children:S("div",{className:zV,children:e.map(e=>S(FM,{attachment:e,onRemove:t},e.localId))})})}const jV=uf({defaultValues:YL,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=ch({mutationFn:Vp,onSuccess:async()=>{await Ir.invalidateQueries({queryKey:["files/attachments"]}),await Ir.invalidateQueries({queryKey:["banks/transactions"]})}});return S(e.AppField,{name:"attachments",children:e=>R(N,{children:[S(e.AttachmentDropzoneField,{entityId:cs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&S(qV,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),_V=Gn({display:"flex",flexDirection:"column",gap:"8px"});function KV({children:e}){return S("div",{className:_V,children:e})}const YV=$n({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 ZV({children:e,surface:t,style:n}){const r=Gn(YV.raw({surface:t}),n);return S("div",{className:r,children:e})}function GV(){return S(Mh,{alignment:"horizontal"})}const QV=Gn({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function XV(e){return S("div",{className:QV,children:e.children})}function JV({property:e}){return"string"==typeof e?S(Ys,{children:e}):e}function $V({label:e,value:t}){return R(XV,{children:[S(JV,{property:e}),S(JV,{property:t})]})}function eB(e){return Nt(Pt(e))}function tB({amount:e,date:t,description:n}){return R(ZV,{surface:"foreground",children:[S($V,{label:"Description",value:n}),S(GV,{}),S($V,{label:"Date",value:eB(t)}),S(GV,{}),S($V,{label:"Amount",value:kF(e)})]})}const nB=Gn.raw({padding:12});function rB({amount:e}){return S(ZV,{surface:"background",style:nB,children:S($V,{label:"Fee",value:kF(e)})})}const aB=Gn({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),oB=Gn({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function iB({label:e,warning:t}){return R("div",{className:aB,children:[S(Ys,{children:e}),t&&R("div",{className:oB,children:[S(ud,{Component:ui}),t]})]})}function lB(e){return kF(Math.abs(e))}function sB(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new U(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?`${lB(c)} Overpaid`:"underpaid"===o?function(e){return`${lB(e)} Underpaid`}(c):null}const cB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=c(!1);return R(KV,{children:[S(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=sB(t,e.amount,e.type);return S(iB,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?S(tB,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?S(rB,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(sc,{open:n,onOpenChange:r,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Invoices"}),S(rl,{Component:Qi})]})}),S(xO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=TO(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:t=>{const n=kO(t);e.setFieldValue("children",n),r(!1)},hasExistingInvoices:!0,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function dB({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:kF(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 S(ZV,{children:l.map((e,t)=>R(b,{children:[t>0&&S(GV,{}),S($V,{label:e.label,value:e.value.toString()})]},e.label))})}const uB=uf({defaultValues:YL,render:function({form:e}){const{query:{data:t}}=iP(),n=e.state.values.children;if(UL(n))return R(KV,{children:[S(Ys,{children:`Line Items (${n.length})`}),n.map((n,r)=>S(dB,{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(sc,{children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Line Items"}),S(rl,{Component:Qi})]})}),S(IV,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(cV),onSubmit:t=>{dV(t.map(sV),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),hB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=c(!1);return R(KV,{children:[S(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=sB(t,e.amount,e.type);return S(iB,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?S(tB,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?S(rB,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(sc,{open:n,onOpenChange:r,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Bills"}),S(rl,{Component:Qi})]})}),S(VF,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=WF(t);0!==n&&a.push(BF(n)),e.setFieldValue("children",a),r(!1)}})]})]})}});function pB({amount:e,bankAccountName:t,date:n,description:r}){return R(ZV,{surface:"foreground",children:[S($V,{label:"Description",value:r}),S(GV,{}),t&&R(N,{children:[S($V,{label:"Account",value:t}),S(GV,{})]}),S($V,{label:"Date",value:eB(n)}),S(GV,{}),S($V,{label:"Amount",value:kF(e)})]})}const gB=uf({defaultValues:YL,render:function({form:e}){const[t,n]=c(!1);return R(KV,{children:[S(iB,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?S(pB,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),R(sc,{open:t,onOpenChange:n,children:[S(dc,{children:e=>R(Ic,{popupTriggerProps:e,children:[S(Ys,{children:"Edit Linked Transactions"}),S(rl,{Component:Qi})]})}),S(pO,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,onSubmit:t=>{const r=kO(t);e.setFieldValue("children",r),n(!1)}})]})]})}}),mB=uf({defaultValues:YL,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?S(cB,{form:e}):t.some(e=>"bill"===e.lineItemType)?S(hB,{form:e}):t.some(e=>"payment"===e.lineItemType)?S(gB,{form:e}):UL(t)?S(uB,{form:e}):null}});function vB({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:d}=nV(),u=void 0===i?ix[s]:lx[s],[h,p]=c(l??null),g=S(RV,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),m=S(n.Subscribe,{selector:e=>e.isDefaultValue,children:e=>S(Uh,{disabled:e})});return R(sL,{onSubmit:n.handleSubmit,Header:g,Footer:m,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&S(WV,{transaction:e,bankAccount:r}),S(n.AppField,{name:"amount",children:e=>S(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),S(n.AppField,{name:"date",children:e=>S(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),S(BV,{form:n,transaction:e,isManual:a}),S(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=VL(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,d).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>S(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>S(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(BL(e))})},r[0][0].id))}),S(n.Subscribe,{selector:e=>e.values.children,children:e=>tt(e)&&S(mB,{form:n})}),S(n.AppField,{name:"notes",children:e=>S(e.TextAreaInput,{label:"Note"})}),S(n.AppField,{name:"type",children:()=>null}),i&&S(jV,{form:n,transactionId:i})]})}function bB({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}=nV(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=rs({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:tF(a,r,t),bankAccount:Lg(a?.bankAccount?.id??""),isManual:nr(a)||$p(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return S(o.Subscribe,{selector:e=>e.values.type,children:n=>S(vB,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function fB({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=rs({id:e});return u(()=>{!r&&nr(n)&&_l()},[n,r]),nr(n)?null:S(bB,{transactionId:e,initialTab:t})}function yB({transactionId:e,initialTab:t,initialType:n}){return e?S(fB,{transactionId:e,initialTab:t}):!e&&n?S(bB,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function xB({subject:e,children:t}){return R(Fv,{children:[R(Vv,{children:[S(Vu,{}),S(vo,{children:e})]}),S("div",{className:tN({alignItems:"center",gap:15}),children:t})]})}function CB({conversationId:e,defaultValues:t}){const[n,r]=c(e),{query:{data:a}}=Sl(n),o="CLOSED"===a?.resolutionStatus;return S(jP,{children:R(KP,{children:[S(xB,{subject:a?.subject??"Conversation"}),S(eL,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const TB=ci(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 wB({onClick:e,active:t}){return S(Fs,{type:"button",onClick:e,active:t,children:S(ud,{Component:TB})})}const kB=Gn({display:"flex",flexDirection:"column"});function EB({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:kB,children:[S(fo,{children:e}),n?S(ZM,{width:r}):S(vo,{wrap:"wrap",children:t??""})]})}function AB({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=rs({id:e}),a=Lg(n?.bankAccount.id??"");if(nr(n))return null;const o=JS({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:tN({justifyContent:"space-between"}),children:[S(EB,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),S(EB,{label:"Amount",data:ho(Ku(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),S(EB,{label:"Bank Account",data:Gu(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),S(EB,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function IB({conversationId:e,transactionId:t}){const[n,r]=c(e),[a,o]=c(!0),{query:{data:i}}=Sl(n),l="CLOSED"===i?.resolutionStatus;return S(jP,{children:R(KP,{children:[S(xB,{subject:i?.subject??"Conversation",children:rr(t)&&S(wB,{onClick:()=>o(!a),active:a},"infoButton")}),rr(t)&&S(AB,{transactionId:t,isOpen:a}),S(eL,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function SB(){const e=Kl().length>1;return S(jP,{children:R(KP,{background:"foreground",children:[S(Fv,{children:R(Vv,{children:[S(Vu,e?{Icon:Gi}:{}),S(vo,{children:"Add New Connection"})]})}),S(ZE,{})]})})}function NB(){return S(Fv,{children:R(Vv,{children:[S(Vu,{}),S(vo,{children:"Financial Summary"})]})})}const RB=Gn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),DB=mr.raw({body:"default"}),PB=Gn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},DB);function MB({summaryText:e}){return S("div",{className:RB,children:S("div",{className:PB,children:e})})}const LB=Gn({display:"flex",flexDirection:"column",overflow:"auto"});function FB({summary:e}){return R("div",{className:LB,children:[S(NB,{}),S(MB,{summaryText:e})]})}const OB=Gn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function VB({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Rr({queryKey:vs({id:e}),queryFn:fs})}({id:e});return S(jP,{children:R("div",{className:OB,children:[S(KP,{children:S(FB,{summary:n?.summary})}),S(Mh,{}),S(tL,{conversationId:t??null,attachedEntityId:e})]})})}function BB(){return S(jP,{children:S(KP,{children:S(sA,{showCloseButton:!0,inOverlay:!0})})})}const UB=I.object({id:I.string(),name:I.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:I.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:I.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Cr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),WB={mergeDestination:Pm,selectedAccount:null};const HB=Gn({display:"flex",flexDirection:"column",gap:"20px"}),zB=Gn({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),qB=Gn.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),jB=Gn(qB,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),_B=Gn(qB,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),KB=Gn(qB,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),YB=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),ZB=Gn({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),GB=Gn({width:"100%",display:"flex",justifyContent:"flex-start"}),QB=Gn({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),XB=Gn({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),JB=e=>{Qh(e),Xh(e)};function $B({account:e}){const t=cc(),n=function(e,t){const{mutateAsync:n}=mh();return df({defaultValues:WB,onSubmit:async r=>{if(await Ch()===Su&&rr(e)&&rr(r.value.selectedAccount)){const l=(a=e,o=r.value.mergeDestination,i=r.value.selectedAccount,o===Pm?{...yh(i),duplicateBankAccountIds:[cs(a.id)]}:{...yh(a),duplicateBankAccountIds:[cs(i.id)]});try{await n(l),t.close(),r.value.mergeDestination===Pm&&_l()}catch{await Th()}}var a,o,i},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=nh();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:HB,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:JB,children:[S(vo,{children:"Merge Accounts"}),S("div",{className:zB,children:S(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:jB,children:[S("div",{className:GB,children:S(vo,{children:"Duplicate Account"})}),t===Pm?S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):S(n.AppField,{name:"selectedAccount",children:n=>S(Lm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Fm(t,e,n.state.value)})})]}),R("div",{className:_B,children:[S("div",{className:QB,children:S(vo,{children:"Into"})}),S(n.AppField,{name:"mergeDestination",children:e=>S("div",{className:ZB,children:S(Fs,{onClick:()=>e.handleChange(e.state.value===Pm?Dm:Pm),children:S(ud,{Component:Qi})})})})]}),R("div",{className:KB,children:[S("div",{className:XB,children:S(vo,{children:"Destination Account"})}),t===Pm?S(n.AppField,{name:"selectedAccount",children:n=>S(Lm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Fm(t,e,n.state.value)})}):S(Sm,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:YB,children:[S(gf,{showIcon:!1,onClick:()=>{t.close()}}),S(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>S(Nh,{disabled:nr(e),showIcon:!1,textContent:"Merge"})})]})]})}function eU({bankAccount:e}){return S(lg,{children:R(sc,{placement:"right-start",children:[S(dc,{children:e=>R(gg,{...e,children:[S(ud,{Component:Ak}),S(vo,{children:"Merge Account"})]})}),S(Av,{children:S(Nv,{children:S(vk,{children:S($B,{account:e})})})})]})})}const tU=Gn({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"}}}),nU=({tranStartDate:e})=>R(N,{children:[S(fo,{children:"Start Date"}),Tr(e)?S(vo,{children:`${Bt(Pt(e))}`}):S(vo,{children:"Set Start Date"})]});function rU({bankAccount:e}){return R(sc,{placement:"right-start",children:[S(dc,{children:t=>S("button",{className:Xn(or(tr["start-date-form-section"]),tU,el),...t,type:"button",children:S(nU,{tranStartDate:e.tranStartDate})})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(wk,{bankAccounts:[e]})})})})]})}const aU=e=>["accounting/manualJournalEntry",e.id],oU=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 yi(a)};function iU({id:e}){return Rr({queryKey:aU({id:String(cs(e))}),queryFn:oU,enabled:rr(e)})}const lU=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:Na(n)};return await ka(r)})({data:e,accessToken:t,environment:n});const sU=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Na(n)};return await ka(r)},cU=I.object({amount:I.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:I.string("Required")}),dU=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===cs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},uU=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=iU({id:t??null}),r=function(){const{query:{data:e}}=Jx();return cC(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutate:a}=ch({mutationFn:sU,onSuccess:async()=>{ha("beginning balance mutation successful, invalidating bank account queries");try{return Ir.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}}});const{mutate:o}=ch({onSuccess:async()=>{ha("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Ir.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Ir.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&pa({error:e,severity:"error"})}},mutationFn:lU}),i=cc(),l=((e,t)=>{const n=dU(e,t);return{amount:rr(e.beginningBalanceData.journalEntry?.id)?n:"",date:rr(t?.date)?t.date:""}})(e,n);return df({defaultValues:l,validators:{onBlur:cU},onSubmit:l=>{if(i.close(),nr(t)||nr(n))a({bankAccountId:cs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(nr(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))}),nr(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=Mt(t)??o.date,o)})(n,Pt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);rr(t)&&o(t)}}})},hU=Gn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),pU=Gn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function gU({bankAccount:e}){const t=uU(e),n=cc(),r=()=>{n.close()};return R("form",{className:hU,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[S(vo,{children:"Set Beginning Balance"}),S(t.AppField,{name:"date",children:e=>S(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),S(t.AppField,{name:"amount",children:e=>S(e.EditableAmountField,{label:"Beginning Balance Amount"})}),S(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:pU,children:[S(gf,{showIcon:!1,onClick:r}),S(Nh,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const mU=$n({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"}}}}),vU=Gn({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function bU({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=cr(tr["beginning-balance-form-section"],mU({layout:a}),el),i=cr(tr["beginning-balance-form-section"],mU({layout:"right"}),el),l=r&&Bt(r);return R(sc,{placement:"right-start",children:[S(dc,{children:e=>R("div",{className:vU,children:[R("button",{...o,...e,type:"button",children:[S(fo,{children:"Beginning Balance"}),S(vo,{children:rr(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{...i,...e,type:"button",children:[S(fo,{children:"Migration Date"}),S(vo,{children:l})]})]})}),S(Av,{children:S(Nv,{children:S(vk,{width:"sm",children:S(gU,{bankAccount:e})})})})]})}const fU=$n({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function yU({bankAccount:e,showStartDate:t}){const{query:{data:n}}=iU({id:e?.beginningBalanceData.journalEntry?.id??null}),r=dU(e,n),a=rr(n?.date)?Pt(n?.date):null,o=rr(e.tranStartDate)?Pt(e.tranStartDate):null,i=rr(a)&&rr(o)&&!At(a,o),l=i?"left":t?"right":"left";return R("div",{className:fU({layout:i?"stacked":"inline"}),children:[t&&S(rU,{bankAccount:e}),S(bU,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const xU=Gn({marginTop:"15px",marginBottom:"15px"}),CU={id:"",name:"",mask:"",type:void 0};const TU=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],wU=e=>{Qh(e),Xh(e)};function kU({bankAccountId:e}){const t=Lg(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:CU,[r,a]=c(n),o=function(e,t){const{mutate:n}=mh(),{mutateAsync:r}=gh({mutationFn:uh}),a=Tr(String(e.id));return df({defaultValues:e,validators:{onBlur:UB},onSubmit:async e=>{if(a)n(yh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((o=e.value,{apiAccountName:o.name,apiAccountNo:o.mask??void 0,apiAccountType:o.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 o},onSubmitInvalid:()=>{}})}(r,a),i=!t||bh(t.apiName),l=!!t&&fh(t.apiName),s=Gu(r?.name??"",r?.mask??""),d=Tr(s)?s:"New Bank Account",u=l&&rr(t?.tranStartDate);return S(jP,{children:S(KP,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:wU,children:[R(Fv,{children:[R(Vv,{children:[S(Vu,{Icon:Gi}),S(vo,{children:d}),rr(t)&&S(pk,{shouldUseButtonDiscreteStyles:!0,children:S(eU,{bankAccount:t})})]}),S(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:S(o.SaveButton,{})})]}),R(rL,{children:[S(o.AppField,{name:"name",children:e=>S(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),S(o.AppField,{name:"mask",children:e=>S(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),S(o.AppField,{name:"type",children:e=>S(e.GenericSelectorField,{label:"Account Type",options:TU,disabled:!i})}),rr(t)&&R(N,{children:[S("div",{className:xU,children:S(Mh,{alignment:"horizontal"})}),S(yU,{bankAccount:t,showStartDate:u})]})]})]})})})}function EU({filters:e,filterModels:t,setFilters:n}){const r=Kl().length>1,[a,o]=c(()=>sw(e,t));return S(jP,{children:R(KP,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,r?{Icon:Gi}:{}),S(Ys,{children:"Back"})]})}),S(rP,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),S(FA,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=uw(a);n(e),_l()}})]})})}function AU({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=LI(e);return S(EU,{filters:n,filterModels:t,setFilters:r})}function IU(){const e=CR();return S(AU,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function SU(){const e=UR();return S(AU,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function NU(){const e=_I();return S(AU,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function RU({Icon:e,label:t,popupTriggerChildrenProps:n}){return R(lb,{popupTriggerChildrenProps:n,children:[R(mA,{children:[S(ud,{Component:e}),S(Ys,{children:t})]}),S(ud,{Component:Qi})]})}const DU=ci(aF,"Expenses");function PU(){return S(RU,{Icon:DU,label:"Categories"})}const MU=ci(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"),LU=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function FU(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 OU(e,t){return{search:Tr(e)?e:void 0,status:{in:t}}}function VU(e){return e.pages.flatMap(e=>(e.data??[]).map(FU))}const BU=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function UU(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function WU(e,t){const n=(e,n)=>HL(e=>!t(e),e,n);return{state:n("state",Cr(e.state)?void 0:e.state),city:n("city",Cr(e.city)?void 0:e.city),zip:n("zip",Cr(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Cr(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Cr(e.address1)?void 0:e.address1),address2:n("address2",Cr(e.address2)?void 0:e.address2)}}const HU=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:BU});function zU(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:UU(e.address)}}const qU=I.object({state:I.string(),city:I.string(),zip:I.string(),phoneWork:I.string(),address1:I.string(),address2:I.string()}),jU=I.object({id:I.string().optional(),name:I.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:I.string().optional(),status:I.enum(["ACTIVE","INACTIVE","REMOVED"]),email:I.email().or(I.literal("")),ccEmails:I.array(I.email()),bccEmails:I.array(I.email()),invoicePrefix:I.string().optional(),address:qU.optional()});function _U({customer:e}){const{mutateAsync:t}=Cv(),n=cc();return df({defaultValues:e??HU,validators:{onSubmit:jU},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>HL(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(BU).filter(e=>e in BU).some(e=>!n(e))?WU(e.address??BU,n):void 0,i=a("invoicePrefix",Tr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Tr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Tr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:nr(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 KU=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})),YU=Gn({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),ZU=Gn({width:"100%"}),GU=hf({defaultValues:BU,props:{disabled:!1},render:function({group:e,disabled:t}){return R(N,{children:[S(e.AppField,{name:"address1",children:e=>S(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),S(e.AppField,{name:"address2",children:e=>S(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),S(e.AppField,{name:"city",children:e=>S(e.TextField,{label:"City",placeholder:"City",disabled:t})}),R("div",{className:YU,children:[S("div",{className:ZU,children:S(e.AppField,{name:"state",children:()=>S(xm,{label:"State",options:[{label:"Select State",value:""},...KU],isEmpty:Cr,disabled:t})})}),S("div",{className:ZU,children:S(e.AppField,{name:"zip",children:e=>S(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),S(e.AppField,{name:"phoneWork",children:e=>S(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),QU=Gn.raw({width:"100%"});function XU({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o}){const i=PT();return R(N,{children:[S(Mh,{alignment:"horizontal",color:"normal"}),R("div",{className:Lh,children:[!o&&S(Dh,{disabled:a,onClick:t}),o&&i&&S(Fs,{onClick:n,styles:QU,children:S(Ys,{children:r})}),e]})]})}const JU=Gn({display:"flex",gap:"8px"});function $U({title:e,customer:t}){const n=_U({customer:t}),[r,a]=c(n.state.values.ccEmails.length>0),[o,i]=c(n.state.values.bccEmails.length>0),{mutate:l}=Cv(),{mutate:s}=ch({mutationFn:yv,onSuccess:xv}),d=cc(),u=PT(),h="ACTIVE"===t?.status,p="INACTIVE"===t?.status,g=p&&!u,m=async()=>{if(nr(t))return;"RESTORE"===await async function(e){return ju({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)&&(l({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),d.close())},v=h||g?S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[h&&S(vS,{onClick:async()=>{if(nr(t))return;"ARCHIVE"===await async function(e){return ju({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)&&(s({id:t?.id??""}),d.close())},closeOnClick:!0,children:"Archive"}),p&&S(vS,{onClick:m,closeOnClick:!0,children:"Restore"})]})}):null,b=g?null:S(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>S(XU,{onSave:n.handleSubmit,disabled:e||t,restoreLabel:"Restore Customer",onRestore:m,isArchived:p})});return S(Wv,{title:e,HeaderRightAction:v,Footer:b,padChildren:!1,children:R(rL,{children:[S(n.AppField,{name:"name",children:e=>S(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:p})}),S(n.AppField,{name:"billingContactName",children:e=>S(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:p})}),S(n.AppField,{name:"email",children:e=>S(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:p})}),S(n.AppField,{name:"ccEmails",children:e=>r&&S(e.MultiEmailField,{label:"CC Billing Emails",disabled:p})}),S(n.AppField,{name:"bccEmails",children:e=>o&&S(e.MultiEmailField,{label:"BCC Billing Emails",disabled:p})}),(!r||!o)&&R("div",{className:JU,children:[!r&&S(Ic,{onClick:()=>a(!0),children:"CC"}),!o&&S(Ic,{onClick:()=>i(!0),children:"BCC"})]}),S(n.AppField,{name:"invoicePrefix",children:e=>S(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:p})}),S(GU,{form:n,fields:"address",disabled:p})]})})}function eW({title:e,customer:t}){const n=cc();return S(Dv,{children:n.open&&S($U,{title:e,customer:t})})}const tW=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function nW({customer:e}){return R(sc,{children:[S(dc,{children:t=>R(lb,{popupTriggerChildrenProps:t,children:[R(mA,{children:[S(ld,{Component:MU}),R("div",{className:tW,children:[S(Ys,{children:e.name}),e.email&&S(fo,{children:e.email})]})]}),S(ud,{Component:Qi})]})}),S(eW,{title:"Edit Customer",customer:zU(e)})]})}const rW=Gn.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function aW({selectedValue:e,Icon:t=lp,options:n,onClick:r,additionalStyles:a=[]}){return R(sc,{children:[S(dc,{children:n=>R(Fs,{popupTriggerProps:n,styles:[rW,...a],children:[S(Ys,{children:e.label}),S(ud,{Component:t})]})}),S(vm,{options:n,onClick:r})]})}const oW=Gn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),iW=Gn({display:"flex",gap:"8px"}),lW=Gn.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function sW({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return R("div",{className:oW,children:[S(Ys,{intent:"weak",children:"Search"}),R("div",{className:iW,children:[S(pF,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),S(aW,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[lW]})]})]})}const cW=R(sc,{children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:xs}),S(Ys,{children:"Add Customer"})]})}),S(eW,{title:"Add Customer",customer:void 0})]});function dW(){const[e,t]=c(""),[n,r]=c(LU[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 qm({queryFn:bv,queryKey:pv(e),...t})}({filter:OU(e,t)},{select:VU});return{list:Gv({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(Wv,{title:"Back",HeaderRightAction:cW,padChildren:!0,children:[S(sW,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:LU,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>S(CA,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>S(nW,{customer:e.value},e.value.id))},e.key)),S(TF,{onIntersect:o,enable:i})]})}function uW(){const e=cc();return S(Dv,{children:e.open&&S(dW,{})})}function hW(){return R(sc,{children:[S(dc,{children:e=>S(RU,{Icon:MU,label:"Customers",popupTriggerChildrenProps:e})}),S(uW,{})]})}const pW=ci(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"),gW=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:BU,transactionCount:0,iconUrl:void 0});function mW(e){return{id:e.id,name:e.name,status:e.status,address:UU(e.address),transactionCount:e.transactionCount,iconUrl:e.iconUrl||void 0}}const vW=I.object({id:I.string().optional(),name:I.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:I.enum(["ACTIVE","INACTIVE","REMOVED"]),address:qU.optional(),transactionCount:I.number(),iconUrl:I.string().optional()});const bW=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function fW(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address,transactionCount:e.transactionCount}}function yW(e,t,n){return{search:Tr(e)?e:void 0,name:nr(n)?void 0:{notEqual:n},status:{in:t}}}function xW(e){return e.pages.flatMap(e=>(e.data??[]).map(fW))}function CW({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:yW(e,t,n)},u={select:xW},qm({queryFn:Gm,queryKey:_m(d),...u}));var d,u;return{list:Gv({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 TW=ci(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"),wW=Gn({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),kW=Gn({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),EW=$n({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"}}}}),AW=Gn({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),IW=Gn({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function SW({targetVendor:e,duplicateVendor:t}){return R("div",{className:wW,children:[S(Ys,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),R("div",{className:kW,children:[R("div",{className:EW({archivedVendor:!0}),children:[S(ud,{imageUrl:t.iconUrl,Component:pW}),S(Ys,{intent:"weak",children:t.name})]}),R("div",{className:AW,children:[S(ud,{Component:TW,stylists:[cr(null,IW)]}),S(fo,{intent:"weak",children:"Merging Into"})]}),R("div",{className:EW({archivedVendor:!1}),children:[S(ud,{imageUrl:e.iconUrl,Component:pW}),S(Ys,{children:e.name})]})]}),S(Ys,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function NW({vendor:e,onClose:t}){const{mutate:n}=ch({mutationFn:ev,onSuccess:tv}),[r,a]=c({}),[o,i]=c(""),{list:l,data:s,fetchNextPage:d,isFetching:u,hasNextPage:h,isLoading:p}=CW({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),g=cc(),m=S(Uh,{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 ju({title:"Confirm Merge",body:S(SW,{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(Wv,{title:"Back",Footer:m,padChildren:!0,children:[S(pF,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>S(CA,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>S(sb,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:R(mA,{children:[S(ld,{imageUrl:e.value.iconUrl??void 0,Component:pW}),S(Ys,{children:e.value.name})]})},e.value.id))},e.key)),S(TF,{onIntersect:d,enable:!u&&h})]})}function RW({vendor:e,onClose:t}){const n=cc();return S(Dv,{children:n.open&&S(NW,{vendor:e,onClose:()=>{t(),n.close()}})})}function DW({vendor:e,onClose:t}){return R(sc,{children:[S(dc,{children:e=>S(vS,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),S(RW,{vendor:e,onClose:t})]})}const PW=Gn.raw({width:"100%"});function MW({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o}){const i=PT();return S(XU,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,children:i&&!nr(e)&&R(sc,{children:[S(dc,{children:e=>S(Fs,{popupTriggerProps:e,styles:PW,children:S(Ys,{children:"Merge"})})}),S(RW,{vendor:e,onClose:r})]})})}function LW({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=nv(),n=cc();return df({defaultValues:e??gW,validators:{onSubmit:vW},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(BU).filter(e=>e in BU).some(e=>!t(e))?WU(e.address??BU,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}),{mutate:r}=ch({mutationFn:$m,onSuccess:tv}),{mutate:a}=nv(),o=cc(),i=PT(),l="ACTIVE"===t?.status,s="INACTIVE"===t?.status,c=!nr(t?.transactionCount)&&t.transactionCount>0,d=async()=>{if(nr(t))return;"RESTORE"===await async function(e){return ju({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)&&(a({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),o.close())},u=l&&(!i||l&&!c),h=s&&!i,p=nr(t)||!u&&!h?null:S(pk,{shouldUseButtonDiscreteStyles:!0,children:R(lg,{children:[s&&S(vS,{onClick:d,closeOnClick:!0,children:"Restore"}),!i&&S(DW,{vendor:t,onClose:()=>o.close()}),l&&!c&&S(vS,{onClick:async()=>{if(nr(t))return;"ARCHIVE"===await async function(e){return ju({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)&&(r({id:t?.id??""}),o.close())},closeOnClick:!0,children:"Archive"})]})}),g=s&&!i?null:S(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:r})=>S(MW,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>o.close(),disabled:e||r,isArchived:s})});return S(Wv,{title:e,HeaderRightAction:p,Footer:g,padChildren:!1,children:R(rL,{children:[S(n.AppField,{name:"name",children:e=>S(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:s,maxLength:255})}),S(GU,{form:n,fields:"address",disabled:s})]})})}function FW({title:e,vendor:t}){const n=cc();return S(Dv,{children:n.open&&S(LW,{title:e,vendor:t})})}const OW=Gn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function VW({vendor:e}){return R(sc,{children:[S(dc,{children:t=>R(lb,{popupTriggerChildrenProps:t,children:[R(mA,{children:[S(ld,{imageUrl:e.iconUrl??void 0,Component:pW}),S("div",{className:OW,children:S(Ys,{children:e.name})})]}),S(ud,{Component:Qi})]})}),S(FW,{title:"Edit Vendor",vendor:mW(e)})]})}function BW(){const[e,t]=c(""),[n,r]=c(bW[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=CW({searchTerm:e,statuses:n.value}),d=PT();return R(Wv,{title:"Back",HeaderRightAction:R(sc,{children:[S(dc,{children:e=>R(Fs,{popupTriggerProps:e,children:[S(ud,{Component:xs}),!d&&S(Ys,{children:"Add Vendor"})]})}),S(FW,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[S(sW,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:bW,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>S(CA,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>S(VW,{vendor:e.value},e.value.id))},e.key)),S(TF,{onIntersect:o,enable:!i&&l})]})}function UW(){const e=cc();return S(Dv,{children:e.open&&S(BW,{})})}function WW(){return R(sc,{children:[S(dc,{children:e=>S(RU,{Icon:pW,label:"Vendors",popupTriggerChildrenProps:e})}),S(UW,{})]})}const HW=Gn({padding:"16px"});function zW(){const e=ln(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return S(jP,{children:R(KP,{children:[S(Fv,{children:R(Vv,{children:[S(Vu,{Icon:Gi}),S(vo,{children:"Back"})]})}),S("div",{className:HW,children:R(CA,{label:"Transaction Settings",children:[e&&S(PU,{}),S(WW,{}),S(hW,{})]})})]})})}function qW(){return R(UP,{children:[S(HP,{name:"BankTransactionForm",Component:yB}),S(HP,{name:"Conversation",Component:CB}),S(HP,{name:"MobileConversation",Component:IB}),S(HP,{name:"FinancialSummary",Component:VB}),S(HP,{name:"BanksAndIntegrations",Component:BB}),S(HP,{name:"BankAccountForm",Component:kU}),S(HP,{name:"NewConnection",Component:SB}),S(HP,{name:"TransactionsFilterList",Component:NU}),S(HP,{name:"ExpensesFilterList",Component:IU}),S(HP,{name:"RevenueFilterList",Component:SU}),S(HP,{name:"TransactionSettingsDrawer",Component:zW})]})}const jW=({environment:e,children:t})=>S(Sr.Provider,{value:e,children:t});function _W({children:e}){const{query:{data:t}}=ki(),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 S(Lc.Provider,{value:n,children:e})}const KW=e=>["whiteLabels",e??{}],YW=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:mi(t[3].environment)},r=await wa(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ZW({children:e}){const t=Ci(),{query:{data:n}}=fl({queryKey:KW({filter:{name:{equal:t}}}),queryFn:YW}),r={icons:n?.data?.[0]?.icons};return S(li.Provider,{value:r,children:e})}const GW=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const QW="SSE connection failed with status";function XW({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Nr();u(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Sa[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 He(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${QW} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case GW.CONNECTED:return void ha("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case GW.ERROR:throw pa({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case GW.CACHE_BUST:return ha("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(()=>{Ir.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>pa({error:e,severity:"error"}))},500*Math.random()),ha(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void pa({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 pa({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(QW))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>pa({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const JW=[GW.CACHE_BUST];function $W({children:e}){const{companyId:t,customerPartnerId:n}=l(Lc);return XW({companyId:t,customerPartnerId:n,sseTypes:JW}),e}const eH=i({dimensions:{width:null,height:null}}),tH="undefined"!=typeof window?g:u,nH="undefined"==typeof window;const rH=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;nH&&(t=!1);const[n,r]=c(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=KT(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);tH(()=>{o.current=t},[t]),u(()=>{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),tH(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return S(eH.Provider,{value:r,children:e})},aH=({children:e})=>{const{dimensions:t}=l(eH),n=rr(t.width)&&t.width<parseInt(To("sizes.breakpoint-xl"));return S(DT.Provider,{value:n,children:e})};function oH({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return u(()=>{var e,r;e=n,r=t,la.setProperties(da),ca=r,sa=e},[n,t]),S(jW,{environment:t,children:S(MP,{children:S(wr.Provider,{value:r,children:S(_W,{children:S(ZW,{children:S($W,{children:S(rH,{children:R(aH,{children:[S(ye.ConfirmationRoot,{}),e,S(qW,{})]})})})})})})})})}const iH={FinancialOverview:{path:"/",element:S(rk,{})},FinancialOverviewDashboard:{path:"/",element:S(rk,{})}};function lH({children:e,initialNav:t}){const n=Re(),r=Fe(),i=a(void 0),l=d(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),s=d(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),c=d(e=>{const t=iH[e.page].path;t!==r.pathname&&(ln.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&jl(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);u(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&jl(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:c,registerAnchor:s,location:r,initialPageProps:t.pageProps}),[r,c,s,t.pageProps]);return S(vd.Provider,{value:p,children:e})}function sH({accessToken:e,environment:t="PRODUCTION",initialNav:n={page:"FinancialOverview"}}){return S(oH,{environment:t,accessToken:e,children:S(Oe,{initialEntries:[iH[n.page].path],children:S(lH,{initialNav:n,children:S(Ve,{children:Object.entries(iH).map(([e,t])=>S(Be,{path:t.path,element:t.element},e))})})})})}const cH=["BanksAndIntegrations"],dH={FinancialOverview:!0},uH=new Set(Object.values(ii).flatMap(e=>Object.values(e)));function hH(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!dH[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&cH.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)&&uH.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{uA as BanksAndIntegrations,OR as ExpenseDashboard,rk as FinancialOverview,zR as IncomeDashboard,RP as ReportDashboard,oH as Tight,sH as TightApp,fR as TransactionsDashboard,hH as parseNavUrl,yn 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 C,isEqual as x,differenceBy as T,debounce as w,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 P}from"react/jsx-runtime";import{QueryClient as R,useIsRestoring as D,useQuery as M,keepPreviousData as L,useMutationState as F,useMutation as O,useQueries as V,useInfiniteQuery as B}from"@tanstack/react-query";import U from"yocto-queue";import W from"big.js";import{ResponsiveContainer as H,BarChart as _,Legend as z,CartesianGrid as q,XAxis as j,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 Ce,confirmable as xe}from"react-confirm";import{createFormHookContexts as Te,useStore as we,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 Pe}from"react-dropzone";import{useNavigate as Re,useMatches as De,Outlet as Me,useLocation as Le,createMemoryRouter as Fe,RouterProvider as Oe,MemoryRouter as Ve,Routes as Be,Route as Ue}from"tight-react-router";import{openDB as We}from"idb";import{PersistQueryClientProvider as He}from"@tanstack/react-query-persist-client";import{fetchEventSource as _e}from"@microsoft/fetch-event-source";import{Toast as ze,createToaster as qe,Toaster as je}from"@ark-ui/react/toast";import{Portal as Ke}from"@ark-ui/react/portal";function Ye(e,t){return`${e.trim()}:${t.trim()}`}const Ze=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,Ye("featureFlags","updateFlags"))});function Ge(){return yn(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function Qe(){return yn(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}function Xe(){return yn(e=>e.FEATUREFLAG_GENERAL_LEDGER)}let Je=null,$e=!1;function et(){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 tt(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function nt(){const e=et();if(!e)return;const{meta:t,params:n}=e;if($e)return t.remove(),$e=!1,void(Je=null);Je?n["interactive-widget"]=Je:delete n["interactive-widget"],Je=null,tt(t,n)}const rt="drawerNavigation",at=(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=et();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),$e=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;Je=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",tt(t,n)}(),{drawerHistory:[o]};{const t=b(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,Ye(rt,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,Ye(rt,"closeDrawer")),0===t().drawerHistory.length&&nt()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,Ye(rt,"closeAllDrawers")),nt()},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,Ye(rt,"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,Ye(rt,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,Ye(rt,"confirmCloseDrawer")),0===t().drawerHistory.length&&nt()}}),ot=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,Ye("externalOptions","setOptions"))});function it(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function lt(e){return Array.isArray(e)&&e.length>0}function st(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 ct="search",dt=st({key:ct,name:"Search"});function ut(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function ht(e,t,n){return new Date(e,t,n)}function pt(e){const[t,n,r]=e.split("-");return ht(Number(t),Number(n),Number(r))}function gt(){return ut(ht(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function mt(e,t){return ut(ht(t,e,1))}function vt(){const e=/* @__PURE__ */new Date;return ut(ht(e.getFullYear(),e.getMonth()+1,0))}function ft(e){const t=/* @__PURE__ */new Date;return ut(ht(t.getFullYear(),t.getMonth()-e,1))}function bt(e){const t=e.getMonth(),n=t-t%3;return ut(ht(e.getFullYear(),n,1))}function yt(e){const t=e.getMonth(),n=t-t%3+3;return ut(ht(e.getFullYear(),n,0))}const Ct={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"},xt={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"},Tt=e=>Object.values(Ct).includes(e),wt={[Ct.ALL_TIME]:()=>"",[Ct.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return mt(e.getMonth(),e.getFullYear())}(),[Ct.LAST_YEAR]:()=>ut(ht(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[Ct.LAST_MONTH]:()=>ft(1),[Ct.LAST_6_MONTHS]:()=>ft(5),[Ct.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return ut(ht(e.getFullYear(),e.getMonth()-11,1))}(),[Ct.THIS_YEAR]:()=>ut(ht(/* @__PURE__ */(new Date).getFullYear(),0,1)),[Ct.LAST_3_MONTHS]:()=>ft(2),[Ct.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return bt(ht(e.getFullYear(),e.getMonth()-3,1))}(),[Ct.THIS_QUARTER]:()=>bt(/* @__PURE__ */new Date)};function kt(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 Et=e=>wt[e](),At={[Ct.ALL_TIME]:()=>"",[Ct.THIS_MONTH]:()=>vt(),[Ct.LAST_YEAR]:()=>ut(ht(/* @__PURE__ */(new Date).getFullYear(),0,0)),[Ct.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return ut(ht(e.getFullYear(),e.getMonth(),0))}(),[Ct.LAST_6_MONTHS]:()=>vt(),[Ct.LAST_12_MONTHS]:()=>vt(),[Ct.THIS_YEAR]:()=>gt(),[Ct.LAST_3_MONTHS]:()=>vt(),[Ct.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return yt(ht(e.getFullYear(),e.getMonth()-3,1))}(),[Ct.THIS_QUARTER]:()=>yt(/* @__PURE__ */new Date)},St=e=>At[e](),It=e=>{return Tt(e)?{beginDate:Et(e),endDate:St(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:ut((t=e).beginDate),endDate:ut(t.endDate)};var t},Nt=["SUN","MON","TUE","WED","THU","FRI","SAT"],Pt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Rt({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 Dt(e,t){return e.toDateString()===t.toDateString()}function Mt(e){return Dt(e,/* @__PURE__ */new Date)}function Lt(e,t){const n=ht(e.getFullYear(),e.getMonth(),e.getDate()),r=ht(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function Ft(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 Ot(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=ht(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Vt(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 Ot(o,i,l)?ht(l,o-1,i):null}function Bt(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 Ot(i,l,o)?ht(o,i-1,l):null}function Ut(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 Wt(e,t){return Lt(e,t)?t:e}function Ht(e,t){return Lt(t,e)?t:e}const _t=(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},zt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return Mt(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):_t(t,{abbreviateMonth:!0,abbreviateYear:!1})},qt=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function jt(e,t){return ht(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Kt(e){const{month:t,year:n}=e;return{beginDate:ht(n,t-1,1),endDate:ht(n,t+1,0)}}const Yt="date",Zt=Object.values(Ct).map(e=>{return{name:xt[t=e],value:{date:{name:xt[t],value:t}}};var t}),Gt=st({key:Yt,name:"Date",possibleValues:()=>({values:Zt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function Qt(e){return"OWNER"===e||"READ_ONLY"===e}function Xt(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===ct);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==ct)}const Jt=Gt.createFilter({name:xt[Ct.LAST_12_MONTHS],value:{date:{name:xt[Ct.LAST_12_MONTHS],value:Ct.LAST_12_MONTHS}}});function $t(e,t){return Xt([...t.some(e=>e.modelKey===Yt)?function(e){const t=e.findIndex(e=>e.modelKey===Yt);return-1!==t?it(e,t):e}(e.filters):e.filters,...t])}function en(e,t){const n=e.filters[t];return n&&n.modelKey===Yt?function(e,t){const n=[...e];return n[t]=Jt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function tn(e){return Xt(e.some(e=>e.modelKey===Yt)?e:[...e,Jt])}function nn(e,t){if(e.hasInitialized)return e;const n=[];return Qt(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 rn="transactionsDashboardFilters",an=e=>({transactionsDashboardFilters:[Jt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:$t({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ye(rn,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:en({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ye(rn,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:tn(t)}),void 0,Ye(rn,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=nn({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,Ye(rn,"initialize"))}),on="expenseDashboardFilters",ln=e=>({expenseDashboardFilters:[Jt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:$t({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ye(on,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:en({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ye(on,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:tn(t)}),void 0,Ye(on,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=nn({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,Ye(on,"initialize"))}),sn="incomeDashboardFilters",cn=e=>({incomeDashboardFilters:[Jt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:$t({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ye(sn,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:en({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ye(sn,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:tn(t)}),void 0,Ye(sn,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=nn({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,Ye(sn,"initialize"))}),dn="generalLedgerFilters",un="ACCRUAL",hn={generalLedgerGlAccountId:void 0,generalLedgerDateRange:void 0,generalLedgerAccountingMethod:un},pn=e=>({...hn,setGeneralLedgerGlAccountId:t=>e(e=>({...e,generalLedgerGlAccountId:t}),void 0,Ye(dn,"setGlAccountId")),setGeneralLedgerDateRange:t=>e(e=>({...e,generalLedgerDateRange:t}),void 0,Ye(dn,"setDateRange")),setGeneralLedgerAccountingMethod:t=>e(e=>({...e,generalLedgerAccountingMethod:t}),void 0,Ye(dn,"setAccountingMethod")),setGeneralLedgerFilters:t=>e(e=>({...e,generalLedgerGlAccountId:t.glAccountId,generalLedgerDateRange:t.dateRange,generalLedgerAccountingMethod:t.accountingMethod}),void 0,Ye(dn,"setFilters")),resetGeneralLedgerFilters:()=>e(e=>({...e,...hn}),void 0,Ye(dn,"reset"))}),gn={label:"Connected Accounts",value:"connected"},mn="banksAndIntegrationsState",vn=e=>({banksAndIntegrationsSelectedTab:gn,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,Ye(mn,"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,Ye(mn,"toggleExpandedIntegration"))}),fn={plaidLink:null,plaidLinkEvent:null,plaidLinkError:null,gusto:null,payroll:null,bITile:null,conversations:null,bill:null,transactionForm:null,customer:null},bn=e=>({events:fn,setEvents:t=>e(e=>({events:{...e.events,...t}}),void 0,Ye("events","setEvents"))}),yn=e()(t(n((...e)=>({...Ze(...e),...at(...e),...ot(...e),...an(...e),...ln(...e),...cn(...e),...pn(...e),...vn(...e),...bn(...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})),Cn={SELECT:"select",EXPAND:"expand"},xn={...Cn,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},Tn=[xn.COMMENTS,xn.DATE,xn.DESCRIPTION,xn.AMOUNT,xn.CATEGORY,xn.DIMENSION_VALUE,xn.REVIEW_STATUS],wn=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(Tn)))}),kn=e=>{const t=wn.safeParse(e);return t.success?t.data:void 0},En=A.optional(A.string().trim()),An=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Sn=A.optional(A.array(A.string().trim())),In=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())}),Nn={transactionsDashboard:kn,incomeDashboard:kn,expenseDashboard:kn,accessToken:e=>{const t=En.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=Sn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>An.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=In.safeParse(e);return t.success?t.data:void 0}},Pn=(e,t)=>{if(void 0!==Nn[e])return(0,Nn[e])(t)};function Rn(e){const t=a(!1),n=yn(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=Pn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=yn(e=>e.externalOptions);return{options:o(()=>b(r),[r]),setOptions:n}}const Dn=l(null);function Mn(){return i(Dn)}function Ln(e){const t=a(!1),n=yn(e=>e.setEvents);return s(()=>{e&&!t.current&&(n(e),t.current=!0)},[e,n]),[yn(e=>e.events),n]}function Fn(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function On(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function Vn(e){return String.fromCharCode(e+(e>25?39:97))}function Bn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Vn(t%52)+n;return Vn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var Un=/\s*!(important)?/i;function Wn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var Hn=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}},_n=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function zn(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(_n.has(n))return;const r=e[n],a=t[n];Fn(r)&&Fn(a)?e[n]=zn(r,a):e[n]=a}),e):e,{})}var qn=e=>null!=e;function jn(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);qn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Kn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return jn(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 Yn={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Zn=/([A-Z])/g,Gn=/^ms-/,Qn=Hn(e=>e.startsWith("--")?e:e.replace(Zn,"-$1").replace(Gn,"-ms-").toLowerCase()),Xn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),Jn=`(?:${"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("|")})`,$n=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${Jn}$`),er={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):Fn(e)?jn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&Xn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&$n.test(e)},tr=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,On(t))};const nr=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(",")),rr=/^@|&|&$/;function ar(e){return nr.has(e)||rr.test(e)}const or=/^_/,ir=/&|@/,lr=/* @__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(":");lr.set(t,n)});const sr={conditions:{shift:function(e){return e.sort((e,t)=>{const n=ar(e),r=ar(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>nr.has(e)?e.replace(or,""):ir.test(e)?`[${Wn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${lr.get(e)||Qn(e)}_${Wn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},cr=function(e){const{utility:t,hash:n,conditions:r=Yn}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return Hn(({base:o,...i}={})=>{const l=Kn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return jn(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&Un.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(Un,"").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,Bn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(sr),dr=(...e)=>cr(ur(...e));dr.raw=(...e)=>ur(...e);const{mergeCss:ur}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>Fn(e)&&Object.keys(On(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Kn(t,e))}return{mergeCss:Hn(function(...e){return zn(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(sr);function hr(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const pr=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function gr(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=pr(e),o=e=>({...r,...On(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=ur(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=ur(n,e.css))}),n}(a,r);return ur(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(Hn(function(e){return dr(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=pr(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 gr({base:ur(t,o.base),variants:Object.fromEntries(i.map(e=>[e,ur(n[e],o.variants[e])])),defaultVariants:zn(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 mr,vr=((mr=vr||{}).component="component",mr["dashboard-placeholder-table"]="dashboard-placeholder-table",mr["dashboard-header"]="dashboard-header",mr["dashboard-table"]="dashboard-table",mr["dashboard-table-body"]="dashboard-table-body",mr["dashboard-table-cell"]="dashboard-table-cell",mr["dashboard-table-column-header"]="dashboard-table-column-header",mr["dashboard-table-header"]="dashboard-table-header",mr.label="label",mr.popup="popup",mr["popup-sort-row"]="popup-sort-row",mr["progress-bar"]="progress-bar",mr["progress-bar-fill"]="progress-bar-fill",mr.drawer="drawer",mr.summation="summation",mr["table-parent-row"]="table-parent-row",mr["table-row"]="table-row",mr["table-sub-row"]="table-sub-row",mr.tile="tile",mr["tile-bar-label"]="tile-bar-label",mr["tile-bar-label-outer"]="tile-bar-label-outer",mr["tile-body"]="tile-body",mr["tile-filter-button"]="tile-filter-button",mr["tile-filter-list"]="tile-filter-list",mr["tile-filter-row"]="tile-filter-row",mr["tile-header"]="tile-header",mr["business-owner-dashboard"]="business-owner-dashboard",mr["business-owner-dashboard-header"]="business-owner-dashboard-header",mr["transaction-type-label"]="transaction-type-label",mr["transaction-date-cell-container"]="transaction-date-cell-container",mr["selector-row"]="selector-row",mr["popup-list"]="popup-list",mr.badge="badge",mr["badge-chip"]="badge-chip",mr["date-cell"]="date-cell",mr["vertical-divider"]="vertical-divider",mr["horizontal-divider"]="horizontal-divider",mr["checkbox-input"]="checkbox-input",mr["bulk-select"]="bulk-select",mr["button-base"]="button-base",mr["button-discreet-small"]="button-discreet-small",mr["button-primary"]="button-primary",mr["button-secondary"]="button-secondary",mr["button-success"]="button-success",mr["button-danger"]="button-danger",mr["button-warning"]="button-warning",mr["button-action"]="button-action",mr["button-table-header"]="button-table-header",mr["button-inline"]="button-inline",mr["small-square-button"]="small-square-button",mr.card="card",mr["card-button"]="card-button",mr["card-button-icon-container"]="card-button-icon-container",mr["pagination-button"]="pagination-button",mr.text="text",mr["cell-button"]="cell-button",mr["selector-button"]="selector-button",mr["review-status-selector-button"]="review-status-selector-button",mr["review-status-dropdown-arrow"]="review-status-dropdown-arrow",mr["financial-summary-layout"]="financial-summary-layout",mr["financial-summary-chatbox"]="financial-summary-chatbox",mr["financial-summary-chatbox-header"]="financial-summary-chatbox-header",mr["month-picker"]="month-picker",mr["month-picker-left-button"]="month-picker-left-button",mr["month-picker-right-button"]="month-picker-right-button",mr["month-picker-label"]="month-picker-label",mr["filter-bar"]="filter-bar",mr["filter-search-bar"]="filter-search-bar",mr.pill="pill",mr["filter-pill"]="filter-pill",mr["email-pill"]="email-pill",mr["discreet-form-input"]="discreet-form-input",mr["editable-form-input"]="editable-form-input",mr["amount-input"]="amount-input",mr["modal-popup"]="modal-popup",mr["drawer-header"]="drawer-header",mr["form-body"]="form-body",mr.body="body",mr.heading="heading",mr["sub-label"]="sub-label",mr["strong-label"]="strong-label",mr["strong-sub-label"]="strong-sub-label",mr["weak-label"]="weak-label",mr["metric-xl"]="metric-xl",mr["metric-md"]="metric-md",mr["large-icon"]="large-icon",mr["medium-icon"]="medium-icon",mr["small-icon"]="small-icon",mr["tiny-icon"]="tiny-icon",mr["x-large-icon"]="x-large-icon",mr["xx-large-icon"]="xx-large-icon",mr["category-icon"]="category-icon",mr["card-header"]="card-header",mr.icon="icon",mr["neutral-badge"]="neutral-badge",mr["highlight-badge"]="highlight-badge",mr["success-badge"]="success-badge",mr["warning-badge"]="warning-badge",mr["danger-badge"]="danger-badge",mr["critical-badge"]="critical-badge",mr["button-group"]="button-group",mr["alert-dialog"]="alert-dialog",mr["alert-header"]="alert-header",mr["emphasis-label"]="emphasis-label",mr["profit-loss-graph"]="profit-loss-graph",mr.banner="banner",mr["banner-high"]="banner-high",mr["banner-medium"]="banner-medium",mr["banner-low"]="banner-low",mr["banner-urgent"]="banner-urgent",mr["banner-default"]="banner-default",mr["banner-button"]="banner-button",mr["banner-button-text"]="banner-button-text",mr["banner-button-icon"]="banner-button-icon",mr["banner-icon"]="banner-icon",mr["banner-title"]="banner-title",mr["empty-dashboard-layout"]="empty-dashboard-layout",mr["emphasis-sub-label"]="emphasis-sub-label",mr["bar-transactions-positive"]="bar-transactions-positive",mr["bar-transactions-negative"]="bar-transactions-negative",mr["message-sent"]="message-sent",mr["message-received"]="message-received",mr["date-amount-header"]="date-amount-header",mr["close-button"]="close-button",mr["start-date-form-section"]="start-date-form-section",mr["beginning-balance-form-section"]="beginning-balance-form-section",mr["date-picker-nav-button"]="date-picker-nav-button",mr["date-picker-day-button"]="date-picker-day-button",mr["dropdown-selector-button"]="dropdown-selector-button",mr.chip="chip",mr["attachment-dropzone"]="attachment-dropzone",mr["list-body"]="list-body",mr["loading-skeleton"]="loading-skeleton",mr["line-item-card"]="line-item-card",mr["linked-entity-row"]="linked-entity-row",mr["drawer-search-bar"]="drawer-search-bar",mr["value-comparison-summary"]="value-comparison-summary",mr["category-selector-table-cell"]="category-selector-table-cell",mr["zero-state-button"]="zero-state-button",mr.toast="toast",mr["toast-dismiss"]="toast-dismiss",mr);const fr=e=>null==e,br=e=>!fr(e),yr="Tight-",Cr=e=>`${yr}${e}`;function xr(e){return e in vr}function Tr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===yr&&r in vr}function wr(e){return!xr(e)&&!Tr(e)}const kr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(Cr(e)),t.forEach(e=>{fr(e)||(wr(e)?r.push(e):xr(e)?n.push(Cr(e)):Tr(e)&&n.push(e))}),{className:hr(...n,...r)}},Er=dr.raw({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}),Ar=kr(vr["business-owner-dashboard-header"],dr(Er));function Sr({children:e}){return I("div",{...Ar,children:e})}function Ir(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(Tr(t)&&e.push(t),e),[])],[])}function Nr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(wr(t)&&e.push(t),e),[])],[])}function Pr(e){const t=Array.isArray(e)?e:[e];return{className:hr(...Ir(t),...Nr(t))}}const Rr=gr({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"}}}}),Dr=kr(vr.heading,Rr({heading:"default"}));function Mr({children:e,stylists:t=[]}){const n=Pr([Dr,...t]);return I("div",{...n,children:e})}function Lr(e,t,n){return[...e,{accessToken:t,environment:n}]}function Fr(e,t){return[...e,t]}function Or(e){return""===e.trim()}function Vr(e){return fr(e)||Or(e)}function Br(e){return!Vr(e)}const Ur=l({activeToken:void 0,accountantToken:void 0});function Wr(){const{activeToken:e}=i(Ur);return e}const Hr=()=>{throw new Error("No access token provided")},_r=72e5,zr=new R({defaultOptions:{queries:{gcTime:_r,staleTime:3e4,refetchInterval:6e4}}}),qr=l("SANDBOX");function jr(){return i(qr)}function Kr({queryKey:e,queryFn:t,...n}){const r=Wr(),a=jr(),o=Br(r),i=Lr(e,r??"",a),l=D(),s=M({...n,queryKey:i,queryFn:o?t:Hr,...o?{}:{retry:!1,staleTime:1/0}},zr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Yr{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 Zr=Symbol("Circular"),Gr=Symbol("AccessError");function Qr(e,t,n){return Xr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Xr({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=Zr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=Jr(()=>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=Jr(()=>s[i]);e.push(Xr({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=Jr(()=>s[c]);e[c]=Xr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function Jr(e){try{return e()}catch{return Gr}}const $r=Object.prototype.toString,ea=Object.getPrototypeOf;function ta(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const na=/^\s*at .*(\S+:\d+|\(native\))/m,ra=/^(eval@)?(\[native code])?$/;function aa(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 oa(e,t){const n=ia(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&ta(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[la(n)];return a.push(...da(n).map(e=>la(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function ia(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===$r.call(t))return!0;t=ea(t)}return!1}(e))return e;let n=function(e){if(!ta(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 la(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:sa(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function sa(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(na)?e.split("\n").filter(e=>!!e.match(na)).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=aa(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(ra)).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=aa(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<ca;){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 ca=20;function da(e){const t=e;if(t.cause){const e=ia(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(da(e))}return[]}function ua(...e){console.error}const ha={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 pa=Date.now();const ga=()=>{pa=Date.now()},ma={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-pa,!0}),{reset:ga})},va=[["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\)$/]],fa=[["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/]],ba=(ya=function(e){const t=""!==(n=e)&&va.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 fa)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,...ya(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 ya;class Ca{limit;period;events;constructor(e,t){this.limit=e,this.period=t,this.events=new U}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 xa 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}=oa(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 Ta={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(xa,{client:e,onError:t,FallbackComponent:n,children:r})})},wa=new class{breadcrumbs=[];config;delivery=new Yr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return ua(),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}=oa(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=Qr(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){ua()}}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 ka="",Ea="";const Aa="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",Sa=wa.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.9.0",appType:"browser",releaseStage:Aa,enabledReleaseStages:["prod"],plugins:[ma,ba,ha,(()=>{const e=new Ca(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),Ta]}),Ia=(e,t)=>{try{wa.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?Na({error:n,severity:"error"}):Na({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},Na=async e=>{try{await wa.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:ka,environment:Ea}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await Na({error:t,severity:"error"}):await Na({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},Pa=Sa.getPlugin("react"),Ra=Pa?.BugsnagErrorBoundary,Da=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,Ma=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},La=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},Fa={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function Oa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...C(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?Fa:{}}});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 Va({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=Ma({extraHeaders:t,authorization:e});Ia("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return Ia("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),La(e)}catch(l){return Promise.reject(l)}}async function Ba(e){const{url:t,headers:n}=Oa(e);return Va({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function Ua(e){return Ba(e)}async function Wa(e){return Ba(e)}const Ha=(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}),_a={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"},za={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"},qa={...za,LOCAL:"http://localhost:8082"};function ja(e){return Ha(`${t=e,_a[t]}/v5`,"v5");var t}const Ka=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Ya=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...It(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:ja(a)};return await Wa(o)};function Za({filter:e,grouping:t,select:n,accountingMethod:r}){return Kr({queryKey:Ka({filter:e,grouping:t,accountingMethod:r}),queryFn:Ya,select:n})}const Ga="noDataHeight";function Qa(e){const t=Bt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function Xa(e){const t=Qa(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?W(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?W(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 Ja(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(fr(n))return t;for(const i of n){const{month:e,netIncome:n}=Xa(i);t.total=W(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 $a="MONTHLY",eo=kr(vr["tile-header"],dr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function to({title:e}){return I("div",{...eo,children:I(Mr,{children:e})})}const no=kr(vr["tile-body"],dr({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 ro({children:e}){return I("div",{...no,children:e})}const ao=gr({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 oo({children:e,type:t,isSample:n=!1}){const r=kr(vr.tile,ao({type:t,isSample:n}));return I("div",{...r,children:e})}const io=dr({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),lo=dr.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),so=dr.raw({whiteSpace:"normal",overflowWrap:"break-word"}),co=dr.raw({overflow:"visible",whiteSpace:"nowrap"}),uo=dr({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),ho=dr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),po=dr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"template"});dr.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"});const go=kr(vr.text,dr({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io);function mo({children:e}){return I("div",{...go,children:e})}const vo=kr(vr["metric-xl"],Rr({metric:"xl"}));function fo(e){return I("div",{...vo,children:e.children})}const bo=kr(vr.summation,dr({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function yo({title:e,label:t}){return P("div",{...bo,children:[I(fo,{children:e}),I(mo,{children:t})]})}const Co=kr(null,dr({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function xo({children:e}){return I("div",{...Co,children:e})}const To=(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},wo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),ko=1e9;function Eo(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<ko&&l>=1e3&&(l/=1e3),o>=ko?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${wo(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:To(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:To(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:To(e,t)}}{const t=2,n=To(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=wo(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 Ao(e){return Eo(e,{condense:!0,dollarSign:!0})}function So(e){return Eo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function Io(e){return Eo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function No(e){return Eo(e,{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function Po(e,t){return Eo(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const Ro=gr({variants:{wrap:{ellipsis:lo,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function Do({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Vr(n))return null;const a=Pr([kr(vr["strong-label"],vr.text,Rr({label:"strongLabel"}),Ro({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const Mo=gr({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:lo,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:lo,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function Lo({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=kr(vr["sub-label"],vr.text,Mo({intent:e,wrap:t,accent:r}),io);return Vr(n)?null:I("div",{...a,children:n})}const Fo=kr(null,dr({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 Oo({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ga)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),P("div",{...Fo,children:[I(Do,{children:t[0].name??""}),I(Lo,{children:Ao(Number(n))})]})}const Vo={"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 Bo(e,t){return Vo[e]?.value||t}Bo.var=function(e,t){return Vo[e]?.variable||t};const Uo=kr(null,dr({borderRadius:"50%",flexShrink:0})),Wo=kr(null,dr({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Ho=Bo.var("colors.surface.foreground.disabled");function _o({color:e=Ho,diameter:t=17,label:n}){return P("div",{...Wo,"data-testid":"bullet-row",children:[I("div",{...Uo,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(Lo,{children:n})]})}const zo=kr(null,dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function qo({payload:e}){return void 0===e?null:I("div",{...zo,children:e.map((e,t)=>"none"!==e.type&&I(_o,{color:e.color,label:e.value,diameter:17},t))})}const jo={right:20,left:20},Ko=["income","profit","expenses","loss"],Yo=e=>Ko.findIndex(t=>t===e.dataKey),Zo={paddingBottom:"20px",marginLeft:"-20px"},Go={stackId:"stack",isAnimationActive:!1},Qo=kr(vr["profit-loss-graph"],dr({"& .recharts-surface":{outline:"none"}})),Xo=Bo.var("colors.money"),Jo=Bo.var("colors.border.layout"),$o=Bo.var("colors.border.layout.strong"),ei={fill:Bo.var("colors.typography.base"),fontSize:Bo.var("fontSizes.metric.sm")},ti={profit:Bo.var("colors.money.positive.strong"),income:Bo.var("colors.money.positive.weak"),loss:Bo.var("colors.money.negative.strong"),expenses:Bo.var("colors.money.negative.weak")},ni=[0,100],ri=["auto","auto"];function ai({data:e}){const[t,n]=d(!0);if(void 0===e)return null;const r=e.hasAnyData?ri:ni;return I(H,{width:"100%",height:"100%",...Qo,children:P(_,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:jo,children:[I(z,{verticalAlign:"top",itemSorter:Yo,wrapperStyle:Zo,content:({payload:e})=>I(qo,{payload:e})}),I(q,{strokeDasharray:"0",vertical:!1,stroke:Jo}),I(j,{dataKey:"month",interval:0,tickLine:!1,stroke:Jo,tick:ei}),I(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:Jo,tick:ei,tickFormatter:e=>Ao(e)}),I(Y,{content:({active:e,payload:t})=>I(Oo,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(Z,{name:"Profit",dataKey:"profit",fill:ti.profit,...Go}),I(Z,{name:"Income",dataKey:"income",fill:ti.income,...Go}),I(Z,{name:"Loss",dataKey:"loss",fill:ti.loss,...Go}),I(Z,{name:"Expenses",dataKey:"expenses",fill:ti.expenses,...Go}),I(Z,{dataKey:Ga,fill:Jo,legendType:"none",...Go}),I(G,{y:0,stroke:$o}),I(Q,{dataKey:"netIncome",fill:Xo,stroke:Xo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const oi=dr({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 ii({styles:e}){const t=hr(Cr(vr["loading-skeleton"]),oi,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const li=dr({width:"40%",minHeight:65});function si({children:e}){return P(N,{children:[I(ii,{styles:li}),I(xo,{children:e})]})}const ci=kr(null,dr({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),di=dr({width:"80px",height:"17px",marginBottom:"10px"}),ui=dr({width:"100%",height:"100%"});function hi(){return P(N,{children:[P("div",{...ci,children:[I(ii,{styles:di}),I(ii,{styles:di}),I(ii,{styles:di}),I(ii,{styles:di})]}),I(ii,{styles:ui})]})}const pi=gr({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 gi({size:e}){const t=pi({size:e});return I("div",{className:t,children:"Sample"})}const mi=20200,vi=5043,fi=Object.freeze({income:mi,expenses:vi,netIncome:15157,absoluteSum:Math.abs(mi)+Math.abs(vi)}),bi=Object.freeze({total:vi,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),yi=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),Ci=[{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 xi({filter:e=Ct.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Za({filter:e,grouping:t,select:Ja})}({filter:e,grouping:$a}),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=_t(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=Ci[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 P(oo,{type:"chart",children:[I(to,{title:"Profit + Loss"}),I(ro,{children:r?I(si,{children:I(hi,{})}):P(N,{children:[I(yo,{title:Ao(a?.total??0),label:"Profit"}),I(xo,{children:I(ai,{data:a})})]})}),t&&I(gi,{size:"xl"})]})}const Ti={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},wi=l({}),ki=gr({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 Ei(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:l}=i(wi),s=n?.styleIconKey?l?.[n.styleIconKey]:void 0,c=Pr([kr(null,ki()),...o]);return s?I("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:dr({objectFit:"contain"})}):I(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const Ai=Ei(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"}),Si=Ei(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"),Ii=Ei(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"),Ni=Ei(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"}),Pi=Ei(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 Ri(e){return Ha(`${t=e,za[t]}`,"v6");var t}async function Di({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=Ma({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=>Da(e,t)).join("&"):Da(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});Ia("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return Ia("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),La(e)}catch(s){return Promise.reject(s)}}async function Mi(e){const{url:t,headers:n}=Oa(e);return Di({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function Li(e){return Mi({...e,endpointManager:Ri(e.environment)})}async function Fi(e){return Mi({...e,endpointManager:ja(e.environment)})}const Oi=l(void 0);function Vi(){return i(Oi)}const Bi=e=>["introspect",e];function Ui(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 Fi(r)}(n[2].accessToken,n[2].environment,e)}}function Wi(){const e=Vi();return Kr({queryKey:Bi(e),queryFn:Ui(e)})}const Hi={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"},_i=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],zi={DISCREPANCY:{text:"Discrepancy",Icon:Si,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:Ii,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:Ai,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:Ii,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:Ii,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:Ai,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:Pi,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:Ni,variant:"success"}},qi={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"]},ji={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"]},Ki=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Yi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Zi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],Gi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],Qi=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],Xi=[{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 Ji(){return tl()?Xi:Qi}function $i(e,t){return{...zi[e],key:e,value:(t?qi:ji)[e]}}function el(e){const t=tl()?qi:ji,n=_i.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return zi[n]}function tl(){const{query:{data:e}}=Wi();return"ACCOUNTANT"===e?.userRole}function nl(){return $i("NEEDS_REVIEW",tl())}function rl(e){return e in Hi}const{CONVERSATIONS:al,TRANSACTIONS:ol}=Ti.FinancialOverview,il={MESSAGE_REVIEW:al,TRANSACTION_REVIEW:ol,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},ll={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},sl={resolutionStatus:{in:["OPEN"]}},cl=[],dl=[],ul=Ei(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"),hl=Ei(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"),pl=dr.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"}}),gl=dr(pl),ml=dr.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),vl=dr(ml);dr({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}),dr({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),dr({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const fl=l({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function bl({Component:e,stylists:t}){return I(e,{stylists:[kr(vr["small-icon"],vr.icon),...t??[]],size:12})}const yl=kr(vr["pagination-button"],dr({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})),Cl=kr(null,dr({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"}}),vl),xl=kr(null,dr({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),Tl=kr(null,dr({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function wl(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=i(fl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return P("div",{...yl,children:[I("div",{...xl,children:I("button",{...Cl,onClick:r,disabled:!t,children:I(bl,{Component:ul,stylists:[Tl]})})}),I("div",{...xl,children:I("button",{...Cl,onClick:n,disabled:!e,children:I(bl,{Component:hl,stylists:[Tl]})})})]})}const kl=dr({width:"100%",height:"50px"});function El(){return I(ii,{styles:kl})}const Al=kr(vr["dashboard-placeholder-table"],dr({display:"flex",flexDirection:"column",gap:"4px"})),Sl=kr(null,dr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),Il=dr({width:"100px",height:"20px"});function Nl({numColumns:e=6}){return P("div",{...Al,children:[I("div",{...Sl,children:Array.from({length:e},(e,t)=>I(ii,{styles:Il},t))}),I(El,{}),I(El,{}),I(El,{}),I(El,{}),I(El,{}),I(El,{})]})}function Pl(e,t){const n=Wr(),r=jr();return u(a=>{const o=Br(n),i=o?{}:{retry:!1,staleTime:1/0};return zr.prefetchQuery({queryKey:Lr(e(a),n??"",r),queryFn:o?t:Hr,...i})},[e,t,n,r])}const Rl=Object.freeze({}),Dl=Object.freeze({cursor:"FINAL_PAGE"});function Ml({queryKey:e,queryFn:t,...n}){const[r,i]=d(Rl),l=a(e);x(l.current,e)||(l.current=e,i(Rl));const c=n.select,h=br(c)?e=>({...c(e),cursor:e.cursor}):void 0,p=Fr(e,r),g=Kr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),m=o(()=>{return e=g.query.data?.cursor,t=i,{getFirstPage:()=>t(Rl),getLastPage:()=>t(Dl),hasNextPage:br(e?.after),hasPreviousPage:br(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[g.query.data?.cursor]),v=Pl(u(t=>Fr(e,t),[e]),t),f=Pl(u(t=>Fr(e,t),[e]),t);return s(()=>{const e=g.query.data?.cursor;!g.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{Na({error:e,severity:"error"})}),e.before&&f({cursor:e.before}).catch(e=>{Na({error:e,severity:"error"})}))},[g.query.data?.cursor,g.query.isFetching,v,f]),{...g,paginationControls:m}}function Ll({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 Fl({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=Ll({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Ol={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"},Vl={ASC:"ASC",DESC:"DESC"},Bl=e=>["conversations",e??{}],Ul=e=>["conversations","conversation",e],Wl=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Hl(e){return Ml({queryKey:e?Bl(e):["conversations",{}],queryFn:Wl})}const _l=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 Li(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function zl(e){const t=br(e);return Kr({queryKey:Ul({id:e??""}),queryFn:_l,enabled:t})}const ql=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:Ri(n)};return await Ua(r)};function jl(){return Fl({prefetchFn:Pl(Ul,_l)})}function Kl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Yl({header:e}){const t=Kl(e.column);return I("div",{...kr(vr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:X(e.column.columnDef.header,e.getContext())})}const Zl=kr(vr["dashboard-table-header"],dr({display:"flex",flexDirection:"row",alignItems:"center",minHeight:"32px"}));function Gl({headerGroups:e}){return I("div",{children:e.map(e=>h("div",{...Zl,key:e.id},e.headers.map(e=>I(Yl,{header:e},e.id))))})}const Ql=kr(vr["dashboard-table-body"],dr({display:"flex",flexDirection:"column"}));function Xl({children:e}){return I("div",{...Ql,children:e})}function Jl(e){if("object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id)return e.id}const $l=/* @__PURE__ */new Set;const es=l(void 0);function ts({editMutationKey:e,children:t}){const n=function(e){const t=F({filters:{mutationKey:e,status:"pending"},select:e=>e.state.variables},zr);return o(()=>0===t.length?$l: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=Jl(n);void 0!==e&&t.add(e)}}return t}(t),[t])}(e);return I(es.Provider,{value:n,children:t})}const ns=kr(vr["dashboard-table-cell"],dr({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),rs=dr({display:"flex",flexDirection:"row",height:"100%"});function as({cell:e,onCellClick:t,isMutating:n}){const r=Kl(e.column);return I("div",{className:rs,style:r,onClick:()=>{!n&&t&&t(e)},children:I("div",{style:r,...ns,children:X(e.column.columnDef.cell,{...e.getContext(),isMutating:n})})})}const os=kr(vr["table-sub-row"],dr({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function is({rowData:e,onCellClick:t,isMutating:n}){const r=e.getVisibleCells();return I("div",{...os,children:r.map(e=>I(as,{cell:e,onCellClick:t,isMutating:n,isChild:!0},e.id))})}const ls=dr({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden",position:"relative",isolation:"isolate"}),ss=dr({position:"absolute",inset:"0",backgroundColor:"surface.foreground",opacity:"80%",pointerEvents:"all",cursor:"default"}),cs=dr({background:"surface.background"}),ds=kr(vr["table-row"],dr({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 us({rowData:e,onMouseEnter:t,onMouseLeave:n,onRowClick:r,onCellClick:o,shouldDisplayDivider:l}){const c=function(e){const t=i(es);return t?.has(e)??!1}(e.id),d=e.getIsExpanded(),u=kr(vr["table-parent-row"],ls,e.index%2==0?cs: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:g,ref:m,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 P("div",{...u,onMouseEnter:t,onMouseLeave:n,ref:p,children:[I("div",{...ds,onKeyDownCapture:g,ref:m,role:v,tabIndex:f,children:h.map(e=>I(as,{cell:e,onCellClick:o,isMutating:c},e.id))}),c&&I("div",{className:ss}),d&&I("div",{children:e.subRows.map(e=>I(is,{rowData:e,onCellClick:o,shouldDisplayDivider:l,isMutating:c},e.id))})]})}const hs=(e,t={})=>{yn.getState().openDrawer(e,t)},ps=()=>{yn.getState().requestCloseDrawer()},gs=()=>yn(e=>e.drawerHistory),ms={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 vs(e,t){return!Vr(e)&&e.startsWith(t)}function fs({id:e,prefix:t}){return void 0!==e?`${ms[t]}_${e}`:""}function bs(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}function ys(e,t,n){br(e)&&(e.listener(t),e.preventDefault)||n?.()}function Cs(e,t){const{events:n}=yn.getState();null!==e?vs(e.id,ms.BANK_TRANSACTION)?ys(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>hs("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ys(n.transactionForm,{type:"OPEN_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>hs("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ys(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:null,error:null},()=>hs("BankTransactionForm",{routeProps:{transactionId:t?.transactionId,initialTab:t?.initialTab,initialType:t?.initialType}}))}function xs({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Lr(e,n,r);return zr.fetchQuery({queryKey:a,queryFn:t})}function Ts({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Lr(e,n,r);return zr.prefetchQuery({queryKey:a,queryFn:t})}const ws=[{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"}],ks={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},Es={ASC:"ASC",DESC:"DESC"},As=e=>["banks/transactions",e??{}],Ss=e=>["banks/transactions",e.id],Is=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Ns(e,t){return Ml({queryKey:As(e),queryFn:Is,...t})}const Ps=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 Li(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Rs({id:e,enabled:t=!0}){return Kr({queryKey:Ss({id:e??""}),queryFn:Ps,enabled:t})}function Ds(){return Fl({prefetchFn:Pl(Ss,Ps)})}function Ms(){const{query:{data:e}}=Ns({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!fr(t)&&t.length>0}const Ls=e=>["conversations/messages",e];function Fs(e){if(fr(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 Os=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 Li(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},Vs=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:Ri(n),accessToken:t};return await Ua(r)};function Bs(){return Fl({prefetchFn:Pl(Ls,Os)})}const Us=e=>["summaries",e??{}],Ws=e=>["summaries",e.id],Hs=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:Ri(t[2].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const _s=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 Li(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function zs(){return yn(e=>e.events.conversations)}function qs({rowData:e,isMobile:t}){const n=zs(),{startPrefetch:r,cancelPrefetch:a}=jl(),{startPrefetch:o,cancelPrefetch:i}=Bs(),{startPrefetch:l,cancelPrefetch:s}=Ds(),{startPrefetch:c,cancelPrefetch:d}=Fl({prefetchFn:Pl(Ws,_s)}),h=u(()=>{br(e.original.attachedEntityId)&&vs(e.original.attachedEntityId,ms.BANK_TRANSACTION)?l({id:e.original.attachedEntityId}):br(e.original.attachedEntityId)&&vs(e.original.attachedEntityId,ms.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(()=>{br(e.original.attachedEntityId)&&vs(e.original.attachedEntityId,ms.BANK_TRANSACTION)?s():br(e.original.attachedEntityId)&&vs(e.original.attachedEntityId,ms.FINANCIAL_SUMMARY)&&d(),i(),a()},[s,d,a,i,e.original.attachedEntityId]);return I(us,{rowData:e,onMouseEnter:h,onMouseLeave:p,shouldDisplayDivider:e=>0!==e,onCellClick:()=>{ys(n,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:e.original,error:null},()=>((e,t,n)=>{n?hs("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):br(t)?vs(t,ms.BANK_TRANSACTION)?Cs(null,{transactionId:t,initialTab:"conversation"}):vs(t,ms.FINANCIAL_SUMMARY)&&(r=e,a=t,hs("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){hs("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t))}})}const js=Ei(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"),Ks=dr.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}}),Ys=dr(Ks),Zs=dr.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"}});dr(Zs);const Gs=dr.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Qs=dr(Gs),Xs=dr.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});dr(Xs);const Js=dr.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"}}),$s=dr.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"}}),ec=dr.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"}}}),tc=dr.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"}}),nc=dr.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"}}}),rc=dr.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"}}),ac=gr({base:dr.raw(Ks,Gs,pl),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:Gs,small:Xs},intent:{default:{},danger:$s,primary:Zs,secondary:nc,success:ec,warning:tc,action:rc}}}),oc=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 vr["button-danger"];case"primary":return vr["button-primary"];case"secondary":return vr["button-secondary"];case"success":return vr["button-success"];case"warning":return vr["button-warning"];case"action":return vr["button-action"];case"default":return null}}(c),f=Pr([kr(vr["button-base"],v,r,dr(ac.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 ic({children:e,stylists:t=[],...n}){return I(oc,{intent:"secondary",stylists:t,...n,children:e})}const lc=kr(vr["small-square-button"],void 0),sc=dr({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function cc(){const e=zs();return I("div",{className:sc,children:I(ic,{stylists:[lc],onClick:()=>{ys(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>hs("Conversation",{routeProps:{conversationId:null}}))},width:"fill-parent",children:I(bl,{Component:js})})})}const dc=gr({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 uc({children:e,dashboard:t}){const n=kr(vr["dashboard-table"],dc({dashboard:t}));return I("div",{...n,children:e})}const hc=l(null),pc="mobile",gc=gr({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 mc({children:e,alignVariant:t="flexStart"}){const n=kr(null,gc({alignVariant:t}));return I("div",{...n,children:e})}const vc=gr({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:lo,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:co},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function fc({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=kr(vr.label,vr.text,dr(vc.raw({intent:t,wrap:n,alignment:r}),a));return Vr(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const bc={"sm-sm":kr(vr.text,dr({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io),"sm-med":kr(vr.text,dr({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io),"sm-lg":kr(vr.text,dr({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io),"med-sm":kr(vr.text,dr({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io),"med-med":kr(vr.text,dr({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io),"med-lg":kr(vr.text,dr({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io)};function yc({children:e,size:t,weight:n,stylists:r=[]}){const a=Pr([bc[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const Cc=kr(vr["emphasis-label"],dr({lineHeight:"template"}));function xc({children:e}){return I(yc,{size:"med",weight:"lg",stylists:[Cc],children:e})}function Tc({text:e,isRead:t}){return I(t?fc:xc,{children:e})}function wc({date:e,isRead:t=!1}){const n=zt(e);return I(Tc,{text:n,isRead:t})}const kc=kr(vr["strong-sub-label"],Rr({label:"strongSubLabel"}));function Ec({children:e,stylists:t=[]}){return Vr(e)?null:I(yc,{size:"sm",weight:"med",stylists:[kc,...t],children:e})}const Ac=l(null),Sc=dr({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),Ic=dr.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"}}),Nc=kr(vr["selector-row"],dr(Ic));function Pc(e,t,n){const[r,a]=d(e);return[t??r,n??a]}function Rc({children:e}){return null===pe()?I(ge,{children:e}):e}function Dc({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]=Pc(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}}),C=ue(f),x=he([b,y,C]),T=u(()=>g(!1),[g]);return o(()=>({open:p,setOpen:g,close:T,...x,...v,modal:!0,labelId:l,descriptionId:c,setLabelId:s,setDescriptionId:h,nodeId:m}),[p,g,T,x,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(Rc,{children:I(me,{id:g,children:I(Ac.Provider,{value:{...c,popupParentNodeId:h,blockInteraction:p},children:e})})})}function Mc(){const e=i(Ac);if(fr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function Lc({children:e}){const t=Mc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const Fc=Ei(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 Oc({Component:e,stylists:t}){return I(e,{stylists:[kr(vr["tiny-icon"],vr.icon),...t??[]],size:9})}const Vc=Ei(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"),Bc=kr(vr["button-discreet-small"],dr(Js,{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"}}),gl),Uc=kr(null,dr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),Wc=kr(null,dr({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"}})),Hc=kr(null,dr({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function _c({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return P("div",{...Bc,"data-active":a,children:[P("button",{...Uc,...r,children:[I(Ec,{children:t}),!a&&I("div",{...Hc,children:I(Oc,{Component:Vc})})]}),a&&I("button",{...Wc,onClick:e,children:I(Oc,{Component:Fc})})]})}const zc=gr({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 qc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=Mc(),d=ve([c.refs.setFloating,n]),u=kr(vr.popup,zc({type:r}));return a||l.open?P(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 jc=kr(vr["popup-sort-row"],dr({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 Kc({onClick:e,children:t,active:n}){return I("button",{onClick:e,...jc,children:I(Lo,{accent:n?"active":"action",children:t})})}const Yc=kr(null,dr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),Zc=kr(null,dr({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Gc({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=Mc(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return P("div",{...Yc,children:[I(Ec,{stylists:[Zc],children:"Sort by:"}),I(Kc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Kc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Qc=dr.raw(Js,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Xc({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=d(!1),u=kr(vr["button-discreet-small"],dr(Qc,e),gl),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 Jc={minWidth:"140px"};function $c({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=i(hc);if(!a)return null;const{sortInstance:o,setSortInstance:l}=a,s=o?.orderBy===t,c=()=>{l(void 0)};return t&&n&&r?P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>I(_c,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),I(qc,{style:Jc,children:I(Gc,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{l(e)},sortInstance:o})})]}):I(Xc,{disabled:!0,children:I(Ec,{children:e})})}const ed=gr({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 td({children:e,align:t="left",padding:n="default"}){return I("div",{className:ed({align:t,padding:n}),children:e})}function nd({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I(td,{align:a,padding:o,children:I($c,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const rd="Oldest to Newest",ad="Newest to Oldest";const od=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 id({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=i(od);let a="";return e===r?a="Me":Qt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),I(Tc,{text:a,isRead:t})}const ld=Ei(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"),sd=kr(vr.text,dr({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"template",maxWidth:"100%",fontFamily:"label"}),io);function cd({children:e,stylists:t=[]}){const n=Pr([sd,...t]);return I("div",{...n,children:e})}const dd=gr({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"}}}}),ud=hr(dr({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),io),hd=dr({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),pd=dr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),gd=dr({display:"flex",alignItems:"center",gap:8}),md=dr({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),vd=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),fd=dr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),bd=dr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function yd({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:dd({isRead:a}),onTouchEnd:o,children:P("div",{className:ud,children:[P("div",{className:vd,children:[!a&&I("div",{className:bd}),I(Tc,{text:t,isRead:a})]}),P("div",{className:hd,children:[I("div",{className:fd,children:I(id,{authorUserId:e,isRead:a})}),P("div",{className:gd,children:[I("div",{className:pd,children:I(wc,{date:n,isRead:a})}),a?I(bl,{Component:hl}):I(cd,{children:I(bl,{Component:hl})})]})]}),I("div",{className:md,children:Vr(r)?P(N,{children:[I(bl,{Component:ld}),I(fc,{children:"Shared a file"})]}):I(fc,{children:r})})]})})}const Cd=dr({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),xd=dr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Td({text:e,isRead:t}){return t?I(fc,{children:e}):P("div",{className:Cd,children:[I("div",{className:xd}),I(xc,{children:e})]})}const wd=J(),kd=kr(null,dr({paddingLeft:"25px"})),Ed=[wd.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(mc,{children:I(id,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(Ec,{stylists:[kd],children:"From"}),size:160,maxSize:160}),wd.accessor("subject",{id:"subject",cell:({row:e})=>P(mc,{children:[I(Td,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(fc,{children:e.original.latestMessage.text})]}),header:()=>I(Ec,{stylists:[kd],children:"Subject"}),size:200}),wd.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(mc,{children:I(wc,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(nd,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:ad,sortAscDisplay:rd}),size:150,maxSize:150}),wd.display({id:pc,cell:({row:e})=>I(yd,{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 Ad(e){return e?Ed.filter(e=>e.id===pc):Ed.filter(e=>e.id!==pc)}const Sd=[],Id=dr({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"}),Nd=kr(vr["empty-dashboard-layout"],Id);function Pd({children:e}){return I("div",{...Nd,"data-testid":"empty-dashboard-layout",children:e})}const Rd=dr({width:"25px",height:"25px",borderRadius:"sm"});function Dd({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return br(e)?P(N,{children:[!r&&I(ii,{styles:Rd}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[kr(vr["large-icon"],vr.icon),...n??[]],size:25})}const Md=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I(oc,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),Ld=Ei(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"}),Fd=dr({width:"15px",height:"15px",borderRadius:"sm"});function Od({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return br(e)?P(N,{children:[!r&&I(ii,{styles:Fd}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[kr(vr["medium-icon"],vr.icon),...n??[]],size:15})}function Vd(){const e=zs();return P(N,{children:[I(Dd,{Component:Ld}),I(Do,{wrap:"wrap",children:"Need help with your financials?"}),P(Md,{...kr(vr["zero-state-button"]),onClick:()=>{ys(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>hs("Conversation",{routeProps:{conversationId:null}}))},children:[I(Do,{children:"Message Bookkeeper"}),I(Od,{Component:hl})]})]})}const Bd=Ei(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 Ud(){return P(N,{children:[I(Dd,{Component:Bd}),I(Do,{wrap:"wrap",children:"All caught up"}),I(Lo,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const Wd=l({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function Hd(e){const{registerAnchor:t}=i(Wd);g(()=>{t(e)},[e,t])}const _d=kr(null,dr({display:"flex",flexDirection:"row",gap:"5px"}));function zd({children:e}){return I("div",{..._d,children:e})}const qd=gr({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function jd(e){return I(e?Ud:Vd,{})}function Kd({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){Hd(al);const i=function({conversations:e,isMobile:t}){return $({data:e??Sd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??Sd.length,columns:Ad(t),getCoreRowModel:ee(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Hl({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!fr(l?.data?.[0])&&!s;return P("div",{className:qd({isMobile:o}),children:[I("div",{id:al}),P(fl.Provider,{value:r,children:[P(Sr,{children:[I(Mr,{children:"Conversations"}),P(zd,{children:[I(wl,{}),I(cc,{})]})]}),I(uc,{dashboard:"financialOverviewDashboard",children:a?I(Nl,{numColumns:4}):P(N,{children:[!o&&I(hc.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(Gl,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(ts,{editMutationKey:i.options.meta?.editMutationKey,children:I(Xl,{children:i.getRowModel().rows.map(e=>I(qs,{rowData:e,isMobile:o},e.id))})}):I(Pd,{children:jd(c)})]})})]})]})}const Yd=kr(vr.body,Rr({body:"default"}));function Zd({children:e,stylists:t=[]}){if(Vr(e))return null;const n=Pr([Yd,...t]);return I("div",{...n,children:e})}const Gd=kr(null,dr({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Qd=gr({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),Xd=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Jd(){return I("div",{...Gd,children:Xd.map((e,t)=>I(ii,{styles:Qd({width:e?.width})},t))})}const $d=dr({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}"}),eu=dr({position:"relative",width:"25px",height:"25px"});function tu({hasUnread:e}){return P("div",{className:eu,children:[I(Dd,{Component:Ld}),e&&I("div",{"data-testid":"unread-comment-badge",className:$d,"aria-hidden":"true"})]})}const nu=kr(vr["financial-summary-chatbox-header"],dr({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function ru({hasUnreadMessages:e=!1,showMessageIndicator:t}){return P("div",{...nu,children:[I(Do,{children:"Message Bookkeeper"}),t&&I(tu,{hasUnread:e})]})}const au=dr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function ou(){const e=zs();return P("div",{className:au,children:[I(Dd,{Component:Bd}),I(Do,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(Lo,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),P(Md,{...kr(vr["zero-state-button"]),onClick:()=>{ys(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>hs("Conversation"))},children:[I(Do,{children:"Send a Message"}),I(Od,{Component:hl})]})]})}const iu=dr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function lu({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=jl(),{startPrefetch:a,cancelPrefetch:o}=Bs(),i=u(()=>{a({id:t}),n({id:t})},[t,a,n]),l=u(()=>{o(),r()},[o,r]);return P("div",{className:iu,children:[I(Dd,{Component:Bd}),I(Do,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(Lo,{wrap:"wrap",children:"Pick up where you left off."}),I(ic,{onClick:()=>hs("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(Do,{children:"Continue conversation"})})]})}const su=dr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function cu({summaryId:e}){return P("div",{className:su,children:[I(Dd,{Component:Bd}),I(Do,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(Lo,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(ic,{...kr(vr["zero-state-button"]),onClick:()=>hs("FinancialSummary",{routeProps:{summaryId:e}}),children:I(Do,{children:"Talk to a bookkeeper"})})]})}function du({summaryId:e,conversationId:t}){const n=br(t);return fr(e)?I(ou,{}):n?I(lu,{conversationId:t,summaryId:e}):I(cu,{summaryId:e})}const uu=dr({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"}),hu=kr(vr["financial-summary-chatbox"],dr({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 pu({summaryData:e}){const t=br(e?.summary),n=br(e?.conversation);return P("div",{className:uu,children:[I(ru,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...hu,children:I(du,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const gu=Ei(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"),mu=dr({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function vu(){return P("div",{className:mu,children:[I(Dd,{Component:gu}),I(Do,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const fu=dr({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),bu=gr({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:{}}}}),yu=kr(null,dr({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),Cu=dr({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function xu({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Kr({queryKey:(t={limit:1,filter:{date:{equal:mt(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Us(t):["summaries",{}],queryFn:Hs,...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 $${mi.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${vi.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=kr(vr["financial-summary-layout"],bu({isSample:e,isZeroState:o}));return P("div",{className:Cu,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(Jd,{}):o?I(vu,{}):P("div",{className:fu,children:[I(Zd,{stylists:[yu],children:a}),e&&I(gi,{size:"lg"})]})}),I(pu,{summaryData:n})]})}const Tu=kr(vr["month-picker"],dr({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),wu=kr(vr["month-picker-left-button"],dr({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),ku=kr(vr["month-picker-right-button"],dr({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),Eu=kr(vr["month-picker-label"],dr({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function Au({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=ht(e.year,e.month,1),o=_t(a,{abbreviateMonth:!0});return P("div",{...Tu,children:[I(ic,{stylists:[wu],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(bl,{Component:ul})}),I("div",{...Eu,children:I(Do,{children:o})}),I(ic,{stylists:[ku],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(bl,{Component:hl})})]})}const Su=dr({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function Iu({children:e}){return I("div",{className:Su,children:e})}function Nu(){return yn(e=>e.events.bITile)}const Pu=gr({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),Ru=kr(vr["progress-bar"],dr({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),Du=kr(vr["progress-bar-fill"],dr({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),Mu=kr(vr["tile-bar-label"],dr({paddingLeft:"10px"})),Lu=kr(vr["tile-bar-label-outer"],dr({paddingLeft:"10px"}));function Fu({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?vr["bar-transactions-positive"]:vr["bar-transactions-negative"],l=kr(i,Pu({color:n})),s=Pr([Du,l]);return P("div",{...Ru,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...Mu,children:I(fc,{children:e})})}),!o&&I("div",{...Lu,children:I(fc,{children:e})})]})}const Ou=kr(vr["metric-md"],dr(Rr.raw({metric:"md"}),co));function Vu(e){return I("div",{...Ou,children:e.children})}const Bu=dr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),Uu=dr({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function Wu({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 P("div",{className:Bu,children:[I(Fu,{label:e,percentage:a,color:r}),I("div",{className:Uu,children:I(Vu,{children:Ao(t)})})]})}const Hu=Ei(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"),_u={},zu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return _u[e]={loading:!1,error:null,scriptEl:t}},qu="undefined"!=typeof window&&void 0!==window.document;function ju({src:e,checkForExisting:t=!1,...n}){let r=_u[e];!r&&t&&e&&qu&&(r=zu(e));const[a,o]=d(r?r.loading:Boolean(e)),[i,l]=d(r?r.error:null),[c,u]=d(!1);return s(()=>{if(!qu||!e||c||i)return;let a;r=_u[e],!r&&t&&(r=zu(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=_u[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 _u[e])}},[e]),[a,i]}const Ku=e=>["integrations",e??{}],Yu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(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 Ml({...t,queryKey:Ku(e),queryFn:Yu})}function Gu(e){return Zu({filter:{apiName:{equal:"PLAID"}}},e)}function Qu(e){return Ha(`${t=e,_a[t]}/v1`,"v1");var t}async function Xu({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}=Oa(r);return await Di({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const Ju="cancel",$u="danger",eh="success",th=dr({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),nh=dr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),rh=gr({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"}}),ah={transform:"none",willChange:"auto"};function oh({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?vr["alert-dialog"]:null,{className:h}=kr(u,rh({size:r,padding:a}));return e?I(fe,{children:I(be,{lockScroll:!0,className:th,children:I(ye,{context:l,modal:!0,returnFocus:!0,children:I("div",{...d(),className:h,style:ah,children:n})})})}):null}const ih=kr(vr["close-button"],dr({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"}}),vl),lh=()=>ps();function sh({Icon:e=Fc,handleClose:t=lh}={}){return I("button",{...ih,onClick:t,type:"button",children:I(Od,{Component:e,...ih})})}const ch=kr(vr["alert-header"],dr({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"template"},so));function dh({children:e}){return I("div",{...ch,children:e})}const uh=dr({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),hh=dr.raw({width:"100%"}),ph=e=>{switch(e){case gh.DANGER:return"danger";case gh.SUCCESS:return"success";case gh.ACTION:return"primary";default:return"secondary"}},gh={SUCCESS:"success",DANGER:"danger",ACTION:"action"},mh=Ce.createConfirmation(xe(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return P(oh,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[P("div",{className:nh,children:[I(dh,{children:r}),o&&I(sh,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(fc,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:uh,children:i.map(e=>I(oc,{intent:ph(e.type),styles:hh,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(Do,{children:e.label})},e.key))})]})}));function vh(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function fh(e){return new W(e).div(100).toNumber()}function bh(e){return new W(e).times(100).toNumber()}function yh(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function Ch(e,t){return t?e?`${e} ${yh(t)}`:yh(t):e??""}const xh=e=>{ys(yn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:{defaultValues:e},error:null},()=>hs("Conversation",{routeProps:{conversationId:null,defaultValues:e}}))},Th=dr({display:"flex",flexDirection:"column",gap:"12px"});async function wh(e){await mh({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Ju,label:"Cancel"},{key:eh,label:"Chat",type:gh.SUCCESS}]})===eh&&xh({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const kh=e=>["banks/accounts",e??{}],Eh={integration:{expand:!0},status:{notIn:["REMOVED"]}},Ah=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:Ri(o)},l=await Ua(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function Sh(e){return Ml({queryKey:kh({...e?.params,filter:{...Eh,...e?.params?.filter}}),queryFn:Ah,enabled:e?.enabled,select:e?.select})}function Ih(e,t){return xs({queryKey:Fr(kh({filter:Eh}),{}),queryFn:Ah,accessToken:e,environment:t})}const Nh={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},Ph={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."}},Rh={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:Ph.short.credentialsChanged,longMessage:Ph.long.relinkCredentials,buttonType:Nh.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:Ph.short.credentialsChanged,longMessage:Ph.long.relinkCredentials,buttonType:Nh.RELINK},INVALID_MFA:{shortMessage:Ph.short.credentialsChanged,longMessage:Ph.long.relinkCredentials,buttonType:Nh.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:Ph.short.credentialsChanged,longMessage:Ph.long.invalidUpdatedUsername,buttonType:Nh.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:Ph.short.accountLocked,longMessage:Ph.long.accountLocked,buttonType:Nh.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:Ph.short.credentialsChanged,longMessage:Ph.long.relinkCredentials,buttonType:Nh.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:Ph.short.supportChanged,longMessage:Ph.long.supportChanged,buttonType:Nh.CHAT},USER_SETUP_REQUIRED:{shortMessage:Ph.short.updateNeeded,longMessage:Ph.long.updateNeeded,buttonType:Nh.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:Ph.short.supportChanged,longMessage:Ph.long.mfaUpdateNeeded,buttonType:Nh.OPEN_BANK},NO_ACCOUNTS:{shortMessage:Ph.short.noAccountsAvailable,longMessage:Ph.long.noAccountsUnlink,buttonType:Nh.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:Ph.short.noAccountsAvailable,longMessage:Ph.long.noAccountsUnlink,buttonType:Nh.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:Ph.short.connectionError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},ITEM_NOT_FOUND:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},PRODUCT_NOT_READY:{shortMessage:Ph.short.serverError,longMessage:Ph.long.productNotReady,buttonType:Nh.CHAT},USER_PERMISSION_REVOKED:{shortMessage:Ph.short.connectionError,longMessage:Ph.long.permissionRevoked,buttonType:Nh.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:Ph.short.temporarilyDown,longMessage:Ph.long.bankMaintenance,buttonType:Nh.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:Ph.short.serverDown,longMessage:Ph.long.serverDown,buttonType:Nh.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:Ph.short.temporarilyDown,longMessage:Ph.long.bankMaintenance,buttonType:Nh.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:Ph.short.supportChanged,longMessage:Ph.long.supportChanged,buttonType:Nh.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:Ph.short.connectionError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT},PLANNED_MAINTENANCE:{shortMessage:Ph.short.temporarilyDown,longMessage:Ph.long.bankConnectionMaintenance,buttonType:Nh.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:Ph.short.requestError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:Ph.short.inputError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:Ph.short.volumeDown,longMessage:Ph.long.bankMaintenance,buttonType:Nh.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:Ph.short.serverError,longMessage:Ph.long.connectionError,buttonType:Nh.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:Ph.short.updateNeeded,longMessage:Ph.long.partnerCredsChange,buttonType:Nh.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:Ph.short.credentialsExpiring,longMessage:Ph.long.credentialsExpiring,buttonType:Nh.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:Ph.short.relinkNeeded,longMessage:Ph.long.relinkForStatements,buttonType:Nh.RELINK}},DEFAULT:{DEFAULT:{shortMessage:Ph.short.connectionError,longMessage:Ph.long.connectionError,buttonType:Nh.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:Ph.short.generic,longMessage:Ph.long.generic,buttonType:Nh.CHAT}}};function Dh({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=Rh[e];if(!n)return Na({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),Rh.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(Na({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),Rh.DEFAULT.DEFAULT)}function Mh(e){return!0===e?.additionalConsentRequired}const Lh=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:fs({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:fs({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 Fh({mutationFn:e,onMutateFn:t,onSuccess:n,onError:r,...a}){const o=Wr(),i=jr(),l=!Vr(o);return O({...a,mutationFn:l?t=>e({data:t,accessToken:o,environment:i}):Hr,onMutate:l&&br(t)?e=>t({data:e,accessToken:o,environment:i}):void 0,onSuccess:n,onError:r},zr)}const Oh=l({createToast:()=>null,dismiss:()=>{}});function Vh(){const{createToast:e,dismiss:t}=i(Oh);return o(()=>({success:(t,n)=>e("success",t,n),error:(t,n)=>e("error",t,n),dismiss:t}),[e,t])}function Bh({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(br(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);br(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(fr(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 Uh(e){return"object"==typeof e&&null!==e}const Wh={isFailureResult:function(e){return Uh(e)&&"FAILURE"===e.result},isPartialFailure:function(){return!1},getErrorMessages:function(e){if(!Uh(e)||!br(e.errors))return[];const t=[],{fieldErrors:n,globalErrors:r}=e.errors;if(br(n))for(const a of Object.values(n))br(a)&&Br(a.errorMessage)&&t.push(a.errorMessage);if(Array.isArray(r))for(const a of r)br(a)&&Br(a.errorMessage)&&t.push(a.errorMessage);return t}};function Hh({mutationFn:e,onSuccess:t,onError:n,meta:r,...a}){const o=Vh(),{onSuccess:i,onError:l}=Bh({toast:o,responseErrorParser:Wh,toastOptions:r?.toastOptions,onSuccess:t,onError:n});return Fh({...a,mutationFn:async({data:t,accessToken:n,environment:r})=>{const a=await e({data:t,accessToken:n,environment:r});return Wh.isFailureResult(a)?Promise.reject(a):a},onSuccess:i,onError:l})}const _h=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:ja(n)};return await Wa(r)},zh=async({data:e,accessToken:t,environment:n})=>_h({data:e,accessToken:t,environment:n}),qh=async({data:e,accessToken:t,environment:n})=>_h({data:e,accessToken:t,environment:n}),jh=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:ja(n)};return await Wa(r)})({data:{accounts:e},accessToken:t,environment:n});function Kh(e){return Hh({onSuccess:async()=>{Ia("mutation successful, invalidating bank account queries");try{return zr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&Na({error:e,severity:"error"})}},...e})}function Yh(){return Kh({mutationFn:qh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update account"}}})}function Zh(){return Hh({onSuccess:async()=>{Ia("mutation successful, invalidating bank account queries");try{return zr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&Na({error:e,severity:"error"})}},mutationFn:jh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update accounts"}}})}const Gh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,Qh=e=>"PLAID"===e,Xh=e=>({id:bs(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),Jh=dr({display:"flex",flexDirection:"column",gap:"16px"}),$h=async()=>mh({title:"Merge Accounts",body:P("div",{className:Jh,children:[I(fc,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(fc,{wrap:"wrap",children:"This action can't be undone."}),I(fc,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Ju,label:"Cancel"},{key:$u,label:"Continue",type:gh.DANGER}]}),ep=()=>mh({title:"Merge Failed",body:I(fc,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Ju,label:"OK"}]}),{formContext:tp,fieldContext:np,useFieldContext:rp,useFormContext:ap}=Te(),op=Ei(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 ip({children:e,stylists:t=[],...n}){return I(oc,{intent:"success",stylists:t,...n,children:e})}function lp({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return P(ip,{type:"submit",disabled:n,children:[e&&I(bl,{Component:op}),I(Do,{children:t})]})}const sp=dr({animation:"linear 1s spin infinite"}),cp=dr({background:"conic-gradient(from 90deg, transparent 0deg, {colors.icon.base.weak} 360deg)",height:"100%",width:"100%",opacity:1}),dp=dr({position:"relative"});function up({size:e}){const t=e??15;return I("div",{className:dp,children:P("svg",{className:sp,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:cp})})})}),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 hp=kr(null,dr({display:"flex",width:"100%"}));function pp({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r,isSubmitting:a}){let o;return o=a&&e?P(N,{children:[I(up,{size:12}),I(Do,{children:t})]}):a&&!e?I(up,{size:12}):!a&&e?P(N,{children:[I(bl,{Component:op}),I(Do,{children:t})]}):I(Do,{children:t}),I(Md,{type:"submit",disabled:n||a,stylists:[hp],onClick:r,children:o})}const gp=gr({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 mp({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=kr("vertical"===e?vr["vertical-divider"]:vr["horizontal-divider"],n,gp({alignment:e,color:t}));return I("div",{...r})}const vp=dr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),fp=[kr(null,dr({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],bp=kr(null,dr({display:"flex",alignItems:"center",gap:"4px"}));function yp({errorMessage:e}){return P("div",{...bp,children:[I(Od,{Component:Si,stylists:fp}),I(Lo,{intent:"danger",wrap:"wrap",children:e})]})}const Cp=dr({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function xp({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o,isSubmitting:i}){return P(N,{children:[I(mp,{alignment:"horizontal",color:"normal"}),P("div",{className:vp,children:[e,o&&I("div",{className:Cp,children:I(yp,{errorMessage:o})}),I(pp,{showIcon:t,disabled:r,onClick:a,textContent:n,isSubmitting:i})]})]})}const Tp=dr.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"}}),wp=dr.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function kp({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 Ep=dr({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},Tp),Ap=dr(wp),Sp=dr({display:"flex",flexDirection:"column",gap:"8px"}),Ip=dr({display:"flex",justifyContent:"space-between",alignItems:"center"});function Np({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=kr(i||null,Ep,l,Ap,vl),[b,y]=d(!0),{dataAttributes:C}=kp({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:m,disableHover:h,disabled:v});return P("div",{className:Sp,children:[P("div",{className:Ip,children:[void 0!==r&&I(fc,{children:r}),br(g)&&I(fc,{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?.()},...C,children:e}),o&&"open"!==n?.["data-state"]&&u&&I(yp,{errorMessage:u})]})}function Pp({disabled:e=!1,...t}){const n=rp(),r=we(n.form.store,e=>e.isSubmitting);return I(Np,{...t,disabled:r||e})}const Rp=dr({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 Dp({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a,disabled:o}){const i=rp(),l=we(i.store,e=>e.meta.errors[0]?.message),s=we(i.store,e=>e.meta.isDefaultValue),c=we(i.store,e=>e.meta.isTouched);return I(Pp,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:s,isTouched:c,className:vr["discreet-form-input"],additionalStyles:Rp,errorMessage:l,onClick:a,onBlur:i.handleBlur,disabled:o,children:e})}function Mp(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 Lp(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Fp(e){"Enter"===e.key&&e.currentTarget.blur()}const Op=kr(vr["amount-input"],Rr({metric:"md"}),dr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),Vp=kr(null,dr({display:"flex",alignItems:"center",gap:"2px"}));function Bp({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=d(!1);return P("div",{...Vp,children:[fr(e)&&I(Vu,{children:"$"}),I(Ee,{...Op,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:fr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Fp,autoFocus:o})]})}const Up=gr({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 Wp({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=rp(),h=we(u.store,e=>e.meta.errors[0]?.message),p=we(u.store,e=>e.meta.isTouched),g="string"==typeof u.state.value?u.state.value.length:0,m=br(c)?c-g:void 0;return I(Pp,{label:t,inputRef:r,popupTriggerProps:o,className:vr["editable-form-input"],additionalStyles:Up({kind:e}),errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:m,hasErrorStyles:d,disabled:a,children:n})}const Hp=kr(null,dr({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function _p({options:e,onSelect:t,selectedLabel:n}){const r=Mc();return I("div",{...Hp,children:e.map(e=>I(Kc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const zp=Ei(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"),qp=kr(vr["dropdown-selector-button"],dr({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"}}),gl);function jp({selectedLabel:e,options:t,onSelect:n}){return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>P("button",{...qp,...t,children:[I(Do,{children:e}),I(Oc,{Component:zp})]})}),I(qc,{children:I(_p,{options:t,onSelect:n,selectedLabel:e})})]})}const Kp=kr(null,dr({display:"flex",alignItems:"center",gap:"15px"})),Yp=Pt.map((e,t)=>({value:t,label:e})),Zp=Rt({}).map(e=>({value:e,label:String(e)}));function Gp({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return P("div",{...Kp,children:[I(jp,{selectedLabel:Pt[r],options:Yp,onSelect:e=>a(n,e)}),I(jp,{selectedLabel:String(n),options:Zp,onSelect:e=>a(e,r)})]})}const Qp=kr(null,dr({background:"surface.foreground",padding:"25px",gap:"15px"})),Xp=kr(null,dr({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),Jp=kr(vr["date-picker-nav-button"],dr({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"}}),gl),$p=kr(null,dr({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),eg=kr(null,dr({padding:"8px",textAlign:"center"})),tg=kr(vr["date-picker-day-button"],dr({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"}}),gl),ng=kr(null,dr({color:"typography.base"}));function rg({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&Dt(e,t),l=Mt(e),s=e.getMonth()!==n,c=!!a&&Lt(e,a),d=!!o&&Lt(o,e);return I("button",{...tg,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(Do,{stylists:s||c||d?[ng]:[],children:e.getDate().toString()})})}function ag({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=Mc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=ht(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&&Lt(a,u),g=fr(o)||d.length>0&&Lt(d[0],o),m=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return P("div",{...Qp,children:[P("div",{...Xp,children:[I("button",{...Jp,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:I(bl,{Component:ul})}),I(Gp,{currentMonthYear:l,onMonthYearChange:r}),I("button",{...Jp,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:I(bl,{Component:hl})})]}),P("div",{...$p,children:[Nt.map(e=>I("div",{...eg,children:I(Lo,{children:e})},e)),d.map(t=>I(rg,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const og=kr(null,Rr({label:"default"}),dr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),ig=kr(null,Rr({label:"default"}),dr({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 lg(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant",block:"end"}),e.current.setAttribute("data-hasscrolled","true"))}async function sg(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 cg=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),dg=[...cg].map(e=>`.${e}`).join(","),ug=/* @__PURE__ */new Set(["xls","xlsx","csv"]),hg={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...cg].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."},pg={"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 gg(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 mg(e,t,n){return gg(e,null,e.name,t,!1,!0,n)}async function vg(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||!cg.has(r))return hg.unsupportedFileType;if(e.size>52428800)return ug.has(r)?hg.fileTooLargeSpreadsheet:hg.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await sg(e);for(const e of a)if(await sg(e.file)===t)return hg.duplicate}return null}(e,t);return n?mg(e,n):gg(e,null,e.name,hg.pendingUpload,!0,!1)}const fg=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=ja(n).getUrl(`/files/upload/${a}`),s=Vr(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 bg(){return Fh({mutationFn:fg,onSuccess:async()=>zr.invalidateQueries({queryKey:["files/attachments"]})})}const yg=async({data:e,accessToken:t,environment:n})=>{const r=ja(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 Cg=dr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),xg=dr({display:"none"}),Tg=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=bg();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 gg(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return mg(e.file,hg.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=>vg(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 P("div",{children:[I("input",{className:xg,type:"file",multiple:!0,accept:dg,ref:r,onChange:l}),I(ic,{type:"button",onClick:i,children:I("span",{className:Cg,children:I(Od,{Component:ld})})})]})},wg=S.custom(),kg=S.object({message:S.object({text:S.string(),attachments:S.array(wg)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),Eg=dr.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),Ag=dr.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"}),Sg=dr(Ag,Eg),Ig=dr.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),Ng=dr(Ig,Eg,Rr.raw({body:"default"})),Pg=dr({display:"block",width:"100%"}),Rg=dr({position:"relative"}),Dg=dr({display:"flex",justifyContent:"flex-end",gap:"15px"}),Mg=dr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Lg=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=rp(),c=a(null),{startCallback:d}=Ll({delay:50,callback:e=>n(e)});m(l,()=>c.current);const u=!e&&kg.safeParse(s.form.state.values).success;return I(Wp,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(lg(t),void d(!0)),children:P("div",{className:Pg,children:[P("div",{className:Rg,children:[P("pre",{className:Sg,children:[s.state.value.text,I("br",{})]}),I("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:Ng,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),P("div",{className:Dg,children:[!i&&I(Tg,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),I(ic,{disabled:!u,type:"submit",children:I("span",{className:Mg,children:I(Od,{Component:Bd})})})]})]})})}),Fg=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,Og=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 Vg(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 Bg(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 Ug(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 Wg(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 Hg(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(Og),[h,p]=v(Vg,{focusedIndex:null,maxIndex:e});s(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&fr(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=Mc(),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(Bg)),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}=Wg(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&&Ug(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:C}=Ll({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&Ug(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return x=l.focusedIndex,s(()=>{const e=E.current;if(null===x||T)return;const{node:t,metadata:n}=Wg(x,w,k);return A.lastOpenedIndex!==x&&n?.hasCascading&&(A.closeCurrentCascade(),S({focusedIndex:x,node:t,listElement:e})),()=>I()},[x,T=c,E=r,A=e,I=C,w=f,k=b,S=y]),function(e,t,n,r){s(()=>{const{metadata:a}=Wg(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 x,T,w,k,E,A,S,I}const _g=l(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function zg({style:e,children:t,forceNewCascade:n}){const r=kr(vr["popup-list"],Sc,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=Hg(a);return I("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:I(Og.Provider,{value:o,children:I(_g.Provider,{value:a,children:t})})})}function qg({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=Br(e),h=e=>{n?.(e)};return P(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 jg=hr(Rr({body:"default"}),dr({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function Kg({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:jg})}function Yg({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=Mc(),[c,u]=d(""),h=Br(c),p=l?.(h);return I(qc,{children:I(zg,{style:p,children:I(qg,{searchTerm:c,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:Kg,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(Og);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 Gg=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...Nc,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(Gg,{...Nc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),Xg=dr({display:"flex",gap:"8px",alignItems:"center"});function Jg({promptText:e}){return P("div",{className:Xg,children:[I(bl,{Component:js}),I(fc,{children:e})]})}function $g({text:e}){return I("div",{...Nc,children:e?I(Do,{children:e}):I(ii,{styles:dr({width:"100%",height:"16px"})})})}const em=kr(vr["popup-list"],Sc),tm=()=>P("div",{...em,children:[I($g,{}),I($g,{}),I($g,{}),I($g,{}),I($g,{})]});function nm({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(tm,{}):P(N,{children:[r&&I(Qg,{onClick:()=>hs("BankAccountForm"),children:I(Jg,{promptText:"Add bank account"})}),e?.map(e=>I(Qg,{onClick:()=>t(e),children:I(Do,{wrap:"wrap",children:Ch(e?.name,e?.mask)})},e?.id))]})}const rm={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},am={...rm,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function om({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ae(e??[],am),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(tm,{}):P(N,{children:[a&&I(Qg,{onClick:()=>hs("BanksAndIntegrations"),children:I(Jg,{promptText:"Add bank account"})}),0===l.length?I($g,{text:"No results found"}):l.map(e=>I(Qg,{onClick:()=>n(e),children:I(Do,{wrap:"wrap",children:Ch(e?.name,e?.mask)})},e?.id))]})}function im({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(Yg,{onClick:e,placeholder:"Search bank accounts...",SearchList:om,DefaultList:nm,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const lm=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function sm({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=Ch(n?.name??"",n?.mask??"");return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:r=>I(Wp,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:lm,type:"button",disabled:t,children:br(n)?I(fc,{children:i}):I(fc,{intent:"weak",children:"Select bank account"})})})}),I(im,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const cm=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),dm=e=>{if(fr(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||br(e.lastSyncedDate))},um=()=>{const e=Sh({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function hm(){return Sh({select:e=>{return{...e,plaidItemAccountsReadyToSync:dm(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>Qh(e.apiName)))};var t}})}function pm(e){return e?.filter(e=>Gh(e.apiName)&&"ACTIVE"===e.status)}function gm(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function mm(e){return Sh({select:t=>({...t,data:gm(t?.data,e)})})}const vm=e=>{const{query:t}=Sh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data};function fm({options:e,onClick:t}){const n=Mc();return I(qc,{children:I(zg,{children:e.map((e,r)=>I(Qg,{onClick:()=>(t(e),void n.close()),children:I(fc,{children:e.label})},`${e.label}_${r}`))})})}const bm=kr(null,dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),ym=dr.raw({color:"typography.base.weak"}),Cm=(e,t)=>e===t;function xm({options:e,label:t,isEqual:n=Cm,isEmpty:r,disabled:a}){const o=rp(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!fr(o.state.value)&&!r?.(o.state.value);return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:n=>I(Wp,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...bm,type:"button",children:I(fc,l?{children:i(e,o.state.value)}:{extraClassNames:[ym],children:`Select ${t.toLowerCase()}...`})})})}),I(fm,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const Tm=dr({border:"none",outline:"none",backgroundColor:"transparent"},Rr.raw({label:"default"})),wm=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"})),km=Ei(wm,"Bank",{styleIconKey:"bank"}),Em=gr({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 Am({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?Ch(e,t):e;return P("div",{className:Em({active:r}),children:[n&&I(Lo,{intent:r?"normal":"weak",children:n}),I(fc,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const Sm=e=>["plaidInstitutionLogo",e??{}],Im=kr(vr["category-icon"],dr({objectFit:"contain"})),Nm=kr(vr["category-icon"],dr({objectFit:"contain",color:"icon.base"}));function Pm(e,t,n){const r=({size:n=24})=>{const{icons:r}=i(wi),a=e;return Br(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?I(Se,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...Nm}):I("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...Im});var o};return r.displayName=t,r}const Rm=dr({display:"flex",gap:"10px",maxWidth:"100%"});function Dm({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=Wr(),n=jr();return M({queryKey:Sm({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Xu({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?Pm(i,"Logo"):void 0;return P("div",{className:Rm,children:[I(Dd,{Component:l&&o?l:km}),I(Am,{accountName:e,accountNo:t,active:a,syncText:r})]})}const Mm=kr(vr.text,Rr({label:"strongLabel"}),dr({maxWidth:"100%"}),io);function Lm({children:e,stylists:t=[]}){const n=Pr([Mm,...t]);return I("div",{...n,children:e})}const Fm=dr({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Om({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(ic,{popupTriggerProps:r,disabled:n,width:"fill-parent",children:I(Lm,{children:e?Ch(e.name,e.mask):P("div",{className:Fm,children:[I(fc,{children:t}),I(bl,{Component:js})]})})})}const Vm="TRIGGER_ACCOUNT",Bm="FORM_SELECTABLE_ACCOUNT",Um=dr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Wm({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return P("div",{className:Um,children:[P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>I(Om,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Vm?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(im,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I(yp,{errorMessage:o})]})}const Hm=(e,t,n)=>{if(!n)return;const r=e===Bm?t:n,a=e===Bm?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)&&Gh(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},_m=dr({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),zm=dr({display:{base:"block",sm:"none"}}),qm=dr({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),jm=dr({display:"flex",justifyContent:"center",alignItems:"center"}),Km=dr({display:{base:"none",sm:"block"}}),Ym=dr({display:{base:"block",sm:"none"}});function Zm({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return P("div",{className:_m,children:[P("div",{className:qm,children:[o?I(Wm,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Vm,bankAccounts:n,isFilling:r,warningMessage:Hm(Vm,e,t??null)}):I(Om,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),P("div",{className:jm,children:[I("div",{className:Km,children:I(Od,{Component:hl})}),I("div",{className:Ym,children:I(Od,{Component:zp})})]}),I(Dm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:zm,children:I(mp,{alignment:"horizontal"})})]})}function Gm({queryKey:e,queryFn:t,...n}){const r=Wr(),a=jr(),o=Br(r),i=Lr(e,r??"",a),l=D(),s=B({...n,queryKey:i,queryFn:o?t:Hr,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},zr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const Qm=e=>["vendors",e??{}],Xm=e=>["vendors","infinite",e??{}],Jm=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:Ri(r)},o=await Ua(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},$m=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return Jm({queryParams:n,cursor:r,accessToken:a,environment:o})};function ev(e={},t){return Ml({queryKey:Qm(e),queryFn:$m,...t})}const tv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return Jm({queryParams:n,cursor:o,accessToken:r,environment:a})},nv="FAILURE";function rv(e){return"object"==typeof e&&null!==e}function av(e){return!!rv(e)&&(e.result===nv||Array.isArray(e.data)&&e.data.some(av))}const ov={isFailureResult:function(e){return rv(e)&&e.result===nv},isPartialFailure:function(e){return!(!rv(e)||e.result===nv)&&Array.isArray(e.data)&&e.data.some(av)},getErrorMessages:function e(t){if(!rv(t))return[];const n=[];if(Array.isArray(t.error))for(const r of t.error)br(r)&&Br(r.message)&&n.push(r.message);if(Array.isArray(t.data))for(const r of t.data)n.push(...e(r));return n}};function iv({onSuccess:e,onError:t,meta:n,...r}){const a=Vh(),{onSuccess:o,onError:i}=Bh({toast:a,responseErrorParser:ov,toastOptions:n?.toastOptions,onSuccess:e,onError:t});return Fh({...r,onSuccess:o,onError:i})}async function lv(e){const{url:t,headers:n}=Oa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=Ma({extraHeaders:n,authorization:t});Ia("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return Ia("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),La(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function sv(e){return lv(e)}const cv=async({data:e,accessToken:t,environment:n})=>Ua({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:Ri(n)}),dv=async({data:e,accessToken:t,environment:n})=>sv({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:Ri(n)}),uv=async({data:e,accessToken:t,environment:n})=>Ua({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:Ri(n)}),hv=async()=>await zr.invalidateQueries({queryKey:["vendors"]});function pv(){return iv({mutationFn:cv,onSuccess:hv,meta:{toastOptions:{defaultSuccessMessage:"Vendor saved",defaultErrorMessage:"Couldn't save vendor"}}})}const gv=hr(Rr({body:"default"}),dr({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),mv=dr({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),vv=kr(vr["button-inline"],dr({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function fv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return P("div",{className:mv,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:gv}),I("button",{type:"button",onClick:r,...vv,children:I(Lo,{children:"Add"})})]})}function bv({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(fv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:c}):I(Jg,{promptText:e})})}function yv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ae(e??[],rm),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(tm,{}):P(N,{children:[I(bv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?I($g,{text:"No results found"}):l.map(e=>I(Qg,{onClick:()=>n(e),children:I(fc,{children:e.name})},e.id))]})}function Cv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(tm,{}):P(N,{children:[I(bv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(Qg,{onClick:()=>t(e),children:I(fc,{children:e.name})},e.id))]})}function xv({onClick:e}){const{query:{data:t,isLoading:n}}=ev({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=pv(),a=t?.data??[];return I(Yg,{onClick:e,placeholder:"Search vendors...",SearchList:yv,DefaultList:Cv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}const Tv=dr({all:"unset"});function wv({children:e}){return I("div",{tabIndex:0,role:"button",className:Tv,children:e})}function kv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const Ev=e=>["customers",e??{}],Av=e=>["customers","infinite",e??{}],Sv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:Ri(r)},o=await Ua(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Iv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return Sv({queryParams:n,cursor:r,accessToken:a,environment:o})};function Nv(e={},t){return Ml({queryKey:Ev(e),queryFn:Iv,...t})}const Pv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return Sv({queryParams:n,cursor:o,accessToken:r,environment:a})},Rv=async({data:e,accessToken:t,environment:n})=>Ua({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:Ri(n)}),Dv=async({data:e,accessToken:t,environment:n})=>sv({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:Ri(n)}),Mv=async()=>await zr.invalidateQueries({queryKey:["customers"]});function Lv(){return iv({mutationFn:Rv,onSuccess:Mv,meta:{toastOptions:{defaultSuccessMessage:"Customer saved",defaultErrorMessage:"Couldn't save customer"}}})}const Fv={left:"-100%",right:"100%"},Ov={type:"tween",duration:.3},Vv={x:0},Bv=e=>({x:Fv[e]}),Uv=e=>({x:Fv[e]});function Wv({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(qc,{style:r,modal:!0,forceMount:t,children:e})}const Hv=dr({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),_v=kr(null,Hv);function zv({children:e,clickHandler:t}){const n=Mc();return t||(t=()=>{n.close()}),I(be,{lockScroll:!0,..._v,onClick:t,children:e})}const qv=dr({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 jv({children:e,overlay:t=!1}){const n=Mc(),r=u(e=>{e.stopPropagation()},[]);return I(Ie,{children:n.context.open&&P(Wv,{fadeIn:!1,forceMount:!0,children:[t&&I(zv,{}),I(Ne.div,{transition:Ov,initial:Bv("right"),animate:Vv,exit:Uv("right"),className:qv,onAnimationEnd:r,children:e})]})})}const Kv=dr.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Yv=dr.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=kr(vr["drawer-header"],dr(Kv));function Gv({hideDivider:e=!1,children:t}){return P(N,{children:[I("header",{...Zv,children:t}),!e&&I(mp,{alignment:"horizontal",color:"normal"})]})}const Qv=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Xv({children:e}){return I("div",{className:Qv,children:e})}const Jv=dr({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),$v=gr({base:Yv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function ef({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=Mc();return P(N,{children:[I(Gv,{children:P(Xv,{children:[I(sh,{Icon:ul,handleClose:()=>{r?.(),i.close()}}),I(Do,{children:o}),!fr(t)&&I("div",{className:Jv,children:t})]})}),I("div",{className:$v({padChildren:a}),children:n}),e]})}function tf({overlay:e=!1,...t}){return I(jv,{overlay:e,children:I(ef,{...t})})}const nf=Ei(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"}),rf=dr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),af=kr(vr["drawer-search-bar"],dr({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"})),of=hr(dr({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"}}),Rr({label:"strongLabel"})),lf=kr(null,dr({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function sf({searchTerm:e,setSearchTerm:t,placeholder:n}){return P("div",{className:rf,children:[I(Do,{children:"Search"}),P("div",{...af,children:[I(Od,{Component:nf}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:of}),Br(e)&&I(ic,{stylists:[lf],onClick:()=>t(""),children:I(Od,{Component:Fc})})]})]})}function cf({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=d("");return I(qg,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:sf,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function df({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:d}){const[h,p]=Pc({},a?.selected,i),[g,m]=Pc({},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 uf=Ei(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"),hf=dr({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function pf({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return P("div",{className:hf,children:[I(Od,{Component:uf}),I(Do,{wrap:"wrap",children:`No ${t} found`}),n&&I(Lo,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const gf=dr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function mf({children:e}){return I("div",{className:gf,children:e})}const vf=kr(vr["list-body"],null);function ff({title:e,children:t}){return P(mf,{children:[e,I("div",{...vf,children:t})]})}const bf=Ei(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"),yf=kr(null,dr({fill:"surface.intent.action.active"}));function Cf({selected:e,showEmptyIndicator:t}){return e?I(Od,{Component:Ni,stylists:[yf]}):t?I(Od,{Component:bf}):null}const xf=gr({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 Tf({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=kr(vr["selector-row"],xf({selected:r}),vl);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function wf({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return P(Tf,{handleClick:t,selected:n,children:[e,I(Cf,{selected:n,showEmptyIndicator:r})]})}const kf=dr.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function Ef(){return I(ii,{styles:dr(Ic,kf)})}const Af=dr({width:"70px",height:"24px"}),Sf=dr({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function If(){return P("div",{className:Sf,children:[I(ii,{styles:Af}),P(mf,{children:[I(Ef,{}),I(Ef,{}),I(Ef,{})]}),I(ii,{styles:Af}),P(mf,{children:[I(Ef,{}),I(Ef,{}),I(Ef,{})]})]})}function Nf({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ae(e,rm),[e]),s=df({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(If,{}):0===s.groups.length?I(pf,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):I(ff,{title:I(fc,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return I(wf,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:I(fc,{children:t.value.name})},t.key)})})}const Pf=dr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),Rf=dr({width:"100%"});function Df({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 P("div",{className:Rf,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||p()},children:[I(mp,{alignment:"horizontal"}),I(Tf,{handleClick:i?void 0:()=>{r&&(r(),!o)||l(!0)},children:i?I(fv,{placeholder:t,value:c,onChange:u,onSubmit:()=>{c.trim()&&(n(c.trim()),u(""),l(!1))},onCancel:p,inputRef:h}):I(Jg,{promptText:e})})]})}function Mf(){return yn(e=>e.events.customer)}function Lf({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=Mf(),l=df({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(If,{}):P(mf,{children:[I(Df,{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:br(i)&&!i.preventDefault}),P("div",{className:Pf,children:[I(fc,{children:"Customers"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I(wf,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(fc,{children:t.value.name})},t.key)})})]})]})}function Ff({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=Nv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(kv)})}),{mutateAsync:a}=Lv(),o=Mc(),i=n?.data??[],[l,s]=d(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(tf,{title:"Back",Footer:I(xp,{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(cf,{placeholder:"Search customers...",onClick:e=>{fr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:Nf,DefaultList:Lf,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({[fs({id:n,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function Of({frequencies:e,onClick:t}){const n=Mc();return I(qc,{children:I(zg,{children:e.map(e=>I(Qg,{onClick:()=>(t(e),void n.close()),children:I(Do,{children:e.name})},e.value))})})}const Vf=gr({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 Bf({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=kr(vr["button-group"],hr(Vf({width:a,backgroundColor:o,active:t,corners:i}),Qs,Ys,dr(nc),gl));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(Do,{wrap:"wrap",textAlign:"center",children:e.label}):I(fc,{wrap:"wrap",alignment:"center",children:e.label})})}const Uf=gr({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"},fit:{width:"fit-content"}}}});function Wf({width:e,children:t}){return I("div",{className:Uf({width:e}),children:t})}function Hf({width:e="full",options:t,handleClick:n,selectedIndex:r}){const[a,o]=d(null);return I(Wf,{width:e,children:t.map((t,i)=>P(f,{children:[0!==i&&I(mp,{color:i!==r&&i!==r+1||a===r?"normal":"active"}),I(Bf,{option:t,isActive:i===r,handleClick:()=>n(i),onHoverChange:e=>o(e?i:null),width:e,backgroundColor:"foreground",corners:"rounded"})]},t.value))})}const _f=Ei(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"),zf=dr({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}"},Tp,wp,ml),qf=kr(null,dr({color:"icon.base"})),jf=kr(vr["attachment-dropzone"],zf);function Kf({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return P("div",{...a,...e({className:jf.className,onMouseDown:r,onBlur:n}),children:[I("input",{...t()}),I(Od,{stylists:[qf],Component:_f}),I(fc,{children:"Add Files"})]})}const Yf=dr({display:"flex",flexDirection:"column",gap:"8px"}),Zf=dr({display:"flex",justifyContent:"space-between",alignItems:"center"});function Gf({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return P("div",{className:Yf,children:[o&&I("div",{className:Zf,children:I(fc,{children:o})}),I(Kf,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&I(yp,{errorMessage:i})]})}const Qf=dr({display:"flex",justifyContent:"start",width:"100%"}),Xf=dr({display:"flex",alignItems:"center",gap:"9px"}),Jf=dr({width:"100%"}),$f=gr({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function eb(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function tb({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||!eb(n)}),[e,t]),s=o(()=>new Ae(l,rm),[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(pf,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return P(N,{children:[I("div",{className:Qf,children:I(fc,{children:"Search Results"})}),I("div",{className:$f({nested:u}),children:d.map(e=>I("div",{className:Jf,children:e.map(e=>I(Tf,{handleClick:()=>i(e),selected:r[e.id],children:P("div",{className:Xf,children:[I(Cf,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(fc,{children:e.name})]})},e.id))},e[0].id))})]})}const nb=Ei(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"),rb=gr({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"}}}}),ab=dr({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"}}),ob=dr({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 ib({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=kr(vr["selector-row"],rb({active:r,expanded:a}),vl);return P("div",{...i,children:[o?P("button",{type:"button",className:ab,onClick:t,children:[I(Cf,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:ab,children:e}),!fr(n)&&I("button",{type:"button",className:ob,onClick:n,children:I(Od,{Component:a?nb:zp})})]})}function lb({dimensionValueRows:e,onClick:t}){return e.map(e=>I(Tf,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:P("div",{className:Xf,children:[I(Cf,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(fc,{children:e.value.name})]})},e.key))}function sb({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=df({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||!eb(t)}}),c=s.groups.some(e=>e.getRows().length>1);return P(N,{children:[I("div",{className:Qf,children:I(fc,{children:e})}),I("div",{className:$f({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return P("div",{className:Jf,children:[(c||0===t)&&I(mp,{alignment:"horizontal"}),I(ib,{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(fc,{children:n.value.name})}),n.expanded&&P(N,{children:[I(mp,{alignment:"horizontal"}),I(lb,{dimensionValueRows:r,onClick:i})]})]},e.key)}return I(lb,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function cb({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(cf,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:tb,DefaultList:sb,listLength:t.flatDimensionValues.length,extraProps:t})}function db({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||!eb(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=Mc(),h=Object.values(l).some(Boolean);return I(ef,{title:"Back",Footer:I(xp,{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(cb,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:c,selectedRow:l,setSelectedRow:s})})}function ub(e){const t=Mc();return I(jv,{children:t.open&&I(db,{...e})})}const hb=dr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),pb=dr.raw({color:"typography.base.weak"});function gb(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 mb=/\D/g,vb=dr({border:"none",outline:"none",backgroundColor:"transparent"},Rr.raw({label:"default"})),fb=dr({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),bb=gr({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}}}}),yb=dr({border:"none",background:"none",padding:0,cursor:"pointer"}),Cb=dr({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function xb({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return P("div",{...kr(vr.pill,n,bb({disabled:r})),children:[I("div",{className:Cb,children:e}),I("button",{className:yb,onClick:t,disabled:r,children:I(Oc,{Component:Fc,stylists:[kr(null,fb)]})})]})}const Tb=S.email(),wb=dr({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),kb=dr({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},Rr.raw({label:"default"})),{useAppForm:Eb,withForm:Ab,withFieldGroup:Sb}=ke({formContext:tp,fieldContext:np,formComponents:{SaveButton:lp,FormSaveButton:pp,FormFooter:xp},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=rp();return I(Dp,{inputRef:t,label:e,children:I(Bp,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=rp();return I(Wp,{inputRef:r,label:e,hasErrorStyles:t,children:I(Bp,{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=rp(),s=we(l.store,e=>e.meta.isDefaultValue),c=a(null),[u,h]=d(()=>l.state.value?Bt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Bt(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=Vt(r);if(a){let e=a;t&&n?e=Ht(Wt(a,t),n):t?e=Wt(a,t):n&&(e=Ht(a,n)),l.handleChange(Ut(e)),h(e)}else l.handleChange("")},f=g||(p?Ft(p):""),[b,y]=d(!1),C=e=>{b&&(()=>{if(p&&!s){const e=Vt(g);(t&&e&&Lt(e,t)||n&&e&&Lt(n,e))&&m(Ft(p))}})(),y(e)},x=e=>{"Enter"===e.key&&(e.preventDefault(),C(!b))},T=o?Wp:Dp;return P(Dc,{placement:"bottom-start",onOpenChange:C,open:b,children:[I(Lc,{children:t=>I(T,{label:e,inputRef:c,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:I("input",{...og,ref:c,type:"text",id:l.name,value:f,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:x,autoComplete:"off"})})}),I(qc,{initialFocus:!1,children:I(ag,{selectedDate:p,onDateSelect:e=>{l.handleChange(Ut(e)),m(Ft(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=rp(),i=a(null);return I(Wp,{label:e,inputRef:i,children:I("textarea",{...ig,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:Lg,ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=rp(),a=vm(t?.id??""),{query:{data:o},isFilling:i}=Sh({select:e=>({...e,data:pm(e?.data)})}),l=o?.data,s=br(e)&&!Fg(e);return I(sm,{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=rp(),r=t.findIndex(e=>e.value===n.state.value);return I(Wp,{label:e,disableHover:!0,children:I(Hf,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:xm,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=rp(),l=a(null);return I(Wp,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:I("input",{className:Tm,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?Wp:Dp,{handleBlur:l}=rp();return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(wv,{children:I(fc,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})})}),I(xv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?Wp:Dp;return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(wv,{children:I(fc,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})})}),I(Ff,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??ws[0].name}`;return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>I(Wp,{inputRef:r,label:e,popupTriggerProps:t,children:I(Do,{children:o})})}),I(Of,{frequencies:ws,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=pg,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=rp(),c=we(s.form.store,e=>e.isSubmitting),{mutateAsync:u}=bg(),[h,p]=d(!0),{dataAttributes:g}=kp({isActive:h,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l,disabled:n||c}),{getRootProps:m,getInputProps:v}=Pe({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=>vg(e,n))),...i.map(e=>mg(e,hg.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(Gf,{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 P(Dc,{children:[I(Lc,{children:n=>I(Wp,{label:e,popupTriggerProps:n,children:I("button",{className:hb,type:"button",children:I(fc,t?{children:t.name}:{extraClassNames:[pb],children:`Select ${e.toLowerCase()}...`})})})}),I(ub,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=rp(),o=a(null),i=a(null);return g(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),I(Wp,{label:e,disabled:t,inputRef:o,kind:"text",children:I("input",{className:vb,value:gb(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace(mb,"").length,o=t.value.replace(mb,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=gb(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=rp(),[o,i]=d(""),l=a(null),s=r.state.value,c=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=Tb.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(Wp,{label:e,disabled:t,inputRef:l,kind:"container",children:P("div",{className:wb,children:[s.map(e=>I(xb,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:vr["email-pill"],disabled:t},e)),I("input",{ref:l,className:kb,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 Ib=[kr(null,dr({"& path":{stroke:"icon.base"}}))];function Nb({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return P(ic,{type:"button",onClick:n,children:[e&&I(bl,{Component:Fc,stylists:Ib}),I(Do,{children:t})]})}const Pb=dr({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),Rb=dr({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),Db=dr({maxWidth:"600px"}),Mb=dr({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),Lb=dr({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Fb=dr({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Ob=dr({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Vb=dr({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),Bb=dr({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),Ub=e=>{Mp(e),Lp(e)};function Wb({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=Sh(),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=Wr(),o=jr(),i=br(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,Ts({queryKey:Fr(As({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:Is,accessToken:n,environment:r}))}),Eb({defaultValues:l,onSubmit:async e=>{if(await $h()===$u){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await ep());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=Fr(As({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await xs({queryKey:r,queryFn:Is,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Bt(e.tranStartDate||""),l=Bt(n||""),s=Bt(e.tranMinStartDate||""),fr(l)?i:br(s)?Ht(l,s):(br(i)&&Ht(l,i),i));var i,l,s;return fr(r)?null:Ut(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...Xh(t),duplicateBankAccountIds:[bs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await ep()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return P("form",{className:Pb,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:Ub,children:[P("div",{className:Rb,children:[I(Do,{children:"Merge Accounts"}),I("div",{className:Db,children:I(fc,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),P("div",{className:Mb,children:[P("div",{className:Lb,children:[I("div",{className:Fb,children:I(Do,{children:"Duplicate Account"})}),I("div",{className:Ob,children:I(Do,{children:"Into"})}),I("div",{className:Vb,children:I(Do,{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)&&Gh(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:Bb,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return P(N,{children:[I(Nb,{showIcon:!1,onClick:()=>n()}),I(Md,{onClick:()=>i.reset(o),disabled:!t,children:I(Do,{children:"Clear Selections"})}),I(lp,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Hb=dr({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"}),_b=Ce.createConfirmation(xe(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I(oh,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:Hb,children:I(Wb,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function zb({plaidItemAccounts:e,matchingAccountPairs:t}){await _b({matchingAccountPairs:t,plaidItemAccounts:e})}const qb=dr({display:"flex",flexDirection:"column",gap:"12px"}),jb=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}=Oa(r);return Di({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(Ia("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(Na({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),wh("NO_LINK_TOKEN"))}catch(r){return Na({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),wh("LINK_TOKEN_FAILED")}};async function Kb(e,t,n){const r=await async function(e,t){const n=Fr(Ku({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await xs({queryKey:n,queryFn:Yu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Yb(e,t,n,r){Ia("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||Ia("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,Ts({queryKey:Fr(kh({filter:Eh}),{}),queryFn:Ah,accessToken:r,environment:a});const o=await Kb(e,t,n);if(o){const e=await Ih(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}=Oa(a);return await Va({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(Ia("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([zr.invalidateQueries({queryKey:["integrations"]}),zr.invalidateQueries({queryKey:["banks/accounts",{}]}),zr.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===Dh({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return Na({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 Ih(n,r),s=l?.data?.filter(e=>Gh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=T(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(Na({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await mh({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:Ju,label:"Cancel"},{key:eh,label:"Chat",type:gh.SUCCESS}]})===eh&&xh({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void Na({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 Na({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),mh({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Ju,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return Na({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 mh({title:"All set! Ready to track your transactions?",body:P("div",{className:Th,children:[I(fc,{wrap:"wrap",children:`Your ${n} ${t} ${vh("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(fc,{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(fc,{wrap:"wrap",children:Ch(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:eh,label:"Get Started",type:gh.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:Lh(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 mh({title:"Your transactions are being categorized",body:P("div",{className:qb,children:[I(fc,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(fc,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),P("ul",{children:[r.map(({duplicateAccount:e})=>I("li",{children:I(fc,{wrap:"wrap",children:Ch(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(fc,{wrap:"wrap",children:"and more..."})})]}),I(fc,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Ju,label:"No thanks"},{key:eh,label:"Review",type:gh.SUCCESS}]})===eh&&await zb({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(Na({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>mh({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${vh("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:eh,label:"Get started",type:gh.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return Na({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await mh({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Ju,label:"Cancel"},{key:eh,label:"Chat",type:gh.SUCCESS}]})===eh&&xh({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 fr(e)?(Ia("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(Ia("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(Na({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&&(Na({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 mh({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:Ju,label:"Cancel"},{key:"chat",label:"Chat"},{key:eh,label:"Banks & Integrations",type:gh.SUCCESS}]});"chat"===t?xh({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==eh||(e=>{const t=yn.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||hs("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Gb=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${zt(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},Xb="PLAID_LINK_NEW",Jb="PLAID_LINK_UNLINK_RELINK",$b="PLAID_LINK_UPDATE",ey="PLAID_LINK_UNLINK";function ty({plaidEvent:e,apiAccessToken:t,apiErrorCode:n}){const r=t?{plaidAccessToken:t}:null,a=null!=n;switch(e){case Xb:return{type:"PLAID_LINK_NEW",result:"SUCCESS",data:null,error:null};case $b:return a?{type:"PLAID_LINK_RESET",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RESET",result:"SUCCESS",data:r,error:null};case Jb:return a?{type:"PLAID_LINK_RELINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RELINK",result:"SUCCESS",data:r,error:null};case ey: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 ny({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 ry(){return yn(e=>e.events.plaidLink)}function ay(){return yn(e=>e.events.plaidLinkEvent)}function oy(){return yn(e=>e.events.plaidLinkError)}const iy=l({});function ly({onPlaidLink:e,children:t}){return I(iy.Provider,{value:{onPlaidLink:e},children:t})}function sy(){return i(iy)}const cy=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:ja(n)};return await Wa(r)};function dy(){return Fh({mutationFn:cy,onSuccess:()=>{const e=["integrations"];return zr.invalidateQueries({queryKey:e})}})}const uy=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:ja(t)};return await Wa(n)};function hy(){return Fh({mutationFn:uy,onSuccess:()=>{const e=["integrations"];return zr.invalidateQueries({queryKey:e})}})}const py=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(bs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:ja(n)};return await async function(e){return lv(e)}(r)};function gy(){const{mutate:e}=hy();return Fh({mutationFn:py,onSuccess:()=>{const e=["integrations"];return zr.invalidateQueries({queryKey:e})},onError:async t=>{Na({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await mh({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Ju,label:"Cancel"},{key:eh,label:"Try Again",type:gh.SUCCESS}]})===eh&&e()}})}function my(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)=>{Ia(`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 vy(e,t,n,r,a,o){const i=await jb(e,t,n);if(!i)return;const l=await my(i,a);if("success"===l?.status){const{public_token:e,metadata:i}=l;Ia("Plaid link successful",{public_token:e,metadata:i});const s=await Yb(e,i,t,n);if(s.relinkPlaidItemId)return vy(s.relinkPlaidItemId,t,n,r,a,o)}else if("exit"===l?.status){const{metadata:e,error:t}=l;Ia("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 Na({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:l,token:i}})}function fy(){const[e,t]=ju({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Wr(),r=jr(),{mutate:a}=hy(),{onPlaidLink:o}=sy(),i=ry(),l=ay(),s=oy();return{linkPlaid:e=>{if(br(i)){const t=ty(e);if(br(t)&&i.listener(t),i.preventDefault)return}if(br(o)){const t=ny(e);o(t)}else vy(e.plaidItemId?bs(e.plaidItemId):void 0,n,r,a,l,s)},loading:e||br(t),hasOnPlaidLinkOverride:br(i)||br(o)}}function by(){const[e,t]=ju({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Wr(),r=jr(),{mutate:a}=hy(),{apiPartnerName:o}=i(od),{onPlaidLink:l}=sy(),s=ry(),c=ay(),d=oy();return{linkPlaid:e=>{if(br(s)){const t=ty(e);if(br(t)&&s.listener(t),s.preventDefault)return}if(br(l)){const t=ny(e);l(t)}else!async function(e,t,n,r,a,o,i){const l=await jb(e,t,n);if(!l)return;const s=await my(l,o);if("success"===s?.status){const{public_token:e,metadata:l}=s;Ia("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 Kb(t.institution.institution_id,n,r);if(i)return Na({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,mh({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:Ju,label:"Cancel"},{key:eh,label:"Relink",type:gh.SUCCESS}]}))===eh?{relinkPlaidItemId:bs(i.id)}:{}}var o;return Ia("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Yb(e,t,n,r)}(e,l,t,n,r);c.relinkPlaidItemId&&vy(c.relinkPlaidItemId,t,n,a,o,i)}else if("exit"===s?.status){const{metadata:e,error:t}=s;Ia("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?bs(e.plaidItemId):void 0,n,r,o,a,c,d)},loading:e||br(t),hasOnPlaidLinkOverride:br(s)||br(l)}}const yy=kr(null,Ys,dr({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"}}}}),gl);function Cy({onPress:e,preventDefault:t,eventSource:n}){const{linkPlaid:r,loading:a}=fy();return P("button",{onClick:()=>{e?.(),t||r({plaidEvent:Xb,message:"Tile Plaid Link button pressed"})},...yy,disabled:a,"data-event-name":n,children:[I(Od,{Component:Hu}),I(fc,{intent:"primary",children:"Link Account"})]})}const xy=dr({width:266,minHeight:32});function Ty(){return I(ii,{styles:xy})}const wy=kr(vr.text,dr({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io);function ky({children:e}){return I("div",{...wy,children:e})}const Ey={SUCCESS:dr({backgroundColor:"surface.intent.success.highlight"}),DANGER:dr({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:dr({backgroundColor:"surface.intent.secondary"})},Ay=kr(vr.chip,dr({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function Sy({variant:e,children:t}){return I("div",{className:hr(Ay.className,Ey[e]),children:I(ky,{children:t})})}const Iy=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function Ny({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${Eo(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return I(Sy,{variant:Iy(r,n,t),children:a})}const Py=dr({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function Ry({title:e,label:t,comparison:n,invertDirection:r}){return P("div",{className:Py,children:[I(yo,{title:e,label:t}),br(n)&&I(Ny,{difference:n,invertDirection:r})]})}const Dy={netIncome:0,income:0,expenses:0,absoluteSum:0},My=e=>{if(fr(e))return Dy;const t=e.income?.total??0,n=e.expenses?.total??0,r=W(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},Ly=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(My):[]},Fy=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function Oy({defaultRange:e=Ct.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=Nu(),i=u(()=>{a?.listener?.({type:"PROFIT_AND_LOSS_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Kt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return Za({filter:e,grouping:t,select:Ly})}({filter:l,grouping:t?$a:void 0}),{profitLossData:d,profitDifference:h}=o(()=>{if(n)return{profitLossData:fi,profitDifference:null};if(!s||0===s.length)return{profitLossData:Fy,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 P(oo,{isSample:n,children:[I(to,{title:"Profit + Loss"}),I(ro,{children:c?P(si,{children:[I(Ty,{}),I(Ty,{})]}):P(N,{children:[I(Ry,{title:Ao(d.netIncome),label:"Profit",comparison:h}),P(xo,{children:[I(Wu,{amount:d.income,total:d.absoluteSum,color:"positive",label:"Income"}),I(Wu,{amount:d.expenses,total:d.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(gi,{size:"sm"}),r&&I(Cy,{onPress:i,preventDefault:a?.preventDefault})]})}const Vy=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],By=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...It(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:ja(a)};return await Wa(o)},Uy={moneyIn:0,moneyOut:0,netMoneyIn:0},Wy=e=>{if(fr(e)||fr(e.operatingActivities)||!e.operatingActivities.children)return Uy;let t=new W(0),n=new W(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(W(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Hy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Wy):[]};const _y=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function zy({defaultRange:e=Ct.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=Nu(),i=u(()=>{a?.listener?.({type:"CASH_FLOW_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Kt(t):e,{query:{data:s,isFetched:c},isFilling:d}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Kr({queryKey:Vy({filter:e,grouping:t}),queryFn:By,select:n})}({filter:e,grouping:t,select:Hy})}({filter:l,grouping:t?$a:void 0}),{cashFlowData:h,difference:p}=o(()=>{if(n)return{cashFlowData:yi,difference:null};if(!s||0===s.length)return{cashFlowData:_y,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 P(oo,{isSample:n,children:[I(to,{title:"Cash Flow"}),I(ro,{children:d?P(si,{children:[I(Ty,{}),I(Ty,{})]}):P(N,{children:[I(Ry,{title:Ao(h.netMoneyIn),label:"Change in Cash",comparison:p}),P(xo,{children:[I(Wu,{amount:h.moneyIn,total:g,color:"positive",label:"Money In"}),I(Wu,{amount:h.moneyOut,total:g,color:"negative",label:"Money Out"})]})]})}),n&&I(gi,{size:"sm"}),r&&I(Cy,{onPress:i,preventDefault:a?.preventDefault})]})}const qy=dr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),jy=dr({display:"flex",justifyContent:"end"});function Ky({color:e,bulletLabel:t,moneySummary:n}){return P("div",{className:qy,children:[I(_o,{color:e,label:t}),I("div",{className:jy,children:I(fc,{children:n})})]})}const Yy=kr(null,dr({display:"flex",gap:"10px",alignItems:"center"})),Zy=dr({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Gy=kr(null,Zy);function Qy({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>P("div",{...Yy,children:[I(_o,{color:Bo.var("colors.brand.secondary")}),t?I(ii,{styles:Zy}):I("div",{...Gy})]},n))})}const Xy={total:0,children:[]},Jy=e=>{return fr(e)||fr(e.expenses)||!e.expenses.children?Xy:{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},$y=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Jy):[]},eC=[Bo.var("colors.brand.primary"),Bo.var("colors.brand.success"),Bo.var("colors.brand.action")],tC=Object.freeze({total:0,children:[]});function nC({defaultRange:e=Ct.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=yn(e=>e.externalOptions),l=Nu(),s=u(()=>{l?.listener?.({type:"EXPENSE_TILE",result:"SUCCESS",data:null,error:null})},[l]),c=i.dataVisualizationColors??eC,d=t?Kt(t):e,{query:{data:h},isFilling:p}=function({filter:e,grouping:t}){return Za({filter:e,grouping:t,select:$y})}({filter:d,grouping:t?$a:void 0}),{expenseData:g,expensesDifference:m}=o(()=>{if(r)return{expenseData:bi,expensesDifference:null};if(!h||0===h.length)return{expenseData:tC,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":`${Pt[n]} Total`,f=g.children.length>0;return P(oo,{isSample:r,children:[I(to,{title:"Expenses"}),I(ro,{children:p?I(si,{children:I(Qy,{shimmer:!0})}):P(N,{children:[I(Ry,{title:Ao(g.total),label:v,comparison:m,invertDirection:!0}),I(xo,{children:f?g.children.map((e,t)=>I(Ky,{color:c[t],bulletLabel:e.name,moneySummary:Ao(e.total)},t)):I(Qy,{})})]})}),r&&I(gi,{size:"sm"}),a&&I(Cy,{onPress:s,preventDefault:l?.preventDefault})]})}const rC=kr(null,dr({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function aC({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:ht(l=e.year,i,1),endDate:ht(l,i+1,0)});var i,l,s,c,d,u,h,p;return P("div",{...rC,children:[P(Sr,{children:[I(Mr,{children:"Monthly Review"}),I(Au,{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})]}),P(Iu,{children:[I(Oy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(zy,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(nC,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const oC="Oldest to Newest",iC="Newest to Oldest",lC="A-Z",sC="Z-A",cC="Lowest to Highest",dC="Highest to Lowest",uC="A-Z",hC="Z-A";function pC(){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 ks)??!1,n=(e.direction&&e.direction in Es)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const gC=dr({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"}}}),mC=dr({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),vC=dr({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function fC({checked:e,onClick:t,Icon:n=op}){const[r,a]=d(e??!1),o=void 0===e?r:e;return I("button",{...kr(vr["checkbox-input"],gC,o?vC:mC,vl),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&I(Oc,{Component:n})})}const bC=kr(null,dr({paddingLeft:"20px",paddingRight:"5px"}));function yC({checked:e,onClick:t,Icon:n=op}){return I("div",{...bC,children:I(fC,{checked:e,onClick:t,Icon:n})})}const CC=kr(vr["date-cell"],dr({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function xC({date:e,annotation:t}){const n=Ft(Bt(e));return P("div",{...CC,children:[t&&I(ky,{children:t}),I(fc,{children:n})]})}const TC="Income",wC={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},kC={EXPENSE:"Expense",REVENUE:TC,TRANSFER_IN:"Bank Transfer In",TRANSFER_OUT:"Bank Transfer Out"},EC={Expense:[{name:kC.EXPENSE,value:wC.EXPENSE}],Income:[{name:kC.REVENUE,value:wC.REVENUE}],Transfer:[{name:kC.TRANSFER_IN,value:wC.TRANSFER_IN},{name:kC.TRANSFER_OUT,value:wC.TRANSFER_OUT}]},AC={EXPENSE:"Expense",REVENUE:TC,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},SC=Object.fromEntries(Object.entries(AC).map(([e,t])=>[e,`Add ${t}`])),IC=Object.fromEntries(Object.entries(AC).map(([e,t])=>[e,`Edit ${t}`])),NC=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},PC=e=>e===wC.TRANSFER_IN||e===wC.TRANSFER_OUT,RC=dr({color:"money.negative"}),DC=dr({color:"money.positive"}),MC=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>Or(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),LC=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!fr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:RC};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?DC:RC}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":TC,css:t?RC:DC}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?RC:DC};break;default:t=(e=>({type:e.type,displayName:MC(e.type),css:e.amount<0?RC:DC}))(e)}var n;return t},FC=Ei(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"),OC=kr(vr["transaction-date-cell-container"],dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function VC({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=LC(e),a=kr(vr["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?P("div",{...OC,children:[I(Od,{Component:FC}),I(xC,{date:e.date,annotation:o})]}):I(xC,{date:e.date,annotation:o})}const BC=dr({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),UC=dr({display:"flex",flexDirection:"column",width:"100%"}),WC=dr({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function HC({iconUrl:e,iconSpacing:t}){return void 0!==e?I("img",{src:e,className:WC,alt:void 0,width:24,height:24}):t?I("span",{className:WC}):null}function _C({label:e,subLabel:t,iconUrl:n,iconSpacing:r=!0}){return P("div",{className:BC,children:[I(HC,{iconUrl:n,iconSpacing:r}),P("div",{className:UC,children:[I(fc,{children:e}),I(Lo,{children:t})]})]})}function zC({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:dr({paddingLeft:"25px"}),children:I(_C,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I(_C,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}const qC=Ei(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"),jC=Ei(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"),KC=dr({display:"flex",alignItems:"center",gap:"8px"}),YC=dr({padding:"6px"});function ZC({amount:e,canExpand:t=!1,isExpanded:n=!1}){return t?I(Xc,{ariaLabel:n?"Collapse children":"Expand children",ariaExpanded:n,children:P("div",{className:KC,children:[I(Od,{Component:n?jC:qC}),I(Vu,{children:e})]})}):I("div",{className:YC,children:I(Vu,{children:e})})}const GC=Ei(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"),QC=Ei(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"),XC=dr({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),JC=dr({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function $C({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return GC;case"Deposited to":return QC;default:return null}})(e);return P("div",{className:XC,children:[n&&I(Od,{Component:n}),P("div",{className:JC,children:[e&&I(Lo,{children:e}),t&&I(fc,{children:t})]})]})}const ex={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 tx(e,t=!0){const n=Dh({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 nx(){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 rx={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"},ax=e=>["tasks",e??{}],ox={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},ix={filter:{status:{in:["ACTIVE"]}}},lx=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:Ri(t[2].environment)},a=await Ua(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function sx(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=fr(r=e)||fr(r.data)?[]:[...r.data].sort((e,t)=>ox[e.priority]-ox[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=ix,Kr({...r,queryKey:a?ax(a):["tasks",{}],queryFn:lx}));var r,a;const{query:{data:i},isFilling:l}=hm(),{query:{data:s},isFilling:c}=Gu({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=>tx(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[ex]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const cx=e=>{const t=il[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},dx=e=>["banks/transactions/summary",e],ux=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:Ri(t[2].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},hx=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>mx({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),px=async({data:e,accessToken:t,environment:n})=>mx({data:{data:e},accessToken:t,environment:n}),gx=async({data:e,accessToken:t,environment:n})=>px({data:[e],accessToken:t,environment:n}),mx=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:Ri(n)};return await Ua(r)};function vx(){return Ia("mutation successful, invalidating BT queries"),Promise.all([zr.invalidateQueries({queryKey:["banks/transactions"]}),zr.invalidateQueries({queryKey:["banks/transactions/summary"]}),zr.invalidateQueries({queryKey:["tasks"]}),zr.invalidateQueries({queryKey:["reports"]})]).catch(e=>Na({error:e,severity:"error"}))}function fx(){return yx({mutationFn:gx,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}})}function bx({mutationKey:e=["banks/transactions"],...t}){return iv({onSuccess:()=>vx(),mutationKey:e,...t})}function yx({mutationKey:e=["banks/transactions"],...t}){return iv({onSuccess:()=>vx(),mutationKey:e,...t})}function Cx(){return bx({mutationFn:px,meta:{toastOptions:{defaultErrorMessage:"Couldn't update categories"}}})}const xx=()=>["accounting/glAccounts"],Tx=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await Fi(n);return Ax(r)};function wx(e){return Kr({...e,queryKey:["accounting/glAccounts"],queryFn:Tx})}function kx(e){return e.filter(e=>"ACTIVE"===e.status)}function Ex(e){return wx({select:t=>Px(e?kx(t):t).flatMap(e=>[e,...e.children])})}const Ax=e=>e.map(e=>({...e,id:fs({id:e.id,prefix:"GL_ACCOUNT"})}));function Sx(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 Ix(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>Ix(e,t))}const Nx=e=>!e.parentAccountNo;function Px(e){const t=Sx(e);return e.filter(Nx).map(e=>({...e,children:Ix(e,t)}))}function Rx(e,t){return(t.get(e)??[]).map(e=>{const n=Rx(e.accountNo,t);return{...e,children:n}})}function Dx(e){const t=Sx(e);return e.filter(Nx).map(e=>({...e,children:Rx(e.accountNo,t)}))}function Mx(){return wx({select:Dx})}const Lx=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function Fx(e,t){return o(()=>void 0===t?e??[]:e?.filter(e=>t.includes(e.type))??[],[e,t])}const Ox=dr({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"}}),Vx=hr(Ox,dr({padding:"2.5px"})),Bx=hr(Ox,dr({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),Ux=dr({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"}}),Wx=hr(Ux,dr({_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"}}})),Hx=dr({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"}}}),_x=hr(Hx,dr({_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"}}})),zx=dr({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"}}),qx=hr(zx,dr({_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"}}})),jx=dr({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"}}),Kx=hr(jx,dr({_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"}}})),Yx=dr({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"}}),Zx=hr(Yx,dr({_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"}}})),Gx=dr({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"}}),Qx={default:Wx,neutral:Wx,warning:Kx,success:qx,danger:Zx,highlight:_x},Xx=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=Pr([kr(vr["selector-button"],hr(Gx,Qx[e]),vl),...n]);return I("button",{ref:a,...o,...r,children:t})}),Jx={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function $x(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function eT(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=>{$x(e,n,t)})}(r,n):a?$x(a,r,n):i&&$x(r,r,n)}),n}const tT=[kr(null,dr({marginLeft:"6px",marginRight:"6px"}))],nT=kr(null,dr({whiteSpace:"normal"}));function rT({types:e,activeOnly:t,onClick:n,searchTerm:r}){const{query:{data:a},isFilling:i}=Ex(t),l=Fx(a,e),s=o(()=>new Ae(l,Jx),[l]),c=o(()=>eT(s.search(r),l),[l,r,s]);return i?I(tm,{}):c.map(({parent:e,child:t})=>I(Qg,{onClick:()=>n(t),children:P(Lm,{stylists:[nT],children:[e.name,I(bl,{Component:hl,stylists:tT}),t.name]})},`${t.accountNo}`))}const aT=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=ve([a,t?.ref]);return I(Gg,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function oT({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=i(_g),{itemRef:o,index:l,itemProps:s}=Zg({hasCascading:!0}),{isScrolling:c}=i(Og);return P(Dc,{open:n===l,onOpenChange:e=>{c||r(e,l)},placement:"right-start",children:[I(Lc,{children:t=>I(aT,{itemProps:s,index:l,ref:o,popupTriggerProps:t,children:e})}),I(qc,{initialFocus:a,children:t})]})}const iT=dr({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),lT=dr({display:"flex",gap:"8px",color:"icon.base"});function sT({Icon:e,iconUrl:t,displayLabel:n}){const r=t?Pm(t,"Icon"):void 0;return P("div",{className:iT,children:[P("div",{className:lT,children:[!fr(e)&&e,fr(e)&&r&&I(Od,{Component:r}),I(Do,{wrap:"wrap",children:n})]}),I(bl,{Component:hl})]})}function cT({types:e,activeOnly:t,onClick:n}){const{query:{data:r,isFetching:a},isFilling:o}=(l=t,wx({select:e=>Px(l?kx(e):e)})),i=Fx(r,e);var l;return o?I(tm,{}):o||a||void 0!==r?i.map(e=>I(oT,{triggerChildren:I(sT,{displayLabel:e.name}),popupChildren:I(dT,{glAccount:e,onClick:n})},e.accountNo)):I($g,{text:"No data"})}function dT({glAccount:e,onClick:t}){return I(zg,{children:e.children.map(e=>I(Qg,{onClick:()=>t(e),children:I(Do,{children:e.name})},e.accountNo))})}const uT=dr({maxWidth:"420px",width:"fit-content"});function hT({onClick:e,types:t,activeOnly:n,placeholder:r="Search accounts..."}){return I(Yg,{onClick:e,placeholder:r,getSearchActiveStyles:e=>e?uT:void 0,SearchList:rT,DefaultList:cT,extraProps:{types:t,activeOnly:n},listLength:0,forceSearchVisible:!0})}const pT=kr(vr["category-selector-table-cell"]);function gT({accountName:e,iconUrl:t,onChange:n,types:r,activeOnly:a,placeholder:o}){const{startPrefetch:i,cancelPrefetch:l}=Fl({prefetchFn:Pl(xx,Tx)}),s=fr(t)?void 0:Pm(t,"");return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:t=>P(Xx,{...t,stylists:[pT],onMouseEnter:i,onMouseLeave:l,children:[s&&I(Od,{Component:s}),I(fc,{children:e})]})}),I(hT,{onClick:n,types:r,activeOnly:a,placeholder:o})]})}function mT({transaction:e,parentTransaction:t,accountName:n}){const{mutate:r}=fx(),a=void 0!==t;return I(gT,{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:Lx,placeholder:"Search revenue accounts..."})}const vT=e=>e>0?"Deposited to":"Withdrawn from",fT=Ei(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"),bT=e=>({id:e.id,name:e.name});function yT(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:vh("Category","Categories",n.size,!0),list:[...n].join(", ")}}const CT=kr(null,dr({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),xT=kr(null,dr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function TT({transaction:e}){const{label:t,list:n}=yT(e.children);return I(mc,{children:P("div",{...xT,children:[I(Od,{Component:fT}),P("div",{...CT,children:[I(Do,{children:t}),I(Lo,{children:n})]})]})})}const wT=()=>["expenses/categories"],kT=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await Fi(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:fs({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?fs({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function ET(e){return Kr({...e,queryKey:["expenses/categories"],queryFn:kT})}function AT(){return ET({select:e=>({...e,data:e.data?DT(e.data):void 0})})}function ST(e,t){return(t.get(e)??[]).map(e=>{const n=ST(e.id,t);return{...e,children:n.length>0?n:void 0}})}function IT(e){if(0===e.length)return[];const t=PT(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=ST(e.id,t);return{...e,children:n.length>0?n:void 0}})}function NT(){return ET({select:e=>({...e,data:e.data?IT(e.data):void 0})})}function PT(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 RT(e){if(0===e.length)return[];const t=PT(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function DT(e){if(0===e.length)return[];const t=PT(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function MT(){return Fl({prefetchFn:Pl(wT,kT)})}const LT={keys:[{name:"name"}],threshold:.1};function FT(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function OT(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?FT(a,r,n):o?FT(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{FT(e,n,t)})}(r,n)}),n}const VT=kr(null,dr({whiteSpace:"normal"})),BT=[kr(null,dr({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function UT({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=ET({select:e=>({...e,data:e.data?RT(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ae(i??[],LT),[i]),c=o(()=>i?OT(s.search(e),i):[],[i,e,s]);return a?I(tm,{}):l?I($g,{text:"No data"}):0===c.length?I($g,{text:"No results found"}):I(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=Pm(n.iconUrl,"Expense Icon");return P(Qg,{onClick:()=>t(bT(n)),children:[I(Od,{Component:a}),I(Lm,{stylists:[VT],children:r?n.name:P(N,{children:[e.name,I(bl,{Component:hl,stylists:BT}),n.name]})})]},`${e.id}_${n.id}`)})})}function WT({category:e,handleCategoryChange:t}){return I(zg,{children:e.children?.map(e=>{const n=Pm(e.iconUrl,"Expense Icon");return P(Qg,{onClick:()=>t(bT(e)),children:[I(Od,{Component:n}),I(Do,{wrap:"wrap",children:e.name})]},e.id)})})}function HT({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=AT(),a=t?.data,o=!r&&n&&void 0===a;return r?I(tm,{}):o?I($g,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(oT,{triggerChildren:I(sT,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(WT,{category:t,handleCategoryChange:e})},t.id);const n=Pm(t.iconUrl,"Expense Category Icon");return P(Qg,{onClick:()=>e(bT(t)),children:[I(Od,{Component:n}),I(Do,{wrap:"wrap",children:t.name})]},t.id)})})}const _T=({onClick:e})=>{const{query:{data:t}}=AT();return I(Yg,{onClick:e,placeholder:"Search expense categories...",SearchList:UT,DefaultList:HT,listLength:(t?.data??[]).length})},zT=kr(vr["category-selector-table-cell"]);function qT({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=MT(),a=e.category?.name??"",{mutate:o}=fx(),i=void 0!==t,l=fr(e.category?.iconUrl)?void 0:Pm(e.category.iconUrl,"Expense Icon");return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>P(Xx,{...e,stylists:[zT],onMouseEnter:n,onMouseLeave:r,children:[l&&I(Od,{Component:l}),I(fc,{children:a})]})}),I(_T,{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 jT({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(TT,{transaction:e});switch(NC(e.type)){case"EXPENSE_CATEGORY":return I(qT,{transaction:e,parentTransaction:t});case"TRANSFER":return I($C,{annotation:vT(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return Na({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(mT,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function KT({name:e}){return I(N,{children:e&&I(fc,{children:e})})}function YT({onClick:e}){const t=Mc(),n=Ji();return I(qc,{children:I(zg,{children:n.map(({status:n,displayName:r})=>I(Qg,{onClick:()=>(e(n),void t.close()),children:I(Do,{children:r})},n))})})}const ZT=kr(vr["review-status-selector-button"],dr({width:"151px",justifyContent:"center"})),GT=kr(vr["review-status-dropdown-arrow"],dr({display:"none"}));function QT({status:e,transactionId:t}){const[n,r]=d(!1),{mutate:a}=fx(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:c}=el(e);return t&&((u=t).startsWith(ms.TRANSACTION_LINE_ITEM)||u.startsWith(ms.PROCESSOR_TRANSACTION))?null:P(Dc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(Lc,{children:e=>P(Xx,{variant:s,...e,stylists:[ZT],onClick:i,children:[I(Od,{Component:c}),I(fc,{children:l}),I("div",{...GT,children:I(bl,{Component:zp})})]})}),I(YT,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function XT({status:e,transactionId:t}){return I(QT,{status:e,transactionId:t},t)}function JT({isMutating:e}){return e?I(up,{}):I(Od,{Component:hl})}function $T({isMutating:e}){return I(JT,{isMutating:e})}const ew=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})),tw=Ei(ew,"Dash"),nw=kr(null,dr({stroke:"icon.base.weak"}));function rw({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(tu,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(Oc,{Component:tw,stylists:[nw]})})})}function aw({conversationId:e}){const{query:{data:t}}=zl(e??null),{startPrefetch:n,cancelPrefetch:r}=jl(),{startPrefetch:a,cancelPrefetch:o}=Bs(),i=br(t),l=i&&"READ"===t?.readStatus,s=u(()=>{br(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=u(()=>{br(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I(rw,{hasConversation:i,hasUnread:!l})})}function ow(e){return So(fh(e.amount))}const iw=kr(vr["badge-chip"],Vx),lw=kr(null,uo),sw=kr(null,vl),cw=kr(vr["neutral-badge"],Ux),dw=kr(vr["highlight-badge"],Hx),uw=kr(vr["success-badge"],zx),hw=kr(vr["warning-badge"],jx),pw=kr(vr["danger-badge"],vr["critical-badge"],Yx);function gw({type:e,children:t}){let n;switch(e){case"danger":n=pw;break;case"warning":n=hw;break;case"neutral":n=cw;break;case"success":n=uw;break;case"highlight":n=dw}const r=Pr([iw,lw,n,sw]);return I("div",{...r,children:t})}function mw({reviewStatus:e}){const{variant:t,Icon:n}=el(e);return I(gw,{type:t,children:I(Od,{Component:n})})}const vw=dr({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),fw=dr({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),bw=dr({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),yw=dr({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),Cw=dr({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),xw=dr({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function Tw({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=yT(e.children);return`${t}: ${n}`}switch(NC(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${vT(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void Na({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 P("div",{className:vw,children:[r&&I(Od,{Component:FC}),P("div",{className:Cw,children:[P("div",{className:bw,children:[t.iconUrl?I("img",{src:t.iconUrl,className:xw,alt:void 0,width:24,height:24}):I("span",{className:xw}),I(Do,{children:t.description})]}),P("div",{className:yw,children:[I(mw,{reviewStatus:t.reviewStatus}),I(Lo,{wrap:"wrapTwice",children:n})]})]}),P("div",{className:fw,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(ZC,{amount:ow(e.original),canExpand:e.getCanExpand(),isExpanded:e.getIsExpanded()}),I(bl,{Component:hl})]})]})}const ww=Ei(ew,"Minus");function kw({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(yC,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?ww:op})}const Ew=J(),Aw=[Ew.display({id:xn.SELECT,header:({table:e})=>I(kw,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(yC,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),Ew.accessor("date",{id:xn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(mc,{children:I(VC,{transaction:e.row.original,isChild:t})})},header:()=>I(nd,{columnName:"Date",sortDef:"DATE",sortAscDisplay:oC,sortDescDisplay:iC}),size:130,maxSize:144}),Ew.accessor("description",{id:xn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(mc,{children:I(zC,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(nd,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:lC,sortDescDisplay:sC}),size:180}),Ew.accessor("amount",{id:xn.AMOUNT,cell:e=>I(mc,{alignVariant:"flexEnd",children:I(ZC,{amount:ow(e.row.original),canExpand:e.row.getCanExpand(),isExpanded:e.row.getIsExpanded()})}),header:()=>I(nd,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:cC,sortDescDisplay:dC,align:"right"}),size:130,maxSize:130}),Ew.accessor("category.id",{id:xn.CATEGORY,cell:({row:e})=>I(jT,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(nd,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),Ew.accessor(e=>e.dimensionValues[0]?.id,{id:xn.DIMENSION_VALUE,cell:e=>I(mc,{children:I(KT,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>I(nd,{columnName:"Business"}),size:130}),Ew.accessor("reviewStatus",{id:xn.REVIEW_STATUS,cell:e=>I(mc,{children:I(XT,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(nd,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:uC,sortDescDisplay:hC,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),Ew.display({id:xn.COMMENTS,cell:e=>{const t=e.row.original;return I(mc,{alignVariant:"center",children:I(aw,{conversationId:t.conversation?.id})})},header:()=>I(nd,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),Ew.display({id:xn.EXPAND,cell:e=>I("div",{className:dr({paddingRight:"20px"}),children:I($T,{isMutating:e.isMutating})}),size:40,maxSize:60})],Sw=Ew.display({id:"MOBILE",cell:e=>I(Tw,{row:e.row})}),Iw=l(!0);function Nw(){return i(Iw)}const Pw=[];function Rw({transactions:e,columns:t}){const n=Nw(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(xn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[Sw]:(i=t)?Aw.filter(e=>i.includes(e.id)):Aw;var i;return $({data:e??Pw,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??Pw.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 Dw=[xn.COMMENTS,xn.DATE,xn.DESCRIPTION,xn.AMOUNT,xn.CATEGORY,xn.REVIEW_STATUS];function Mw({Component:e,stylists:t}){return I(e,{stylists:[kr(vr["xx-large-icon"],vr.icon),...t??[]],size:50})}function Lw(){return P(N,{children:[I(Mw,{Component:Ni}),I(Do,{wrap:"wrap",children:"All caught up"}),I(Lo,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function Fw({children:e,stylists:t=[],...n}){return I(oc,{intent:"warning",stylists:t,...n,children:e})}function Ow({eventSource:e}){const{linkPlaid:t,loading:n}=fy();return I(Fw,{...kr(vr["zero-state-button"]),onClick:()=>t({plaidEvent:Xb,message:"Plaid Link button pressed"}),disabled:n,eventSource:e,children:I(Do,{children:"Link your bank"})})}function Vw({eventSource:e}){return P(N,{children:[I(Mw,{Component:km}),I(Mr,{children:"Link Bank Account"}),I(Lo,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(Ow,{eventSource:e})]})}const Bw=dr({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function Uw(){return P(N,{children:[I("div",{className:Bw,children:I(Mw,{Component:Ii})}),I(Mr,{children:"Transactions are being processed"}),I(Lo,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}function Ww(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=w(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=w(e,t,n)},[e,t,n]),i}function Hw({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=d(e),[a,o]=d(!1);s(()=>{r(e)},[e]);const i=Ww(u(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const _w=kr(vr["filter-bar"],dr({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"}})),zw=kr(vr["filter-search-bar"],dr({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),qw=kr(null,dr({color:"icon.base",flexShrink:0,marginRight:"15px"})),jw=kr(null,dr({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"}})),Kw=dr({width:25});function Yw({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=Hw({debouncedValue:t,onChangeDebouncedValue:e});return I("div",{..._w,children:P("div",{...zw,children:[I("div",{className:Kw,children:n||i?I(up,{}):I(Od,{stylists:[qw],Component:nf})}),I("input",{...jw,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Lp})]})})}const Zw=kr(vr["date-amount-header"],dr({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function Gw({formattedDate:e,formattedSum:t}){return P("div",{...Zw,children:[I(Do,{wrap:"wrap",children:e}),I(Vu,{children:t})]})}function Qw(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=PC(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();Cs(e?.original??t.original,{initialTab:"conversation"})}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();Cs(e?.original??t.original)}}function Xw({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=Ds(),a=u(()=>n({id:e.original.id}),[n,e.original]),o=u(()=>{Cs(e.original)},[e.original]);return I(us,{rowData:e,onMouseEnter:a,onMouseLeave:r,onRowClick:o,onCellClick:Qw,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 Jw({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=So(fh(r.netSumCents)),r.rows.push(n))}else{const r=Bt(e);t.set(e,{date:e,formattedDate:r?Ft(r):e,netSumCents:n.original.amount,formattedSumDollars:So(fh(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>P(f,{children:[I(Gw,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(Xw,{rowData:e},e.id))]},e.date))})}function $w({table:e,hasSelect:t}){const n=Nw();return I(ts,{editMutationKey:e.options.meta?.editMutationKey,children:I(Xl,{children:n?I(Jw,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(Xw,{rowData:e,hasSelect:t},e.id))})})}function ek(e){return e?"Search":"Search transactions..."}function tk(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 nk(e,t){return e.get(t)??[]}function rk(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function ak(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function ok(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function ik({buttonText:e,onButtonClick:t}){return P(N,{children:[I(Dd,{Component:uf}),I(Do,{children:"No results"}),I(Lo,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(Xc,{onClick:t,children:e})]})}const lk=dr({xl:{minWidth:"900px"}}),sk=dr({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function ck({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){Hd(ol);const c=function({transactions:e}){return function({transactions:e,columns:t}){return Rw({transactions:e,columns:t?[...t,xn.EXPAND]:void 0})}({transactions:e,columns:Dw})}({transactions:i}),{query:{data:d},isFilling:u}=Ns({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=Nw(),p=!fr(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(ik,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(Lw,{})):a=I(Uw,{}):a=I(Vw,{eventSource:"FinancialOverviewTransactionsTableZeroState"}),a}(e??!1,i.length>0,p,l.length>0);return P("div",{className:lk,children:[I("div",{id:ol}),P(fl.Provider,{value:o,children:[P(Sr,{children:[I(Mr,{children:"Transactions for review"}),I(zd,{children:I(wl,{})})]}),I(uc,{dashboard:"financialOverviewDashboard",children:r?I(Nl,{}):P(N,{children:[!h&&I("div",{className:sk,children:I(Yw,{placeholder:ek(h),searchTerm:l,onChange:s,isFetching:a})}),I(hc.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(Gl,{headerGroups:c.getHeaderGroups()})}),fr(g)?I($w,{table:c,hasSelect:!1}):I(Pd,{children:g})]})})]})]})}function dk(){const[e,t]=d(""),{sortInstance:n,setSortInstance:r,apiSort:a}=pC(),o={...(()=>{const e=nl();return{...ll,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=Ns({filter:o,sort:a,limit:10}),u=i?.data??cl,{hasPlaidLinkedBankAccount:h,isFilling:p}=um();return I(ck,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:c,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const uk=kr(null,dr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function hk({children:e}){return I("div",{...uk,children:e})}const pk=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:Ld,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:Ai,buttonText:"Review"};case"LINK_BANK":return{Icon:km,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:km,buttonText:"Fix"};case"RELINK":return{Icon:km,buttonText:"Relink"};case"CHAT":return{Icon:Si,buttonText:"Learn more"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:Ni,buttonText:""};default:return{Icon:Si,buttonText:""}}},gk=kr(vr["banner-title"],dr({display:"flex",alignItems:"center",gap:"8px"})),mk=kr(vr["banner-icon"],dr({width:"20px",height:"20px"}));function vk({title:e,type:t}){const{Icon:n}=pk(t);return P("div",{...gk,children:[I(Od,{Component:n,stylists:[mk]}),I(Do,{wrap:"wrap",children:e})]})}const fk=kr(null,dr({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 bk({title:e,description:t,type:n}){return P("div",{...fk,children:[I(vk,{title:e,type:n}),I(Lo,{wrap:"wrap",children:t})]})}const yk=vr["banner-button"],Ck=dr.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),xk=kr(vr["banner-button-text"]),Tk=kr(vr["banner-button-icon"]);function wk({priority:e,type:t,handleClick:n,eventSource:r}){const{buttonText:a}=pk(t),o=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return P(oc,{onClick:n,intent:o,styles:Ck,className:yk,eventSource:r,children:[I(Do,{stylists:[xk],children:a}),I(bl,{stylists:[Tk],Component:hl})]})}const kk=gr({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"}}}}),Ek={HIGH:vr["banner-high"],MEDIUM:vr["banner-medium"],LOW:vr["banner-low"],URGENT:vr["banner-urgent"]};function Ak({task:e,handleClick:t,eventSource:n}){const{name:r,description:a,shortDescription:o,type:i,priority:l}=e,s=Nw()?o:a,c=kr(vr.banner,Ek[l],kk({priority:l}));return P("div",{...c,children:[I(bk,{title:r,description:s,type:i}),I(wk,{priority:l,type:i,handleClick:t,eventSource:n})]})}function Sk(e,t){ys(yn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>hs("Conversation",{routeProps:{conversationId:null,defaultValues:{message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}}}}))}function Ik(e,t,n,r,a){return()=>mh({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function Nk(e){const{mutateAsync:t}=gy(),n=Wr(),r=jr(),{apiPartnerName:a}=i(od),o=Nw(),{linkPlaid:l,loading:s,hasOnPlaidLinkOverride:c}=fy(),{linkPlaid:d,loading:u}=fy(),h=ry(),p=br(e)?function(e){const t=Dh({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return br(t)?t:Mh(e)?Rh.ADDITIONAL_CONSENT_REQUIRED.DEFAULT:null}(e):null;if(fr(p)||fr(e))return null;const g="ITEM_LOCKED"===e.apiErrorCode;switch(p.buttonType){case Nh.DELETE_OR_RELINK:case Nh.RELINK:return s?null:(v=l,f=a,b=o,{alert:Ik(p,(m=e).apiInstitutionName,f,b,[{key:Ju,label:"Cancel"},{key:eh,label:"Relink",type:gh.SUCCESS}]),actions:{success:()=>{v({plaidEvent:$b,plaidItemId:m.id,apiAccessToken:m.apiAccessToken,apiErrorCode:m.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case Nh.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:Ik(e,t.apiInstitutionName,a,o,[{key:Ju,label:"Cancel"},{key:Nh.CHAT,label:"Chat"},{key:eh,label:"Unlink and Relink",type:gh.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:Jb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[Nh.CHAT]:()=>Sk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,t,d,a,o,c);case Nh.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l,s){return{alert:Ik(e,t.apiInstitutionName,i,l,[{key:Ju,label:"Cancel"},{key:Nh.CHAT,label:"Chat"},{key:Nh.RELINK,label:"Relink"},{key:eh,label:"Go To Bank",type:gh.SUCCESS}]),actions:{success:async()=>{const e=await Xu({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;br(o)?ys(s,{type:"PLAID_LINK_ROUTE_TO_BANK",result:"SUCCESS",data:{bankUrl:o},error:null},()=>window.open(o,"_blank")):window.open(o,"_blank")},[Nh.RELINK]:()=>{o({plaidEvent:$b,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[Nh.CHAT]:()=>Sk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,g,n,r,l,a,o,h);case Nh.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:Ik(e,t.apiInstitutionName,a,o,[{key:Ju,label:"Cancel"},{key:eh,label:"Unlink",type:gh.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:ey,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:Ik(e,t,a,o,[{key:Ju,label:"Cancel"},{key:Nh.CHAT,label:"Chat",type:gh.SUCCESS}]),actions:{[Nh.CHAT]:()=>Sk(t,r)}}}(p,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var m,v,f,b}const Pk=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){Na({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function Rk({task:e}){const{linkPlaid:t,loading:n}=fy(),{linkPlaid:r,loading:a}=by(),o=Nk(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&fr(o);if(i||l||s)return null;const c="LINK_BANK"===e.type?"FinancialOverviewLinkAccountBanner":"RELINK"===e.type?"FinancialOverviewRelinkAccountBanner":void 0;return I(Ak,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:$b,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?(Ia("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Xb,message:"Plaid Banner Link Bank pressed"})):br(o)&&(Ia("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Pk(o))},eventSource:c})}const Dk=kr(vr.banner,vr["banner-default"],kk({priority:"DEFAULT"}));function Mk(){const e=Nw()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...Dk,children:I(bk,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const Lk=kr(vr.banner,vr["banner-default"],kk({priority:"DEFAULT"}));function Fk(){const e=Nw()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...Lk,children:I(bk,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Ok=dr({width:"100%",height:72,minWidth:"300px"});function Vk(){return P(N,{children:[I(ii,{styles:Ok}),I(ii,{styles:Ok}),I(ii,{styles:Ok})]})}function Bk({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(Vk,{}):a?e.map(e=>void 0===rx[e.type]?null:"LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(Nh).includes(e.type)?I(Rk,{task:e},e.id):I(Ak,{task:e,handleClick:()=>t(e.type)},e.id)):I(n?Fk:Mk,{})}const Uk=kr(vr["button-table-header"]),Wk=dr({height:{xl:"auto",base:"44px"}});function Hk(){const e=Sh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:Wk,children:P(ic,{onClick:()=>{hs(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[Uk],eventSource:"FinancialOverviewActionItemHeader",children:[I(bl,{Component:Hu}),I(Ec,{children:"Banks & Integrations"})]})})}const _k=Ei(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"),zk=dr.raw({width:"44px",height:"44px"});function qk(){return I(ic,{onClick:()=>hs("NavMenu"),styles:zk,children:I(Od,{Component:_k})})}const jk=kr(vr["business-owner-dashboard-header"],dr(Er,{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}})),Kk=dr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"});function Yk(){return P("div",{...jk,children:[P("div",{className:Kk,children:[I(qk,{}),I(Hk,{})]}),I(Mr,{children:"Action Items"})]})}const Zk=()=>{const e=Nw(),{isApp:t}=i(Wd);return e&&t};function Gk({shouldFilterTasks:e=!1}){const t=Zk(),{taskBanners:n,isFilling:r}=sx(e),a=Ms(),{query:{data:o}}=hm();return P(N,{children:[t?I(Yk,{}):P(Sr,{children:[I(Mr,{children:"Action Items"}),I(Hk,{})]}),I(hk,{children:I(Bk,{taskBanners:n,handleScrollAction:cx,isWaitingForPlaidItemAccountsSync:!a&&!0===o?.plaidItemAccountsReadyToSync,isFilling:r})})]})}const Qk=kr(vr["business-owner-dashboard"],dr({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),Xk=dr({display:"flex",width:"100%",justifyContent:"center"}),Jk={status:{in:["ACTIVE","INACTIVE"]}};function $k({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 Ol)??!1,n=(e.direction&&e.direction in Vl)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:l,paginationControls:s}=Hl({limit:10,sort:a,filter:sl}),c=o?.data??dl,h=Nw(),{hasBookkeeper:p}=i(od),{initialPageProps:g}=i(Wd),{query:{data:m}}=hm(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=Ns({filter:Jk,limit:1});return(e?.data?.length??0)>0}(),m),f=/* @__PURE__ */new Date,b={month:f.getMonth(),year:f.getFullYear()};const[y,C]=Pc(g?.period??b,e,t),x=(T=y.month,{beginDate:ht((w=y.year)-1,T+1,1),endDate:ht(w,T+1,0)});var T,w;return I("div",{className:Xk,children:P("div",{...Qk,children:[I(Gk,{shouldFilterTasks:h}),!h&&P(N,{children:[I(aC,{period:y,handleDateChange:e=>{var t,n;(t=b).year===(n=e).year&&n.month>t.month||n.year>t.year||C(e)},todayPeriod:b,showSamples:v,showLinkAccountButton:v&&!m?.plaidItemAccountsReadyToSync}),p&&P(N,{children:[I(Sr,{children:I(Mr,{children:"Financial Summary"})}),I(xu,{isSample:v,period:y})]})]}),!h&&I(N,{children:I(xi,{filter:x,isSample:v})}),p&&I(Kd,{sortInstance:n,setSortInstance:r,conversations:c,paginationControls:s,isFilling:l,isMobile:h}),I(dk,{})]})})}function eE(e){return I(Ra||N,{children:e.children})}function tE({children:e}){return I(eE,{children:I("div",{className:Cr(vr.component),children:e})})}function nE({source:e,children:t}){return I(Dn.Provider,{value:e,children:t})}function rE(e){return I(tE,{children:I(nE,{source:"FinancialOverview",children:I($k,{...e})})})}const aE=dr({display:"flex",flexDirection:"column"});function oE({task:e}){return I("div",{className:aE,children:I(Rk,{task:e})})}const iE=dr({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),lE=dr({width:"80px",height:"12px"}),sE=dr({width:"150px",height:"16px"}),cE=dr({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),dE=dr({userSelect:"none",cursor:"pointer"});function uE(){return P("div",{className:cE,children:[P("div",{className:dE,children:[P("div",{className:iE,children:[I(ii,{styles:sE}),I(ii,{styles:lE})]}),P("div",{className:iE,children:[I(ii,{styles:sE}),I(ii,{styles:lE})]})]}),I("div",{className:dE,children:P("div",{className:iE,children:[I(ii,{styles:sE}),I(ii,{styles:lE})]})})]})}const hE=dr.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function pE({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=Nw(),a=n||r?Xc:ic;return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(a,{extraClassNames:[hE],popupTriggerProps:e,children:I(bl,{Component:uf,stylists:t})})}),I(qc,{children:e})]})}const gE=Ei(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"),mE=gr({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 vE({width:e="lg",children:t}){const n=kr(vr["modal-popup"],mE({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const fE=dr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),bE=dr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),yE=dr({display:"flex",flexDirection:"column",gap:"12px"}),CE=dr({display:"flex",flexDirection:"row",gap:"10px"}),xE=dr({display:"flex",flexDirection:"column",gap:"10px"}),TE=({acknowledged:e,setAcknowledged:t})=>P("div",{className:yE,children:[I(fc,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),P("div",{className:CE,children:[I(fC,{checked:e,onClick:()=>t(!e)}),I(fc,{wrap:"wrap",children:"I understand."})]})]});function wE({bankAccounts:e}){const{apiPartnerName:t}=i(od),n=e.reduce((e,t)=>{const n=Bt(t.tranStartDate||""),r=Bt(e.tranStartDate||"");return n&&r&&Lt(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutateAsync:n}=Zh(),r=Mc();return Eb({defaultValues:{tranStartDate:t},onSubmit:async t=>{var a,o;await n((a=e,o=t.value.tranStartDate,a.map(e=>({id:bs(e.id),tranStartDate:o,duplicateBankAccountIds:[]})))),r.close(),mh({title:"Start Date Updated",body:P("div",{className:xE,children:[I(fc,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(fc,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:eh,type:gh.SUCCESS}]})}})})(e,n),a=Mc(),o=()=>{a.close()},[l,s]=d(!1),{query:{data:c}}=Gu(),u=c?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Bt(e.reduce((e,t)=>{const n=Bt(t.tranMinStartDate||""),r=Bt(e.tranMinStartDate||"");return n&&r&&Lt(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${Ch(e[0]?.name,e[0]?.mask)} account dating back to ${qt(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${qt(h)}.`;return P("form",{className:fE,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit()},children:[I(Do,{children:"Set Bank Transaction Start Date"}),I(fc,{wrap:"wrap",children:p}),I(fc,{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=Bt(e.values.tranStartDate||""),r=Bt(n),a=t&&r&&Lt(t,r);return P(N,{children:[e.isDirty&&a&&I(TE,{acknowledged:l,setAcknowledged:s}),P("div",{className:bE,children:[I(Nb,{showIcon:!1,onClick:o}),I(lp,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!l})]})]})}})]})}function kE({bankAccounts:e}){return P(Dc,{placement:"right-start",children:[I(Lc,{children:e=>P(Qg,{...e,children:[I(Od,{Component:gE}),I(Do,{children:"Edit Start Date"})]})}),I(Wv,{children:I(zv,{children:I(vE,{width:"sm",children:I(wE,{bankAccounts:e})})})})]})}const EE=Ei(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"),AE=Ei(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"),SE={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 IE(e){const{apiPartnerName:t,unitIntegrationBankName:n}=i(od);return"UNIT"===e?n??t??"Unit":SE[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const NE=dr({display:"flex",flexDirection:"column",gap:"16px"}),PE=kr(null,dr({color:"brand.danger"}));function RE({integration:e,accounts:t}){const{mutate:n}=gy(),r=Mc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=fy(),{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}}=mm(e.id),u=d?.data,h=IE(e.apiName),p="PLAID"===e.apiName;return P(zg,{children:[p&&!o&&P(Qg,{onClick:()=>(a({plaidEvent:$b,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(Od,{Component:js}),I(Do,{children:"Add Account"})]}),p&&u&&I(kE,{bankAccounts:u}),lt(t)&&P(Qg,{onClick:()=>zb({plaidItemAccounts:t}),children:[I(Od,{Component:AE}),I(Do,{children:"Merge Accounts"})]}),p&&P(Qg,{onClick:()=>(async()=>{let o;var l;o=lt(t)?await(async e=>mh({title:"Remove Institution",body:I("div",{className:NE,children:I(fc,{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:Ju,label:"Cancel"},{key:$u,label:"Remove",type:gh.DANGER}]}))(e.apiInstitutionName??h):await(async e=>mh({title:"Remove Institution",body:I("div",{className:NE,children:I(fc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Ju,label:"Cancel"},{key:$u,label:"Remove",type:gh.DANGER}]}))(h),r.close(),o===$u&&(p&&i?a({plaidEvent:ey,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(Od,{stylists:[PE],Component:EE}),I(Do,{stylists:[PE],children:"Delete Connection"})]})]})}const DE=dr({userSelect:"none"});function ME({children:e}){return I("div",{className:DE,children:e})}const LE=dr({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 FE({children:e}){return I("div",{className:LE,children:e})}const OE=kr(vr.badge,Bx),VE=kr(null,uo),BE=kr(null,vl),UE=kr(vr["neutral-badge"],Wx),WE=kr(vr["highlight-badge"],_x),HE=kr(vr["success-badge"],qx),_E=kr(vr["warning-badge"],Kx),zE=kr(vr["danger-badge"],vr["critical-badge"],Zx);function qE({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=zE;break;case"warning":o=_E;break;case"neutral":o=UE;break;case"success":o=HE;break;case"highlight":o=WE}const i=Pr([OE,VE,o,BE]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function jE({plaidItem:e}){const t=Nk(e),n=fr(e.apiErrorCode)&&Mh(e);return P(qE,{type:n?"highlight":"danger",onClick:n=>{n.stopPropagation(),t&&(Ia(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Pk(t))},disabled:fr(t),children:[I(Od,{Component:n?Hu:Si}),I(Lo,{children:n?"Relink for Statements":"Fix Bank Error"}),I(bl,{Component:hl})]})}const KE=gr({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"}}}}}),YE=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function ZE({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=hr(KE({active:a}),vl);return P("button",{className:l,onClick:t=>{t.stopPropagation(),hs("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[P("div",{className:YE,children:[I(Od,{Component:i?FC:km}),I(Am,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(Od,{Component:hl})]})}const GE=dr({display:"flex",flexDirection:"column",gap:"4px"}),QE=dr({display:"flex",alignItems:"center",gap:"8px"}),XE=kr(null,dr({color:"brand.primary.weak"})),JE=dr({overflow:"hidden"});function $E({integration:e,isCompact:t=!1}){const{query:{data:n}}=mm(e.id),r=n?.data,a="PLAID"===e.apiName,o=IE(e.apiName);if(!lt(r))return null;const i=e.iconUrl?Pm(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return P(ME,{children:[P(FE,{children:[P(Xv,{children:[I(Dd,{Component:i??km}),P("div",{className:GE,children:[I(fc,{children:e.apiInstitutionName??o}),I(Lo,{children:Gb(r)})]})]}),P("div",{className:QE,children:[a&&(l=e,br(l.apiErrorCode)||Mh(l))&&I(jE,{plaidItem:e}),I(pE,{stylists:[XE],shouldUseButtonDiscreteStyles:t,children:I(RE,{integration:e,accounts:r})})]})]}),I("div",{className:JE,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(ZE,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Qb(t),active:n,integration:e},t.id)})})]});var l}const eA=Pm("data:image/png;base64,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","Stripe"),tA=Pm("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"),nA=Pm("data:image/png;base64,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","Shopify"),rA=Pm("data:image/png;base64,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","Gusto"),aA=Pm("data:image/png;base64,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","Freshbooks"),oA=Pm("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAABlNJREFUeAHtnN0vH0sYx586nL5qvFRflHoXOYSkTSsu3IpWpHdSDeGCK3Evxx9xQuqllaC3biTSlpIjlbghLuQkTuIlNKVatKmEaqOYPt9frO4P+/vtzL5Q9knmt7uz88zM89mZ3dln5rdEByWTo/7hMMFhjYM44QE2wlbYDNsN5U8+84TDNoeTDsXIPtgOBmDhJ4j4l4OR4mmLBws/SKB22iAEsxdM6AwH9Lv/OIRw8OQXgR3ezf6Df/7mkPcr3tvbJYDGs4kf3MH/2o30Nv4E/gcgPOYu+cd7R7sE1gEINytPDAh4N2YDMFq0B0gjYbD1ABmA0aJDtR23t1FRUZSamkrp6emUkJBAMTExdOHCBV81vn79Sp8+faK3b9/S1NQUzczM0JcvX9yuoq88VwHdunWL7t+/Tw8ePKA7d+5QbGwsnTmD54SxCCHo/fv3NDY2Rq9evaLe3l5aWFgwVnDgTLAht+Xzd+/eFe3t7YJbBdtrTVZWVkRbW5u4ffu25XoxSzN5mEpkJqMDaVJSUnxgvn//bo3KIdobGxvi2bNnIjEx8UC5Jg03q+cMoOrqavHx48dDTLM3irufqKysNGusSjp7AV2+fFl0dHTYS8FEbk+fPhUXL15UARBMxz5AN27cEG/evDFhjjNJ+vv7xdWrV4MZLHveHkCAMzo66ozlErkODw8LHjLIQgiU3jogdKuhoSEJM5xNipZkY3ezBojHMaKzs9NZixVyb21tDdQqZM5ZA1RVVaVQfXdUysrKZEAYpVUHlJSUJDBwO66yuLgo4uLijAw3G68O6Dh2rf0Xq6WlxSwIo3RqgDDUd2KEvN9Aq8f84iuysrKMjA8ar+zuqK2tpbNnzzrwamhvlvAQ1NTUWMo0KMX97zbo1+x+sHpxXdNfXl4W165dk7YTdiu5O4qKiigiIkL5qqytrRG/p0np80CULl1Sm1uAr6mwsJCeP38uVaaWWJpsT0+P8tVfXV0Vubm54vz581IhPz9fMFjlcru6uqTtZEDQkbtJR0ZGCjw+VWVyclKEhYVJVxZA5+bmVIsV7J0U4eHh0uVK36TT0tKI+7PW+qS38CCGhsr3bOgE8z4GqszNmzcpOTk5UJJDz0kDyszMpJAQabW9wrkl7O27uQPAuLiyIn0pl5aWiP09suXspYf+9jaW4bgvmByQFWlAcJwj/I5y5coV6Wqr9xXpoo5eQZtWkqnJqQIkA0ZLe6oA8UyIZrfprfQ9qLi4mB4/fkw8IDFdiD4hRtB1dXW0ubmpj3ZlH7O1siINKDo6mh49eiRbzl76+fl5qq+v3zt2cwdT2bIi3cUmJiZoZwfL99SEXSRqiha1tra2aHp6WjoXaUAo5MOHD9IFaQromj9+/NAOTW9VdPSZYz5/dnZWH2VqX7qL8cumbyEBhu4qcv36dcrLy6Px8XEp9Xv37pHKOEYrZGRkhNbX17VD01tpQMj5xYsX9PDhQ9OF6BPyFBH19fUR+7L10QH38Q7GE4J07ty5gOkCnUSdVUX6DZeXrYjPnz8rv1m7rYg1AqqTidL3IFwFdndQd3e36gVxXY99QVItdn8FpVsQZyBycnLEt2/f3G4M0uXxfUdkZGQo2Qg7AUtZGQuZjrs0NjYq22cZEC+pc2UNkOpF4EGpwKIKK43AUgtCwRUVFar1d1SPB7OipKTEKhzoq3cxTRdL4Y6b2NC1NLjWAfF0jBgYGDg2jHjM45sx0S6gxa11QKgAxhlYvHTUMjg4KHgNtnb17djaA0iD9Pr16yNjhJZjMxx77kH6JoyVXVhR4bY0NDTY2a30Lc++FqQHVV5eLvCYdVowIVhaWqo3yO59ZwABVnx8vGhubhYYzdotmIbGk4q9CnYD2Z+fc4C0FpWdnS2ampoE+5Esc8K0N8DwBOZ+Qxw5dvUfh1ihUVBQ4PszC/w7vIwm6DQ0HGVw0/ISY3r58iXxcIIw+eiWuApIbxT8Qpgrx1+iMOMJZ5g2b6X/OxT+CgVPoIqzS1+e6v6RAVKtsNt6Sv4gtyt5lOV5gILQ9wCZACTv6g+S6Qk6vY4W9O4EGWS3Ke8AqN/uXE9Qfv14zHufxzn8ivo+j6OdesI7jgzVf+N8wWRPvE90+TeQA5/oAilAAjWssDytrQm2g4Hf98v42E9wT8In87zPBDKEn02Y0wmZAdg6AAAAAElFTkSuQmCC","Uber"),iA=Pm("data:image/png;base64,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","Bank"),lA={GUSTO:rA,FRESHBOOKS:aA,FRESHBOOKS2:aA,SHOPIFY:nA,STRIPE:eA,SQUARE:tA,UBER:oA};function sA(e){return lA[e]??iA}const cA=dr({display:"flex",flexDirection:"column",gap:"4px"});function dA({integration:e,isCompact:t}){const n=IE(e.apiName),r=function(e){if(e)return`Last synced ${zt(e)}`}(e.lastSyncedDate),a=sA(e.apiName);return I(ME,{children:P(FE,{children:[P(Xv,{children:[I(Dd,{Component:a}),P("div",{className:cA,children:[I(fc,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(Lo,{intent:"normal",children:r})]})]}),I(pE,{shouldUseButtonDiscreteStyles:t,children:I(RE,{integration:e})})]})})}const uA=dr({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),hA=dr.raw({color:"typography.base.weak"}),pA=dr({overflow:"hidden"});function gA({manualBankAccounts:e,isCompact:t=!1}){const n=Nw(),r=t||n?Xc:ic;return P(ME,{children:[P("div",{className:uA,children:[I(fc,{extraClassNames:[hA],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>hs("BankAccountForm"),active:!1,children:I(bl,{Component:js})})]}),I("div",{className:pA,children:e.map(e=>I(ZE,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const mA=kr(vr["selector-row"],hr(dr(Js,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),gl)),vA=dr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),fA=dr({display:"flex",alignItems:"center",gap:"8px"}),bA=dr({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),yA=kr(null,dr({width:"20px",height:"20px"}));function CA(){const{linkPlaid:e,loading:t}=by();return I("button",{...mA,disabled:t,onClick:()=>{Ia("Add New Connection button pressed"),e({plaidEvent:Xb,message:"Add New Connection button pressed"})},children:P("div",{className:vA,children:[P("div",{className:fA,children:[I(Dd,{stylists:[yA],Component:km}),P("div",{className:bA,children:[I(fc,{children:"Connect your bank"}),I(Lo,{children:"Find your banking institution with Plaid"})]})]}),I(Od,{Component:hl})]})})}const xA=dr({paddingInline:"16px",paddingBottom:"8px"}),TA=dr.raw({color:"typography.base.weak",fontWeight:"label"});function wA({title:e,children:t}){return P("div",{children:[I("div",{className:xA,children:I(fc,{extraClassNames:[TA],children:e})}),t]})}const kA=dr({minWidth:"100%",height:"45px"});function EA(){return P(N,{children:[I(ii,{styles:kA}),I(ii,{styles:kA}),I(ii,{styles:kA})]})}const AA=kr(vr["selector-row"],hr(dr(Js,{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"}),gl)),SA=dr({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),IA=dr({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),NA=dr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function PA({integration:e}){const{linkPlaid:t,loading:n}=fy(),r="PLAID"===e.apiName,a=IE(e.apiName),o=e.iconUrl?Pm(e.iconUrl,"Institution Icon"):km;return I("button",{...AA,disabled:n||!r,onClick:()=>{Ia(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:$b,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:P("span",{className:SA,children:[P("div",{className:IA,children:[I(Dd,{Component:o}),I(fc,{children:e.apiInstitutionName??a??void 0})]}),r&&P("div",{className:NA,children:[I(bl,{Component:Hu}),I(fc,{children:"Relink"})]})]})})}const RA=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"}))),DA=kr(vr["selector-row"],hr(dr(Js,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),gl)),MA=dr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),LA=dr({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),FA=dr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),OA=dr({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"}}),VA=dr({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function BA(){const e=Mc(),{mutateAsync:t}=dy(),[n,r]=d("");return P("div",{className:LA,children:[I(Do,{children:"Enter your shop name"}),I("div",{className:VA,children:I(RA,{})}),I(fc,{children:"Please enter the name of your shop below."}),I("input",{className:OA,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),P("div",{className:FA,children:[I(Nb,{showIcon:!1,onClick:()=>{e.close()}}),I(ip,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(Do,{children:"Connect"})})]})]})}function UA(){const e=sA("SHOPIFY")??Hu;return P(Dc,{placement:"bottom",children:[I(Lc,{children:t=>P("button",{...DA,...t,children:[P("div",{className:MA,children:[I(Dd,{Component:e}),I(fc,{children:"Shopify"})]}),I(Od,{Component:hl})]})}),I(Wv,{children:I(zv,{children:I(vE,{width:"sm",children:I(BA,{})})})})]})}const WA=kr(vr["selector-row"],hr(dr(Js,{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"}),gl)),HA=dr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function _A({apiName:e}){const{mutateAsync:t}=dy(),n=IE(e),r=yn(e=>e.events.gusto);if("SHOPIFY"===e)return I(UA,{});const a=sA(e)??Hu;return P("button",{...WA,onClick:async()=>{if("GUSTO"===e){let e=!1;if(br(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:[P("div",{className:HA,children:[I(Dd,{Component:a}),I(fc,{children:n})]}),I(Od,{Component:hl})]})}const zA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function qA(e){return zA.includes(e)}const jA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],KA=dr({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),YA=dr({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function ZA(){const{query:{data:e},isFilling:t}=nx(),n=e?.multiAccountIntegrations,r=e?.integrations,a=br(n)&&n.length>0||br(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=i(od),n=yn(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(qA),a=e?.map(e=>e.apiName)||[];let o=r??jA;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return P("div",{className:KA,children:[(t||a)&&I(wA,{title:"Already Connected",children:t?I(EA,{}):P(N,{children:[n?.map(e=>I(PA,{integration:e},e.id)),r?.map(e=>I(PA,{integration:e},e.id))]})}),I(wA,{title:"Available Banks",children:I(CA,{})}),o&&o.length>0&&I(wA,{title:"Integrations",children:I("div",{className:YA,children:o.map(e=>I(_A,{apiName:e},e))})})]})}const GA=dr({marginTop:"16px"}),QA=dr({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),XA=dr.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function JA({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(ZA,{}):t?P(N,{children:[P("div",{className:GA,children:[I(fc,{extraClassNames:[XA],children:"Connected Accounts"}),r?.map(t=>I($E,{integration:t,isCompact:e},t.id)),a?.map(t=>I(dA,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(gA,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(gA,{manualBankAccounts:o}):P("div",{className:QA,children:[I(Dd,{Component:km}),I(Do,{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 $A=kr(null,dr({color:"typography.base.weak"})),eS=kr(vr["drawer-header"],dr({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Kv)),tS=dr({display:"flex",gap:"8px"}),nS=dr({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),rS=gr({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),aS=dr({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),oS=dr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),iS=kr(null,dr({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),lS=gr({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function sS({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=Nw()||e,{query:{data:a},isFilling:o}=nx(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=Sh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>Qh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:pm(e?.data)};var t}}),{mutate:c,isPending:d}=hy(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&tx(p,!1),m="connected"===yn(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,f=m?"Add New Connection":"Add New Account",b=()=>{hs(m?"NewConnection":"BankAccountForm")},y=r?Xc:ic;return P(ly,{onPlaidLink:n,children:[P("div",{...eS,children:[P(Xv,{children:[t&&I(sh,{}),r?I(Do,{children:"Banks & Integrations"}):I(Mr,{stylists:[$A],children:"Banks & Integrations"})]}),P("div",{className:tS,children:[0!==h&&P(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(Od,{Component:Hu,stylists:[kr(null,lS({refreshLoading:d}))]}),!r&&I(fc,{children:"Sync Accounts"})]}),P(y,{onClick:()=>b(),active:!1,children:[I(Od,{Component:js}),!r&&I(fc,{children:"Add New Connection"})]})]})]}),g&&I("div",{className:oS,children:I(oE,{task:g})}),o?I(uE,{}):P(N,{children:[I("div",{className:rS({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:nS,children:I(JA,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&I("div",{className:aS,children:P(ic,{stylists:[iS],onClick:()=>b(),children:[I(Od,{Component:js}),I(Do,{children:f})]})})]})]})}const cS=dr({display:"flex",justifyContent:"center"}),dS=dr({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 uS({onPlaidLink:e}){return I(tE,{children:I(nE,{source:"BanksAndIntegrations",children:I("div",{className:cS,children:I("div",{className:dS,children:I(sS,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})})}function hS(e){return st({key:"customer",name:"Customer",possibleValues:e})}function pS(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 gS=dr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function mS({children:e}){return I("div",{className:gS,children:e})}function vS({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return P(Dc,{children:[I(Lc,{children:e=>P(Tf,{popupTriggerChildrenProps:e,children:[P(mS,{children:[t&&I(Od,{Component:Pm(t,"")}),I(fc,{wrap:"wrap",children:i})]}),I(Od,{Component:hl})]})}),I(tf,{title:r,Footer:o??null,children:a})]})}function fS(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 bS({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 yS=dr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),CS=kr(vr["list-body"],dr({display:"block"}));function xS({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return P("div",{className:yS,children:[e&&I(fc,{intent:"weak",children:e}),n?I(pf,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):I("div",{...CS,children:t})]})}const TS=dr({display:"flex",flexDirection:"column",gap:"16px"});function wS({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I(wf,{handleClick:t,selected:n,isMultiSelect:r,children:P(mS,{children:[e.iconUrl&&I(Od,{Component:Pm(e.iconUrl,"")}),I(fc,{wrap:"wrap",children:e.name??""})]})},e.id)}function kS({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(mf,{children:I("div",{className:TS,children:I(bS,{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(xS,{label:r,children:e})}})})})}function ES({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=fS(e,{items:n,fuseOptions:LT,processResults:OT});return r?I(If,{}):0===Object.keys(i).length?I(pf,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(kS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function AS(e,t){return eT(e,t).map(e=>({parent:e.parent,child:e.child}))}function SS({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=fS(e,{items:n,fuseOptions:Jx,processResults:AS});return r?I(If,{}):0===Object.keys(i).length?I(pf,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(kS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function IS(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...IS(n));return t}function NS(e,t){return e.value?.[t]?.value?.id?.in??[]}function PS(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&NS(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{NS(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function RS(e,t){const n=[];return e.forEach(e=>NS(e,t).forEach(e=>n.push(e))),new Set(n)}function DS(e,t,n,r){return u(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!NS(t,e).some(e=>n.includes(e)));return rk(t,e,r)})},[t,r,e])}const MS=dr.raw({width:"100%",justifyContent:"center"}),LS=dr({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 FS({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return P("div",{className:LS,children:[P(Md,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[I(fc,{children:"Apply"}),I(bl,{Component:op})]}),I(ic,{onClick:e,styles:MS,children:I(fc,{children:"Clear All"})})]})}function OS({onApply:e,onClearAll:t}){const n=Mc();return I(FS,{onApply:()=>{e(),n.close()},onClearAll:t})}function VS({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(()=>IS(e),[e]),g=u(()=>{i(p)},[p,i]),m=u(()=>{if(p&&l&&s){const e=nk(s,"category"),t=PS(l,e,p,"category");d(t)}},[p,l,s,d]),v=I(OS,{onApply:m,onClearAll:g});return I(vS,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:I(cf,{placeholder:"Search expense categories...",onClick:a,SearchList:ES,DefaultList:BS,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 BS({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(If,{}):I(ff,{title:I(Do,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=IS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(VS,{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(wf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:P(mS,{children:[e.iconUrl&&I(Od,{Component:Pm(e.iconUrl,e.name??"")}),I(fc,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const US=[];function WS({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=NT(),s=i?.data??US,c=RS(nk(t,"category"),"category"),d=u(e=>{const t=HS(e);n(t)},[n]),h=DS("category",r,0,a);return a&&o?I(cf,{placeholder:"Search expense categories...",onClick:d,SearchList:ES,DefaultList:BS,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 HS(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 _S(){const{query:{data:e},isFilling:t}=ET(),n=e?.data,r=o(()=>n?.map(HS),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function zS(e){return st({key:"category",name:"Category",NestedListComponent:WS,possibleValues:e})}const qS=[{value:"in",label:"In"}];function jS(e){return st({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:qS})}function KS(){const e=function(){const e=tl();return(e?Ki:Yi).map(t=>$i(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 YS(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const ZS=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 GS(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:br((a=t).greaterThanEqual)?fh(a.greaterThanEqual):null,maxAmount:br(a.lessThanEqual)?fh(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const QS=dr({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function XS({children:e,title:t}){return I(tf,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:QS,children:e})})}const JS=dr({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),$S=dr({display:"flex",flexDirection:"column",flex:1}),eI=dr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function tI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(XS,{title:"Amount",children:I(nI,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function nI({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Mc();return Eb({defaultValues:GS(0,r),validators:{onChange:ZS},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=we(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=Eo(e,{dollarSign:!0,signage:"default"}),a=bh(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=Eo(t,{dollarSign:!0,signage:"default"}),r=bh(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 P(N,{children:[I("div",{className:eI,children:P(mf,{children:[P("div",{className:JS,children:[I("div",{className:$S,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(Do,{children:"To"}),I("div",{className:$S,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I(yp,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(FS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const rI=[{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 aI(){return st({key:"amount",name:"Amount",operators:rI,ModalComponent:tI})}function oI(){const{query:{data:e},isFilling:t}=Sh(),n=e?.data,r=function({institutionIds:e}){const t=Wr(),n=jr(),r=[...new Set(e)],a=V({queries:r.map(e=>({queryKey:Sm({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Xu({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=>br(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=Ch(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 iI(e){return st({key:"bankAccount",name:"Bank Account",possibleValues:e})}const lI=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:[],sI=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:Ri(t[1].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function cI(e){return Kr({queryKey:["dimensionValues"],queryFn:sI,...e})}function dI(){const{query:{data:e},isFilling:t}=Nv({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 uI(e){return st({key:"vendor",name:"Vendor",possibleValues:e})}function hI(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 st({key:"type",name:"Type",possibleValues:()=>({values:t})})}const pI=Ei(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"),gI=kr(null,dr({fill:"surface.intent.action.active"}));function mI({isSelected:e}){return I(Od,e?{Component:pI,stylists:[gI]}:{Component:bf})}function vI({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(ff,{title:I(Lo,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?CI(l.value.status?.value):a.some(e=>x(e.value,l.value)));var l;return P(Tf,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[I(mS,{children:I(fc,{wrap:"wrap",children:r.name})}),I(mI,{isSelected:i})]},`${r.name}_${o}`)})})}const fI="status",bI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function yI(){const e="in";return{values:bI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function CI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function xI(e){return CI(e.value.status?.value)}function TI(){return st({key:fI,name:"Status",possibleValues:yI,singleSelect:!0,SimpleListComponent:vI})}const wI=(kI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(kI));var kI;function EI({onApply:e,onClearAll:t}){const n=Mc();return I(FS,{onApply:()=>{e(),n.close()},onClearAll:t})}function AI({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(()=>IS(e),[e]),g=u(()=>{i(p)},[p,i]),m=u(()=>{if(p&&l&&s){const e=nk(s,"glAccount"),t=PS(l,e,p,"glAccount");d(t)}},[p,l,s,d]),v=I(EI,{onApply:m,onClearAll:g});return I(vS,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:I(cf,{placeholder:"Search GL accounts...",onClick:a,SearchList:SS,DefaultList:SI,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 SI({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(If,{}):I(ff,{title:I(Do,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=IS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(AI,{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(wf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(mS,{children:I(fc,{wrap:"wrap",children:e.name})})},e.id)})})}const II=[];function NI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Mx(),s=i??II,c=RS(nk(t,"glAccount"),"glAccount"),d=u(e=>{const t=PI(e);n(t)},[n]),h=DS("glAccount",r,0,a);return a&&o?I(cf,{placeholder:"Search GL accounts...",onClick:d,SearchList:SS,DefaultList:SI,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 PI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function RI(e){return st({key:"glAccount",name:"GL Account",NestedListComponent:NI,possibleValues:e})}function DI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(Tt(e)){const t=It(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(kt(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,pS(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 pS(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return pS(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return pS(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 pS(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return pS(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function MI(e,t){const n=e.reduce(DI,{});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 LI=e=>{const t=yn(e=>e.transactionsDashboardFilters),n=yn(e=>e.expenseDashboardFilters),r=yn(e=>e.incomeDashboardFilters),a=yn(e=>e.setTransactionsDashboardFilters),o=yn(e=>e.addTransactionsDashboardFilters),i=yn(e=>e.removeTransactionsDashboardFilter),l=yn(e=>e.hasInitializedTransactionsDashboardFilters),s=yn(e=>e.setExpenseDashboardFilters),c=yn(e=>e.addExpenseDashboardFilters),d=yn(e=>e.removeExpenseDashboardFilter),u=yn(e=>e.hasInitializedExpenseDashboardFilters),h=yn(e=>e.setIncomeDashboardFilters),p=yn(e=>e.addIncomeDashboardFilters),g=yn(e=>e.removeIncomeDashboardFilter),m=yn(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 FI(){return{getCategories:_S(),getBankAccounts:oI(),getCustomers:dI(),getVendors:function(){const{query:{data:e},isFilling:t}=ev(),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}=cI(),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}=Ex(),n=o(()=>e?.map(e=>PI(e)),[e]);return u(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:KS()}}function OI(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 VI=dr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function BI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(XS,{title:"Back",children:I(UI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function UI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Mc();return Eb({defaultValues:{[e.key]:OI(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 P(N,{children:[I("div",{className:VI,children:I(mf,{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(FS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const WI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function HI(){return st({key:"description",name:"Description",operators:WI,ModalComponent:BI})}const _I=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function zI(){return st({key:"notes",name:"Notes",operators:_I,ModalComponent:BI})}const qI=[{name:"Expense",types:EC.Expense},{name:"Income",types:EC.Income},{name:"Transfer",types:EC.Transfer}];function jI(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:jS(h),amount:aI(),bankAccount:iI(l),category:zS(i),customer:hS(c),date:Gt,description:HI(),glAccount:RI(d),notes:zI(),status:TI(),vendor:uI(s),type:hI(qI),search:dt}),[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(()=>MI(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 KI(e,t,n,r,a){const o=yn(e=>e.initializeTransactionsDashboardFilters),i=yn(e=>e.initializeExpenseDashboardFilters),l=yn(e=>e.initializeIncomeDashboardFilters),c=yn(e=>e.hasInitializedTransactionsDashboardFilters),d=yn(e=>e.hasInitializedExpenseDashboardFilters),u=yn(e=>e.hasInitializedIncomeDashboardFilters),h=nl(),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 YI=l(void 0);function ZI(){const e=i(YI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function GI({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!==ct&&l.modelKey!==Yt&&(l.modelKey!==fI||!xI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(fr(n)&&br(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(fr(r)&&br(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=Eo(fh(n),{dollarSign:!0,signage:"default"}),i=Eo(fh(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(xb,{text:e.text,additionalValidClassName:vr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const QI=Ei(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"),XI=dr({width:"17px",height:"17px",borderRadius:"sm"});function JI({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return br(e)?P(N,{children:[!r&&I(ii,{styles:XI}),I("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[kr(vr["medium-icon"],vr.icon),...n??[]],size:17})}const $I=dr({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),eN={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function tN(){const e=Nw(),{dashboardKey:t}=ZI();return I(ic,{onClick:()=>{hs(eN[t],{routeProps:{}})},stylists:[kr(null,$I)],children:e?I(JI,{Component:QI}):P(N,{children:[I(bl,{Component:QI}),I(fc,{children:"Filters"})]})})}const nN=S.object({beginDate:S.string().nullable(),endDate:S.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Bt(e.beginDate),n=Bt(e.endDate);if(t&&n)return!Lt(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),rN=dr({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),aN=dr({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),oN=kr(null,dr({marginTop:"22px"}));function iN({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,Eb({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:nN},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=we(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return P("div",{className:rN,children:[P("div",{className:aN,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(Dd,{Component:ww,stylists:[oN]}),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(yp,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const lN={width:"fit-content"};function sN({onDateRangeChange:e}){const{filters:t}=ZI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Yt);if(void 0!==t){const e=t.value.date?.value;if(kt(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(oT,{triggerChildren:I(sT,{displayLabel:"Custom"}),popupChildren:I(qc,{style:lN,children:I(iN,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const cN=dr({width:200,minWidth:200});function dN({dateFilter:e,addFilter:t}){return I(Qg,{onClick:()=>t(e),children:I(Do,{children:xt[e]})})}function uN({getModel:e,addFilters:t}){const{setOpen:n}=Mc(),r=r=>{const a=e(Yt);if(void 0===a)return;const o=a.createFilter({name:xt[r],value:{[a.key]:{name:xt[r],value:r}}});t([o]),n(!1)};return I(qc,{children:P(zg,{style:cN,children:[I(dN,{dateFilter:Ct.ALL_TIME,addFilter:r}),I(mp,{alignment:"horizontal"}),I(dN,{dateFilter:Ct.THIS_MONTH,addFilter:r}),I(dN,{dateFilter:Ct.LAST_MONTH,addFilter:r}),I(dN,{dateFilter:Ct.LAST_3_MONTHS,addFilter:r}),I(dN,{dateFilter:Ct.LAST_12_MONTHS,addFilter:r}),I(mp,{alignment:"horizontal"}),I(dN,{dateFilter:Ct.THIS_QUARTER,addFilter:r}),I(dN,{dateFilter:Ct.LAST_QUARTER,addFilter:r}),I(mp,{alignment:"horizontal"}),I(dN,{dateFilter:Ct.THIS_YEAR,addFilter:r}),I(dN,{dateFilter:Ct.LAST_YEAR,addFilter:r}),I(mp,{alignment:"horizontal"}),I(sN,{onDateRangeChange:n=>{const r=e(Yt);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const hN=[kr(null,$I)];function pN({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Yt);let n=xt[Ct.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=Tt(e)?xt[e]:kt(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Bt(e.beginDate):null,n=e.endDate?Bt(e.endDate):null;return t&&!n?`After ${qt(t)}`:!t&&n?`Before ${qt(n)}`:t&&n?`${Ft(t)} - ${Ft(n)}`:"Custom"}(e):t.name}return n})(e);return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(ic,{stylists:hN,popupTriggerProps:e,children:I(fc,{children:r})})}),I(uN,{getModel:t,addFilters:n})]})}const gN=dr({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),mN=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function vN({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=Mc();return I(Qg,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:P("div",{className:gN,children:[P("span",{className:mN,children:[n&&I(Od,{Component:n}),I(Do,{children:e})]}),o&&I(Od,{Component:hl})]})})}const fN=[{label:AC[wC.EXPENSE],type:wC.EXPENSE},{label:AC[wC.REVENUE],type:wC.REVENUE},{label:AC.BANK_TRANSFER,type:"TRANSFER_IN"},{label:AC.BANK_TRANSFER,type:"TRANSFER_OUT"}],bN=kr(null,$I);function yN({manualTransactionOptions:e}){const t=fN.filter(t=>e.includes(t.type)),n=Nw();return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(ic,{stylists:[bN],popupTriggerProps:e,children:n?I(JI,{Component:js}):P(N,{children:[I(bl,{Component:js}),I(fc,{children:"Add Transaction"})]})})}),I(qc,{children:I(zg,{children:t.map(({label:e,type:t})=>I(vN,{closeOnClick:!0,onClick:()=>Cs(null,{initialType:t}),children:e},t))})})]})}const CN=Ei(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"),xN=dr.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function TN(){return I(ic,{styles:xN,onClick:()=>hs("TransactionSettingsDrawer"),children:I(Od,{Component:CN})})}const wN=dr.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function kN({children:e,styles:t}){return I("div",{className:dr(wN,t),children:e})}const EN=kr(vr["dashboard-header"],dr({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),AN=kr(null,dr({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),SN=dr.raw({paddingLeft:"15px",paddingRight:"15px"}),IN=dr({display:"none",xl:{display:"flex"}});function NN({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=ZI(),l=Nw(),s=o(()=>fr(n)?"":n.find(e=>e.modelKey===ct)?.value.search?.value??"",[n]);return P("div",{...EN,children:[P("div",{...AN,children:[I(Yw,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(ct);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:ek(l)}),I(tN,{}),I(yN,{manualTransactionOptions:t}),!l&&I(pN,{filters:n,getModel:a,addFilters:i}),I(TN,{}),I("div",{className:IN,children:I(wl,{})})]}),n.length>0&&I(kN,{styles:SN,children:I(GI,{filters:n,removeFilter:r})})]})}const PN=Tn.filter(e=>e!==xn.COMMENTS&&e!==xn.DIMENSION_VALUE),RN=kr(null,dr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function DN(){return I("div",{...RN,children:I(wl,{})})}const MN=dr.raw({gap:"6px"});function LN({Icon:e,label:t,children:n,onClick:r}){return n?P(Dc,{placement:"bottom-start",children:[I(Lc,{children:n=>P(Xc,{popupTriggerProps:n,extraClassNames:[MN],children:[e&&I(bl,{Component:e}),I(fc,{children:t})]})}),n]}):P(Xc,{onClick:r,extraClassNames:[MN],children:[e&&I(bl,{Component:e}),I(fc,{children:t})]})}const FN=Ei(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"),ON=kr(null,dr({whiteSpace:"normal"}));function VN({transactions:e,id:t,label:n,resetSelected:r}){const{mutateAsync:a}=bx({mutationFn:px,meta:{toastOptions:{defaultErrorMessage:"Couldn't update review statuses"}}}),o=Mc();return rl(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(Lm,{stylists:[ON],children:n})}):null}const BN={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},UN=e=>e.map(e=>({id:e.id,status:BN.INACTIVE})),WN=Ei(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"),HN=[{id:"delete",label:"Delete",Icon:FN,component:function({transactions:e,resetSelected:t,...n}){const{mutateAsync:r}=bx({mutationFn:px,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=UN(e);await r(n),t&&t()};return I(LN,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&mh({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:Ju,label:"Cancel"},{key:$u,label:"Delete",type:gh.DANGER}]}).then(e=>{e===$u&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:WN,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=Cx(),o=e.length;return o>0&&I(LN,{label:`${t} ${vh("Expense","Expenses",o,!0)}`,...r,children:I(_T,{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:WN,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=Cx(),o=e.length;return I(LN,{label:`${t} ${vh("Revenue","Revenues",o,!0)}`,...r,children:I(hT,{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:Lx,placeholder:"Search revenue accounts..."})})}}];function _N({subActionList:e}){return I(zg,{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(qc,{children:i.length>0?I(_N,{subActionList:i}):I(Qg,{children:I(fc,{children:"No Actions Available for Selection"})},"no-actions")})})}const qN=kr(vr["bulk-select"],dr({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function jN({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=Ji();return o(()=>[...HN,{id:"review",label:"Change Review Status",Icon:Ni,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:VN}))}],[e])})(),s=()=>e.resetRowSelection(!0);return P("div",{...qN,children:[I(kw,{table:e}),I(Do,{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(zN,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&I(t,{transactions:d,resetSelected:s,...c},i)})]})}function KN({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r,zeroStateEventName:o}){const i=Nw(),l=function({transactions:e,columns:t}){const n=Nw(),r=Rw({transactions:e,columns:t?[xn.SELECT,...t,xn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!fr(t.getColumn(Cn.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}=ZI(),c=l.getIsAllRowsSelected(),d=l.getIsSomeRowsSelected(),u=c||d;let h;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?h=I(ik,{buttonText:"Clear Filters",onButtonClick:()=>s([])}):r&&0===e?.length&&(h=I(Uw,{})):h=I(Vw,{eventSource:o});const p=u&&fr(h)&&!i;return P(uc,{dashboard:"transactionDashboard",children:[p?I(jN,{table:l}):I(Gl,{headerGroups:l.getHeaderGroups()}),fr(h)?I($w,{table:l}):I(Pd,{children:h})]})}const YN={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"}},ZN=(e={})=>{const t=tr(YN,e);return YN.transform(t,er)},GN=e=>dr(ZN(e));GN.raw=ZN;const QN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},XN=(e={})=>{const t=tr(QN,e);return QN.transform(t,er)},JN=e=>dr(XN(e));JN.raw=XN;const $N={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},eP=(e={})=>{const t=tr($N,e);return $N.transform(t,er)},tP=e=>dr(eP(e));tP.raw=eP;const nP={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},rP=(e={})=>{const t=tr(nP,e);return nP.transform(t,er)},aP=e=>dr(rP(e));aP.raw=rP;const oP=dr({display:"flex",padding:"16px 12px",borderWidth:"md",borderStyle:"solid",borderRadius:"lg",borderColor:"border.layout",backgroundColor:"surface.foreground"}),iP=kr(vr.card,oP,dr({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function lP({children:e}){return I("div",{...iP,children:e})}const sP=kr(vr["card-header"],dr({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function cP({children:e}){return I("div",{...sP,children:e})}const dP=dr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function uP({children:e}){return I("div",{className:dP,children:e})}const hP=gr({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 pP({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}=ZI();if(!d(t))return null;const h="active"===r,p=kr(vr["card-button"],hP({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 gP=gr({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"}}),mP=dr({minWidth:"200px"}),vP=dr({marginLeft:"auto"});function fP({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=ZI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Kr({queryKey:dx({groupBy:e,filter:t}),queryFn:ux})}({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)||!rl(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,kr(vr["card-button-icon-container"],gP({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&rl(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return P(pP,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:mP,isZeroState:t,filterEffectiveValueExtractor:YS,children:[I("div",{...l,children:I(Od,{Component:e.Icon})}),!t&&i&&P(N,{children:[I(Do,{children:e.text}),I("div",{className:vP,children:I(Vu,{children:s})})]}),!t&&!i&&P(N,{children:[I(fc,{children:e.text}),I("div",{className:dr({marginLeft:"auto"}),children:I(Vu,{children:s})})]}),t&&P(N,{children:[I(fc,{intent:"weak",children:e.text}),I("div",{className:dr({marginLeft:"auto"}),children:I(Vu,{children:s})})]})]},e.text)}function bP({isZeroState:e}){const t=function(){const e=tl();return(e?Zi:Gi).map(t=>$i(t,e))}();return P(lP,{children:[I(cP,{children:I(fc,{intent:"weak",children:"Review Status"})}),I(uP,{children:t.map(t=>I(fP,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const yP=dr({width:"20px",height:"20px",borderRadius:"sm"});function CP({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return br(e)?P(N,{children:[!r&&I(ii,{styles:yP}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[kr(vr["medium-icon"],vr.icon),...n??[]],size:20})}const xP=dr({minWidth:"269px"}),TP=dr({marginLeft:"auto"});function wP({account:e,isZeroState:t}){const{apiFilters:n}=ZI(),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=Vr(e.mask)?void 0:yh(e.mask),c=Eo(null!=(d=e.accountBalance)?fh(d):0,{dollarSign:!0});var d;return P(pP,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:xP,isZeroState:t,filterEffectiveValueExtractor:lI,children:[e.iconUrl&&I(CP,{imageUrl:e.iconUrl,Component:km}),!t&&a&&P(N,{children:[I(Do,{children:o}),s&&I(fc,{wrap:"wrap",children:s}),I("div",{className:TP,children:I(Vu,{children:c})})]}),!t&&!a&&P(N,{children:[I(fc,{children:o}),s&&I(fc,{wrap:"wrap",children:s}),I("div",{className:TP,children:I(Vu,{children:c})})]}),t&&P(N,{children:[I(fc,{intent:"weak",children:o}),s&&I(fc,{intent:"weak",wrap:"wrap",children:s}),I("div",{className:TP,children:I(Vu,{children:c})})]})]},e.id)}const kP=[{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 EP({isZeroState:e}){const{query:{data:t}}=Sh({params:{filter:{apiName:{in:[...cm]}}}}),n=(r=t?.data??[],e?kP: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 P(lP,{children:[I(cP,{children:I(fc,{intent:"weak",children:"Account Balances"})}),I(uP,{children:n.map((t,n)=>I(wP,{account:t,isZeroState:e},n))})]})}const AP=dr({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),SP=dr({display:{"@page/xl":"flex",base:"none"}}),IP=dr({display:{"@page/xl":"none",base:"flex"}}),NP=dr({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 PP({showZeroStates:e,Chart:t}){return P("div",{className:NP,children:[I("div",{className:SP,children:I(bP,{isZeroState:e})}),I("div",{className:SP,children:I(EP,{isZeroState:e})}),I("div",{className:AP,children:I(t,{})}),I("div",{className:IP,children:I(bP,{isZeroState:e})}),I("div",{className:IP,children:I(EP,{isZeroState:e})})]})}const RP=dr({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),DP=aP({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),MP=dr({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),LP=dr({paddingTop:"8px"}),FP=dr({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),OP=dr({display:"flex",flexDirection:"column",gap:"10px"});function VP({columns:e=PN,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1,zeroStateEventName:d}){const{filters:u}=ZI(),{hasPlaidLinkedBankAccount:h}=um(),p=h??!1,g=Nw();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(Nl,{});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&&br(u[0].value?.date)?0:u.length,t.length);return I("div",{className:DP,children:P("div",{className:RP,children:[g&&c&&I("div",{className:OP,children:I(Gk,{})}),I(PP,{Chart:l,showZeroStates:!i}),P("div",{className:MP,children:[I("div",{className:LP,children:I(NN,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:FP,children:I(KN,{hasLinkedBankAccount:p,filterState:r,transactions:t,columns:e,zeroStateEventName:d})})]}),I(DN,{})]})})}return"zero state"}const BP=dr({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),UP=kr(vr.card,oP,BP);function WP({children:e}){return I("div",{...UP,children:e})}const HP=dr({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function _P({children:e}){return I("div",{className:HP,children:e})}const zP=kr(vr["card-header"],dr({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function qP({children:e}){return I("div",{...zP,children:e})}const jP=dr({minWidth:"300px"});function KP({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:jP,children:I(Hf,{options:e,handleClick:t,selectedIndex:n})})}function YP(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=yt(e);return{beginDate:bt(ht(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:ut(ht(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:gt()}:"LAST_12_MONTHS"}const ZP=Bo.var("colors.border.layout"),GP=kr(vr["profit-loss-graph"],dr({"& .recharts-surface":{outline:"none"}})),QP=Bo.var("colors.money.positive.weak"),XP=Bo.var("colors.money.positive"),JP=Bo.var("colors.money.negative.weak"),$P=Bo.var("colors.money.negative"),eR=Bo.var("colors.surface.intent.action"),tR=Bo.var("colors.surface.intent.action.active"),nR=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],rR=()=>{const[e,t]=d(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Za({accountingMethod:"CASH",filter:YP(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=Bt(e??"");return{longLabel:t?_t(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:Qa(e)}}(e):"QUARTERLY"===t?function(e){const t=pt(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=pt(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??[]}(nR[e].value)}};function aR({selectedIndex:e,onSelect:t}){return I(KP,{options:nR,handleClick:t,selectedIndex:e})}const oR={top:20,right:20,left:20,bottom:5},iR={fill:Bo.var("colors.typography.base"),fontSize:Bo.var("fontSizes.metric.sm")};function lR({data:e,children:t,tooltip:n}){return I(H,{width:"100%",height:"100%",...GP,style:{flexGrow:1},children:P(_,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:oR,children:[I(j,{dataKey:"label",interval:0,tickLine:!1,stroke:ZP,tick:iR}),I(Y,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const sR=dr({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function cR(){return P("div",{className:sR,children:[I(_o,{color:QP,label:"Income",diameter:10}),I(_o,{color:JP,label:"Expense",diameter:10})]})}const dR=kr(null,dr({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),uR=kr(null,dr({width:"100%",height:"1px",backgroundColor:"border.layout"})),hR=kr(null,dr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),pR=Bo.var("colors.money.positive"),gR=Bo.var("colors.money.negative");function mR({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 P("div",{...dR,children:[I(Do,{children:a}),I("div",{...uR}),P("div",{...hR,children:[I(_o,{color:pR,label:"Income",diameter:12}),I(Vu,{children:Ao(Number(o))})]}),P("div",{...hR,children:[I(_o,{color:gR,label:"Expense",diameter:12}),I(Vu,{children:Ao(Number(i))})]})]})}function vR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return P(WP,{children:[P(_P,{children:[P(qP,{children:[I(fc,{intent:"weak",children:"All Transactions"}),I(yo,{title:Ao(r),label:void 0})]}),P(qP,{children:[I(aR,{selectedIndex:e,onSelect:t}),I(cR,{})]})]}),P(lR,{data:n,tooltip:({active:e,payload:t})=>I(mR,{active:e,payload:t}),children:[I(Z,{name:"Income",dataKey:"income",minPointSize:2,fill:QP,isAnimationActive:!1,activeBar:{fill:XP}}),I(Z,{name:"Expense",dataKey:"expense",minPointSize:2,fill:JP,isAnimationActive:!1,activeBar:{fill:$P}})]})]})}const fR=dr({display:"flex",flexDirection:"column",gap:{base:0,sm:"16px"}});function bR({columns:e,limit:t=100}){const n=jI(),{userRole:r}=i(od),{sortInstance:a,setSortInstance:o,apiSort:l}=pC(),s=Zk(),{isFilling:c,paginationControls:d,query:{data:u,isError:h,error:p,isFetching:g}}=Ns({limit:t,sort:l,filter:{...n.apiFilters}}),m=u?.data,v=Ms();return KI("transactionsDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,c,v),P("div",{className:fR,children:[s&&I(qk,{}),I(YI.Provider,{value:n,children:I(fl.Provider,{value:d,children:I(hc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(VP,{columns:e,transactions:m,isFetching:g,isFilling:c,isError:h,error:p??null,hasTransactions:v,Chart:vR,manualTransactionOptions:[wC.EXPENSE,wC.REVENUE,"TRANSFER_IN"],zeroStateEventName:"TransactionsDashboardZeroState"})})})})]})}const yR=e=>I(tE,{children:I(nE,{source:"TransactionsDashboard",children:I(bR,{...e})})}),CR={in:["EXPENSE","TRANSFER_OUT"]},xR=[{name:"Expense",types:EC.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:wC.TRANSFER_OUT}]}];function TR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=FI(),p=o(()=>({reviewStatus:jS(h),amount:aI(),bankAccount:iI(l),category:zS(i),customer:hS(c),date:Gt,description:HI(),glAccount:RI(d),notes:zI(),status:TI(),vendor:uI(s),type:hI(xR),search:dt}),[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(()=>MI(e,CR),[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 wR=kr(vr.text,dr({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),io);function kR({children:e}){return I("div",{...wR,children:e})}const ER=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function AR({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 P("div",{className:ER,children:[I(ky,{children:n}),I(kR,{children:Io(r)})]})}const SR=dr({width:"160px",height:"32px"}),IR=dr({width:"54px",height:"32px"}),NR=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:SR,children:I(fc,{children:String(t.value)})}),PR=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:IR,children:I(fc,{alignment:"right",children:(r=n.value,Eo(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},RR=({active:e,payload:t})=>I(AR,{active:e,payload:t});function DR({data:e}){return I(H,{width:"100%",height:44*(e?.length??0)+12,...GP,children:P(_,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[I(j,{type:"number",hide:!0,domain:[0,"dataMax"]}),I(K,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:NR,width:172}),I(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:PR,width:66}),I(Y,{content:RR,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(Z,{dataKey:"total",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR},barSize:32})]})})}const MR=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):[]},LR=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function FR(){const[e,t]=d(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Ut(n),endDate:Ut(t)}})(LR[e].value),{query:{data:r}}=Za({filter:n,select:MR}),a=n?`${Ft(Bt(n.beginDate))} - ${Ft(Bt(n.endDate))}`:"";return P(WP,{children:[P(_P,{children:[P(qP,{children:[I(fc,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(fc,{intent:"weak",wrap:"ellipsis",children:a})]}),I(KP,{options:LR,handleClick:e=>t(e),selectedIndex:e})]}),I(DR,{data:r})]})}function OR({columns:e,limit:t=100}){const n=TR(),{userRole:r}=i(od),{sortInstance:a,setSortInstance:o,apiSort:l}=pC(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=Ns({limit:t,sort:l,filter:{...n.apiFilters}}),g=d?.data,m=Ms();return KI("expenseDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),I(YI.Provider,{value:n,children:I(fl.Provider,{value:c,children:I(hc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(VP,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:FR,manualTransactionOptions:[wC.EXPENSE,"TRANSFER_OUT"],showTasks:!0,zeroStateEventName:"ExpenseDashboardZeroState"})})})})}const VR=e=>I(tE,{children:I(nE,{source:"ExpenseDashboard",children:I(OR,{...e})})}),BR={in:["REVENUE","TRANSFER_IN"]},UR=[{name:TC,types:EC.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:wC.TRANSFER_IN}]}];function WR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=LI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=FI(),h=o(()=>({reviewStatus:jS(d),amount:aI(),bankAccount:iI(l),category:zS(i),customer:hS(s),date:Gt,description:HI(),glAccount:RI(c),notes:zI(),status:TI(),type:hI(UR),search:dt}),[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(()=>MI(e,BR),[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 HR(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=rR(),r=n.reduce((e,t)=>e+t.income,0);return P(WP,{children:[P(_P,{children:[P(qP,{children:[I(fc,{intent:"weak",children:"Total Income"}),I(yo,{title:Ao(r),label:void 0})]}),I(qP,{children:I(aR,{selectedIndex:e,onSelect:t})})]}),I(lR,{data:n,tooltip:({active:e,payload:t})=>I(AR,{active:e,payload:t}),children:I(Z,{name:"Revenue",dataKey:"income",minPointSize:2,fill:eR,isAnimationActive:!1,activeBar:{fill:tR}})})]})}function _R({columns:e,limit:t=100}){const n=WR(),{userRole:r}=i(od),{sortInstance:a,setSortInstance:o,apiSort:l}=pC(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=Ns({limit:t,sort:l,filter:{...n.apiFilters}}),g=d?.data,m=Ms();return KI("incomeDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),I(YI.Provider,{value:n,children:I(fl.Provider,{value:c,children:I(hc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(VP,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:HR,manualTransactionOptions:[wC.REVENUE,"TRANSFER_IN"],showTasks:!0,zeroStateEventName:"IncomeDashboardZeroState"})})})})}const zR=e=>I(tE,{children:I(nE,{source:"IncomeDashboard",children:I(_R,{...e})})});function qR(){return I(mp,{color:"weak",alignment:"horizontal"})}function jR(e){return t=>{"Enter"!==t.key&&"Space"!==t.code||(t.preventDefault(),e?.(t))}}const KR=gr({base:{display:"flex",padding:"16px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...ml,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),YR=gr({base:{...ho},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function ZR({name:e,disabled:t,onClick:n}){const r=t?void 0:n,a=t?void 0:jR(n);return P("div",{className:KR({disabled:t}),role:"button",tabIndex:t?-1:0,onKeyDown:a,onClick:r,children:[I("div",{className:YR({disabled:t??!1}),children:e}),!t&&I(Od,{Component:hl})]})}const GR=dr({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),QR=dr({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 12px",width:"100%",cursor:"pointer"}),XR=dr(ho,{color:"typography.base.weak"});function JR({label:e,defaultExpanded:t=!1,children:n}){const[r,a]=d(t),o=()=>a(e=>!e),i=jR(o);return P("div",{className:GR,children:[P("div",{className:QR,role:"button",tabIndex:0,"aria-expanded":r,onClick:o,onKeyDown:i,children:[I("div",{className:XR,children:e}),I(Od,{Component:r?zp:hl})]}),r&&n]})}const $R={"/":{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 eD(){const e=Re();return u((t,n)=>{e($R[t].route,n)},[e])}function tD(){const e=eD();return P(JR,{label:"Accounting",defaultExpanded:!0,children:[I(qR,{}),I(ZR,{name:"Profit & Loss",onClick:()=>e("profit-and-loss")}),I(qR,{}),I(ZR,{name:"Balance Sheet",onClick:()=>e("balance-sheet")}),I(qR,{}),I(ZR,{name:"Cash Flow Statement",onClick:()=>e("cash-flow-statement")}),I(qR,{}),I(ZR,{disabled:!0,name:"Trial Balance"})]})}function nD(){return P(JR,{label:"Income and Invoices",children:[I(qR,{}),I(ZR,{disabled:!0,name:"Income Analysis"}),I(qR,{}),I(ZR,{disabled:!0,name:"Accounts Receivable Aging"})]})}function rD(){return P(JR,{label:"Expenses and Bills",children:[I(qR,{}),I(ZR,{disabled:!0,name:"Expense Analysis"}),I(qR,{}),I(ZR,{disabled:!0,name:"Accounts Payable Aging"}),I(qR,{}),I(ZR,{disabled:!0,name:"Time & Task Analysis"}),I(qR,{}),I(ZR,{disabled:!0,name:"Mileage Analysis"})]})}function aD(){return P(JR,{label:"Taxes",children:[I(qR,{}),I(ZR,{disabled:!0,name:"Schedule C"}),I(qR,{}),I(ZR,{disabled:!0,name:"Form 1065"}),I(qR,{}),I(ZR,{disabled:!0,name:"Form 1120-S"}),I(qR,{}),I(ZR,{disabled:!0,name:"Form 1120"}),I(qR,{}),I(ZR,{disabled:!0,name:"T2125"}),I(qR,{}),I(ZR,{disabled:!0,name:"Tax Details for Filing"})]})}const oD=GN({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),iD=JN({gap:"16px",width:"100%"}),lD=tP({gap:"8px",alignItems:"center"}),sD=dr(ho,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),cD=dr(ho,{color:"typography.base"});function dD(){const e=De(),t=Re(),n=e.flatMap(e=>function(e){try{return QL.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:lD,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return P(f,{children:[r>0&&I(bl,{Component:hl}),a?I("span",{className:cD,"aria-current":"page",children:e.label}):I("button",{type:"button",className:sD,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const uD=JN({gap:"16px",alignItems:"flex-start",width:"100%"}),hD=dr({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),pD=l(void 0);function gD({children:e}){const[t,n]=d(()=>It(Ct.LAST_6_MONTHS)),[r,a]=d("MONTHLY"),[o,i]=d("ACCRUAL"),[l,s]=d(void 0),[c,u]=d([]);return I(pD.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 mD={[Ct.LAST_6_MONTHS]:"Last 6 Months",[Ct.LAST_12_MONTHS]:"Last 12 Months (TTM)",[Ct.LAST_QUARTER]:"Last Quarter",[Ct.LAST_YEAR]:"Last Year",[Ct.THIS_QUARTER]:"This Quarter",[Ct.THIS_YEAR]:"This Year"},vD=[Ct.LAST_6_MONTHS,Ct.LAST_12_MONTHS,Ct.LAST_QUARTER,Ct.LAST_YEAR,Ct.THIS_QUARTER,Ct.THIS_YEAR];const fD=dr({width:"200px",minWidth:"200px"}),bD={width:"fit-content"};function yD({onPresetSelect:e,onCustomSelect:t}){const{close:n}=Mc();return I(qc,{children:P(zg,{style:fD,children:[vD.map((t,r)=>P(f,{children:[I(Qg,{onClick:()=>(e(t),void n()),children:I(Do,{children:mD[t]})}),(1===r||3===r)&&I(mp,{alignment:"horizontal"})]},t)),I(mp,{alignment:"horizontal"}),I(oT,{triggerChildren:I(sT,{displayLabel:"Custom"}),popupChildren:I(qc,{style:bD,children:I(iN,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function CD({value:e,onChange:t}){const n=function(e){const t=Bt(e.endDate),n=Bt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:Ft(n)} - ${null===t?e.endDate:Ft(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${Ft(n)} - ${Ft(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?_t(n,{abbreviateMonth:!0}):`${_t(n,{abbreviateMonth:!0})} - ${_t(t,{abbreviateMonth:!0})}`}(e);return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>P(ic,{popupTriggerProps:e,children:[I(Od,{Component:gE}),I(fc,{wrap:"nowrap",children:n})]})}),I(yD,{onPresetSelect:e=>{t(It(e))},onCustomSelect:e=>{t(e)}})]})}const xD={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},TD={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},wD=["NONE","MONTHLY","QUARTERLY","YEARLY"],kD=dr({width:"200px",minWidth:"200px"});function ED({onSelect:e}){const{close:t}=Mc();return I(qc,{children:I(zg,{style:kD,children:wD.map(n=>I(Qg,{onClick:()=>(e(n),void t()),children:I(Do,{children:xD[n]})},n))})})}function AD({value:e,onChange:t}){const n=TD[e];return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>P(ic,{popupTriggerProps:e,children:[I(Od,{Component:gu}),I(fc,{wrap:"nowrap",children:n})]})}),I(ED,{onSelect:t})]})}function SD({popupTriggerProps:e,text:t}){return P(Tf,{popupTriggerChildrenProps:e,children:[I(mS,{children:I(fc,{wrap:"wrap",children:t})}),I(Od,{Component:hl})]})}function ID({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=nk(n,e.key),i=ok(e.name,o,1);return P(Dc,{children:[I(Lc,{children:e=>I(SD,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>rk(n,e.key,t))},filters:a})]})}const ND=Ei(wm,"Bank");function PD({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(mI,{isSelected:n}):I(Cf,{selected:n,showEmptyIndicator:!0});return P(Tf,{handleClick:t,selected:n,children:[P(mS,{children:[o&&I(Dd,{imageUrl:e.iconUrl,Component:ND}),I(fc,{wrap:"wrap",children:e.name})]}),i]})}function RD({values:e,model:t,pendingFilters:n,onClick:r}){return I(ff,{title:I(Lo,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=nk(n,t.key),i=(l=e,o.some(e=>x(e.value,l.value)));var l;return I(PD,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(pf,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function DD({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ae(e,rm),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return I(RD,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function MD({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I(cf,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:DD,DefaultList:RD,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function LD({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=Mc();return I(tf,{title:"Back",Footer:I(FS,{onClearAll:()=>{a(e=>rk(e,t.key,[]))},onApply:()=>{const e=nk(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(MD,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function FD({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=Mc();return I(FS,{onApply:()=>{n(ak(e)),a()},onClearAll:()=>{t(e=>rk(e,r,[]))}})}function OD({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=nk(n,e.key),a=e.singleSelect?(o=r,i=t,l=e.createFilter,o.some(e=>x(e.value,i.value))?o:[l(i)]):function(e,t,n){const r=e.findIndex(e=>x(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 rk(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=I(tf,{title:"Back",Footer:I(FD,{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(fr(l)||!lt(l))return null;if(s)return I(Ef,{});i=I(LD,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=nk(n,e.key),s=ok(e.name,l);return P(Dc,{children:[I(Lc,{children:e=>I(SD,{popupTriggerProps:e,text:s})}),i]})}const VD=dr({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function BD({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=Nw();return I("div",{className:VD,children:I(ff,{title:I(Lo,{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 fr(o)&&void 0===t.SimpleListComponent?I(ID,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):I(OD,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function UD(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(fr(e)||n.has(e))continue;const i=r.children.find(e=>!fr(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 WD(){return cI({select:UD})}function HD(e){return!fr(e)&&e.startsWith("dimension_")}const _D=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:Ri(t[1].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function zD(){return Kr({queryKey:["dimensions"],queryFn:_D})}function qD({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=zD(),{query:{data:i}}=cI(),l=HD(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||!eb(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(cb,{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=>rk(e,l,n))},allowMultiselect:!0})}function jD(e,t){return st({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>I(qD,{...e,dimension:t})})}function KD({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=dI(),t=function(){const{query:{data:e}}=WD();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,jD(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:hS(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=Mc(),[a,i]=d(()=>tk(e,n));return I(ef,{title:"Filter By",padChildren:!1,Footer:I(FS,{onApply:()=>{t(ak(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:I(BD,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function YD({filters:e,setFilters:t}){const{open:n}=Mc();return I(jv,{overlay:!0,children:n&&I(KD,{filters:e,setFilters:t})})}function ZD({filters:e,setFilters:t}){return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>P(ic,{popupTriggerProps:e,children:[I(Od,{Component:QI}),I(fc,{wrap:"nowrap",children:"Filters"})]})}),I(YD,{filters:e,setFilters:t})]})}const GD=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"})))),QD=Ei(GD,"DimensionValue"),XD=dr({width:"200px",minWidth:"200px"});function JD({labels:e,onSelect:t}){const{close:n}=Mc(),r=e=>{t(e),n()};return I(qc,{children:P(zg,{style:XD,children:[I(Qg,{onClick:()=>r(void 0),children:I(Do,{children:"None"})}),e.map(e=>I(Qg,{onClick:()=>r(e.id),children:I(Do,{children:e.name})},e.id))]})})}function $D({value:e,onChange:t}){const{query:{data:n=[]}}=WD();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>P(ic,{popupTriggerProps:e,children:[I(Od,{Component:QD}),I(fc,{wrap:"nowrap",children:a})]})}),I(JD,{labels:n,onSelect:t})]})}function eM({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(Hf,{width:"fit",options:r,selectedIndex:a,handleClick:i})})}const tM=Ei(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 nM(){return P(ic,{disabled:!0,children:[I(bl,{Component:tM}),I(fc,{children:"Export Report"})]})}function rM(){return P(ic,{disabled:!0,children:[I(bl,{Component:Bd}),I(fc,{children:"Send Report"})]})}function aM({filters:e,setFilters:t}){return e.map((n,r)=>I(xb,{text:n.name,onClickRemove:()=>t(it(e,r)),additionalValidClassName:vr["filter-pill"]},n.id))}function oM(){const e=i(pD);if(void 0===e)throw new Error("useReportPreviewContext must be used within a ReportPreviewProvider");return e}const iM=tP({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),lM=tP({gap:"8px",flexWrap:"wrap"});function sM({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}=oM();return P(N,{children:[P("div",{className:iM,children:[P("div",{className:lM,children:[I(CD,{value:n,onChange:r}),I(AD,{value:a,onChange:o}),e&&I(ZD,{filters:d,setFilters:u}),e&&I($D,{value:s,onChange:c})]}),P("div",{className:lM,children:[I(eM,{textOverrides:t?.accountingMethod,accountingMethod:i,onChange:l}),I(nM,{}),I(rM,{})]})]}),e&&I(kN,{children:I(aM,{filters:d,setFilters:u})})]})}const cM=gr({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:ho,bold:po},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 dM({children:e,colspan:t,...n}){return I("th",{colSpan:t,className:cM({...n}),children:e})}const uM=gr({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:ho,bold:po},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"}}),hM=aP({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"}),pM=dr({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),gM=dr({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),mM=dr({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function vM({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:hM,ref:t,onScroll:n,children:P("table",{className:pM,children:[I("thead",{className:gM,children:e.getHeaderGroups().map(e=>I("tr",{className:mM,children:e.headers.map((e,t)=>e.isPlaceholder?I(dM,{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:uM({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 fM=e=>["reports","profitAndLoss",e],bM=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(n);return"SUCCESS"===r.result?r.data:void 0};function yM(e){const t=[];return{caboose:()=>[...t],car(e){return t.push(e),this}}}const CM="Total";function xM(e){return Vr(e)?CM:`${CM} ${e}`}function TM(e){if(void 0!==e)return Eo(fh(e),{cents:"always",signage:"parens"})}function wM(e){if(!fr(e))return Eo(fh(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function kM(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?kM(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 EM(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function AM(e){if(!fr(e))return Eo(e,{cents:"always",decorator:"%",signage:"parens"})}function SM({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return I("td",{rowSpan:e,onClick:n,className:cM({clickable:r??void 0!==n,...a}),children:t})}const IM=Ei(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 NM({expanded:e,canExpand:t=!0}){return I(Oc,{Component:t?e?zp:hl:IM})}const PM=dr({alignItems:"center",display:"flex",gap:8});function RM({depth:e=0,children:t}){return I("div",{className:PM,style:{paddingLeft:9*e},children:t})}function DM({context:e}){const t=e.table.getIsAllRowsExpanded();return I(SM,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:P(RM,{children:[I(NM,{expanded:t}),t?"Collapse All":"Expand All"]})})}function MM(e){return"expandTotal"===e.row.original.type?e.row.depth-1:e.row.depth}function LM({context:e}){return I(SM,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:P(RM,{depth:MM(e),children:[I(NM,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})}const FM=J();function OM(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const VM=FM.accessor("label",{id:"label",header:e=>I(DM,{context:e}),cell:e=>I(LM,{context:e})});const BM={placeholderData:L},UM=S.object({glAccountId:S.string(),dateRange:S.object({start:S.string().optional(),end:S.string().optional()}).optional(),accountingMethod:S.enum(["CASH","ACCRUAL"])}),WM=[];function HM(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function _M(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!HD(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 zM(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=oM(),i=function(){const e=eD();return u((t,n)=>{e(t,{state:n})},[e])}(),{query:{data:l},isFilling:s}=(c={filter:{...e,dimensionValues:_M(a),customerIds:HM(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},d=BM,Kr({queryKey:fM(c??{}),queryFn:bM,...d}));var c,d;const h=u((e,t)=>{fr(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=EM(e,e=>wM(n(e)?.total));var i;return{key:t,label:a,values:o,subrows:[...kM(r?.children??[],t,e=>n(e)?.children,t=>EM(e,e=>TM(t(e)?.total))),{key:`${t}.total`,label:xM(a),type:"expandTotal",values:o}]}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,type:a,values:EM(e,r)})}(t);return yM().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>wM(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>AM(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>wM(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>AM(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>wM(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}(l),[l]),g=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)=>FM.accessor(`values.${d}[${t}]`,{header:t=>I(dM,{border:OM(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&&Br(t.accountId)?()=>h(t,c):void 0;return I(SM,{border:OM(e.column)?"left":void 0,alignment:"end",onClick:r,children:!n&&e.cell.getValue()})}})));var c,d,u,h;return l?FM.group({id:`valueRecord.${o}`,header:t=>I(dM,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:s}):s[0]});return[VM,...o]}(l,h),[l,h]);return{table:$({data:p??WM,columns:g,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 qM(){const{table:e,isFilling:t}=zM();return P(N,{children:[I(sM,{hasDimensionFiltering:!0}),!t&&I(vM,{table:e})]})}const jM=e=>["reports","balanceSheet",e],KM=async e=>{const t=e.queryKey,n={path:"/v6/reports/balanceSheet",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(n);return"SUCCESS"===r.result?r.data:void 0};function YM(e,t){const n=e.map((e,n)=>[`${n}[0]`,t(e)]);return Object.fromEntries(n)}function ZM(e,t,n,r){const a=YM(n,e=>wM(r(e)?.total)),o=[...kM(e.children??[],t,e=>r(e)?.children,e=>YM(n,t=>TM(e(t)?.total))),{key:`${t}.total`,label:xM(e.name),type:"expandTotal",values:a}];return{key:t,label:e.name,values:a,subrows:o}}const GM=xM("Liabilities and Equity");const QM=J(),XM=QM.accessor("label",{id:"label",header:e=>I(DM,{context:e}),cell:e=>I(LM,{context:e})});const JM=[];function $M(){const{dateRange:e,period:t,accountingMethod:n}=oM(),{query:{data:r},isFilling:a}=(i=BM,Kr({queryKey:jM({filter:e,grouping:{period:t},accountingMethod:n}),queryFn:KM,...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=yM(),a=n.assets;a&&r.car(ZM(a,"assets",t,e=>e.assets));const o=n.liabilitiesAndEquity?.liabilities;o&&r.car(ZM(o,"liabilities",t,e=>e.liabilitiesAndEquity?.liabilities));const i=n.liabilitiesAndEquity?.equity;i&&r.car(ZM(i,"equity",t,e=>e.liabilitiesAndEquity?.equity));const l=n.liabilitiesAndEquity?.name;return r.car({key:"totalLiabilitiesAndEquity",label:void 0!==l?xM(l):GM,type:"reportTotal",values:YM(t,e=>wM(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,QM.accessor(`values.${r}[0]`,{header:()=>I(dM,{border:"left",weight:"bold",alignment:"end",children:n.name}),cell:e=>{const t=e.row.getCanExpand()&&e.row.getIsExpanded();return I(SM,{border:"left",alignment:"end",children:!t&&e.cell.getValue()})}});var n,r});return[XM,...t]}(r),[r]);return{table:$({data:l??JM,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 eL(){const{table:e,isFilling:t}=$M();return P(N,{children:[I(sM,{hasDimensionFiltering:!1}),!t&&I(vM,{table:e})]})}const tL=e=>["reports","cashFlowStatement",e],nL=async e=>{const t=e.queryKey,n={path:"/v6/reports/cashFlowStatement",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(n);return"SUCCESS"===r.result?r.data:void 0};function rL(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function aL(e,t,n,r){const a=kM(e.children??[],t,e=>r(e)?.children,e=>rL(n,t=>TM(e(t)?.total))),o=rL(n,e=>wM(r(e)?.total)),i=[...a,{key:`${t}.total`,label:xM(e.name),type:"expandTotal",values:o}];return{key:t,label:e.name,values:o,subrows:i}}const oL=J();function iL(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const lL=oL.accessor("label",{id:"label",header:e=>I(DM,{context:e}),cell:e=>I(LM,{context:e})});const sL=[];function cL(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!HD(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 dL(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=oM(),{query:{data:i},isFilling:l}=(s={filter:{...e,dimensionValues:cL(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},c=BM,Kr({queryKey:tL(s??{}),queryFn:nL,...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=yM();return n.operatingActivities&&r.car(aL(n.operatingActivities,"operatingActivities",t,e=>e.operatingActivities)),n.investingActivities&&r.car(aL(n.investingActivities,"investingActivities",t,e=>e.investingActivities)),n.financingActivities&&r.car(aL(n.financingActivities,"financingActivities",t,e=>e.financingActivities)),r.car({key:"changeInCash",label:"Change in Cash",type:"sectionStart",values:rL(t,e=>wM(e.netCashChange))}),r.car({key:"beginCash",label:"Beginning Cash",values:rL(t,e=>wM(e.beginCashBalance))}),r.car({key:"endCash",label:"End Cash",type:"reportTotal",values:rL(t,e=>wM(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)=>oL.accessor(`values.${c}[${t}]`,{header:t=>I(dM,{border:iL(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(SM,{border:iL(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?oL.group({id:`valueRecord.${a}`,header:t=>I(dM,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[lL,...a]}(i),[i]);return{table:$({data:d??sL,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 uL={accountingMethod:{cash:"Cash (Direct)",accrual:"Accrual (Indirect)"}};function hL(){const{table:e,isFilling:t}=dL();return P(N,{children:[I(sM,{hasDimensionFiltering:!0,textOverrides:uL}),!t&&I(vM,{table:e})]})}const pL=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"})),gL=dr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"center",paddingTop:"15%",width:"100%",height:"100vh"}),mL=dr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"flex-start"}),vL=dr({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%"}),fL=dr({display:"flex",flexDirection:"column",gap:"12px"}),bL=dr({fontFamily:"Duplet Semibold, sans-serif",fontWeight:"md",fontSize:"md",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),yL=dr({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"}),CL=dr({display:"inline"});function xL(){const e=Zk();return I("div",{className:gL,children:P("div",{className:mL,children:[e&&I(qk,{}),P("div",{className:vL,children:[I(pL,{width:89,height:24,overflow:"visible"}),P("div",{className:fL,children:[P("span",{className:CL,children:[I("span",{className:bL,children:"This component is currently only available in the "}),I("a",{className:bL,href:"https://docs.tight.com/v5.0/embeddable-ui/white-labeled-experience/how-to-embed",target:"_blank",rel:"noreferrer",children:"v5 Javascript SDK"})]}),P("span",{className:CL,children:[I("span",{className:yL,children:"It will be available in "}),I("a",{className:yL,href:"https://docs.tight.com/embeddable-ui/tight-embeddable-ui",target:"_blank",rel:"noreferrer",children:"v6 React Components"}),I("span",{className:yL,children:" soon"})]})]})]})]})})}function TL({onClick:e,accounts:t,listLabel:n,nestedTitle:r,isFilling:a,selectedAccountId:o,onSelect:i,Header:l}){return a?I(If,{}):P(N,{children:[l,I(ff,{title:I(Do,{children:n}),children:t.map(t=>t.hasChilds?I(vS,{text:t.name,iconUrl:t.iconUrl,title:r,children:I(wL,{accounts:t.children,selectedAccountId:o,onSelect:i,listLabel:t.name,nestedTitle:r})},t.id):I(wf,{handleClick:()=>e(t),selected:t.id===o,children:I(mS,{children:I(fc,{wrap:"wrap",children:t.name})})},t.id))})]})}function wL({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=Mc(),c=e=>{n(e),s.close()},d=t?/* @__PURE__ */new Set([t]):/* @__PURE__ */new Set;return I(cf,{placeholder:o,onClick:c,SearchList:({searchTerm:t,onClick:n})=>I(SS,{searchTerm:t,onClick:n,glAccounts:e,isFilling:r,selectedIds:d}),DefaultList:TL,listLength:e.length,extraProps:{accounts:e,listLabel:a,nestedTitle:i,isFilling:r,selectedAccountId:t,onSelect:c,Header:l},forceSearchVisible:!0})}const kL=dr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function EL({children:e,...t}){return I("button",{className:kL,type:"button",...t,children:e})}const AL=dr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",minWidth:"280px"});function SL({isMobile:e}){const t=Mc(),n=a(e);return s(()=>{n.current!==e&&(n.current=e,t.close())},[e,t]),null}function IL({selectedAccountId:e,onSelect:t}){const{query:{data:n},isFilling:r}=wx({select:e=>Dx(e.filter(e=>"ACTIVE"===e.status))});return I(tf,{title:"Select Account",overlay:!0,children:I(wL,{accounts:n??[],isFilling:r,onSelect:t,selectedAccountId:e})})}function NL({onSelect:e}){return I(hT,{onClick:e,activeOnly:!0})}function PL({selectedAccountId:e,onSelect:t,initialOpen:n=!1}){const r=Nw(),{query:{data:a}}=wx(),o=a?.find(t=>t.id===e);return P(Dc,{placement:"bottom-start",initialOpen:n,children:[I(SL,{isMobile:r}),I(Lc,{children:e=>{return I(Np,{label:"Account",popupTriggerProps:e,additionalStyles:AL,children:P(EL,{children:[I(fc,{intent:o?"default":"weak",children:(t=o,t?(n=t.accountNo,r=t.name,`${n?`#${n}`:""} ${r??""}`.trim()):"Select an account")}),I(Od,{Component:hl})]})});var t,n,r}}),r?I(IL,{selectedAccountId:e,onSelect:t}):I(NL,{onSelect:t})]})}const RL=(e,t)=>["generalLedger",e,t],DL=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:Ri(t[4].environment)},r=await Ua(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 ML({name:e,align:t="left"}){return I(td,{align:t,padding:"right"===t?"large":"default",children:I(Ec,{children:e})})}const LL={...kC,INVOICE:"Invoice",BILL:"Bill",PAYROLL:"Payroll",JOURNAL_ENTRY:"Journal Entry"};function FL(e){return null===e||0===e?"":Io(fh(e))}function OL({entry:e}){return I(mc,{children:I(_C,{label:e.entity?.displayName??"",subLabel:e.entity?.secondaryDisplayName??void 0,iconSpacing:!1})})}function VL({label:e}){return I(mc,{children:I(fc,{children:e})})}function BL({balance:e}){return I(mc,{alignVariant:"flexEnd",children:I(ZC,{amount:(t=e??null,No(null===t?0:fh(t)))})});var t}const UL=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"100%"});function WL(e){return function(t){return"entry"!==t.row.original.kind?null:I(e,{entry:t.row.original.entry})}}const HL=J(),_L=[HL.display({id:"date",cell:WL(function({entry:e}){return I(mc,{children:I(xC,{date:e.date})})}),header:()=>I(ML,{name:"Date"}),size:100,maxSize:130}),HL.display({id:"type",cell:WL(function({entry:e}){return I(mc,{children:I(fc,{children:(t=e.type,fr(t)?"":LL[t])})});var t}),header:()=>I(ML,{name:"Type"}),size:110}),HL.display({id:"source",cell:e=>{const t=e.row.original;if("entry"===t.kind)return I(OL,{entry:t.entry});const n="beginningBalance"===t.kind?"Beginning Balance":"Ending Balance";return I(VL,{label:n})},header:()=>I(ML,{name:"Source"}),size:180}),HL.display({id:"debit",cell:WL(function({entry:e}){return I(mc,{alignVariant:"flexEnd",children:I(ZC,{amount:FL(e.drAmount)})})}),header:()=>I(ML,{name:"Debit",align:"right"}),size:100,maxSize:130}),HL.display({id:"credit",cell:WL(function({entry:e}){return I(mc,{alignVariant:"flexEnd",children:I(ZC,{amount:FL(e.crAmount)})})}),header:()=>I(ML,{name:"Credit",align:"right"}),size:100,maxSize:130}),HL.display({id:"balance",cell:e=>{const t=e.row.original,n="entry"===t.kind?t.entry.runningBalance:t.balance;return I(BL,{balance:n})},header:()=>I(ML,{name:"Balance",align:"right"}),size:110,maxSize:140}),HL.display({id:"account",cell:WL(function({entry:e}){const t=e.glAccount?.iconUrl,n=Br(t)?Pm(t,""):void 0;return I(mc,{children:P("div",{className:UL,children:[n&&I(Od,{Component:n}),I(fc,{children:e.glAccount?.displayName??""})]})})}),header:()=>I(ML,{name:"Account"}),size:140}),HL.display({id:"drilldown",cell:WL(function(){return I(mc,{alignVariant:"center",children:I(Od,{Component:hl})})}),size:40,maxSize:60})];function zL(e){return"beginningBalance"===e.kind?"__beginning_balance__":"endingBalance"===e.kind?"__ending_balance__":e.entry.id??""}const qL=JN({gap:"16px",alignItems:"stretch",width:"100%"}),jL=dr({alignSelf:"flex-start"}),KL=dr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}),YL=[];function ZL({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 Ml({queryKey:RL(e??"",t),queryFn:DL,...n,enabled:Br(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 YL;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:_L,getCoreRowModel:ee(),getRowId:zL})}({rows:h});return P("div",{className:qL,children:[I("div",{className:jL,children:I(PL,{selectedAccountId:e,onSelect:e=>t(e.id)})}),e&&P(fl.Provider,{value:c,children:[I(uc,{dashboard:"generalLedger",children:s?I(Nl,{numColumns:_L.length}):P(N,{children:[I(Gl,{headerGroups:p.getHeaderGroups()}),h.length>0?I(Xl,{children:p.getRowModel().rows.map(e=>I(us,{rowData:e,shouldDisplayDivider:()=>!1},e.id))}):I(Pd,{children:I(fc,{children:"No entries for this account."})})]})}),I("div",{className:KL,children:I(wl,{})})]})]})}const GL=JN({gap:"16px",alignItems:"flex-start",width:"100%"}),QL=S.object({label:S.string()}),XL=Fe([{path:$R["/"].path,errorElement:I(N,{}),element:I(Me,{}),handle:$R["/"].handle,children:[{index:!0,Component:function(){const e=Zk();return P("div",{className:oD,children:[e&&I(qk,{}),P("div",{className:iD,children:[I(tD,{}),I(nD,{}),I(rD,{}),I(aD,{})]})]})}},{Component:function(){return P("div",{className:uD,children:[I(dD,{}),I("div",{className:hD,children:I(Me,{})})]})},children:[{path:$R["profit-and-loss"].path,element:I(Me,{}),handle:$R["profit-and-loss"].handle,children:[{index:!0,Component:function(){return I(gD,{children:I(qM,{})})}},{path:$R["profit-and-loss/general-ledger"].path,Component:function(){const e=Xe(),{state:t}=Le(),n=(r=t,UM.safeParse(r).success?t:void 0);var r;const[a,o]=d(n?.glAccountId),[i,l]=d(n?.dateRange),[s,c]=d(n?.accountingMethod??un);return e?I("div",{className:GL,children:I(ZL,{glAccountId:a,onGlAccountChange:o,dateRange:i,onDateRangeChange:l,accountingMethod:s,onAccountingMethodChange:c})}):I(xL,{})},handle:$R["profit-and-loss/general-ledger"].handle}]},{path:$R["balance-sheet"].path,Component:function(){return I(gD,{children:I(eL,{})})},handle:$R["balance-sheet"].handle},{path:$R["cash-flow-statement"].path,Component:function(){return I(gD,{children:I(hL,{})})},handle:$R["cash-flow-statement"].handle}]}]}]);function JL(){return s(()=>()=>{XL.navigate($R["/"].route)},[]),I(Oe,{router:XL})}function $L(){return I(tE,{children:I(JL,{})})}const eF=We("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),tF={queryClient:zr,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await eF).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await eF).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await eF).delete("queryClient",e)}(e)}}}(),maxAge:_r,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function nF({children:e}){return I(He,{client:zr,persistOptions:tF,children:e})}const rF=dr({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"}}),aF=dr({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:"overlay",overscrollBehavior:{base:"contain",xl:"none"}}),oF=kr(null,vr.component,rF);function iF({children:e}){const t=a(null),n=a(null),r=Nw();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:aF,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,yn.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...oF,children:e})})})}const lF=l({closingQueue:[],drawerHistory:[]});function sF({children:e}){const t=yn(e=>e.drawerHistory),n=yn(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(lF.Provider,{value:r,children:a&&I(iF,{children:e})})}const cF=l({isActive:!0,isClosing:!1});function dF({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=i(lF),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(cF.Provider,{value:{isActive:s,isClosing:c},children:d&&I(e,{...d.routeProps})})}const uF=gr({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"}}),hF=dr({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function pF({children:e,side:t="right",mobileCoverage:n="full"}){const r=a(null),{isActive:o,isClosing:l}=i(cF),{onExitAnimationEnd:c,onInitialAnimationComplete:h}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=d(!0),o=u(()=>{yn.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:P(Ne.div,{tabIndex:-1,ref:m,onAnimationComplete:()=>h(),transition:Ov,initial:Bv(t),animate:Vv,exit:Uv(t),...kr(vr.drawer,uF({side:t,mobileCoverage:n})),children:[e,!o&&I("div",{className:hF})]})})})}const gF=gr({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 mF({background:e,children:t}){return I("div",{className:gF({background:e}),children:t})}const vF=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function fF(e){return void 0!==vF[e]}function bF(e){return vF[e]}const yF=Ei(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"),CF=dr({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function xF({cldrShortName:e}){return I("div",{className:CF,children:bF(e)})}const TF=gr({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),wF=dr({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 kF({reactions:e,type:t,handleClick:n}){return I("div",{className:wF,children:e.map((e,r)=>I("button",{className:TF({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(xF,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const EF=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:Ri(n)};return await Ua(o)},AF=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:Ri(n)};return await sv(o)};function SF(e,t,n){return Lr(Ls({id:e}),t,n)}async function IF(e){const t=Ls({id:e});return Ia("mutation successful, invalidating messages queries"),zr.invalidateQueries({queryKey:t}).catch(e=>Na({error:e,severity:"error"}))}function NF(e,t,n){const r=[...e];return r[n]=t,r}const PF=dr({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),RF=Object.keys(vF).filter(fF).map(e=>({emojiCode:e,authorInfo:[]}));function DF({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:l}=i(od),{mutate:s}=function(e){const{userId:t,userEmail:n}=i(od);return iv({mutationFn:EF,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=SF(n,t,r);await zr.cancelQueries({queryKey:i});const l=zr.getQueryData(i);return zr.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:NF(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:()=>IF(e)})}(e);return P(Dc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(Lc,{children:e=>I("button",{className:PF,...e,children:I(Od,{Component:yF})})}),I(qc,{type:"reaction",children:I(kF,{reactions:RF,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 MF=gr({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function LF({reactions:e,type:t,handleClick:n}){const r=MF({type:t});return I("div",{className:r,children:I(kF,{reactions:e,handleClick:n,type:t})})}const FF=gr({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),OF=gr({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"}}}}),VF=dr({position:"relative",display:"flex",flexDirection:"column"});function BF({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(od);return iv({mutationFn:AF,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=SF(n,t,r);await zr.cancelQueries({queryKey:o});const i=zr.getQueryData(o);return zr.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return fr(r)||0===r.reactions.length?t:NF(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:()=>IF(e)})}(e),m=n?"sent":"received",v=o.filter(e=>fF(e.emojiCode)),f=v.length>0,b="sent"===m?vr["message-sent"]:vr["message-received"],y=kr(vr[b],OF({type:m}));return P("div",{className:FF({type:m,hasReactionsOnMessage:f}),ref:l,onMouseEnter:()=>"received"===m&&u(!0),children:[P("div",{className:VF,children:[I("div",{...y,children:r}),f&&I(LF,{reactions:v,type:m,handleClick:e=>g({id:t,emojiCode:e})})]}),c&&I(DF,{conversationId:e,messageId:t,type:m,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const UF=gr({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),WF=dr({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}),HF=dr({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),_F=dr({textDecoration:"none",color:"inherit",cursor:"pointer"});function zF({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=Nw();return I("div",{className:UF({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 Na({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:_F,children:P("div",{className:WF,children:[P("div",{className:HF,children:[I(fc,{children:n}),I(Lo,{children:`${r}`})]}),I(Od,{Component:tM})]})})})}const qF=kr(null,dr({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function jF({children:e}){return I("div",{...qF,children:e})}const KF=kr(null,dr({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"})),YF=dr({minHeight:1,width:"100%"}),ZF=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=u(()=>{t&&br(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),P("div",{tabIndex:-1,...KF,ref:i,children:[I("div",{className:YF,ref:o}),e]})}),GF=Object.freeze({message:{text:"",attachments:[]}}),QF=dr({width:"24px",height:"24px",objectFit:"contain"});function XF({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:QF})}const JF=dr({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"}),$F=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),eO=dr({display:"grid",flexDirection:"column",minWidth:0}),tO="LOADING",nO="LOADED",rO="ERROR";function aO({attachment:e,onRemove:t}){const n=e.hasError?rO:e.isPending?tO:nO;return P("div",{className:JF,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[P("div",{className:$F,children:[e.iconUrl&&I(XF,{iconUrl:e.iconUrl,fileName:e.displayFileName}),P("div",{className:eO,children:[I(fc,{children:e.displayFileName}),n===tO&&e.displayText&&I(Lo,{accent:"strongest",children:e.displayText}),n===nO&&e.fileSize&&I(Lo,{children:e.fileSize}),n===rO&&I(Lo,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(Xc,{onClick:async n=>{n.stopPropagation(),await mh({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Ju,label:"Cancel"},{key:$u,label:"Remove",type:gh.DANGER}]})===$u&&t(e)},children:I(bl,{Component:Fc})})]})}const oO=dr({width:"100%"});function iO({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:Eb({defaultValues:t??GF,onSubmit:t=>{kg.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}=Hh({mutationFn:yg,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await zr.invalidateQueries({queryKey:["files/attachments"]}),await zr.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:oO,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=>P(N,{children:[e.map(e=>I(aO,{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 lO(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 sO(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return Ia("mutation successful, invalidating messages queries"),Promise.all([zr.invalidateQueries({queryKey:e}),zr.invalidateQueries({queryKey:t}),zr.invalidateQueries({queryKey:n})]).catch(e=>Na({error:e,severity:"error"}))}const cO=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>ql({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),dO=async({data:e,accessToken:t,environment:n})=>ql({data:{data:[e]},accessToken:t,environment:n}),uO=dr({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),hO=dr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),pO=dr({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),gO="Marked As Resolved";function mO({resolver:e}){const t=e?`${e} ${gO}`:gO;return P("div",{className:hO,children:[I("div",{className:uO}),I("div",{className:pO,children:t}),I("div",{className:uO})]})}const vO=gr({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 fO({width:e="md",height:t="md"}){return I(ii,{styles:vO({width:e,height:t})})}const bO=dr({display:"flex",flexDirection:"row-reverse"});function yO(){return P(N,{children:[I(fO,{width:"lg",height:"lg"}),I("div",{className:bO,children:I(fO,{width:"md",height:"lg"})}),I("div",{className:bO,children:I(fO,{width:"lg",height:"xl"})}),I(fO,{width:"md",height:"lg"})]})}const CO=dr({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function xO({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(jF,{children:I(BF,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(jF,{children:I(yO,{})}):P("div",{className:CO,children:[I(Do,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(fc,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const TO=kr(null,dr({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 wO({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:l,defaultValues:c,defaultSubject:u}){const{userId:h}=i(od),{mutate:p}=function(){const{userId:e}=i(od);return iv({mutationFn:Vs,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=Lr(Ls({id:e.conversationId}),t,n);await zr.cancelQueries({queryKey:a});const o=zr.getQueryData(a);return zr.setQueryData(a,t=>[lO(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:sO})}(),{query:{data:g},isFilling:m}=function(e){const t=br(e);return Kr({queryKey:Ls({id:e??""}),queryFn:Os,select:Fs,enabled:t})}(e),{mutate:v,isPending:f,variables:b}=(k=t,E=l,iv({mutationFn:dO,meta:{toastOptions:{defaultErrorMessage:"Failed to create conversation"}},onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(fr(e)||fr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(br(E)){const e={id:E};vs(E,ms.BANK_TRANSACTION)?o=async()=>{const t=Ss(e);return await zr.invalidateQueries({queryKey:t})}:vs(E,ms.FINANCIAL_SUMMARY)&&(i=async()=>await zr.invalidateQueries({queryKey:a}))}return Ia("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([zr.invalidateQueries({queryKey:n}),zr.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>Na({error:e,severity:"error"}))}})),{mutate:y}=iv({mutationFn:cO,meta:{toastOptions:{defaultErrorMessage:"Failed to mark conversation as read"}},onSuccess:async()=>{const e=["conversations"],t=["tasks"];return Ia("mutation successful, invalidating conversations queries"),Promise.all([zr.invalidateQueries({queryKey:e}),zr.invalidateQueries({queryKey:t})]).catch(e=>Na({error:e,severity:"error"}))}}),[C,x]=d(!1),T=a(null),w=a(null);var k,E;s(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),s(()=>{lg(w)},[g,w]);const A=fr(e)||fr(g)||m;return P(N,{children:[A?I(ZF,{ref:w,inputRef:T,activeKeyboard:C,setActiveKeyboard:x,children:I(xO,{isConversationLoading:f,isFilling:m,message:b?.message?.text})}):P(ZF,{ref:w,activeKeyboard:C,setActiveKeyboard:x,inputRef:T,children:[n&&I(mO,{resolver:"Conversation"}),g.map((t,n)=>{const r=t[0].author.userId===h;return I(jF,{children:t.map(t=>P(N,{children:[t.attachments.filter(e=>!fr(e)).map(e=>I(zF,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(BF,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...TO,children:I(iO,{scrollRef:w,inputRef:T,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(fr(e)){const e=function(e,t,n){let r="";return br(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",...br(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:x,defaultValues:c})})]})}function kO({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=d(e),{query:{data:o}}=zl(r),i="CLOSED"===o?.resolutionStatus;return P(mF,{children:[I(Gv,{}),I(wO,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const EO=kr(vr["form-body"],dr({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 AO({children:e}){return I("div",{...EO,tabIndex:-1,children:e})}const SO=kr(null,dr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),IO=kr(null,dr({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),NO=dr({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),PO=e=>{Mp(e),Lp(e)},RO=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:o,conversationId:l,transactionId:c,transaction:d})=>{const{isClosing:u}=i(cF),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}=yn.getState(),t=h.current;br(t)&&(vs(t.id,ms.BANK_TRANSACTION)?ys(e.transactionForm,{type:"CLOSE_BANK_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}):ys(e.transactionForm,{type:"CLOSE_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}))},[u]),I(pF,{children:P("div",{...SO,children:[I(mF,{children:P("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:PO,...IO,children:[n,I(AO,{children:e}),r]})}),null!==o&&I("div",{className:NO}),"conversation"===o&&c&&I(kO,{conversationId:l,attachedEntityId:c,defaultSubject:d?.description})]})})},DO=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],MO=["FEDERAL","STATE","SALES"],LO=["Q1","Q2","Q3","Q4"],FO=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function OO(e){if(!fr(e))return FO.find(t=>t.value===e)?.name}const VO=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(Hi)),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=ht(e.getFullYear(),e.getMonth(),e.getDate()),r=ht(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||Dt(new Date(e),/* @__PURE__ */new Date))&&Lt(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(wg)}),BO=S.object({id:S.string(),name:S.string().optional(),requiredness:S.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),UO=S.object({id:S.string(),name:S.string().optional(),dimension:BO.optional()}),WO=UO.extend({child:UO.optional()}),HO=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(WO),customer:S.object({id:S.string(),name:S.string().optional()}).nullable(),amount:S.number()}),_O=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()})}),zO=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()})}),qO=S.object({lineItemType:S.literal("fee"),amount:S.number()}),jO=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()})})}),KO=S.discriminatedUnion("lineItemType",[HO,_O,qO,zO,jO]),YO=VO.extend({children:S.array(KO),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).nullable()});YO.extend({tax:S.object({paymentInfo:S.object({region:S.enum(MO).optional(),year:S.number().optional(),quarter:S.enum(LO).optional()}).nullable().optional()}).optional()});const ZO=VO.extend({id:S.string(),type:S.literal(Object.values(wC)),description:S.string(),displayName:S.string(),iconUrl:S.string(),status:S.literal(Object.values(BN)),reviewStatus:S.literal(Object.values(Hi)),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()}),GO=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()}),QO=S.object({children:S.array(GO),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"]})})}),XO=YO.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&&Vr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),JO=YO.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!!fr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>JO.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),$O=ZO.extend({}),eV=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()}),tV=S.object({children:S.array(eV),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"]})})}),nV=YO.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 rV(e){return e.reduce((e,t)=>new W(e).plus(t??0).toNumber(),0)}function aV(e,t){const n=new W(e).times(100).round(0),r=new W(t).times(100).round(0);return!n.eq(r)}function oV(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(Vr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function iV(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function lV(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function sV(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function cV(e){return"EXPENSE"!==e.type||fr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function dV(e,t,n){if(e(t))return n}const uV={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function hV(e){return Vr(e)?void 0:e}function pV(e,t,n){const r=(e,t)=>dV(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:hV((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:hV(e.id),amount:e.amount?bh(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:hV(e.id),amount:bh(e.amount)}}(e);case"bill":return function(e){return{id:hV(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:hV(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?bh(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=>!fr(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 fr(t)?e:{...e,glAccountId:fs({id:t,prefix:"GL_ACCOUNT"})}});return fr(r)?fr(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:fs({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function gV(e=null){const{mutateAsync:t}=fx(),{mutateAsync:n}=yx({mutationFn:hx,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}}),{query:{data:r}}=ET();return async(a,o,i)=>{const l=r?.data??[];var s,c;e?(await t(function(e,t,n,r){return{...pV(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,{...pV(s,c,()=>!0),amount:s.amount?bh(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||uV[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}))}}const mV=YO.extend({type:S.literal("TAX_PAYMENT"),tax:S.object({paymentInfo:S.object({region:S.enum(MO,{message:`Tax region must be one of: ${MO.join(", ")}`}),quarter:S.enum(LO,{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: ${MO.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))});function vV(){const e=a(!0);return s(()=>(e.current=!0,()=>{e.current=!1}),[]),u(()=>{e.current&&ps()},[])}const fV={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Ut(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:ws[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function bV(e){const t=/* @__PURE__ */new Map;for(const n of e){if(fr(n.bill)||!fr(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 yV(e){const t=/* @__PURE__ */new Map;for(const n of e){if(fr(n.invoice)||!fr(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 CV(e){const t=/* @__PURE__ */new Map;for(const n of e){if(fr(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 xV(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function TV(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(fr(e.paymentId)&&fr(e.bill)&&fr(e.invoice)||xV(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...bV(r),...yV(r),...CV(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=>!(fr(e.invoice)&&fr(e.payroll)&&fr(e.bill)&&fr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return fr(e.paymentId)||xV(e,n)?t&&xV(e,n)?(r=e,{...r,lineItemType:"fee",amount:fh(r.amount)}):fr(e.invoice)?fr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:fh(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return fr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:fh(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:fh(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:fh(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:fh(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=fh(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 wV({value:e}){return{fields:kV(function(e){switch(e){case"EXPENSE":return XO;case"TAX_PAYMENT":return mV;case"BANK_TRANSFER":return JO;case"REVENUE":return nV}}(e.type).safeParse(e))}}function kV(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 EV(e,t,n){const r=gV(e),{query:{data:a}}=wx({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=vV(),i=e?(s=t,c=a,{id:(l=e).id,type:cV(l),reviewStatus:l.reviewStatus,amount:fh(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:oV(l.dimensionValues,s),children:TV(l,c),reconciliationMatch:l.reconciliationMatch?{...l.reconciliationMatch,amount:fh(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:bs(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...fV,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var l,s,c;return Eb({defaultValues:i,canSubmitWhenInvalid:!0,validators:{onBlur:wV,onSubmit:wV},onSubmit:async e=>(await r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),o()),onSubmitInvalid:()=>{}})}function AV({onClick:e}){return I(vN,{Icon:FN,onClick:e,closeOnClick:!0,children:"Archive"})}function SV({onClick:e}){return I(vN,{onClick:e,closeOnClick:!0,children:"Restore"})}function IV(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 NV=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"})),PV=Ei(NV,"Bill");function RV({onClick:e,error:t,validate:n}){return I(xp,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const DV=dr({display:"flex",flexDirection:"column",width:"100%"}),MV=kr(vr["value-comparison-summary"],dr({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),LV=dr({display:"flex",flexDirection:"column",gap:"8px"});function FV({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return I("div",{className:DV,children:P("div",{...MV,children:[P("div",{className:LV,children:[I(fc,{intent:"weak",children:"Selected Total"}),I(Do,{children:Po(fh(e),r)})]}),P("div",{className:LV,children:[I(fc,{intent:"weak",children:`${n} Total`}),I(Do,{children:Io(t)})]})]})})}const OV=dr.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),VV=kr(null,dr({color:"icon.base"}));function BV({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=Hw({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return I("div",{className:rf,children:P("div",{...af,children:[l?I(up,{}):I(Od,{stylists:[VV],Component:nf}),I("input",{className:of,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Lp}),Br(e)&&I(ic,{styles:OV,onClick:()=>o(""),children:I(Od,{Component:Fc})})]})})}const UV=dr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function WV({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return P("div",{className:UV,children:[I(fc,{intent:"weak",children:"Search"}),I(BV,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function HV(e,t,n){return`${e} | ${Ft(Bt(t))} | ${Io(fh(n))}`}const _V=kr(vr["linked-entity-row"],dr({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"}})),zV=dr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),qV=kr(null,dr({color:"icon.base"}));function jV({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return P("button",{type:"button",..._V,onClick:o,children:[P("div",{className:zV,children:[I(Od,{stylists:[qV],Component:r}),I(fc,{wrap:"wrap",children:HV(t,n,e)})]}),I(Cf,{selected:a,showEmptyIndicator:!0})]})}const KV={root:null,threshold:1};function YV({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,KV);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return I("div",{ref:n})}function ZV({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return I(N,{children:t.groups.map(t=>P(xS,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>I(jV,{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(YV,{onIntersect:a,enable:!r&&o})]},t.key))})}function GV(e){return Eo(e,{cents:"always",dollarSign:!0})}function QV(e){return GV(Math.abs(e))}function XV({title:e,body:t}){return mh({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 JV(e,t,n){const r=QV(e);return`The selected bills total of ${QV(t)} is less than the expense total of ${r}. Was there a fee of ${QV(n)}?`}const $V=dr(Yv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function eB({children:e}){return I("div",{className:$V,children:e})}function tB({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(()=>Or(c)?[...n,...t.filter(e=>!v.has(e.id))]:t,[c,n,t,v]),b=df({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]),C=y.reduce((e,t)=>e+t.amount,0),x=l&&!s;return I(ef,{title:"Link Bill",Footer:I(RV,{onClick:()=>{const t=new W(C).div(100).times(-1).toNumber(),n=new W(e).sub(t).toNumber();t>e&&y.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return XV({title:"Bill Payment",body:JV(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:P(eB,{children:[I(FV,{selectedAmount:C,transactionTotal:e,transactionTypeLabel:"Expense"}),I(WV,{searchTerm:c,onChange:u,isFetching:x,searchPlaceholder:"Search bills..."}),I(ZV,{listLabel:"Bills",glSourceList:b,icon:PV,fetchNextPage:a,hasNextPage:i,isFetching:l,pluralNoun:"bills",singularNoun:"bill"})]})})}const nB=e=>["bills/bills","infinite",e??{}],rB=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:Ri(n)},o=await Ua(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})},aB=[];function oB(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 iB(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return fr(e)||(t.search=e),t}function lB(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:iB(t)},Gm({queryFn:rB,queryKey:nB(s)}));var s,c;const u=(r?.pages??aB).flatMap(e=>(e.data??[]).map(oB));return I(tB,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function sB(e){const t=Mc();return I(jv,{children:t.open&&I(lB,{...e})})}function cB(e){return{lineItemType:"fee",amount:e}}function dB(e){return{lineItemType:"bill",amount:fh(-e.amount),bill:{id:e.id,amount:fh(e.amount),date:e.date,name:e.name}}}function uB(e){return e.map(dB)}function hB(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function pB(e){return`Remove ${e}?`}function gB(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function mB({action:e,titleName:t,entityName:n}){return mh({title:pB(t),body:gB(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 vB={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},fB={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function bB(e,t){const n=fB[t];return mB({titleName:n,entityName:n.toLowerCase(),action:vB[e]})}function yB(e){return e.filter(e=>"bill"===e.lineItemType).map(e=>({id:e.bill.id,name:e.bill.name,date:e.bill.date,amount:bh(e.bill.amount)}))}const CB="bill",xB=Ab({defaultValues:fV,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType),a=yB(e.state.values.children);return P(Dc,{open:t,onOpenChange:n,children:[I(vN,{onClick:async()=>{const t=hB(CB,e.state.values.children);CB!==t?"YES"===await bB(CB,t)&&n(!0):n(!0)},Icon:PV,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),I(sB,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=uB(t);0!==r&&a.push(cB(r)),e.setFieldValue("children",a),n(!1)},previouslySelected:a})]})}}),TB=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})),wB=Ei(TB,"Payroll");function kB(e,t,n){const r=QV(e);return`The selected invoice total of ${QV(t)} is greater than the transaction total of ${r}. Was there a fee of ${QV(n)}?`}const EB=e=>["payments/payments","infinite",e??{}],AB=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:Ri(n)},o=await Ua(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})},SB=dr({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),IB=dr({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),NB=dr({marginLeft:"auto"});function PB({description:e,amount:t,bankAccountDisplayName:n,date:r}){return P("div",{className:SB,children:[P("div",{className:IB,children:[I(fc,{children:e}),t&&I(fc,{wrap:"nowrap",children:So(t)})]}),P("div",{className:IB,children:[n&&I(Lo,{children:n}),I("span",{className:NB,children:r&&I(Lo,{wrap:"nowrap",children:Ft(Bt(r))})})]})]})}function RB({payment:e,selected:t,onClick:n}){return I(wf,{handleClick:n,selected:t,isMultiSelect:!0,children:I(PB,{description:e.description,amount:fh(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}function DB(e){return e}function MB(e){return e.pages.flatMap(e=>(e.data??[]).map(DB))}function LB(e){return Object.values(e).some(e=>e)}function FB(e,t){return e===bh(t)}function OB(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:Or(t)?void 0:t}}function VB({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:OB(n,a)},m={select:MB},Gm({queryFn:AB,queryKey:EB(g),...m}));var g,m;const[v,f]=d(r),[b,y]=d([]),C=o(()=>Object.fromEntries([...v,...b].map(e=>[e.id,!0])),[v,b]),x=o(()=>new Set(r.map(e=>e.id)),[r]),T=o(()=>Or(a)?[...r,...(l??[]).filter(e=>!x.has(e.id))]:l??[],[a,r,l,x]),w=[...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]&&!x.has(t.id)&&!o.has(t.id)),s=[...a,...i],c=[...n,...s].reduce((e,t)=>e+t.amount,0),d=LB(e);void 0===k||!FB(c,t)&&d||E(void 0),f(n),y(s)},[r,b,l,x,t,k]),S=df({data:[T],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:C},onSelectedChange:A}),N=c&&!p;return I(ef,{title:"Link Transactions",Footer:I(RV,{validate:()=>{const e=FB(w,t),n=LB(C),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:P(eB,{children:[I(FV,{selectedAmount:w,transactionTotal:t,transactionTypeLabel:TC,selectedAmountSignage:"default"}),I(WV,{searchTerm:a,onChange:i,isFetching:N,searchPlaceholder:"Search transactions..."}),S.groups.map(e=>{const t=e.getRows();return I(xS,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return I(RB,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),I(YV,{onIntersect:s,enable:!c&&h})]})})}function BB({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const a=Mc();return I(jv,{children:a.open&&I(VB,{transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r,onSubmit:e})})}function UB({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,C]=d(!1),x=o(()=>new Set(n.map(e=>e.id)),[n]),T=o(()=>Or(p)?[...n,...t.filter(e=>!x.has(e.id))]:t,[p,n,t,x]),w=df({data:[T],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:e=>{v(e),b(t=>{const n={...t},r=T.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(ef,{title:"Link Invoice",HeaderRightAction:I(pE,{shouldUseButtonDiscreteStyles:!0,children:I(zg,{forceNewCascade:!0,children:P(Dc,{open:y,onOpenChange:C,children:[I(vN,{onClick:async()=>{const e=k.length>0;if(i){if("YES"!==await bB("payment","invoice"))return}else if(e&&"YES"!==await async function(){return mB({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;C(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),I(BB,{transactionTotalDollars:e,parentBankAccountId:l,previouslySelected:[],onSubmit:a})]})})}),Footer:I(RV,{onClick:async()=>{const t=fh(E);if(t>e&&k.length>0){const n=new W(t).sub(e),a=n.toNumber(),o=n.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return XV({title:"Invoice Payment",body:kB(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:P(eB,{children:[I(FV,{selectedAmount:E,transactionTotal:e,transactionTypeLabel:TC}),I(WV,{searchTerm:p,onChange:g,isFetching:A,searchPlaceholder:"Search invoices..."}),I(ZV,{listLabel:"Invoices",glSourceList:w,icon:wB,fetchNextPage:s,hasNextPage:c,isFetching:u,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const WB=e=>["invoicing/invoices","infinite",e??{}],HB=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:Ri(r)},o=await Ua(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})},_B=[];function zB(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return Or(e)||(t.search=e),t}function qB(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return Gm({queryFn:HB,queryKey:WB(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:zB(t)}});var s;const c=(r?.pages??_B).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return I(UB,{...e,invoices:c,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function jB(e){const t=Mc();return I(jv,{children:t.open&&I(qB,{...e})})}function KB(e){const t=fh(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const YB=(e,t)=>{const n=e.map(KB);return 0!==t&&n.push(cB(t)),n};function ZB(e){const t=fh(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 GB(e){return e.map(ZB)}function QB(e){return e.filter(e=>"invoice"===e.lineItemType).map(e=>({id:e.invoice.id,name:e.invoice.name,date:e.invoice.date,amount:bh(e.invoice.amount)}))}const XB="invoice",JB=Ab({defaultValues:fV,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType),a=QB(e.state.values.children);return P(Dc,{open:t,onOpenChange:n,children:[I(vN,{onClick:async()=>{const t=hB(XB,e.state.values.children);XB!==t?"YES"===await bB(XB,t)&&n(!0):n(!0)},Icon:wB,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),I(jB,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=YB(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:(t,r)=>{const a=GB(r);e.setFieldValue("children",a),n(!1)},hasExistingInvoices:r,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),$B=ws.filter(e=>"ONE_TIME"!=e.value);function eU({onClick:e}){const t=Mc();return I(oT,{triggerChildren:I(sT,{displayLabel:"Make recurring"}),popupChildren:I(Of,{frequencies:$B,onClick:n=>{e(n),t.close()}})})}function tU({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(Xc,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(Dd,{Component:t})})}function nU({activeTab:e,onClick:t,popupTriggerProps:n}){return I(tU,{active:"conversation"===e,onClick:()=>t("conversation"),icon:Ld,ariaLabel:"conversation-tab",popupTriggerProps:n})}const rU=dr({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function aU({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=Mc(),[a,o]=d(e),{query:{data:i}}=zl(a),l="CLOSED"===i?.resolutionStatus;return I(Wv,{children:P("div",{className:rU,children:[I(Gv,{children:P(Xv,{children:[I(sh,{Icon:ul,handleClose:()=>r.setOpen(!1)}),I(Do,{children:"Back"})]})}),I(wO,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const oU={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:TC},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},iU=Object.values(oU);function lU({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=Qe();return a?I(If,{}):I(ff,{title:P(N,{children:[s&&t&&I(Do,{children:"Suggested"}),I(Do,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(vS,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(dU,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I(wf,{handleClick:()=>e(t),selected:n,children:P(mS,{children:[t.iconUrl&&I(Od,{Component:Pm(t.iconUrl,t.name??"")}),I(fc,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const sU="Search expense categories...",cU=[];function dU({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=NT(),s=r??i?.data??cU,c=Mc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I(cf,{placeholder:sU,onClick:d,SearchList:ES,DefaultList:lU,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function uU({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,glAccount:r}){const{query:{data:a},isFilling:o}=Mx(),i=Fx(a,Lx),l=Qe()&&n?I(ff,{title:I(Do,{children:"Suggested"})}):void 0;return I(wL,{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 hU({list:e,onClick:t,NestedChildList:n}){return I(mf,{children:e.groups.map(e=>I(xS,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(vS,{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(wf,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:P(mS,{children:[e.value.iconUrl&&I(Od,{Component:Pm(e.value.iconUrl,e.value.name)}),I(fc,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const pU="All Tax Categories";function gU({handleConversion:e,region:t}){const n=Mc(),r=df({data:[FO],groups:[{label:pU,key:pU}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(hU,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function mU({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=Qe(),d=!l&&i&&0===r.length;return l?I(If,{}):P(mf,{children:[a&&I("div",{children:I(Tf,{handleClick:t,children:I(fc,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(Do,{children:"Suggested"}),!d&&P(N,{children:[I(Do,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I(wf,{handleClick:()=>e(t),selected:n,children:I(PB,{description:t.description,amount:fh(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const vU={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function fU({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ae(n??[],vU),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?I(If,{}):0===l.length?I(pf,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I(mf,{children:I("div",{children:l.map(e=>{const n=a?.id===e.id;return I(wf,{handleClick:()=>t(e),selected:n,children:I(PB,{description:e.description,amount:fh(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const bU=[];function yU({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Bt(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:Ut(jt(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Ut(jt(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=Ns(s,{enabled:null!==l}),m=h?.data??bU,{query:{data:v}}=wx({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),f=Mc();return I(cf,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),f.close()},SearchList:fU,DefaultList:mU,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 CU({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 iU.indexOf(oU.EXPENSE);case"REVENUE":return iU.indexOf(oU.REVENUE);case"TAX_PAYMENT":return iU.indexOf(oU.TAX_EXPENSE);default:return iU.indexOf(oU.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 P(tf,{title:t,children:[!i&&I(Hf,{options:iU,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(iU[l].value){case"EXPENSE":return I(dU,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(uU,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return I(gU,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:f});case"BANK_TRANSFER":return I(yU,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:v??0,transactionDate:p,reconciliationMatch:m})}},{})]})}function xU({children:e}){const{startPrefetch:t,cancelPrefetch:n}=MT();return I(EL,{onMouseEnter:t,onMouseLeave:n,children:e})}const TU=dr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function wU({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!fr(o)&&""!==o.id,l=fr(o?.iconUrl)?void 0:Pm(o.iconUrl,"Expense Icon");return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(Wp,{label:"Category",popupTriggerProps:e,children:P(xU,{children:[i?P("div",{className:TU,children:[l&&I(Od,{Component:l}),I(fc,{wrap:"wrap",children:o.name})]}):I(fc,{intent:"weak",children:"Select category"}),I(Od,{Component:hl})]})})}),I(CU,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function kU(){const{query:{data:e}}=cI(),{query:{data:t=[]}}=WD(),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 EU=dr({display:"flex",gap:"8px",alignItems:"center"});function AU({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!fr(o)&&""!==o.id,l=fr(o?.iconUrl)?void 0:Pm(o.iconUrl,"Revenue Icon");return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(Wp,{label:"Category",popupTriggerProps:e,children:P(xU,{children:[i?P("div",{className:EU,children:[l&&I(Od,{Component:l}),I(fc,{children:o.name})]}):I(fc,{intent:"weak",children:"Select category"}),I(Od,{Component:hl})]})})}),I(CU,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function SU(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 IU=(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=>!fr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},NU={id:"customer",name:"Customer"};function PU(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function RU(e){return SU({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function DU(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 MU=kr(vr["line-item-card"],dr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),LU=dr({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),FU=dr({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),OU=Ab({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}=kU(),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 P("div",{...MU,children:[P("div",{className:LU,children:[I(fc,{children:`Line Item #${t+1}`}),P(Xc,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(fc,{children:"Remove"}),I(Od,{Component:FN})]})]}),P("div",{className:FU,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(wU,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(AU,{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=>!fr(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:iV(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,NU.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(lV(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})})})]})]})}}),VU=dr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function BU({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=Mc();return I(qc,{children:P(zg,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return I(Qg,{onClick:()=>{n(e.id,!r)},children:P("div",{className:VU,children:[I(fc,{children:a(e)}),I(Od,{Component:r?Ni:bf})]})},e.id)}),!fr(r)&&I(Qg,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(fc,{children:"Confirm Selection"})})]})})}const UU=e=>Object.keys(e).filter(t=>e[t]);function WU({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return P(Dc,{placement:"bottom-end",children:[I(Lc,{children:e=>P(Xc,{popupTriggerProps:e,children:[I(fc,{children:"Itemize By"}),I(Od,{Component:zp})]})}),I(BU,{items:[...e,NU],selectedIds:UU(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const HU=dr({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),_U=dr({display:"flex",justifyContent:"space-between",alignItems:"center"}),zU=dr.raw({color:"surface.intent.danger.active"}),qU=dr({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function jU({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=rV(n),i=aV(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 P("div",{className:HU,children:[P("div",{className:_U,children:[I(fc,{children:`${AC[e]} amount`}),I(fc,{children:GV(t)})]}),P("div",{className:_U,children:[I(fc,{children:"Line items total"}),I(fc,{children:GV(o)})]}),P("div",{className:_U,children:[I(fc,{extraClassNames:l?[zU]:void 0,children:"Difference"}),I(fc,{extraClassNames:l?[zU]:void 0,children:(d=t,u=o,Po(new W(d).minus(u).toNumber(),"default"))})]}),l&&P("div",{className:qU,children:[I(bl,{Component:Si}),I(fc,{extraClassNames:[zU],children:c})]}),s&&P("div",{className:qU,children:[I(bl,{Component:Si}),I(fc,{extraClassNames:[zU],children:"At least 2 line items are required"})]})]});var d,u}function KU({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(xp,{onSave:e,children:I(jU,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const YU=dr({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function ZU(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}=kU(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new W(r).div(2).round(2,W.roundDown),n=new W(r).sub(t);return[SU({amount:t.toNumber(),...structuredClone(c)}),SU({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=Mc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return QO;case"BANK_TRANSFER":return $O;case"REVENUE":return tV}}(r);return Eb({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=kV(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=rV(e.children.map(e=>e.amount));return aV(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:IU(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,SU({...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===NU.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(fr(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(WU,{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(KU,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return P(ef,{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(OU,{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:YU,children:e.length<10&&P(Xc,{onClick:r,active:!1,children:[I(fc,{children:"Add Line Item"}),I(bl,{Component:js})]})})})]})}function GU(e){const t=Mc();return I(jv,{children:t.open&&I(ZU,{...e})})}function QU({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=Mc();return P(Dc,{children:[I(Lc,{children:e=>I(vN,{Icon:fT,popupTriggerProps:e,children:"Itemize"})}),I(GU,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(PU)),r.close()}})]})}const XU=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?P(Dc,{children:[I(Lc,{children:e=>I(nU,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(aU,{conversationId:r,attachedEntityId:a})]}):I(nU,{onClick:n,activeTab:t}),JU=Ab({defaultValues:fV,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=Ge(),s=Nw(),c=!fr(n)&&Fg(n)&&"EXPENSE"===n.type,{mutateAsync:d}=bx({mutationFn:px,meta:{toastOptions:{defaultSuccessMessage:"Transactions saved",defaultErrorMessage:"Couldn't save transactions"}}}),h=IV(e),p=u(t=>{DU(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(Gv,{children:P(Xv,{children:[I(sh,{}),I(Do,{children:t}),i&&I(XU,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(pE,{shouldUseButtonDiscreteStyles:!0,children:P(zg,{children:[I(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>P(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&I(xB,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&I(JB,{form:e}),0===t.length&&I(QU,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:p}),sV(t)&&I(vN,{Icon:fT,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(eU,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===BN.ACTIVE&&I(AV,{onClick:async()=>{fr(n)||await async function(){return mh({title:"Archive transaction",body:"Are you sure you want to archive this transaction?",buttons:[{key:Ju,label:"Cancel"},{key:$u,label:"Archive",type:gh.DANGER}]}).then(e=>e===$u)}()&&await h(async()=>{await d(UN([n])),ps()})}}),n?.status===BN.INACTIVE&&I(SV,{onClick:async()=>{fr(n)||await h(async()=>{var e;await d((e=[n],e.map(e=>({id:e.id,status:BN.ACTIVE})))),ps()})}})]})})]})})}});function $U(e){return 0===e.length||sV(e)&&e.every(e=>null===e.customer)}const eW=Ab({defaultValues:fV,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=Ge();return P(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=>$U(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(wU,{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})})]})}}),tW=Ab({defaultValues:fV,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return P(N,{children:[I(e.Subscribe,{selector:e=>$U(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(AU,{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 nW({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===vT(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(Wp,{label:a,popupTriggerProps:e,children:P(xU,{children:[r?I(PB,{description:r.description||"",amount:r.amount||0,date:r.date||Ft(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(fc,{intent:"weak",children:"Needs Match"}),I(Od,{Component:hl})]})})}),I(CU,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const rW=Ab({defaultValues:fV,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return P(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(nW,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function aW({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return P(Dc,{placement:"bottom-start",children:[I(Lc,{children:e=>I(Wp,{label:"Category",popupTriggerProps:e,children:P(xU,{children:[I(fc,{children:OO(r?.paymentInfo?.region)??"Select region..."}),I(Od,{Component:hl})]})})}),I(CU,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const oW=Ab({defaultValues:fV,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return P(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(aW,{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:DO})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:Rt({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})})]})}}),iW=Ab({defaultValues:fV,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 br(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:fh(t.value.transfer.amount)}),br(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(eW,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return I(tW,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return I(rW,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return I(oW,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),lW=kr(null,dr({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function sW({transaction:e,bankAccount:t}){const n=e?e.description:"",r=fr(t)||fr(e)?"":((e,t)=>{const n=PC(t.type),r=vT(t.amount);return`${n?`${r} `:""}${Ch(e.name,e.mask)}`})(t,e);return P("div",{...lW,children:[I(Do,{wrap:"wrap",children:n}),t&&I(Lo,{children:r})]})}const cW=dr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),dW=dr({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function uW({attachments:e,onRemove:t}){return I("div",{className:cW,children:I("div",{className:dW,children:e.map(e=>I(aO,{attachment:e,onRemove:t},e.localId))})})}const hW=Ab({defaultValues:fV,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=Hh({mutationFn:yg,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await zr.invalidateQueries({queryKey:["files/attachments"]}),await zr.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>P(N,{children:[I(e.AttachmentDropzoneField,{entityId:bs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(uW,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),pW=dr({display:"flex",flexDirection:"column",gap:"8px"});function gW({children:e}){return I("div",{className:pW,children:e})}const mW=gr({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 vW({children:e,surface:t,style:n}){const r=dr(mW.raw({surface:t}),n);return I("div",{className:r,children:e})}function fW(){return I(mp,{alignment:"horizontal"})}const bW=dr({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function yW(e){return I("div",{className:bW,children:e.children})}function CW({property:e}){return"string"==typeof e?I(fc,{children:e}):e}function xW({label:e,value:t}){return P(yW,{children:[I(CW,{property:e}),I(CW,{property:t})]})}function TW(e){return Ft(Bt(e))}function wW({amount:e,date:t,description:n}){return P(vW,{surface:"foreground",children:[I(xW,{label:"Description",value:n}),I(fW,{}),I(xW,{label:"Date",value:TW(t)}),I(fW,{}),I(xW,{label:"Amount",value:GV(e)})]})}const kW=dr.raw({padding:12});function EW({amount:e}){return I(vW,{surface:"background",style:kW,children:I(xW,{label:"Fee",value:GV(e)})})}const AW=dr({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),SW=dr({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function IW({label:e,warning:t}){return P("div",{className:AW,children:[I(fc,{children:e}),t&&P("div",{className:SW,children:[I(Od,{Component:Si}),t]})]})}function NW(e){return GV(Math.abs(e))}function PW(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new W(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?`${NW(c)} Overpaid`:"underpaid"===o?function(e){return`${NW(e)} Underpaid`}(c):null}const RW=Ab({defaultValues:fV,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=QB(e.state.values.children);return P(gW,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=PW(t,e.amount,e.type);return I(IW,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?I(wW,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?I(EW,{amount:Math.abs(e.amount)},`fee_${t}`):null),P(Dc,{open:n,onOpenChange:r,children:[I(Lc,{children:e=>P(Xc,{popupTriggerProps:e,children:[I(fc,{children:"Edit Linked Invoices"}),I(bl,{Component:hl})]})}),I(jB,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=YB(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:(t,n)=>{const a=GB(n);e.setFieldValue("children",a),r(!1)},hasExistingInvoices:!0,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function DW({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:GV(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(vW,{children:l.map((e,t)=>P(f,{children:[t>0&&I(fW,{}),I(xW,{label:e.label,value:e.value.toString()})]},e.label))})}const MW=Ab({defaultValues:fV,render:function({form:e}){const{query:{data:t}}=zD(),n=e.state.values.children;if(sV(n))return P(gW,{children:[I(fc,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(DW,{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}`)),P(Dc,{children:[I(Lc,{children:e=>P(Xc,{popupTriggerProps:e,children:[I(fc,{children:"Edit Line Items"}),I(bl,{Component:hl})]})}),I(GU,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(RU),onSubmit:t=>{DU(t.map(PU),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),LW=Ab({defaultValues:fV,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=yB(e.state.values.children);return P(gW,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=PW(t,e.amount,e.type);return I(IW,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?I(wW,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?I(EW,{amount:Math.abs(e.amount)},`fee_${t}`):null),P(Dc,{open:n,onOpenChange:r,children:[I(Lc,{children:e=>P(Xc,{popupTriggerProps:e,children:[I(fc,{children:"Edit Linked Bills"}),I(bl,{Component:hl})]})}),I(sB,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=uB(t);0!==n&&a.push(cB(n)),e.setFieldValue("children",a),r(!1)},previouslySelected:a})]})]})}});function FW({amount:e,bankAccountName:t,date:n,description:r}){return P(vW,{surface:"foreground",children:[I(xW,{label:"Description",value:r}),I(fW,{}),t&&P(N,{children:[I(xW,{label:"Account",value:t}),I(fW,{})]}),I(xW,{label:"Date",value:TW(n)}),I(fW,{}),I(xW,{label:"Amount",value:GV(e)})]})}const OW=Ab({defaultValues:fV,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:bh(e.payment.amount),date:e.payment.date,description:e.payment.name,bankAccount:{displayName:e.payment.bankAccount.displayName}}));return P(gW,{children:[I(IW,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?I(FW,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),P(Dc,{open:t,onOpenChange:n,children:[I(Lc,{children:e=>P(Xc,{popupTriggerProps:e,children:[I(fc,{children:"Edit Linked Transactions"}),I(bl,{Component:hl})]})}),I(BB,{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=GB(r);e.setFieldValue("children",[...a,...o]),n(!1)}})]})]})}}),VW=Ab({defaultValues:fV,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?I(RW,{form:e}):t.some(e=>"bill"===e.lineItemType)?I(LW,{form:e}):t.some(e=>"payment"===e.lineItemType)?I(OW,{form:e}):sV(t)?I(MW,{form:e}):null}});function BW({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:c}=kU(),u=void 0===i?SC[s]:IC[s],[h,p]=d(l??null),g=I(JU,{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(xp,{disabled:e,isSubmitting:t})});return P(RO,{onSubmit:n.handleSubmit,Header:g,Footer:m,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(sW,{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(iW,{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=iV(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(lV(e))})},r[0][0].id))}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>lt(e)&&I(VW,{form:n})}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(hW,{form:n,transactionId:i})]})}function UW({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}=kU(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=Rs({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:EV(a,r,t),bankAccount:vm(a?.bankAccount?.id??""),isManual:fr(a)||Fg(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(BW,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function WW({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=Rs({id:e});return s(()=>{!r&&fr(n)&&ps()},[n,r]),fr(n)?null:I(UW,{transactionId:e,initialTab:t})}function HW({transactionId:e,initialTab:t,initialType:n}){return e?I(WW,{transactionId:e,initialTab:t}):!e&&n?I(UW,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function _W({subject:e,children:t}){return P(Gv,{children:[P(Xv,{children:[I(sh,{}),I(Do,{children:e})]}),I("div",{className:tP({alignItems:"center",gap:15}),children:t})]})}function zW({conversationId:e,defaultValues:t}){const[n,r]=d(e),{query:{data:a}}=zl(n),o="CLOSED"===a?.resolutionStatus;return I(pF,{children:P(mF,{children:[I(_W,{subject:a?.subject??"Conversation"}),I(wO,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const qW=Ei(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 jW({onClick:e,active:t}){return I(ic,{type:"button",onClick:e,active:t,children:I(Od,{Component:qW})})}const KW=dr({display:"flex",flexDirection:"column"});function YW({label:e,data:t,isFilling:n,shimmerWidth:r}){return P("div",{className:KW,children:[I(Lo,{children:e}),n?I(fO,{width:r}):I(Do,{wrap:"wrap",children:t??""})]})}function ZW({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=Rs({id:e}),a=vm(n?.bankAccount.id??"");if(fr(n))return null;const o=JN({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 P("div",{"data-open":t,className:o,children:[P("div",{className:tP({justifyContent:"space-between"}),children:[I(YW,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(YW,{label:"Amount",data:So(fh(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(YW,{label:"Bank Account",data:Ch(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(YW,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function GW({conversationId:e,transactionId:t}){const[n,r]=d(e),[a,o]=d(!0),{query:{data:i}}=zl(n),l="CLOSED"===i?.resolutionStatus;return I(pF,{children:P(mF,{children:[I(_W,{subject:i?.subject??"Conversation",children:br(t)&&I(jW,{onClick:()=>o(!a),active:a},"infoButton")}),br(t)&&I(ZW,{transactionId:t,isOpen:a}),I(wO,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function QW(){const e=gs().length>1;return I(pF,{children:P(mF,{background:"foreground",children:[I(Gv,{children:P(Xv,{children:[I(sh,e?{Icon:ul}:{}),I(Do,{children:"Add New Connection"})]})}),I(ZA,{})]})})}function XW(){return I(Gv,{children:P(Xv,{children:[I(sh,{}),I(Do,{children:"Financial Summary"})]})})}const JW=dr({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),$W=Rr.raw({body:"default"}),eH=dr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},$W);function tH({summaryText:e}){return I("div",{className:JW,children:I("div",{className:eH,children:e})})}const nH=dr({display:"flex",flexDirection:"column",overflow:"auto"});function rH({summary:e}){return P("div",{className:nH,children:[I(XW,{}),I(tH,{summaryText:e})]})}const aH=dr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function oH({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Kr({queryKey:Ws({id:e}),queryFn:_s})}({id:e});return I(pF,{children:P("div",{className:aH,children:[I(mF,{children:I(rH,{summary:n?.summary})}),I(mp,{}),I(kO,{conversationId:t??null,attachedEntityId:e})]})})}function iH(){return I(pF,{children:I(mF,{children:I(sS,{showCloseButton:!0,inOverlay:!0})})})}const lH=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;Vr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),sH={mergeDestination:Bm,selectedAccount:null};const cH=dr({display:"flex",flexDirection:"column",gap:"20px"}),dH=dr({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),uH=dr.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),hH=dr(uH,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),pH=dr(uH,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),gH=dr(uH,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),mH=dr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),vH=dr({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),fH=dr({width:"100%",display:"flex",justifyContent:"flex-start"}),bH=dr({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),yH=dr({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),CH=e=>{Mp(e),Lp(e)};function xH({account:e}){const t=Mc(),n=function(e,t){const{mutateAsync:n}=Yh(),r=vV();return Eb({defaultValues:sH,onSubmit:async a=>{if(await $h()===$u&&br(e)&&br(a.value.selectedAccount)){const s=(o=e,i=a.value.mergeDestination,l=a.value.selectedAccount,i===Bm?{...Xh(l),duplicateBankAccountIds:[bs(o.id)]}:{...Xh(o),duplicateBankAccountIds:[bs(l.id)]});try{await n(s),t.close(),a.value.mergeDestination===Bm&&r()}catch{await ep()}}var o,i,l},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=Sh();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 P("form",{className:cH,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:CH,children:[I(Do,{children:"Merge Accounts"}),I("div",{className:dH,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>P(N,{children:[P("div",{className:hH,children:[I("div",{className:fH,children:I(Do,{children:"Duplicate Account"})}),t===Bm?I(Dm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Wm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Hm(t,e,n.state.value)})})]}),P("div",{className:pH,children:[I("div",{className:bH,children:I(Do,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:vH,children:I(ic,{onClick:()=>e.handleChange(e.state.value===Bm?Vm:Bm),children:I(Od,{Component:hl})})})})]}),P("div",{className:gH,children:[I("div",{className:yH,children:I(Do,{children:"Destination Account"})}),t===Bm?I(n.AppField,{name:"selectedAccount",children:n=>I(Wm,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Hm(t,e,n.state.value)})}):I(Dm,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),P("div",{className:mH,children:[I(Nb,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(lp,{disabled:fr(e),showIcon:!1,textContent:"Merge"})})]})]})}function TH({bankAccount:e}){return I(zg,{children:P(Dc,{placement:"right-start",children:[I(Lc,{children:e=>P(Qg,{...e,children:[I(Od,{Component:AE}),I(Do,{children:"Merge Account"})]})}),I(Wv,{children:I(zv,{children:I(vE,{children:I(xH,{account:e})})})})]})})}const wH=dr({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"}}}),kH=({tranStartDate:e})=>P(N,{children:[I(Lo,{children:"Start Date"}),Br(e)?I(Do,{children:`${qt(Bt(e))}`}):I(Do,{children:"Set Start Date"})]});function EH({bankAccount:e}){return P(Dc,{placement:"right-start",children:[I(Lc,{children:t=>I("button",{className:hr(Cr(vr["start-date-form-section"]),wH,vl),...t,type:"button",children:I(kH,{tranStartDate:e.tranStartDate})})}),I(Wv,{children:I(zv,{children:I(vE,{width:"sm",children:I(wE,{bankAccounts:[e]})})})})]})}const AH=e=>["accounting/manualJournalEntry",e.id],SH=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 Fi(a)};function IH({id:e}){return Kr({queryKey:AH({id:String(bs(e))}),queryFn:SH,enabled:br(e)})}const NH=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:ja(n)};return await Wa(r)})({data:e,accessToken:t,environment:n});const PH=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:ja(n)};return await Wa(r)},RH=S.object({amount:S.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:S.string("Required")}),DH=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===bs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},MH=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=IH({id:t??null}),r=function(){const{query:{data:e}}=Ex();return Fx(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutateAsync:a}=Hh({mutationFn:PH,meta:{toastOptions:{defaultErrorMessage:"Couldn't save beginning balance"}},onSuccess:async()=>{Ia("beginning balance mutation successful, invalidating bank account queries");try{return zr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&Na({error:e,severity:"error"})}}});const{mutateAsync:o}=Hh({onSuccess:async()=>{Ia("mutation successful, invalidating manual journal entry queries");try{return Promise.all([zr.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),zr.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&Na({error:e,severity:"error"})}},mutationFn:NH,meta:{toastOptions:{defaultErrorMessage:"Couldn't update journal entry"}}}),i=Mc(),l=((e,t)=>{const n=DH(e,t);return{amount:br(e.beginningBalanceData.journalEntry?.id)?n:"",date:br(t?.date)?t.date:""}})(e,n);return Eb({defaultValues:l,validators:{onBlur:RH},onSubmit:async l=>{if(fr(t)||fr(n))await a({bankAccountId:bs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(fr(e.id))return null;const o={...e,id:e.id},i=a.map(e=>bs(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===bs(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),fr(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=Ut(t)??o.date,o)})(n,Bt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);br(t)&&await o(t)}return i.close()}})},LH=dr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),FH=dr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function OH({bankAccount:e}){const t=MH(e),n=Mc(),r=()=>{n.close()};return P("form",{className:LH,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(Do,{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=>P("div",{className:FH,children:[I(Nb,{showIcon:!1,onClick:r}),I(lp,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const VH=gr({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"}}}}),BH=dr({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function UH({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=kr(vr["beginning-balance-form-section"],VH({layout:a}),vl),i=kr(vr["beginning-balance-form-section"],VH({layout:"right"}),vl),l=r&&qt(r);return P(Dc,{placement:"right-start",children:[I(Lc,{children:e=>P("div",{className:BH,children:[P("button",{...o,...e,type:"button",children:[I(Lo,{children:"Beginning Balance"}),I(Do,{children:br(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&P("button",{...i,...e,type:"button",children:[I(Lo,{children:"Migration Date"}),I(Do,{children:l})]})]})}),I(Wv,{children:I(zv,{children:I(vE,{width:"sm",children:I(OH,{bankAccount:e})})})})]})}const WH=gr({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function HH({bankAccount:e,showStartDate:t}){const{query:{data:n}}=IH({id:e?.beginningBalanceData.journalEntry?.id??null}),r=DH(e,n),a=br(n?.date)?Bt(n?.date):null,o=br(e.tranStartDate)?Bt(e.tranStartDate):null,i=br(a)&&br(o)&&!Dt(a,o),l=i?"left":t?"right":"left";return P("div",{className:WH({layout:i?"stacked":"inline"}),children:[t&&I(EH,{bankAccount:e}),I(UH,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const _H=dr({marginTop:"15px",marginBottom:"15px"}),zH={id:"",name:"",mask:"",type:void 0};const qH=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],jH=e=>{Mp(e),Lp(e)};function KH({bankAccountId:e}){const t=vm(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:zH,[r,a]=d(n),o=function(e,t){const{mutateAsync:n}=Yh(),{mutateAsync:r}=Kh({mutationFn:zh,meta:{toastOptions:{defaultSuccessMessage:"Account created",defaultErrorMessage:"Couldn't create account"}}}),a=Br(String(e.id)),o=vV();return Eb({defaultValues:e,validators:{onBlur:lH},onSubmit:async e=>{if(a)await n(Xh(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:fs({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||Gh(t.apiName),l=!!t&&Qh(t.apiName),s=Ch(r?.name??"",r?.mask??""),c=Br(s)?s:"New Bank Account",u=l&&br(t?.tranStartDate);return I(pF,{children:I(mF,{children:P("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:jH,children:[P(Gv,{children:[P(Xv,{children:[I(sh,{Icon:ul}),I(Do,{children:c}),br(t)&&I(pE,{shouldUseButtonDiscreteStyles:!0,children:I(TH,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),P(AO,{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:qH,disabled:!i})}),br(t)&&P(N,{children:[I("div",{className:_H,children:I(mp,{alignment:"horizontal"})}),I(HH,{bankAccount:t,showStartDate:u})]})]})]})})})}function YH({filters:e,filterModels:t,setFilters:n}){const r=gs().length>1,[a,o]=d(()=>tk(e,t));return I(pF,{children:P(mF,{children:[I(Gv,{children:P(Xv,{children:[I(sh,r?{Icon:ul}:{}),I(fc,{children:"Back"})]})}),I(BD,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),I(FS,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=ak(a);n(e),ps()}})]})})}function ZH({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=LI(e);return I(YH,{filters:n,filterModels:t,setFilters:r})}function GH(){const e=TR();return I(ZH,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function QH(){const e=WR();return I(ZH,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function XH(){const e=jI();return I(ZH,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function JH({Icon:e,label:t,popupTriggerChildrenProps:n}){return P(Tf,{popupTriggerChildrenProps:n,children:[P(mS,{children:[I(Od,{Component:e}),I(fc,{children:t})]}),I(Od,{Component:hl})]})}const $H=Ei(NV,"Expenses");function e_(){return I(JH,{Icon:$H,label:"Categories"})}const t_=Ei(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"),n_=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function r_(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 a_(e,t){return{search:Br(e)?e:void 0,status:{in:t}}}function o_(e){return e.pages.flatMap(e=>(e.data??[]).map(r_))}const i_=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function l_(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function s_(e,t){const n=(e,n)=>dV(e=>!t(e),e,n);return{state:n("state",Vr(e.state)?void 0:e.state),city:n("city",Vr(e.city)?void 0:e.city),zip:n("zip",Vr(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Vr(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Vr(e.address1)?void 0:e.address1),address2:n("address2",Vr(e.address2)?void 0:e.address2)}}const c_=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:i_});function d_(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:l_(e.address)}}const u_=S.object({state:S.string(),city:S.string(),zip:S.string(),phoneWork:S.string(),address1:S.string(),address2:S.string()}),h_=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:u_.optional()});function p_({customer:e}){const{mutateAsync:t}=Lv(),n=Mc();return Eb({defaultValues:e??c_,validators:{onSubmit:h_},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>dV(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(i_).filter(e=>e in i_).some(e=>!n(e))?s_(e.address??i_,n):void 0,i=a("invoicePrefix",Br(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Br(e.billingContactName)?e.billingContactName:void 0),email:a("email",Br(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:fr(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 g_=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})),m_=dr({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),v_=dr({width:"100%"}),f_=Sb({defaultValues:i_,props:{disabled:!1},render:function({group:e,disabled:t}){return P(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})}),P("div",{className:m_,children:[I("div",{className:v_,children:I(e.AppField,{name:"state",children:()=>I(xm,{label:"State",options:[{label:"Select State",value:""},...g_],isEmpty:Vr,disabled:t})})}),I("div",{className:v_,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})})]})}}),b_=dr.raw({width:"100%"});function y_({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o,isSubmitting:i}){const l=Nw();return P(N,{children:[I(mp,{alignment:"horizontal",color:"normal"}),P("div",{className:vp,children:[!o&&I(pp,{disabled:a,onClick:t,isSubmitting:i}),o&&l&&I(ic,{onClick:n,styles:b_,children:I(fc,{children:r})}),e]})]})}const C_=dr({display:"flex",gap:"8px"});function x_({title:e,customer:t}){const n=p_({customer:t}),[r,a]=d(n.state.values.ccEmails.length>0),[o,i]=d(n.state.values.bccEmails.length>0),l=Mc(),s=Nw(),c="ACTIVE"===t?.status,u="INACTIVE"===t?.status,h=u&&!s,{mutateAsync:p}=iv({mutationFn:Dv,onSuccess:Mv,meta:{toastOptions:{defaultSuccessMessage:"Customer deleted",defaultErrorMessage:"Couldn't delete customer"}}}),{mutateAsync:g}=Lv(),m=IV(n),v=async()=>{if(fr(t))return;"RESTORE"===await async function(e){return mh({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(pE,{shouldUseButtonDiscreteStyles:!0,children:P(zg,{children:[c&&I(AV,{onClick:async()=>{if(fr(t))return;const{id:e}=t;if(fr(e))return;"ARCHIVE"===await async function(e){return mh({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(SV,{onClick:v})]})}):null,b=h?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(y_,{onSave:n.handleSubmit,disabled:e,restoreLabel:"Restore Customer",onRestore:v,isArchived:u,isSubmitting:t})});return I(ef,{title:e,HeaderRightAction:f,Footer:b,padChildren:!1,children:P(AO,{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)&&P("div",{className:C_,children:[!r&&I(Xc,{onClick:()=>a(!0),children:"CC"}),!o&&I(Xc,{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(f_,{form:n,fields:"address",disabled:u})]})})}function T_({title:e,customer:t}){const n=Mc();return I(jv,{children:n.open&&I(x_,{title:e,customer:t})})}const w_=dr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function k_({customer:e}){const t=Mf(),[n,r]=d(!1),a=P(N,{children:[P(mS,{children:[I(Dd,{Component:t_}),P("div",{className:w_,children:[I(fc,{children:e.name}),e.email&&I(Lo,{children:e.email})]})]}),I(Od,{Component:hl})]});if(t?.preventDefault)return I(Tf,{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 P(Dc,t?{enableClickMiddleware:!1,open:n,onOpenChange:r,children:[I(Lc,{children:e=>I(Tf,{handleClick:o,popupTriggerChildrenProps:e,children:a})}),I(T_,{title:"Edit Customer",customer:d_(e)})]}:{children:[I(Lc,{children:e=>I(Tf,{popupTriggerChildrenProps:e,children:a})}),I(T_,{title:"Edit Customer",customer:d_(e)})]})}const E_=dr.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function A_({selectedValue:e,Icon:t=zp,options:n,onClick:r,additionalStyles:a=[]}){return P(Dc,{children:[I(Lc,{children:n=>P(ic,{popupTriggerProps:n,styles:[E_,...a],children:[I(fc,{children:e.label}),I(Od,{Component:t})]})}),I(fm,{options:n,onClick:r})]})}const S_=dr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),I_=dr({display:"flex",gap:"8px"}),N_=dr.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function P_({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return P("div",{className:S_,children:[I(fc,{intent:"weak",children:"Search"}),P("div",{className:I_,children:[I(BV,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),I(A_,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[N_]})]})]})}const R_=P(N,{children:[I(Od,{Component:js}),I(fc,{children:"Add Customer"})]});function D_(){const e=Mf(),[t,n]=d(!1);if(e?.preventDefault)return I(ic,{onClick:()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null})},children:R_});if(br(e)){const r=()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}),n(!0)};return P(Dc,{enableClickMiddleware:!1,open:t,onOpenChange:n,children:[I(Lc,{children:e=>I(ic,{onClick:r,popupTriggerProps:e,children:R_})}),I(T_,{title:"Add Customer",customer:void 0})]})}return P(Dc,{children:[I(Lc,{children:e=>I(ic,{popupTriggerProps:e,children:R_})}),I(T_,{title:"Add Customer",customer:void 0})]})}function M_(){const[e,t]=d(""),[n,r]=d(n_[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 Gm({queryFn:Pv,queryKey:Av(e),...t})}({filter:a_(e,t)},{select:o_});return{list:df({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 P(ef,{title:"Back",HeaderRightAction:I(D_,{}),padChildren:!0,children:[I(P_,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:n_,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>I(xS,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>I(k_,{customer:e.value},e.value.id))},e.key)),I(YV,{onIntersect:o,enable:i})]})}function L_(){const e=Mc();return I(jv,{children:e.open&&I(M_,{})})}function F_(){return P(Dc,{children:[I(Lc,{children:e=>I(JH,{Icon:t_,label:"Customers",popupTriggerChildrenProps:e})}),I(L_,{})]})}const O_=Ei(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"),V_=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:i_,iconUrl:void 0});function B_(e){return{id:e.id,name:e.name,status:e.status,address:l_(e.address),iconUrl:e.iconUrl||void 0}}const U_=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:u_.optional(),iconUrl:S.string().optional()});const W_=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function H_(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address}}function __(e,t,n){return{search:Br(e)?e:void 0,name:fr(n)?void 0:{notEqual:n},status:{in:t}}}function z_(e){return e.pages.flatMap(e=>(e.data??[]).map(H_))}function q_({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:__(e,t,n)},u={select:z_},Gm({queryFn:tv,queryKey:Xm(d),...u}));var d,u;return{list:df({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 j_=Ei(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"),K_=dr({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),Y_=dr({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),Z_=gr({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"}}}}),G_=dr({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),Q_=dr({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function X_({targetVendor:e,duplicateVendor:t}){return P("div",{className:K_,children:[I(fc,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),P("div",{className:Y_,children:[P("div",{className:Z_({archivedVendor:!0}),children:[I(Od,{imageUrl:t.iconUrl,Component:O_}),I(fc,{intent:"weak",children:t.name})]}),P("div",{className:G_,children:[I(Od,{Component:j_,stylists:[kr(null,Q_)]}),I(Lo,{intent:"weak",children:"Merging Into"})]}),P("div",{className:Z_({archivedVendor:!1}),children:[I(Od,{imageUrl:e.iconUrl,Component:O_}),I(fc,{children:e.name})]})]}),I(fc,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function J_({vendor:e,onClose:t}){const{mutate:n}=iv({mutationFn:uv,onSuccess:hv}),[r,a]=d({}),[o,i]=d(""),{list:l,data:s,fetchNextPage:c,isFetching:u,hasNextPage:h,isLoading:p}=q_({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),g=Mc(),m=I(xp,{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 mh({title:"Confirm Merge",body:I(X_,{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 P(ef,{title:"Back",Footer:m,padChildren:!0,children:[I(BV,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>I(xS,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>I(wf,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:P(mS,{children:[I(Dd,{imageUrl:e.value.iconUrl??void 0,Component:O_}),I(fc,{children:e.value.name})]})},e.value.id))},e.key)),I(YV,{onIntersect:c,enable:!u&&h})]})}function $_({vendor:e,onClose:t}){const n=Mc();return I(jv,{children:n.open&&I(J_,{vendor:e,onClose:()=>{t(),n.close()}})})}function ez({vendor:e,onClose:t}){return P(Dc,{children:[I(Lc,{children:e=>I(vN,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),I($_,{vendor:e,onClose:t})]})}const tz=dr.raw({width:"100%"});function nz({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o,isSubmitting:i}){const l=Nw();return I(y_,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,isSubmitting:i,children:l&&!fr(e)&&P(Dc,{children:[I(Lc,{children:e=>I(ic,{popupTriggerProps:e,styles:tz,children:I(fc,{children:"Merge"})})}),I($_,{vendor:e,onClose:r})]})})}function rz({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=pv(),n=Mc();return Eb({defaultValues:e??V_,validators:{onSubmit:U_},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(i_).filter(e=>e in i_).some(e=>!t(e))?s_(e.address??i_,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=Mc(),a=Nw(),o="ACTIVE"===t?.status,i="INACTIVE"===t?.status,{mutateAsync:l}=iv({mutationFn:dv,onSuccess:hv,meta:{toastOptions:{defaultSuccessMessage:"Vendor deleted",defaultErrorMessage:"Couldn't delete vendor"}}}),{mutateAsync:s}=pv(),c=IV(n),d=async()=>{if(fr(t))return;"RESTORE"===await async function(e){return mh({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=fr(t)||!u&&!h?null:I(pE,{shouldUseButtonDiscreteStyles:!0,children:P(zg,{children:[i&&I(SV,{onClick:d}),!a&&I(ez,{vendor:t,onClose:()=>r.close()}),o&&I(AV,{onClick:async()=>{if(fr(t)||fr(t.id))return;const{id:e}=t;if(fr(e))return;"ARCHIVE"===await async function(e){return mh({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(nz,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>r.close(),disabled:e,isSubmitting:a,isArchived:i})});return I(ef,{title:e,HeaderRightAction:p,Footer:g,padChildren:!1,children:P(AO,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:i,maxLength:255})}),I(f_,{form:n,fields:"address",disabled:i})]})})}function az({title:e,vendor:t}){const n=Mc();return I(jv,{children:n.open&&I(rz,{title:e,vendor:t})})}const oz=dr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function iz({vendor:e}){return P(Dc,{children:[I(Lc,{children:t=>P(Tf,{popupTriggerChildrenProps:t,children:[P(mS,{children:[I(Dd,{imageUrl:e.iconUrl??void 0,Component:O_}),I("div",{className:oz,children:I(fc,{children:e.name})})]}),I(Od,{Component:hl})]})}),I(az,{title:"Edit Vendor",vendor:B_(e)})]})}function lz(){const[e,t]=d(""),[n,r]=d(W_[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=q_({searchTerm:e,statuses:n.value}),c=Nw();return P(ef,{title:"Back",HeaderRightAction:P(Dc,{children:[I(Lc,{children:e=>P(ic,{popupTriggerProps:e,children:[I(Od,{Component:js}),!c&&I(fc,{children:"Add Vendor"})]})}),I(az,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[I(P_,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:W_,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>I(xS,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>I(iz,{vendor:e.value},e.value.id))},e.key)),I(YV,{onIntersect:o,enable:!i&&l})]})}function sz(){const e=Mc();return I(jv,{children:e.open&&I(lz,{})})}function cz(){return P(Dc,{children:[I(Lc,{children:e=>I(JH,{Icon:O_,label:"Vendors",popupTriggerChildrenProps:e})}),I(sz,{})]})}const dz=dr({padding:"16px"});function uz(){const e=yn(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return I(pF,{children:P(mF,{children:[I(Gv,{children:P(Xv,{children:[I(sh,{Icon:ul}),I(Do,{children:"Back"})]})}),I("div",{className:dz,children:P(xS,{label:"Transaction Settings",children:[e&&I(e_,{}),I(cz,{}),I(F_,{})]})})]})})}const hz=gr({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 pz({children:e,handleClick:t,selected:n=!1}){return I("button",{...kr(vr["selector-row"],hz({selected:n}),gl),"aria-current":n,onClick:t,type:"button",children:e})}const gz=dr({display:"flex",alignItems:"center",gap:"8px",flex:"1 0 0"});function mz({children:e}){return I("div",{className:gz,children:e})}const vz={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 fz(e,t){return vz[e.page]===t}const bz=dr({display:"flex",flexDirection:"column",gap:"8px"}),yz=dr({marginTop:"8px",marginBottom:"16px"});function Cz({section:e,index:t,onClick:n}){const r=function(){const{isApp:e,navigate:t,location:n}=i(Wd);if(e)return{navigate:t,location:n}}();if(fr(r))return null;const{navigate:a,location:o}=r;return P("div",{className:bz,children:[t>0&&I("div",{className:yz,children:I(mp,{alignment:"horizontal"})}),void 0!==e.label&&I(Lo,{intent:"weak",children:e.label}),e.items.map(e=>I(pz,{selected:fz(e,o.pathname),handleClick:()=>{a&&(n?.(),a({page:e.page}))},children:P(mz,{children:[I(Od,{Component:e.Icon}),I(fc,{children:e.label})]})},e.label))]})}const xz=l(null),Tz=l(void 0),wz=dr({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"flex-start",alignItems:"center",width:"fit-content",color:"typography.intent.secondary",fontWeight:"label.strong"}),kz=dr({height:"32px",width:"auto",maxWidth:"100%",objectFit:"contain",objectPosition:"left"}),Ez=dr({flex:1,overflowY:"auto",display:"flex",flexDirection:"column",padding:"16px",height:"100%"}),Az=dr({paddingTop:"16px",paddingBottom:"16px"});function Sz({onClick:e}){const t=i(xz),n=i(Tz);if(fr(t))return null;const{sections:r}=t;return P("div",{className:Ez,children:[void 0!==n&&P(N,{children:[I("div",{className:wz,children:I("img",{src:n.partnerLogoUrl,alt:n.partnerName,className:kz})}),I("div",{className:Az,children:I(pz,{handleClick:n.onRtlExit,children:P(mz,{children:[I(Od,{Component:ul}),I(fc,{children:"Exit Bookkeeping"})]})})})]}),r.map((t,n)=>I(Cz,{section:t,index:n,onClick:e},t.label??n))]})}function Iz(){return I(pF,{side:"left",mobileCoverage:"partial",children:I(Sz,{onClick:()=>ps()})})}function Nz(){return P(sF,{children:[I(dF,{name:"BankTransactionForm",Component:HW}),I(dF,{name:"Conversation",Component:zW}),I(dF,{name:"MobileConversation",Component:GW}),I(dF,{name:"FinancialSummary",Component:oH}),I(dF,{name:"BanksAndIntegrations",Component:iH}),I(dF,{name:"BankAccountForm",Component:KH}),I(dF,{name:"NewConnection",Component:QW}),I(dF,{name:"TransactionsFilterList",Component:XH}),I(dF,{name:"ExpensesFilterList",Component:GH}),I(dF,{name:"RevenueFilterList",Component:QH}),I(dF,{name:"TransactionSettingsDrawer",Component:uz}),I(dF,{name:"NavMenu",Component:Iz})]})}const Pz=({environment:e,children:t})=>I(qr.Provider,{value:e,children:t});function Rz({children:e}){const{query:{data:t}}=Wi(),n={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?fs({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(od.Provider,{value:n,children:e})}const Dz=e=>["whiteLabels",e??{}],Mz=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ri(t[3].environment)},r=await Ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Lz({children:e}){const t=Vi(),{query:{data:n}}=Ml({queryKey:Dz({filter:{name:{equal:t}}}),queryFn:Mz}),r={icons:n?.data?.[0]?.icons};return I(wi.Provider,{value:r,children:e})}const Fz=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const Oz="SSE connection failed with status";function Vz({companyId:e,customerPartnerId:t,sseTypes:n}){const r=jr();s(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,qa[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 _e(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${Oz} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case Fz.CONNECTED:return void Ia("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case Fz.ERROR:throw Na({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case Fz.CACHE_BUST:return Ia("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(()=>{zr.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>Na({error:e,severity:"error"}))},500*Math.random()),Ia(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void Na({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 Na({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(Oz))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>Na({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const Bz=[Fz.CACHE_BUST];function Uz({children:e}){const{companyId:t,customerPartnerId:n}=i(od);return Vz({companyId:t,customerPartnerId:n,sseTypes:Bz}),e}const Wz=l({dimensions:{width:null,height:null}}),Hz="undefined"!=typeof window?g:s,_z="undefined"==typeof window;const zz=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;_z&&(t=!1);const[n,r]=d(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=Ww(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);Hz(()=>{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),Hz(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I(Wz.Provider,{value:r,children:e})},qz=({children:e})=>{const{dimensions:t}=i(Wz),n=br(t.width)&&t.width<parseInt(Bo("sizes.breakpoint-xl"));return I(Iw.Provider,{value:n,children:e})},jz=Ei(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"),Kz=Ei(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"),Yz=kr(vr.toast,dr({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"}})),Zz={translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)"},Gz=dr({flex:"1 0 0",minWidth:0}),Qz=dr.raw({lineClamp:2}),Xz=kr(vr["toast-dismiss"],dr({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"}})),Jz=gr({base:{},variants:{type:{error:{fill:"typography.intent.notification",stroke:"surface.intent.notification"},success:{fill:"typography.intent.notification",stroke:"surface.intent.notification"}}}});function $z({title:e,type:t}){const n=kr(null,Jz({type:t}));return P(ze.Root,{...Yz,style:Zz,children:[I(Od,{Component:"success"===t?Kz:jz,stylists:[n]}),I(ze.Title,{className:Gz,children:"string"==typeof e?I(fc,{intent:"notification",wrap:"wrap",extraClassNames:[Qz],children:e}):e}),I(ze.CloseTrigger,{...Xz,children:I(bl,{Component:Fc})})]})}const eq=qe({placement:"bottom",offsets:{top:"0px",right:"0px",bottom:"60px",left:"0px"},gap:8,removeDelay:250,duration:3e3,max:24,pauseOnPageIdle:!0,overlap:!1}),tq={success:3e3,error:6e3};function nq(e,t,n){const r=n?.dedupeKey??`${e}:${t}`,a=Date.now();return function(e,t){const n=rq.get(e);return void 0!==n&&t-n<2e3}(r,a)?null:(function(e,t){for(const[n,r]of rq)t-r>=2e3&&rq.delete(n);rq.set(e,t)}(r,a),function(){const e=eq.getVisibleToasts();!function(e){for(const t of aq)e.has(t)||aq.delete(t)}(new Set(e.map(e=>e.id)));const t=e.filter(e=>void 0!==e.id&&!aq.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&&(aq.add(n.id),eq.update(n.id,{removeDelay:0}),eq.dismiss(n.id))}(),eq.create({type:e,title:t,duration:n?.duration??tq[e]}))}const rq=/* @__PURE__ */new Map,aq=/* @__PURE__ */new Set;function oq({children:e}){const t=o(()=>({createToast:nq,dismiss:eq.dismiss}),[]);return P(Oh.Provider,{value:t,children:[e,I(Ke,{children:I(je,{toaster:eq,children:e=>{return I($z,{title:e.title,type:(t=e.type,"success"===t?"success":"error")},e.id);var t}})})]})}function iq({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return s(()=>{var e,r;e=n,r=t,wa.setProperties(Aa),Ea=r,ka=e},[n,t]),I(Pz,{environment:t,children:I(nF,{children:I(Ur.Provider,{value:r,children:I(Rz,{children:I(Lz,{children:I(Uz,{children:I(zz,{children:I(qz,{children:P(oq,{children:[I(Ce.ConfirmationRoot,{}),e,I(Nz,{})]})})})})})})})})})}function lq({children:e,initialNav:t}){const n=Re(),r=Le(),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=vz[e.page];t!==r.pathname&&(yn.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&hs(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&&hs(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(Wd.Provider,{value:p,children:e})}const sq=JN({gap:"16px",alignItems:"stretch",width:"100%"});function cq({limit:e}){const t=Xe(),n=yn(e=>e.generalLedgerGlAccountId),r=yn(e=>e.generalLedgerDateRange),a=yn(e=>e.generalLedgerAccountingMethod),o=yn(e=>e.setGeneralLedgerGlAccountId),i=yn(e=>e.setGeneralLedgerDateRange),l=yn(e=>e.setGeneralLedgerAccountingMethod);return t?P("div",{className:sq,children:[I(Sr,{children:I(Mr,{children:"General Ledger"})}),I(ZL,{glAccountId:n,onGlAccountChange:o,dateRange:r,onDateRangeChange:i,accountingMethod:a,onAccountingMethodChange:l,limit:e})]}):I(xL,{})}const dq={FinancialOverview:{path:vz.FinancialOverview,element:I(rE,{})},FinancialOverviewDashboard:{path:vz.FinancialOverview,element:I(rE,{})},TransactionsDashboard:{path:vz.TransactionsDashboard,element:I(yR,{})},BanksAndIntegrations:{path:vz.BanksAndIntegrations,element:I(uS,{})},ExpenseDashboard:{path:vz.ExpenseDashboard,element:I(VR,{})},IncomeDashboard:{path:vz.IncomeDashboard,element:I(zR,{})},Invoices_NOT_IMPL:{path:vz.Invoices_NOT_IMPL,element:I(xL,{})},TimeAndTasks_NOT_IMPL:{path:vz.TimeAndTasks_NOT_IMPL,element:I(xL,{})},Mileage_NOT_IMPL:{path:vz.Mileage_NOT_IMPL,element:I(xL,{})},Payroll_NOT_IMPL:{path:vz.Payroll_NOT_IMPL,element:I(xL,{})},ReportDashboard:{path:vz.ReportDashboard,element:I($L,{})},ChartOfAccounts_NOT_IMPL:{path:vz.ChartOfAccounts_NOT_IMPL,element:I(xL,{})},GeneralLedger:{path:vz.GeneralLedger,element:I(function({limit:e=100}={}){return Xe()?I(tE,{children:I(cq,{limit:e})}):I(xL,{})},{})},Journal_NOT_IMPL:{path:vz.Journal_NOT_IMPL,element:I(xL,{})},Taxes_NOT_IMPL:{path:vz.Taxes_NOT_IMPL,element:I(xL,{})}},uq=Ei(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"),hq=Ei(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"),pq=Ei(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"),gq={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:uq}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:hq},{page:"ExpenseDashboard",label:"Expenses",Icon:$H},{page:"IncomeDashboard",label:"Income",Icon:hq}]},{items:[{page:"ReportDashboard",label:"Reports",Icon:pq}]}]},mq=Ei(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"),vq=Ei(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"),fq=Ei(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"),bq=Ei(TB,"Payroll"),yq=Ei(GD,"ChartOfAccounts"),Cq=Ei(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"),xq=Ei(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"),Tq=Ei(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"),wq={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:uq}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:hq},{page:"ExpenseDashboard",label:"Expenses",Icon:$H},{page:"IncomeDashboard",label:"Income",Icon:hq}]},{items:[{page:"Invoices_NOT_IMPL",label:"Invoices",Icon:mq},{page:"TimeAndTasks_NOT_IMPL",label:"Time & Tasks",Icon:vq},{page:"Mileage_NOT_IMPL",label:"Mileage",Icon:fq},{page:"Payroll_NOT_IMPL",label:"Payroll",Icon:bq},{page:"ReportDashboard",label:"Reports",Icon:pq}]},{label:"Accounting",items:[{page:"ChartOfAccounts_NOT_IMPL",label:"Chart of Accounts",Icon:yq},{page:"GeneralLedger",label:"General Ledger",Icon:Cq},{page:"Journal_NOT_IMPL",label:"Journal",Icon:xq}]},{items:[{page:"Taxes_NOT_IMPL",label:"Taxes",Icon:Tq}]}]},kq=dr({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 Eq(){return I("div",{className:kq,children:I(Sz,{})})}const Aq=dr({width:"100%",display:"flex",flexDirection:"row"}),Sq=dr({flex:1,display:"flex",flexDirection:"column",padding:{xl:"50px",base:"16px"}});function Iq(){const e=Nw();return P("div",{className:Aq,children:[!e&&I(Eq,{}),I("div",{className:Sq,children:I(Be,{children:Object.entries(dq).map(([e,t])=>I(Ue,{path:t.path,element:t.element},e))})})]})}function Nq(e){const{accessToken:t,environment:n="PRODUCTION",initialNav:r={page:"FinancialOverview"},buildTarget:a,rtlConfig:o}=e,i=/* @__PURE__ */function(e){return e?wq:gq}("PLAYGROUND"===a||"LAB"===a);return I(Ve,{initialEntries:[dq[r.page].path],children:I(Tz.Provider,{value:o,children:I(lq,{initialNav:r,children:I(xz.Provider,{value:i,children:I(iq,{environment:n,accessToken:t,children:I(Iq,{})})})})})})}const Pq=["BanksAndIntegrations"],Rq={BanksAndIntegrations:!0,FinancialOverview:!0,TransactionsDashboard:!0,ExpenseDashboard:!0,IncomeDashboard:!0,ReportDashboard:!0,GeneralLedger:!0},Dq=new Set(Object.values(Ti).flatMap(e=>Object.values(e)));function Mq(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!Rq[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&Pq.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)&&Dq.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{uS as BanksAndIntegrations,VR as ExpenseDashboard,rE as FinancialOverview,zR as IncomeDashboard,$L as ReportDashboard,iq as Tight,Nq as TightApp,yR as TransactionsDashboard,Mq as parseNavUrl,Ln as useEmbeddedEventListeners,Mn as useEventSource,Rn as useOptions};
3
2
  //# sourceMappingURL=index.js.map