@tight-embedded/react 6.3.1 → 6.4.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.css +672 -650
- package/dist/index.css.gz +0 -0
- package/dist/index.d.ts +231 -5
- package/dist/index.js +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.js.map.gz +0 -0
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{create as e}from"zustand";import{devtools as t,persist as n}from"zustand/middleware";import"zustand/react/shallow";import{cloneDeep as r,entries as a,mapValues as o,isEqual as i,differenceBy as l,debounce as s,isEmpty as c}from"lodash-es";import{v4 as d}from"uuid";import*as u from"zod";import{z as h}from"zod";import*as p from"react";import{useRef as g,useMemo as m,createContext as v,useContext as b,Component as f,useState as y,useCallback as x,useEffect as T,createElement as C,forwardRef as w,useImperativeHandle as k,useReducer as E,useLayoutEffect as A,Fragment as S}from"react";import{jsx as I,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as D,useIsRestoring as P,useQuery as L,keepPreviousData as M,useMutation as F,useQueries as O}from"@tanstack/react-query";import U from"yocto-queue";import B from"big.js";import{ResponsiveContainer as V,BarChart as W,Legend as H,CartesianGrid as j,XAxis as z,YAxis as q,Tooltip as K,Bar as _,ReferenceLine as Y,Line as X}from"recharts";import{flexRender as Z,createColumnHelper as G,useReactTable as Q,getCoreRowModel as J,getExpandedRowModel as $}from"@tanstack/react-table";import{useFloatingNodeId as ee,useFloating as te,offset as ne,flip as re,shift as ae,size as oe,autoUpdate as ie,useClick as le,useDismiss as se,useRole as ce,useInteractions as de,useFloatingParentNodeId as ue,FloatingTree as he,FloatingNode as pe,useMergeRefs as ge,FloatingOverlay as me,FloatingPortal as ve,FloatingFocusManager as be}from"@floating-ui/react";import{ContextAwareConfirmation as fe,confirmable as ye}from"react-confirm";import{createFormHookContexts as xe,useStore as Te,createFormHook as Ce}from"@tanstack/react-form";import{NumericFormat as we}from"react-number-format";import ke from"fuse.js";import{AnimatePresence as Ee,motion as Ae}from"motion/react";import{useDropzone as Se}from"react-dropzone";import{openDB as Ie}from"idb";import{PersistQueryClientProvider as Ne}from"@tanstack/react-query-persist-client";import{fetchEventSource as Re}from"@microsoft/fetch-event-source";function De(e,t){return`${e.trim()}:${t.trim()}`}const Pe=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_GLSOURCE:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,De("featureFlags","updateFlags"))});function Le(){return Yt(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function Me(){return Yt(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}let Fe=null,Oe=!1;function Ue(){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 Be(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Ve(){const e=Ue();if(!e)return;const{meta:t,params:n}=e;if(Oe)return t.remove(),Oe=!1,void(Fe=null);Fe?n["interactive-widget"]=Fe:delete n["interactive-widget"],Fe=null,Be(t,n)}const We="drawerNavigation",He=(e,t)=>({drawerHistory:[],closingQueue:[],openDrawer:(t,n={})=>e(e=>{const{replaceHistory:a,routeProps:o}=n,i={[t]:{routeProps:o}};if(a||0===e.drawerHistory.length)return 0===e.drawerHistory.length&&function(){let e=Ue();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),Oe=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;Fe=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Be(t,n)}(),{drawerHistory:[i]};{const t=r(e.drawerHistory);return t.push(i),{drawerHistory:t}}},void 0,De(We,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,De(We,"closeDrawer")),0===t().drawerHistory.length&&Ve()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,De(We,"closeAllDrawers")),Ve()},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,De(We,"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,De(We,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,De(We,"confirmCloseDrawer")),0===t().drawerHistory.length&&Ve()}}),je=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,De("externalOptions","setOptions"))});function ze(e){return Array.isArray(e)&&e.length>0}function qe(e){const t={...e,selectedValues:e=>e.filter(e=>e.modelKey===t.key),createFilter:e=>({...e,modelKey:t.key,id:d()}),searchFunc:e.searchFunc?e.searchFunc:e=>{return n=e,t.name.toLowerCase().includes(n.toLowerCase());var n}};return t}const Ke="search",_e=qe({key:Ke,name:"Search"});function Ye(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Xe(e,t,n){return new Date(e,t,n)}function Ze(e){const[t,n,r]=e.split("-");return Xe(Number(t),Number(n),Number(r))}function Ge(){return Ye(Xe(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function Qe(e,t){return Ye(Xe(t,e,1))}function Je(){const e=/* @__PURE__ */new Date;return Ye(Xe(e.getFullYear(),e.getMonth()+1,0))}function $e(e){const t=/* @__PURE__ */new Date;return Ye(Xe(t.getFullYear(),t.getMonth()-e,1))}function et(e){const t=e.getMonth(),n=t-t%3;return Ye(Xe(e.getFullYear(),n,1))}function tt(e){const t=e.getMonth(),n=t-t%3+3;return Ye(Xe(e.getFullYear(),n,0))}const nt={ALL_TIME:"ALL_TIME",THIS_MONTH:"THIS_MONTH",LAST_MONTH:"LAST_MONTH",LAST_3_MONTHS:"LAST_3_MONTHS",LAST_12_MONTHS:"LAST_12_MONTHS",THIS_QUARTER:"THIS_QUARTER",LAST_QUARTER:"LAST_QUARTER",THIS_YEAR:"THIS_YEAR",LAST_YEAR:"LAST_YEAR"},rt={ALL_TIME:"All Time",THIS_MONTH:"This Month",LAST_MONTH:"Last Month",LAST_3_MONTHS:"Last 3 Months",LAST_12_MONTHS:"Last 12 Months",THIS_QUARTER:"This Quarter",LAST_QUARTER:"Last Quarter",THIS_YEAR:"This Year",LAST_YEAR:"Last Year"},at=e=>Object.values(nt).includes(e),ot={[nt.ALL_TIME]:()=>"",[nt.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return Qe(e.getMonth(),e.getFullYear())}(),[nt.LAST_YEAR]:()=>Ye(Xe(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[nt.LAST_MONTH]:()=>$e(1),[nt.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return Ye(Xe(e.getFullYear(),e.getMonth()-11,1))}(),[nt.THIS_YEAR]:()=>Ye(Xe(/* @__PURE__ */(new Date).getFullYear(),0,1)),[nt.LAST_3_MONTHS]:()=>$e(2),[nt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return et(Xe(e.getFullYear(),e.getMonth()-3,1))}(),[nt.THIS_QUARTER]:()=>et(/* @__PURE__ */new Date)};function it(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 lt=e=>ot[e](),st={[nt.ALL_TIME]:()=>"",[nt.THIS_MONTH]:()=>Je(),[nt.LAST_YEAR]:()=>Ye(Xe(/* @__PURE__ */(new Date).getFullYear(),0,0)),[nt.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return Ye(Xe(e.getFullYear(),e.getMonth(),0))}(),[nt.LAST_12_MONTHS]:()=>Je(),[nt.THIS_YEAR]:()=>Ge(),[nt.LAST_3_MONTHS]:()=>Je(),[nt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return tt(Xe(e.getFullYear(),e.getMonth()-3,1))}(),[nt.THIS_QUARTER]:()=>tt(/* @__PURE__ */new Date)},ct=e=>st[e](),dt=e=>{return at(e)?{beginDate:lt(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:Ye((t=e).beginDate),endDate:Ye(t.endDate)};var t},ut=["SUN","MON","TUE","WED","THU","FRI","SAT"],ht=["January","February","March","April","May","June","July","August","September","October","November","December"];function pt({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 gt(e,t){return e.toDateString()===t.toDateString()}function mt(e){return gt(e,/* @__PURE__ */new Date)}function vt(e,t){const n=Xe(e.getFullYear(),e.getMonth(),e.getDate()),r=Xe(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function bt(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 ft(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=Xe(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function yt(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 ft(o,i,l)?Xe(l,o-1,i):null}function xt(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 ft(i,l,o)?Xe(o,i-1,l):null}function Tt(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 Ct(e,t){return vt(e,t)?t:e}function wt(e,t){return vt(t,e)?t:e}const kt=(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},Et=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):kt(t,{abbreviateMonth:!0,abbreviateYear:!1})},At=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function St(e,t){return Xe(e.getFullYear(),e.getMonth(),e.getDate()+t)}function It(e){const{month:t,year:n}=e;return{beginDate:Xe(n,t-1,1),endDate:Xe(n,t+1,0)}}const Nt="date",Rt=Object.values(nt).map(e=>{return{name:rt[t=e],value:{date:{name:rt[t],value:t}}};var t}),Dt=qe({key:Nt,name:"Date",possibleValues:()=>({values:Rt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function Pt(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===Ke);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==Ke)}const Lt=Dt.createFilter({name:rt[nt.LAST_12_MONTHS],value:{date:{name:rt[nt.LAST_12_MONTHS],value:nt.LAST_12_MONTHS}}});function Mt(e,t){return Pt([...t.some(e=>e.modelKey===Nt)?function(e){const t=e.findIndex(e=>e.modelKey===Nt);return-1!==t?(n=e,(r=t)>-1&&r<=n.length-1?[...n.slice(0,r),...n.slice(r+1)]:[...n]):e;var n,r}(e.filters):e.filters,...t])}function Ft(e,t){const n=e.filters[t];return n&&n.modelKey===Nt?function(e,t){const n=[...e];return n[t]=Lt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Ot(e){return Pt(e.some(e=>e.modelKey===Nt)?e:[...e,Lt])}function Ut(e,t){if(e.hasInitialized)return e;const n=[];return"OWNER"===t.userRole&&t.hasNonReconciledTransactions&&t.needsReviewStatuses.length>0&&n.push({modelKey:"reviewStatus",id:d(),name:"Needs Review",value:{reviewStatus:{name:"Needs Review",value:{in:t.needsReviewStatuses}}}}),n.push(Lt),{filters:n,hasInitialized:!0}}const Bt="transactionsDashboardFilters",Vt=e=>({transactionsDashboardFilters:[Lt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Mt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,De(Bt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:Ft({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,De(Bt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Ot(t)}),void 0,De(Bt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Ut({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,De(Bt,"initialize"))}),Wt="expenseDashboardFilters",Ht=e=>({expenseDashboardFilters:[Lt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Mt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,De(Wt,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:Ft({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,De(Wt,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Ot(t)}),void 0,De(Wt,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Ut({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,De(Wt,"initialize"))}),jt="incomeDashboardFilters",zt=e=>({incomeDashboardFilters:[Lt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Mt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,De(jt,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:Ft({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,De(jt,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Ot(t)}),void 0,De(jt,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Ut({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,De(jt,"initialize"))}),qt={label:"Connected Accounts",value:"connected"},Kt="banksAndIntegrationsState",_t=e=>({banksAndIntegrationsSelectedTab:qt,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,De(Kt,"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,De(Kt,"toggleExpandedIntegration"))}),Yt=e()(t(n((...e)=>({...Pe(...e),...He(...e),...je(...e),...Vt(...e),...Ht(...e),...zt(...e),..._t(...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})),Xt={SELECT:"select",EXPAND:"expand"},Zt={...Xt,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",CLASS_SEGMENT:"classSegment",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},Gt=[Zt.COMMENTS,Zt.DATE,Zt.DESCRIPTION,Zt.AMOUNT,Zt.CATEGORY,Zt.CLASS_SEGMENT,Zt.REVIEW_STATUS],Qt=u.object({pageSize:u.optional(u.int32().positive()),columns:u.optional(u.array(u.enum(Gt)))}),Jt=e=>{const t=Qt.safeParse(e);return t.success?t.data:void 0},$t=u.optional(u.string().trim()),en=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,tn=u.optional(u.array(u.string().trim())),nn=u.object({integrations:u.optional(u.array(u.enum(["UNIT","STRIPE","GUSTO","SHOPIFY","SQUARE","RUTTER","UBER","MOOV","QUALPAY","MANUAL_ENTRY","PARTNER_IMPLEMENTATION","QBO","XERO","FRESHBOOKS"]))),useOnPlaidLink:u.optional(u.boolean()),hideManualBanks:u.optional(u.boolean())}),rn={transactionsDashboard:Jt,incomeDashboard:Jt,expenseDashboard:Jt,accessToken:e=>{const t=$t.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=tn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>en.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=nn.safeParse(e);return t.success?t.data:void 0}},an=(e,t)=>{if(void 0!==rn[e])return(0,rn[e])(t)};function on(e){const t=g(!1),n=Yt(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of a(e)){const e=an(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const o=Yt(e=>e.externalOptions);return{options:m(()=>r(o),[o]),setOptions:n}}function ln(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function sn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function cn(e){return String.fromCharCode(e+(e>25?39:97))}function dn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=cn(t%52)+n;return cn(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 hn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var pn=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}},gn=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function mn(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(gn.has(n))return;const r=e[n],a=t[n];ln(r)&&ln(a)?e[n]=mn(r,a):e[n]=a}),e):e,{})}var vn=e=>null!=e;function bn(e,t,n={}){const{stop:r,getKey:a}=n;return function e(n,o=[]){if("object"==typeof(i=n)&&null!==i){const i={};for(const[l,s]of Object.entries(n)){const c=a?.(l,s)??l,d=[...o,c];if(r?.(n,d))return t(n,o);const u=e(s,d);vn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function fn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return bn(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:[]}},xn=/([A-Z])/g,Tn=/^ms-/,Cn=pn(e=>e.startsWith("--")?e:e.replace(xn,"-$1").replace(Tn,"-ms-").toLowerCase()),wn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),kn=`(?:${"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("|")})`,En=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${kn}$`),An={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):ln(e)?bn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&wn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&En.test(e)},Sn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,sn(t))};const In=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,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,base".split(",")),Nn=/^@|&|&$/;function Rn(e){return In.has(e)||Nn.test(e)}const Dn=/^_/,Pn=/&|@/,Ln=/* @__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(":");Ln.set(t,n)});const Mn={conditions:{shift:function(e){return e.sort((e,t)=>{const n=Rn(e),r=Rn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>In.has(e)?e.replace(Dn,""):Pn.test(e)?`[${hn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1.5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${Ln.get(e)||Cn(e)}_${hn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},Fn=function(e){const{utility:t,hash:n,conditions:r=yn}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return pn(({base:o,...i}={})=>{const l=fn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return bn(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,dn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(Mn),On=(...e)=>Fn(Un(...e));On.raw=(...e)=>Un(...e);const{mergeCss:Un}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>ln(e)&&Object.keys(sn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>fn(t,e))}return{mergeCss:pn(function(...e){return mn(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(Mn);function Bn(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const Vn=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function Wn(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=Vn(e),o=e=>({...r,...sn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=Un(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=Un(n,e.css))}),n}(a,r);return Un(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(pn(function(e){return On(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=Vn(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 Wn({base:Un(t,o.base),variants:Object.fromEntries(i.map(e=>[e,Un(n[e],o.variants[e])])),defaultVariants:mn(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 Hn,jn=((Hn=jn||{}).component="component",Hn["dashboard-placeholder-table"]="dashboard-placeholder-table",Hn["dashboard-header"]="dashboard-header",Hn["dashboard-table"]="dashboard-table",Hn["dashboard-table-body"]="dashboard-table-body",Hn["dashboard-table-cell"]="dashboard-table-cell",Hn["dashboard-table-column-header"]="dashboard-table-column-header",Hn["dashboard-table-header"]="dashboard-table-header",Hn.label="label",Hn.popup="popup",Hn["popup-sort-row"]="popup-sort-row",Hn["progress-bar"]="progress-bar",Hn["progress-bar-fill"]="progress-bar-fill",Hn.summation="summation",Hn["table-parent-row"]="table-parent-row",Hn["table-row"]="table-row",Hn["table-sub-row"]="table-sub-row",Hn.tile="tile",Hn["tile-bar-label"]="tile-bar-label",Hn["tile-bar-label-outer"]="tile-bar-label-outer",Hn["tile-body"]="tile-body",Hn["tile-filter-button"]="tile-filter-button",Hn["tile-filter-list"]="tile-filter-list",Hn["tile-filter-row"]="tile-filter-row",Hn["tile-header"]="tile-header",Hn["business-owner-dashboard"]="business-owner-dashboard",Hn["business-owner-dashboard-header"]="business-owner-dashboard-header",Hn["transaction-type-label"]="transaction-type-label",Hn["transaction-date-cell-container"]="transaction-date-cell-container",Hn["selector-row"]="selector-row",Hn["popup-list"]="popup-list",Hn.badge="badge",Hn["badge-chip"]="badge-chip",Hn["date-cell"]="date-cell",Hn["vertical-divider"]="vertical-divider",Hn["horizontal-divider"]="horizontal-divider",Hn["checkbox-input"]="checkbox-input",Hn["bulk-select"]="bulk-select",Hn["button-base"]="button-base",Hn["button-discreet-small"]="button-discreet-small",Hn["button-primary"]="button-primary",Hn["button-secondary"]="button-secondary",Hn["button-tertiary"]="button-tertiary",Hn["button-danger"]="button-danger",Hn["button-warning"]="button-warning",Hn["button-action"]="button-action",Hn["button-table-header"]="button-table-header",Hn["button-inline"]="button-inline",Hn["small-square-button"]="small-square-button",Hn.card="card",Hn["card-button-icon-container"]="card-button-icon-container",Hn["pagination-button"]="pagination-button",Hn.text="text",Hn["cell-button"]="cell-button",Hn["selector-button"]="selector-button",Hn["review-status-selector-button"]="review-status-selector-button",Hn["review-status-dropdown-arrow"]="review-status-dropdown-arrow",Hn["financial-summary-layout"]="financial-summary-layout",Hn["financial-summary-chatbox"]="financial-summary-chatbox",Hn["financial-summary-chatbox-header"]="financial-summary-chatbox-header",Hn["month-picker"]="month-picker",Hn["month-picker-left-button"]="month-picker-left-button",Hn["month-picker-right-button"]="month-picker-right-button",Hn["month-picker-label"]="month-picker-label",Hn["filter-bar"]="filter-bar",Hn["filter-search-bar"]="filter-search-bar",Hn["filter-pill"]="filter-pill",Hn["discreet-form-input"]="discreet-form-input",Hn["editable-form-input"]="editable-form-input",Hn["category-text"]="category-text",Hn["amount-input-container"]="amount-input-container",Hn["amount-input"]="amount-input",Hn["modal-popup"]="modal-popup",Hn["drawer-header"]="drawer-header",Hn["form-body"]="form-body",Hn.body="body",Hn.heading="heading",Hn["sub-label"]="sub-label",Hn["strong-label"]="strong-label",Hn["strong-sub-label"]="strong-sub-label",Hn["weak-label"]="weak-label",Hn["metric-xl"]="metric-xl",Hn["metric-md"]="metric-md",Hn["large-icon"]="large-icon",Hn["medium-icon"]="medium-icon",Hn["small-icon"]="small-icon",Hn["tiny-icon"]="tiny-icon",Hn["x-large-icon"]="x-large-icon",Hn["xx-large-icon"]="xx-large-icon",Hn["card-header"]="card-header",Hn.icon="icon",Hn["neutral-badge"]="neutral-badge",Hn["highlight-badge"]="highlight-badge",Hn["success-badge"]="success-badge",Hn["warning-badge"]="warning-badge",Hn["critical-badge"]="critical-badge",Hn["button-group"]="button-group",Hn["alert-dialog"]="alert-dialog",Hn["alert-header"]="alert-header",Hn["emphasis-label"]="emphasis-label",Hn["profit-loss-graph"]="profit-loss-graph",Hn.banner="banner",Hn["banner-high"]="banner-high",Hn["banner-medium"]="banner-medium",Hn["banner-low"]="banner-low",Hn["banner-urgent"]="banner-urgent",Hn["banner-default"]="banner-default",Hn["banner-button"]="banner-button",Hn["banner-button-text"]="banner-button-text",Hn["banner-button-icon"]="banner-button-icon",Hn["banner-icon"]="banner-icon",Hn["banner-title"]="banner-title",Hn["empty-dashboard-layout"]="empty-dashboard-layout",Hn["emphasis-sub-label"]="emphasis-sub-label",Hn["bar-transactions-positive"]="bar-transactions-positive",Hn["bar-transactions-negative"]="bar-transactions-negative",Hn["message-sent"]="message-sent",Hn["message-received"]="message-received",Hn);const zn="Tight-",qn=e=>`${zn}${e}`;function Kn(e){return e in jn}function _n(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===zn&&r in jn}function Yn(e){return!Kn(e)&&!_n(e)}const Xn=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(qn(e)),t.forEach(e=>{void 0!==e&&(Yn(e)?r.push(e):Kn(e)&&n.push(qn(e)))}),{className:Bn(...n,...r)}},Zn=Xn(jn["business-owner-dashboard-header"],On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function Gn({children:e}){return I("div",{...Zn,children:e})}function Qn(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(_n(t)&&e.push(t),e),[])],[])}function Jn(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(Yn(t)&&e.push(t),e),[])],[])}function $n(e){const t=Array.isArray(e)?e:[e];return{className:Bn(...Qn(t),...Jn(t))}}const er=Wn({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:{xl:"16px",base:"18px"},letterSpacing:"0.84px"}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:{xl:"16px",base:"18px"},letterSpacing:"0.84px"},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:{xl:"14px",base:"16px"},letterSpacing:"0.66px"},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"20px",letterSpacing:"0.96px",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"16px",letterSpacing:"0.84px"},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"},letterSpacing:"0.96px"},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:{xl:"14px",base:"16px"},letterSpacing:"0.84px"},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:{xl:"14px",base:"16px"},letterSpacing:"0.84px"}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"25px",letterSpacing:"2px"}},metric:{sm:{fontWeight:"metric.sm",fontSize:"metric.sm",fontFamily:"metric",color:"typography.metric.sm"},md:{fontWeight:"metric.md",fontSize:"metric.md",fontFamily:"metric",color:"typography.metric.md"},lg:{fontWeight:"metric.lg",fontSize:"metric.lg",fontFamily:"metric",color:"typography.metric.lg"},xl:{fontWeight:"metric.xl",fontSize:"metric.xl",fontFamily:"metric",color:"typography.metric.xl"}}}}),tr=Xn(jn.heading,er({heading:"default"}));function nr({children:e,stylists:t=[]}){const n=$n([tr,...t]);return I("div",{...n,children:e})}function rr(e,t,n){return[...e,{accessToken:t,environment:n}]}function ar(e,t){return[...e,t]}const or=e=>null==e,ir=e=>!or(e);function lr(e){return""===e.trim()}function sr(e){return or(e)||lr(e)}function cr(e){return!sr(e)}const dr=v({activeToken:void 0,accountantToken:void 0});function ur(){const{activeToken:e}=b(dr);return e}const hr=()=>{throw new Error("No access token provided")},pr=72e5,gr=new D({defaultOptions:{queries:{gcTime:pr,staleTime:3e4,refetchInterval:6e4}}}),mr=v("SANDBOX");function vr(){return b(mr)}function br({queryKey:e,queryFn:t,...n}){const r=ur(),a=vr(),o=cr(r),i=rr(e,r??"",a),l=P(),s=L({...n,queryKey:i,queryFn:o?t:hr,placeholderData:n.keepPreviousDataPlaceholder?M:void 0,...o?{}:{retry:!1,staleTime:1/0}},gr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class fr{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 yr=Symbol("Circular"),xr=Symbol("AccessError");function Tr(e,t,n){return Cr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Cr({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=yr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=wr(()=>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=wr(()=>s[i]);e.push(Cr({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=wr(()=>s[c]);e[c]=Cr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function wr(e){try{return e()}catch{return xr}}const kr=Object.prototype.toString,Er=Object.getPrototypeOf;function Ar(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Sr=/^\s*at .*(\S+:\d+|\(native\))/m,Ir=/^(eval@)?(\[native code])?$/;function Nr(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 Rr(e,t){const n=Dr(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Ar(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[Pr(n)];return a.push(...Fr(n).map(e=>Pr(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function Dr(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===kr.call(t))return!0;t=Er(t)}return!1}(e))return e;let n=function(e){if(!Ar(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 Pr(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:Lr(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function Lr(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(Sr)?e.split("\n").filter(e=>!!e.match(Sr)).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=Nr(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(Ir)).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=Nr(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<Mr;){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 Mr=20;function Fr(e){const t=e;if(t.cause){const e=Dr(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(Fr(e))}return[]}function Or(...e){console.log}function Ur(...e){console.error}const Br={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 Vr=Date.now();const Wr=()=>{Vr=Date.now()},Hr={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-Vr,!0}),{reset:Wr})},jr=[["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\)$/]],zr=[["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/]],qr=(Kr=function(e){const t=""!==(n=e)&&jr.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 zr)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,...Kr(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 Kr;class _r{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 Yr extends f{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}=Rr(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 Xr={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(Yr,{client:e,onError:t,FallbackComponent:n,children:r})})},Zr=new class{breadcrumbs=[];config;delivery=new fr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return Ur(),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}=Rr(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=Tr(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/Hurdlr/TraxComponents/tree/dev/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){Ur()}}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 Gr="",Qr="";const Jr="prod",$r=Zr.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.3.1",appType:"browser",releaseStage:Jr,plugins:[Hr,qr,Br,(()=>{const e=new _r(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),Xr]}),ea=(e,t)=>{try{Zr.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?ta({error:n,severity:"error"}):ta({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},ta=async e=>{try{await Zr.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:Gr,environment:Qr}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await ta({error:t,severity:"error"}):await ta({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},na=$r.getPlugin("react"),ra=na?.BugsnagErrorBoundary,aa=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,oa=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},ia=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},la={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function sa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...o(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?la:{}}});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=oa({extraHeaders:t,authorization:e});ea("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return ea("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),ia(e)}catch(l){return Promise.reject(l)}}async function da(e){const{url:t,headers:n}=sa(e);return ca({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function ua(e){return da(e)}async function ha(e){return da(e)}const pa=(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}),ga={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"},ma={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"},va={...ma,LOCAL:"http://localhost:8082"};function ba(e){return pa(`${t=e,ga[t]}/v5`,"v5");var t}const fa=({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",...dt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:ba(a)};return await ha(o)};function xa({filter:e,grouping:t,select:n,accountingMethod:r}){return br({queryKey:fa({filter:e,grouping:t,accountingMethod:r}),queryFn:ya,select:n})}const Ta="noDataHeight";function Ca(e){const t=xt(e??"");return null!==t?kt(t,{abbreviateMonth:!0,abbreviateYear:!0}):""}function wa(e){const t=Ca(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?B(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?B(n).plus(a).toNumber():0}}(n,e.income?.total,e.expenses?.total);return{month:{month:t,income:a,expenses:-i,profit:r,loss:o,netIncome:n,hasNoData:/* @__PURE__ */function(e,t,n){return 0===e&&0===t&&0===n}(n,a,i)},netIncome:n}}function ka(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(or(n))return t;for(const i of n){const{month:e,netIncome:n}=wa(i);t.total=B(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 Ea="MONTHLY",Aa=Xn(jn["tile-header"],On({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Sa({title:e}){return I("div",{...Aa,children:I(nr,{children:e})})}const Ia=Xn(jn["tile-body"],On({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 Na({children:e}){return I("div",{...Ia,children:e})}const Ra=Wn({base:{display:"flex",flexDirection:"column",boxShadow:"box-shadow",transition:"height 0.5s, width 0.5s",position:"relative",borderRadius:"lg"},variants:{type:{default:{width:"400px",flexShrink:0,height:"300px"},chart:{minWidth:"900px",maxWidth:"1440px",height:"481px"}},isSample:{true:{pointerEvents:"none"},false:{}}},defaultVariants:{type:"default"}});function Da({children:e,type:t,isSample:n=!1}){const r=Xn(jn.tile,Ra({type:t,isSample:n}));return I("div",{...r,children:e})}const Pa=On({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),La=On.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"});On.raw({whiteSpace:"normal",overflowWrap:"break-word"});const Ma=On({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"12px",letterSpacing:"0.66px"}),Fa=Xn(jn.text,On({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa);function Oa({children:e}){return I("div",{...Fa,children:e})}const Ua=Xn(jn["metric-xl"],er({metric:"xl"}));function Ba(e){return I("div",{...Ua,children:e.children})}const Va=Xn(jn.summation,On({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function Wa({title:e,label:t}){return R("div",{...Va,children:[I(Ba,{children:e}),I(Oa,{children:t})]})}const Ha=Xn(null,On({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function ja({children:e}){return I("div",{...Ha,children:e})}const za=(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},qa=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),Ka=1e9;function _a(e,{cents:t="default",condense:n=!1,dollarSign:r=!1,signage:a="default"}={}){const o="string"==typeof e?parseFloat(e):e;if(Number.isNaN(o))return"";let i;const l=Math.abs(o);let s;if(n&&l>99999){s=Math.sign(o)<0;const e=Math.floor((d=l,Math.log(d)/Math.log(1e3)))-1,t=Math.pow(1e3,e),n=Math.round(l/t),r=n*t;let a,c=n/1e3;l<Ka&&c>=1e3&&(c/=1e3),r>=Ka?a="B":r>=1e6?a="M":(c=Math.round(c),a="K"),i=`${qa(c,0,1)}${a}`}else{let e;const n=2,r=0;let a,l;"floor"===t?(a=r,l=r,c=o,e=Math.sign(c)*Math.floor(Math.abs(c))):"round"===t?(a=r,l=r,e=za(o,a)):"always"===t?(a=n,l=n,e=za(o,a)):"default"===t&&Math.abs(o)>=1e3?(a=r,l=r,e=za(o,a)):(a=n,e=za(o,a),l=e%1==0?r:n),s=Math.sign(e)<0;const d=Math.abs(e);i=qa(d,l,a)}var c,d;let u=i;const h=r?"$":"";return void 0===a||"off"===a?u=`${h}${i}`:"parens"===a?u=`${h}${s?`(${i})`:i}`:"always"===a?u=`${s?"-":"+"}${h}${i}`:"default"===a&&(u=`${s?"-":""}${h}${i}`),u}function Ya(e){return _a(e,{condense:!0,dollarSign:!0})}function Xa(e){return _a(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}const Za=Wn({variants:{wrap:{ellipsis:La,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function Ga({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(sr(n))return null;const a=$n([Xn(jn["strong-label"],jn.text,er({label:"strongLabel"}),Za({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const Qa=Wn({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"16px",letterSpacing:"0.66px",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:La,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},wrapTwice:{ellipsisTextRaw:La,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function Ja({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=Xn(jn["sub-label"],jn.text,Qa({intent:e,wrap:t,accent:r}),Pa);return sr(n)?null:I("div",{...a,children:n})}const $a=Xn(null,On({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 eo({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ta)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",{...$a,children:[I(Ga,{children:t[0].name??""}),I(Ja,{children:Ya(Number(n))})]})}const to={"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.black100":{value:"#CED1D2",variable:"var(--Tight-colors-black100)"},"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.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.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.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.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.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.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.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-green200)",variable:"var(--Tight-colors-brand-success-opaque)"},"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.warning.opaque":{value:"var(--Tight-colors-yellow200)",variable:"var(--Tight-colors-brand-warning-opaque)"},"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.danger.opaque":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-brand-danger-opaque)"},"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.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-weak)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-brand-primary)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-brand-primary-strong)",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)",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-opaque)",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-opaque)",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.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-opaque)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"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.inherit":{value:"inherit",variable:"var(--Tight-colors-inherit)"},"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.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.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.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.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-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.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.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"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.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"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.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.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.base":{value:"var(--Tight-colors-colorPalette-base)",variable:"var(--Tight-colors-colorPalette-base)"},"colors.colorPalette.base.weak":{value:"var(--Tight-colors-colorPalette-base-weak)",variable:"var(--Tight-colors-colorPalette-base-weak)"},"colors.colorPalette.contrast":{value:"var(--Tight-colors-colorPalette-contrast)",variable:"var(--Tight-colors-colorPalette-contrast)"},"colors.colorPalette.contrast.weak":{value:"var(--Tight-colors-colorPalette-contrast-weak)",variable:"var(--Tight-colors-colorPalette-contrast-weak)"},"colors.colorPalette.accent.success":{value:"var(--Tight-colors-colorPalette-accent-success)",variable:"var(--Tight-colors-colorPalette-accent-success)"},"colors.colorPalette.accent.warning":{value:"var(--Tight-colors-colorPalette-accent-warning)",variable:"var(--Tight-colors-colorPalette-accent-warning)"},"colors.colorPalette.accent.danger":{value:"var(--Tight-colors-colorPalette-accent-danger)",variable:"var(--Tight-colors-colorPalette-accent-danger)"},"colors.colorPalette.accent.action":{value:"var(--Tight-colors-colorPalette-accent-action)",variable:"var(--Tight-colors-colorPalette-accent-action)"},"colors.colorPalette.body":{value:"var(--Tight-colors-colorPalette-body)",variable:"var(--Tight-colors-colorPalette-body)"},"colors.colorPalette.label":{value:"var(--Tight-colors-colorPalette-label)",variable:"var(--Tight-colors-colorPalette-label)"},"colors.colorPalette.label.sub":{value:"var(--Tight-colors-colorPalette-label-sub)",variable:"var(--Tight-colors-colorPalette-label-sub)"},"colors.colorPalette.sub":{value:"var(--Tight-colors-colorPalette-sub)",variable:"var(--Tight-colors-colorPalette-sub)"},"colors.colorPalette.label.strong":{value:"var(--Tight-colors-colorPalette-label-strong)",variable:"var(--Tight-colors-colorPalette-label-strong)"},"colors.colorPalette.label.strongSub":{value:"var(--Tight-colors-colorPalette-label-strongSub)",variable:"var(--Tight-colors-colorPalette-label-strongSub)"},"colors.colorPalette.strongSub":{value:"var(--Tight-colors-colorPalette-strongSub)",variable:"var(--Tight-colors-colorPalette-strongSub)"},"colors.colorPalette.label.emphasisSub":{value:"var(--Tight-colors-colorPalette-label-emphasisSub)",variable:"var(--Tight-colors-colorPalette-label-emphasisSub)"},"colors.colorPalette.emphasisSub":{value:"var(--Tight-colors-colorPalette-emphasisSub)",variable:"var(--Tight-colors-colorPalette-emphasisSub)"},"colors.colorPalette.heading":{value:"var(--Tight-colors-colorPalette-heading)",variable:"var(--Tight-colors-colorPalette-heading)"},"colors.colorPalette.metric.sm":{value:"var(--Tight-colors-colorPalette-metric-sm)",variable:"var(--Tight-colors-colorPalette-metric-sm)"},"colors.colorPalette.sm":{value:"var(--Tight-colors-colorPalette-sm)",variable:"var(--Tight-colors-colorPalette-sm)"},"colors.colorPalette.metric.md":{value:"var(--Tight-colors-colorPalette-metric-md)",variable:"var(--Tight-colors-colorPalette-metric-md)"},"colors.colorPalette.md":{value:"var(--Tight-colors-colorPalette-md)",variable:"var(--Tight-colors-colorPalette-md)"},"colors.colorPalette.metric.lg":{value:"var(--Tight-colors-colorPalette-metric-lg)",variable:"var(--Tight-colors-colorPalette-metric-lg)"},"colors.colorPalette.lg":{value:"var(--Tight-colors-colorPalette-lg)",variable:"var(--Tight-colors-colorPalette-lg)"},"colors.colorPalette.metric.xl":{value:"var(--Tight-colors-colorPalette-metric-xl)",variable:"var(--Tight-colors-colorPalette-metric-xl)"},"colors.colorPalette.xl":{value:"var(--Tight-colors-colorPalette-xl)",variable:"var(--Tight-colors-colorPalette-xl)"},"colors.colorPalette.layout.weak":{value:"var(--Tight-colors-colorPalette-layout-weak)",variable:"var(--Tight-colors-colorPalette-layout-weak)"},"colors.colorPalette.layout":{value:"var(--Tight-colors-colorPalette-layout)",variable:"var(--Tight-colors-colorPalette-layout)"},"colors.colorPalette.layout.strong":{value:"var(--Tight-colors-colorPalette-layout-strong)",variable:"var(--Tight-colors-colorPalette-layout-strong)"},"colors.colorPalette.positive":{value:"var(--Tight-colors-colorPalette-positive)",variable:"var(--Tight-colors-colorPalette-positive)"},"colors.colorPalette.positive.weak":{value:"var(--Tight-colors-colorPalette-positive-weak)",variable:"var(--Tight-colors-colorPalette-positive-weak)"},"colors.colorPalette.positive.strong":{value:"var(--Tight-colors-colorPalette-positive-strong)",variable:"var(--Tight-colors-colorPalette-positive-strong)"},"colors.colorPalette.negative":{value:"var(--Tight-colors-colorPalette-negative)",variable:"var(--Tight-colors-colorPalette-negative)"},"colors.colorPalette.negative.weak":{value:"var(--Tight-colors-colorPalette-negative-weak)",variable:"var(--Tight-colors-colorPalette-negative-weak)"},"colors.colorPalette.negative.strong":{value:"var(--Tight-colors-colorPalette-negative-strong)",variable:"var(--Tight-colors-colorPalette-negative-strong)"}};function no(e,t){return to[e]?.value||t}no.var=function(e,t){return to[e]?.variable||t};const ro=Xn(null,On({borderRadius:"50%",flexShrink:0})),ao=Xn(null,On({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),oo=no.var("colors.surface.foreground.disabled");function io({color:e=oo,diameter:t=17,label:n}){return R("div",{...ao,"data-testid":"bullet-row",children:[I("div",{...ro,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(Ja,{children:n})]})}const lo=Xn(null,On({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function so({payload:e}){return void 0===e?null:I("div",{...lo,children:e.map((e,t)=>"none"!==e.type&&I(io,{color:e.color,label:e.value,diameter:17},t))})}const co={right:20,left:20},uo=["income","profit","expenses","loss"],ho=e=>uo.findIndex(t=>t===e.dataKey),po={paddingBottom:"20px",marginLeft:"-20px"},go={stackId:"stack",isAnimationActive:!1},mo=Xn(jn["profit-loss-graph"],On({"& .recharts-surface":{outline:"none"}})),vo=no.var("colors.money"),bo=no.var("colors.border.layout"),fo=no.var("colors.border.layout.strong"),yo={fill:no.var("colors.typography.base"),fontSize:no.var("fontSizes.metric.sm")},xo={profit:no.var("colors.money.positive.strong"),income:no.var("colors.money.positive.weak"),loss:no.var("colors.money.negative.strong"),expenses:no.var("colors.money.negative.weak")},To=[0,100],Co=["auto","auto"];function wo({data:e}){const[t,n]=y(!0);if(void 0===e)return null;const r=e.hasAnyData?Co:To;return I(V,{width:"100%",height:"100%",...mo,children:R(W,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:co,children:[I(H,{verticalAlign:"top",itemSorter:ho,wrapperStyle:po,content:({payload:e})=>I(so,{payload:e})}),I(j,{strokeDasharray:"0",vertical:!1,stroke:bo}),I(z,{dataKey:"month",interval:0,tickLine:!1,stroke:bo,tick:yo}),I(q,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:bo,tick:yo,tickFormatter:e=>Ya(e)}),I(K,{content:({active:e,payload:t})=>I(eo,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(_,{name:"Profit",dataKey:"profit",fill:xo.profit,...go}),I(_,{name:"Income",dataKey:"income",fill:xo.income,...go}),I(_,{name:"Loss",dataKey:"loss",fill:xo.loss,...go}),I(_,{name:"Expenses",dataKey:"expenses",fill:xo.expenses,...go}),I(_,{dataKey:Ta,fill:bo,legendType:"none",...go}),I(Y,{y:0,stroke:fo}),I(X,{dataKey:"netIncome",fill:vo,stroke:vo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const ko=On({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 Eo({styles:e}){const t=Bn(ko,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const Ao=On({width:"40%",minHeight:65});function So({children:e}){return R(N,{children:[I(Eo,{styles:Ao}),I(ja,{children:e})]})}const Io=Xn(null,On({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),No=On({width:"80px",height:"17px",marginBottom:"10px"}),Ro=On({width:"100%",height:"100%"});function Do(){return R(N,{children:[R("div",{...Io,children:[I(Eo,{styles:No}),I(Eo,{styles:No}),I(Eo,{styles:No}),I(Eo,{styles:No})]}),I(Eo,{styles:Ro})]})}const Po=Wn({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 Lo({size:e}){const t=Po({size:e});return I("div",{className:t,children:"Sample"})}const Mo=20200,Fo=5043,Oo=Object.freeze({income:Mo,expenses:Fo,netIncome:15157,absoluteSum:Math.abs(Mo)+Math.abs(Fo)}),Uo=Object.freeze({total:Fo,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),Bo=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),Vo=[{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 Wo({filter:e=nt.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return xa({filter:e,grouping:t,select:ka})}({filter:e,grouping:Ea}),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=kt(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=Vo[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(Da,{type:"chart",children:[I(Sa,{title:"Profit + Loss"}),I(Na,{children:r?I(So,{children:I(Do,{})}):R(N,{children:[I(Wa,{title:Ya(a?.total??0),label:"Profit"}),I(ja,{children:I(wo,{data:a})})]})}),t&&I(Lo,{size:"xl"})]})}const Ho="conversations-section",jo="transactions-section",zo={MESSAGE_REVIEW:Ho,TRANSACTION_REVIEW:jo,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},qo={reviewStatus:{in:["USER_REVIEW_REQUIRED"]},status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},Ko={resolutionStatus:{in:["OPEN"]}},_o=[],Yo=[],Xo=v({}),Zo=Wn({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 Go(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:i}=b(Xo),l=n?.styleIconKey?i?.[n.styleIconKey]:void 0,s=$n([Xn(null,Zo()),...o]);return l?I("img",{src:l,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:On({objectFit:"contain"})}):I(e,{...s,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const Qo=Go(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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"),Jo=Go(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10})),"ArrowRight"),$o=On.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"}}),ei=On($o),ti=On({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),ni=On({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}});On({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),On({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const ri=v({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function ai({Component:e,stylists:t}){return I(e,{stylists:[Xn(jn["small-icon"],jn.icon),...t??[]],size:12})}const oi=Xn(jn["pagination-button"],On({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"},gap:0})),ii=Xn(null,On({border:"none",borderRadius:"sm",backgroundColor:"surface.intent.action.discreet",padding:{xl:"4px",base:"12px"},margin:0,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"}}),ti),li=Xn(null,On({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),si=Xn(null,On({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function ci(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=b(ri);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...oi,children:[I("div",{...li,children:I("button",{...ii,onClick:r,disabled:!t,children:I(ai,{Component:Qo,stylists:[si]})})}),I("div",{...li,children:I("button",{...ii,onClick:n,disabled:!e,children:I(ai,{Component:Jo,stylists:[si]})})})]})}const di=On({width:"100%",height:"50px"});function ui(){return I(Eo,{styles:di})}const hi=Xn(jn["dashboard-placeholder-table"],On({display:"flex",flexDirection:"column",gap:"4px"})),pi=Xn(null,On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),gi=On({width:"100px",height:"20px"});function mi({numColumns:e=6}){return R("div",{...hi,children:[I("div",{...pi,children:Array.from({length:e},(e,t)=>I(Eo,{styles:gi},t))}),I(ui,{}),I(ui,{}),I(ui,{}),I(ui,{}),I(ui,{}),I(ui,{})]})}function vi(e){return pa(`${t=e,ma[t]}`,"v6");var t}function bi(e,t){const n=ur(),r=vr();return x(a=>{const o=cr(n),i=o?{}:{retry:!1,staleTime:1/0};return gr.prefetchQuery({queryKey:rr(e(a),n??"",r),queryFn:o?t:hr,...i})},[e,t,n,r])}const fi=Object.freeze({}),yi=Object.freeze({cursor:"FINAL_PAGE"});function xi({queryKey:e,queryFn:t,...n}){const[r,a]=y(fi),o=g(e);i(o.current,e)||(o.current=e,a(fi));const l=n.select,s=ir(l)?e=>({...l(e),cursor:e.cursor}):void 0,c=ar(e,r),d=br({...n,queryKey:c,queryFn:t,keepPreviousDataPlaceholder:!0,select:s}),u=m(()=>{return e=d.query.data?.cursor,t=a,{getFirstPage:()=>t(fi),getLastPage:()=>t(yi),hasNextPage:ir(e?.after),hasPreviousPage:ir(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[d.query.data?.cursor]),h=bi(x(t=>ar(e,t),[e]),t),p=bi(x(t=>ar(e,t),[e]),t);return T(()=>{const e=d.query.data?.cursor;!d.query.isFetching&&e&&(e.after&&h({cursor:e.after}).catch(e=>{ta({error:e,severity:"error"})}),e.before&&p({cursor:e.before}).catch(e=>{ta({error:e,severity:"error"})}))},[d.query.data?.cursor,d.query.isFetching,h,p]),{...d,paginationControls:u}}async function Ti({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=oa({extraHeaders:t,authorization:e}),l=(({url:e,params:t})=>{let n=e;const r=null==(a=t)?"":Object.entries(a).map(([e,t])=>{let n;return n=Array.isArray(t)?t.map(t=>aa(e,t)).join("&"):aa(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});ea("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return ea("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),ia(e)}catch(s){return Promise.reject(s)}}async function Ci(e){const{url:t,headers:n}=sa(e);return Ti({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function wi(e){return Ci({...e,endpointManager:vi(e.environment)})}async function ki(e){return Ci({...e,endpointManager:ba(e.environment)})}function Ei({delay:e,callback:t}){const n=m(()=>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 T(()=>()=>{n.cancelCallback()},[n]),{startCallback:x(e=>{n.startCallback(e)},[n]),cancelCallback:x(()=>{n.cancelCallback()},[n])}}function Ai({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=Ei({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Si={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"},Ii={ASC:"ASC",DESC:"DESC"},Ni=e=>["conversations",e??{}],Ri=e=>["conversations","conversation",e],Di=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:vi(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 Pi(e){return xi({queryKey:e?Ni(e):["conversations",{}],queryFn:Di})}const Li=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 wi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Mi(e){const t=ir(e);return br({queryKey:Ri({id:e??""}),queryFn:Li,enabled:t})}const Fi=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:vi(n)};return await ua(r)};function Oi(){return Ai({prefetchFn:bi(Ri,Li)})}function Ui(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Bi({header:e}){const t=Ui(e.column);return I("div",{...Xn(jn["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:Z(e.column.columnDef.header,e.getContext())})}const Vi=Xn(jn["dashboard-table-header"],On({display:"flex",flexDirection:"row",alignItems:"center"}));function Wi({headerGroups:e}){return I("div",{children:e.map(e=>C("div",{...Vi,key:e.id},e.headers.map(e=>I(Bi,{header:e},e.id))))})}const Hi=Xn(jn["dashboard-table-body"],On({display:"flex",flexDirection:"column"}));function ji({children:e}){return I("div",{...Hi,children:e})}function zi({cell:e,onCellClick:t}){const n=Ui(e.column),r=Xn(jn["dashboard-table-cell"],On({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column"})),a=Xn(null,On({display:"flex",flexDirection:"row",height:"100%"}));return I("div",{...a,style:n,onClick:()=>{t&&t(e)},children:I("div",{style:n,...r,children:Z(e.column.columnDef.cell,e.getContext())})})}const qi=Xn(jn["table-sub-row"],On({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.opaque"}}));function Ki({rowData:e,onCellClick:t}){const n=e.getVisibleCells();return I("div",{...qi,children:n.map(e=>I(zi,{cell:e,onCellClick:t,isChild:!0},e.id))})}const _i=On({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content"}),Yi=On({background:"surface.background"}),Xi=Xn(jn["table-row"],On({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.opaque"}}));function Zi({rowData:e,onMouseEnter:t,onMouseLeave:n,onCellClick:r,shouldDisplayDivider:a}){const o=e.getIsExpanded(),i=Xn(jn["table-parent-row"],_i,e.index%2==0?Yi:void 0),l=e.getVisibleCells();return R("div",{...i,onMouseEnter:t,onMouseLeave:n,children:[I("div",{...Xi,children:l.map(e=>I(zi,{cell:e,onCellClick:r},e.id))}),o&&I("div",{children:e.subRows.map(e=>I(Ki,{rowData:e,onCellClick:r,shouldDisplayDivider:a},e.id))})]})}const Gi=(e,t={})=>{Yt.getState().openDrawer(e,t)},Qi=()=>{Yt.getState().requestCloseDrawer()},Ji=()=>Yt(e=>e.drawerHistory);function $i({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=rr(e,n,r);return gr.fetchQuery({queryKey:a,queryFn:t})}function el({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=rr(e,n,r);return gr.prefetchQuery({queryKey:a,queryFn:t})}const tl=[{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"}],nl={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},rl={ASC:"ASC",DESC:"DESC"},al=e=>["banks/transactions",e??{}],ol=e=>["banks/transactions",e.id],il=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:vi(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 ll(e,t){return xi({queryKey:al(e),queryFn:il,...t})}const sl=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 wi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function cl({id:e,enabled:t=!0}){return br({queryKey:ol({id:e??""}),queryFn:sl,enabled:t})}function dl(){return Ai({prefetchFn:bi(ol,sl)})}function ul(){const{query:{data:e}}=ll({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!or(t)&&t.length>0}const hl={COMPANY:"co",EMPLOYEE:"emp",CLASS_SEGMENT:"cls",CLASS_LABEL:"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 pl(e,t){return!sr(e)&&e.startsWith(t)}function gl({id:e,prefix:t}){return void 0!==e?`${hl[t]}_${e}`:""}function ml(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}const vl=e=>["conversations/messages",e];function bl(e){if(or(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 fl=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 wi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},yl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:vi(n),accessToken:t};return await ua(r)};function xl(){return Ai({prefetchFn:bi(vl,fl)})}const Tl=e=>["summaries",e??{}],Cl=e=>["summaries",e.id],wl=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:vi(t[2].environment)},r=await ua(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const kl=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 wi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function El({rowData:e,isMobile:t}){const{startPrefetch:n,cancelPrefetch:r}=Oi(),{startPrefetch:a,cancelPrefetch:o}=xl(),{startPrefetch:i,cancelPrefetch:l}=dl(),{startPrefetch:s,cancelPrefetch:c}=Ai({prefetchFn:bi(Cl,kl)}),d=x(()=>{ir(e.original.attachedEntityId)&&pl(e.original.attachedEntityId,hl.BANK_TRANSACTION)?i({id:e.original.attachedEntityId}):ir(e.original.attachedEntityId)&&pl(e.original.attachedEntityId,hl.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]),u=x(()=>{ir(e.original.attachedEntityId)&&pl(e.original.attachedEntityId,hl.BANK_TRANSACTION)?l():ir(e.original.attachedEntityId)&&pl(e.original.attachedEntityId,hl.FINANCIAL_SUMMARY)&&c(),o(),r()},[l,c,r,o,e.original.attachedEntityId]);return I(Zi,{rowData:e,onMouseEnter:d,onMouseLeave:u,shouldDisplayDivider:e=>0!==e,onCellClick:()=>((e,t,n)=>{n?Gi("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):ir(t)?pl(t,hl.BANK_TRANSACTION)?Gi("BankTransactionFormRouter",{routeProps:{transactionId:t,initialTab:"conversation"}}):pl(t,hl.FINANCIAL_SUMMARY)&&(r=e,a=t,Gi("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){Gi("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t)})}const Al=Go(e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},p.createElement("path",{d:"M0.328064 7.5H14.6719",strokeMiterlimit:10}),p.createElement("path",{d:"M7.5 0.328064V14.6719",strokeMiterlimit:10})),"Plus"),Sl=On.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}}),Il=On(Sl),Nl=On({color:"typography.intent.secondary",border:"{borderWidths.md} solid",borderColor:"border.layout",backgroundColor:"surface.intent.action.discreet",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",borderColor:"border.layout","& .Tight-text":{color:"typography.intent.secondary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.discreet.active","& .Tight-text":{color:"typography.intent.secondary.active"}},"& .Tight-text":{color:"typography.intent.secondary"}}),Rl=On.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Dl=On(Rl),Pl=On.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});On(Pl);const Ll=On.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"}}),Ml=On.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"}}),Fl=Wn({base:On.raw(Sl,Rl,$o),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:Rl,small:Pl},intent:{default:{},danger:Ml}}}),Ol=w(function({children:e,stylists:t=[],type:n="button",onClick:r,disabled:a,size:o="default",width:i="default",intent:l="default",active:s=!1,onMouseEnter:c,onMouseLeave:d,popupTriggerProps:u},h){const p=function(e){if("danger"===e)return jn["button-danger"]}(l),g=$n([Xn(jn["button-base"],p,Fl({width:i,size:o,intent:l})),...t]);return I("button",{ref:h,...g,type:n,onClick:r,disabled:a,"data-active":s,onMouseEnter:c,onMouseLeave:d,...u,children:e})}),Ul=Xn(jn["button-primary"],Nl),Bl=w(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I(Ol,{ref:o,stylists:[Ul,...n],active:t,width:r,...a,children:e})}),Vl=()=>{Gi("Conversation",{routeProps:{conversationId:null}})},Wl=Xn(jn["small-square-button"],void 0),Hl=On({width:{xl:"auto",base:"44px"},height:{xl:"auto",base:"44px"}});function jl(){return I("div",{className:Hl,children:I(Bl,{stylists:[Wl],onClick:Vl,width:"fill-parent",children:I(ai,{Component:Al})})})}const zl=Wn({base:{display:"flex",flexDirection:"column",flexGrow:1,animation:"appear.instant",overflow:"hidden"},variants:{dashboard:{transactionDashboard:{border:"none"},businessOwnerDashboard:{marginTop:"16px",border:{base:"none",xl:"{borderWidths.lg} solid {colors.border.layout}"},borderRadius:{base:"zero",xl:"lg"}}}}});function ql({children:e,dashboard:t}){const n=Xn(jn["dashboard-table"],zl({dashboard:t}));return I("div",{...n,children:e})}const Kl=v(null),_l="mobile",Yl=Wn({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 Xl({children:e,alignVariant:t="flexStart"}){const n=Xn(null,Yl({alignVariant:t}));return I("div",{...n,children:e})}const Zl=Wn({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"18px",letterSpacing:"0.84px",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:La,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function Gl({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=Xn(jn.label,jn.text,On(Zl.raw({intent:t,wrap:n,alignment:r}),a));return sr(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const Ql={"sm-sm":Xn(jn.text,On({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa),"sm-med":Xn(jn.text,On({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa),"sm-lg":Xn(jn.text,On({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa),"med-sm":Xn(jn.text,On({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa),"med-med":Xn(jn.text,On({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa),"med-lg":Xn(jn.text,On({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa)};function Jl({children:e,size:t,weight:n,stylists:r=[]}){const a=$n([Ql[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const $l=Xn(jn["emphasis-label"],On({lineHeight:"16px"}));function es({children:e}){return I(Jl,{size:"med",weight:"lg",stylists:[$l],children:e})}function ts({text:e,isRead:t}){return I(t?Gl:es,{children:e})}function ns({date:e,isRead:t=!1}){const n=Et(e);return I(ts,{text:n,isRead:t})}const rs=Xn(jn["strong-sub-label"],er({label:"strongSubLabel"}));function as({children:e,stylists:t=[]}){return sr(e)?null:I(Jl,{size:"sm",weight:"med",stylists:[rs,...t],children:e})}const os=v(null),is=On({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),ls=On.raw({display:"flex",alignItems:"center",gap:"9px",cursor:"pointer",borderRadius:"zero",width:"100%",padding:{sm:"10px",base:"16px"},border:"none",backgroundColor:"surface.foreground",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"}}),ss=Xn(jn["selector-row"],On(ls));function cs(e,t,n){const[r,a]=y(e);return[t??r,n??a]}function ds({children:e}){return null===ue()?I(he,{children:e}):e}function us({children:e,modal:t=!1,initialOpen:n,placement:r,offsetPx:a,open:o,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const c=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,modal:r,open:a,onOpenChange:o,enableClickMiddleware:i=!0}={}){const[l,s]=y(),[c,d]=y(),[u,h]=cs(e,a,o),p=ee(),g=te({placement:t,open:u,nodeId:p,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||h(e)},whileElementsMounted:ie,middleware:[ne(n),re({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),ae({padding:8}),oe({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})]}),v=g.context,b=le(v,{enabled:i}),f=se(v,{bubbles:{escapeKey:!0}}),T=ce(v),C=de([b,f,T]),w=x(()=>h(!1),[h]);return m(()=>({open:u,setOpen:h,close:w,...C,...g,modal:r,labelId:l,descriptionId:c,setLabelId:s,setDescriptionId:d,nodeId:p}),[u,h,w,C,g,r,l,c,p])}({modal:t,initialOpen:n,placement:r,offsetPx:a,open:o,onOpenChange:i,enableClickMiddleware:s}),d=ue(),u=l&&null===d,h=c.nodeId;return I(ds,{children:I(pe,{id:h,children:I(os.Provider,{value:{...c,popupParentNodeId:d,blockInteraction:u},children:e})})})}function hs(){const e=b(os);if(or(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function ps({children:e}){const t=hs(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const gs=Go(e=>p.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M1.23712 1.23718L8.76283 8.76289",stroke:"#182428",strokeWidth:.8,strokeMiterlimit:10}),p.createElement("path",{d:"M8.76288 1.23718L1.23717 8.76289",stroke:"#182428",strokeWidth:.8,strokeMiterlimit:10})),"Cross");function ms({Component:e,stylists:t}){return I(e,{stylists:[Xn(jn["tiny-icon"],jn.icon),...t??[]],size:9})}const vs=Go(e=>p.createElement("svg",{width:11,height:10,viewBox:"0 0 11 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M1.03625 2.20312H9.96378",stroke:"#182428"}),p.createElement("path",{d:"M1.03625 5H9.96378",stroke:"#182428"}),p.createElement("path",{d:"M1.03625 7.79688H7.24223",stroke:"#182428"})),"Sort"),bs=Xn(null,On({display:"flex",alignItems:"center",borderRadius:"md",border:"{borderWidths.lg} solid transparent",maxWidth:"fit-content",justifyContent:"center",_supportHover:{borderColor:"border.intent.action.hover",backgroundColor:"surface.intent.action.discreet.hover"},"&[data-active='true']":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"border.intent.action.active"},"&:has(button:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),ei),fs=Xn(null,On({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),ys=Xn(null,On({display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",padding:0,margin:"6px 6px 6px 5px",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"}})),xs=Xn(null,On({padding:"0 6px 0 0",display:"flex",alignItems:"center"}));function Ts({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...bs,"data-active":a,children:[R("button",{...fs,...r,children:[I(as,{children:t}),!a&&I("div",{...xs,children:I(ms,{Component:vs})})]}),a&&I("button",{...ys,onClick:e,children:I(ms,{Component:gs})})]})}const Cs=Wn({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 ws({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,...o}){const{context:i,blockInteraction:l,...s}=hs(),c=ge([s.refs.setFloating,n]),d=Xn(jn.popup,Cs({type:r}));return a||i.open?R(N,{children:[l&&I(me,{lockScroll:!0}),I(ve,{children:I(be,{context:i,modal:s.modal,initialFocus:e?void 0:-1,children:I("div",{ref:c,...d,style:{...s.floatingStyles,...t},...s.getFloatingProps(o),"aria-labelledby":s.labelId,"aria-describedby":s.descriptionId,children:o.children})})})]}):null}const ks=Xn(jn["popup-sort-row"],On({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 Es({onClick:e,children:t,active:n}){return I("button",{onClick:e,...ks,children:I(Ja,{accent:n?"active":"action",children:t})})}const As=Xn(null,On({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),Ss=Xn(null,On({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Is({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=hs(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return R("div",{...As,children:[I(as,{stylists:[Ss],children:"Sort by:"}),I(Es,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Es,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Ns=On.raw(Ll,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Rs({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=y(!1),d=Xn(jn["button-discreet-small"],On(Ns,e),ei),u=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",...d,onClick:e=>{void 0===u&&c(!s),a&&a(e)},"data-active":u??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const Ds={minWidth:"140px"};function Ps({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=b(Kl);if(!a)return null;const{sortInstance:o,setSortInstance:i}=a,l=o?.orderBy===t,s=()=>{i(void 0)};return t&&n&&r?R(us,{placement:"bottom-start",children:[I(ps,{children:t=>I(Ts,{active:l,onClearClick:s,columnName:e,popupTriggerProps:t})}),I(ws,{style:Ds,children:I(Is,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{i(e)},sortInstance:o})})]}):I(Rs,{disabled:!0,children:I(as,{children:e})})}const Ls=Wn({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 Ms({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I("div",{className:Ls({align:a,padding:o}),children:I(Ps,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Fs="Oldest to Newest",Os="Newest to Oldest";const Us=v({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});function Bs({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=b(Us);let a="";return e===r?a="Me":"OWNER"===n?a="Bookkeeper":"ACCOUNTANT"===n&&(a="User"),I(ts,{text:a,isRead:t})}const Vs=Go(e=>p.createElement("svg",{width:15,height:15,stroke:"currentColor",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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"),Ws=Xn(jn.text,On({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",lineHeight:"16px",maxWidth:"100%",fontFamily:"label"}),Pa);function Hs({children:e,stylists:t=[]}){const n=$n([Ws,...t]);return I("div",{...n,children:e})}const js=Wn({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"}}}}),zs=Bn(On({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),Pa),qs=On({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),Ks=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),_s=On({display:"flex",alignItems:"center",gap:8}),Ys=On({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),Xs=On({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),Zs=On({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),Gs=On({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function Qs({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:js({isRead:a}),onTouchEnd:o,children:R("div",{className:zs,children:[R("div",{className:Xs,children:[!a&&I("div",{className:Gs}),I(ts,{text:t,isRead:a})]}),R("div",{className:qs,children:[I("div",{className:Zs,children:I(Bs,{authorUserId:e,isRead:a})}),R("div",{className:_s,children:[I("div",{className:Ks,children:I(ns,{date:n,isRead:a})}),a?I(ai,{Component:Jo}):I(Hs,{children:I(ai,{Component:Jo})})]})]}),I("div",{className:Ys,children:sr(r)?R(N,{children:[I(ai,{Component:Vs}),I(Gl,{children:"Shared a file"})]}):I(Gl,{children:r})})]})})}const Js=On({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),$s=On({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function ec({text:e,isRead:t}){return t?I(Gl,{children:e}):R("div",{className:Js,children:[I("div",{className:$s}),I(es,{children:e})]})}const tc=G(),nc=Xn(null,On({paddingLeft:"25px"})),rc=[tc.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(Xl,{children:I(Bs,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(as,{stylists:[nc],children:"From"}),size:160,maxSize:160}),tc.accessor("subject",{id:"subject",cell:({row:e})=>R(Xl,{children:[I(ec,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(Gl,{children:e.original.latestMessage.text})]}),header:()=>I(as,{stylists:[nc],children:"Subject"}),size:200}),tc.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(Xl,{children:I(ns,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(Ms,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Os,sortAscDisplay:Fs}),size:150,maxSize:150}),tc.display({id:_l,cell:({row:e})=>I(Qs,{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 ac(e){return e?rc.filter(e=>e.id===_l):rc.filter(e=>e.id!==_l)}const oc=[],ic=On({display:"flex",flexDirection:"column",height:"250px",paddingBottom:"20px",alignItems:"center",justifyContent:"center",boxSizing:"border-box",textAlign:"center",backgroundColor:"surface.background",gap:"10px"}),lc=Xn(jn["empty-dashboard-layout"],ic);function sc({children:e}){return I("div",{...lc,"data-testid":"empty-dashboard-layout",children:e})}const cc=On({width:"25px",height:"25px",borderRadius:"sm"});function dc({imageUrl:e,Component:t,stylists:n}){const[r,a]=y(!1);return ir(e)?R(N,{children:[!r&&I(Eo,{styles:cc}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[Xn(jn["large-icon"],jn.icon),...n??[]],size:25})}const uc=Go(e=>p.createElement("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M11.05 11.02H12.95",strokeWidth:1.5,strokeMiterlimit:10}),p.createElement("path",{d:"M15.82 11.02H17.73",strokeWidth:1.5,strokeMiterlimit:10}),p.createElement("path",{d:"M6.27 11.02H8.18",strokeWidth:1.5,strokeMiterlimit:10})),"Comment",{styleIconKey:"comment"}),hc=On({width:"15px",height:"15px",borderRadius:"sm"});function pc({imageUrl:e,Component:t,stylists:n}){const[r,a]=y(!1);return ir(e)?R(N,{children:[!r&&I(Eo,{styles:hc}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[Xn(jn["medium-icon"],jn.icon),...n??[]],size:15})}const gc=()=>{Gi("Conversation",{routeProps:{conversationId:null}})};function mc(){return R(N,{children:[I(dc,{Component:uc}),I(Ga,{wrap:"wrap",children:"Need help with your financials?"}),R(Bl,{onClick:gc,children:[I(Ga,{children:"Message Bookkeeper"}),I(pc,{Component:Jo})]})]})}const vc=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M14.0625 2.14374L1.5625 6.90624L11.6813 12.8562L14.0625 2.14374Z",strokeWidth:.9375,strokeMiterlimit:10}),p.createElement("path",{d:"M8.25624 10.8375L5.73124 12.8562L5.33749 9.12499L13.4687 2.73749",strokeWidth:.9375,strokeMiterlimit:10})),"Paperplane",{styleIconKey:"send"});function bc(){return R(N,{children:[I(dc,{Component:vc}),I(Ga,{wrap:"wrap",children:"All caught up"}),I(Ja,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const fc=Xn(null,On({display:"flex",flexDirection:"row",gap:"5px"}));function yc({children:e}){return I("div",{...fc,children:e})}const xc=Wn({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Tc(e){return I(e?bc:mc,{})}function Cc({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){const i=function({conversations:e,isMobile:t}){return Q({data:e??oc,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??oc.length,columns:ac(t),getCoreRowModel:J(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Pi({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!or(l?.data?.[0])&&!s;return R("div",{className:xc({isMobile:o}),children:[I("div",{id:Ho}),R(ri.Provider,{value:r,children:[R(Gn,{children:[I(nr,{children:"Conversations"}),R(yc,{children:[I(ci,{}),I(jl,{})]})]}),I(ql,{dashboard:"businessOwnerDashboard",children:a?I(mi,{numColumns:4}):R(N,{children:[!o&&I(Kl.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(Wi,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(ji,{children:i.getRowModel().rows.map(e=>I(El,{rowData:e,isMobile:o},e.id))}):I(sc,{children:Tc(c)})]})})]})]})}const wc=Xn(jn.body,er({body:"default"}));function kc({children:e,stylists:t=[]}){if(sr(e))return null;const n=$n([wc,...t]);return I("div",{...n,children:e})}const Ec=Xn(null,On({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Ac=Wn({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),Sc=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Ic(){return I("div",{...Ec,children:Sc.map((e,t)=>I(Eo,{styles:Ac({width:e?.width})},t))})}const Nc=On({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}"}),Rc=On({position:"relative",width:"25px",height:"25px"});function Dc({hasUnread:e}){return R("div",{className:Rc,children:[I(dc,{Component:uc}),e&&I("div",{"data-testid":"unread-comment-badge",className:Nc,"aria-hidden":"true"})]})}const Pc=Xn(jn["financial-summary-chatbox-header"],On({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Lc({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Pc,children:[I(Ga,{children:"Message Bookkeeper"}),t&&I(Dc,{hasUnread:e})]})}const Mc=On({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center"});function Fc(){return R("div",{className:Mc,children:[I(dc,{Component:vc}),I(Ga,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(Ja,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(Bl,{onClick:()=>Gi("Conversation"),children:[I(Ga,{children:"Send a Message"}),I(pc,{Component:Jo})]})]})}const Oc=On({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});function Uc({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Oi(),{startPrefetch:a,cancelPrefetch:o}=xl(),i=x(()=>{a({id:t}),n({id:t})},[t,a,n]),l=x(()=>{o(),r()},[o,r]);return R("div",{className:Oc,children:[I(dc,{Component:vc}),I(Ga,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(Ja,{wrap:"wrap",children:"Pick up where you left off."}),I(Bl,{onClick:()=>Gi("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(Ga,{children:"Continue conversation"})})]})}const Bc=On({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});function Vc({summaryId:e}){return R("div",{className:Bc,children:[I(dc,{Component:vc}),I(Ga,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(Ja,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(Bl,{onClick:()=>Gi("FinancialSummary",{routeProps:{summaryId:e}}),children:I(Ga,{children:"Talk to a bookkeeper"})})]})}function Wc({summaryId:e,conversationId:t}){const n=ir(t);return or(e)?I(Fc,{}):n?I(Uc,{conversationId:t,summaryId:e}):I(Vc,{summaryId:e})}const Hc=On({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"}),jc=Xn(jn["financial-summary-chatbox"],On({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 zc({summaryData:e}){const t=ir(e?.summary),n=ir(e?.conversation);return R("div",{className:Hc,children:[I(Lc,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...jc,children:I(Wc,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const qc=Go(e=>p.createElement("svg",{stroke:"currentColor",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("circle",{cx:12,cy:12,r:10,strokeWidth:1.5,strokeMiterlimit:10}),p.createElement("path",{d:"M12 6V12L15.5 15.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),"Clock"),Kc=On({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"});function _c(){return R("div",{className:Kc,children:[I(dc,{Component:qc}),I(Ga,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const Yc=On({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),Xc=Wn({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:{}}}}),Zc=Xn(null,On({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),Gc=On({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function Qc({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},br({queryKey:(t={limit:1,filter:{date:{equal:Qe(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Tl(t):["summaries",{}],queryFn:wl,...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 $${Mo.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${Fo.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=Xn(jn["financial-summary-layout"],Xc({isSample:e,isZeroState:o}));return R("div",{className:Gc,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(Ic,{}):o?I(_c,{}):R("div",{className:Yc,children:[I(kc,{stylists:[Zc],children:a}),e&&I(Lo,{size:"lg"})]})}),I(zc,{summaryData:n})]})}const Jc=Xn(jn["month-picker"],On({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),$c=Xn(jn["month-picker-left-button"],On({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),ed=Xn(jn["month-picker-right-button"],On({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),td=Xn(jn["month-picker-label"],On({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function nd({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=Xe(e.year,e.month,1),o=kt(a,{abbreviateMonth:!0});return R("div",{...Jc,children:[I(Bl,{stylists:[$c],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(ai,{Component:Qo})}),I("div",{...td,children:I(Ga,{children:o})}),I(Bl,{stylists:[ed],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(ai,{Component:Jo})})]})}const rd=On({display:"flex",flexWrap:"wrap",justifyContent:"center",rowGap:"10px",columnGap:"max(10px, calc(50% - 600px))",maxWidth:"1440px",width:"100%"});function ad({children:e}){return I("div",{className:rd,children:e})}const od=Wn({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),id=Xn(jn["progress-bar"],On({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm"})),ld=Xn(jn["progress-bar-fill"],On({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),sd=Xn(jn["tile-bar-label"],On({paddingLeft:"10px"})),cd=Xn(jn["tile-bar-label-outer"],On({paddingLeft:"10px"}));function dd({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?jn["bar-transactions-positive"]:jn["bar-transactions-negative"],l=Xn(i,od({color:n})),s=$n([ld,l]);return R("div",{...id,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...sd,children:I(Gl,{children:e})})}),!o&&I("div",{...cd,children:I(Gl,{children:e})})]})}const ud=Xn(jn["metric-md"],er({metric:"md"}));function hd(e){return I("div",{...ud,children:e.children})}const pd=Xn(null,On({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"})),gd=Xn(null,On({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"})),md=({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",{...pd,children:[I(dd,{label:e,percentage:a,color:r}),I("div",{...gd,children:I(hd,{children:Ya(t)})})]})},vd=Go(e=>p.createElement("svg",{stroke:"#000000",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M13.3131 0.489685V4.15097H9.65182",strokeMiterlimit:10}),p.createElement("path",{d:"M2.32925 15.1348V11.4735H5.99054",strokeMiterlimit:10}),p.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}),p.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"),bd={},fd=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return bd[e]={loading:!1,error:null,scriptEl:t}},yd="undefined"!=typeof window&&void 0!==window.document;function xd({src:e,checkForExisting:t=!1,...n}){let r=bd[e];!r&&t&&e&&yd&&(r=fd(e));const[a,o]=y(r?r.loading:Boolean(e)),[i,l]=y(r?r.error:null),[s,c]=y(!1);return T(()=>{if(!yd||!e||s||i)return;let a;r=bd[e],!r&&t&&(r=fd(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=bd[e]={loading:!0,error:null,scriptEl:a});const d=()=>{r&&(r.loading=!1),o(!1),c(!0)},u=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",d),a.addEventListener("error",u),document.body.appendChild(a),()=>{a.removeEventListener("load",d),a.removeEventListener("error",u),r&&r.loading&&(a.remove(),delete bd[e])}},[e]),[a,i]}const Td=e=>["integrations",e??{}],Cd=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:vi(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 wd(e,t){return xi({...t,queryKey:Td(e),queryFn:Cd})}function kd(e){return wd({filter:{apiName:{equal:"PLAID"}}},e)}function Ed(e){return pa(`${t=e,ga[t]}/v1`,"v1");var t}async function Ad({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:Ed(n)},{url:a,headers:o}=sa(r);return await Ti({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}function Sd({children:e,stylists:t=[],...n}){return I(Ol,{stylists:t,intent:"danger",...n,children:e})}const Id=Xn(jn["button-tertiary"],On({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"}}}));function Nd({children:e,stylists:t=[],...n}){return I(Ol,{stylists:[Id,...t],...n,children:e})}const Rd="cancel",Dd="danger",Pd="success",Ld=On({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Md=On({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Fd=Wn({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"}}),Od={transform:"none",willChange:"auto"};function Ud({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0,className:l}){const{context:s}=te({open:e,strategy:"fixed"}),c=se(s,{outsidePress:o,escapeKey:i}),d=ce(s,{role:t}),{getFloatingProps:u}=de([c,d]),h=[Fd({size:r,padding:a}),l].filter(Boolean).join(" ");return e?I(ve,{children:I(me,{lockScroll:!0,className:Ld,children:I(be,{context:s,modal:!0,returnFocus:!0,children:I("div",{...u(),className:h,style:Od,children:n})})})}):null}const Bd=Xn(null,On({display:"flex",backgroundColor:"surface.intent.action.discreet",border:"none",padding:"6px",margin:0,borderRadius:"sm",outline:"none",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),ti),Vd=()=>Qi();function Wd({Icon:e=gs,handleClose:t=Vd}={}){return I("button",{...Bd,onClick:t,type:"button",children:I(pc,{Component:e,...Bd})})}const Hd=On({display:"flex",justifyContent:"flex-end",gap:"8px"}),jd="success",zd="danger",qd=fe.createConfirmation(ye(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(Ud,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,className:jn["alert-dialog"],children:[R("div",{className:Md,children:[I(Ga,{wrap:"wrap",stylists:[Xn(jn["alert-header"])],children:r}),o&&I(Wd,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(Gl,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:Hd,children:i.map(e=>{const n=(e=>{switch(e){case zd:return Sd;case jd:return Nd;default:return Bl}})(e.type);return I(n,{onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(Ga,{children:e.label})},e.key)})})]})}));function Kd(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function _d(e){return new B(e).div(100).toNumber()}function Yd(e){return new B(e).times(100).toNumber()}function Xd(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function Zd(e,t){return t?e?`${e} ${Xd(t)}`:Xd(t):e??""}const Gd=e=>Gi("Conversation",{routeProps:{conversationId:null,defaultValues:e}}),Qd=On({display:"flex",flexDirection:"column",gap:"12px"});async function Jd(e){await qd({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Rd,label:"Cancel"},{key:Pd,label:"Chat",type:jd}]})===Pd&&Gd({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const $d=e=>["banks/accounts",e??{}],eu={integration:{expand:!0},status:{notIn:["REMOVED"]}},tu=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:vi(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 nu(e){return xi({queryKey:$d({filter:eu}),queryFn:tu,enabled:e?.enabled,select:e?.select})}function ru(e,t){return $i({queryKey:ar($d({filter:eu}),{}),queryFn:tu,accessToken:e,environment:t})}const au={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},ou={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."}},iu={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:ou.short.credentialsChanged,longMessage:ou.long.relinkCredentials,buttonType:au.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:ou.short.credentialsChanged,longMessage:ou.long.relinkCredentials,buttonType:au.RELINK},INVALID_MFA:{shortMessage:ou.short.credentialsChanged,longMessage:ou.long.relinkCredentials,buttonType:au.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:ou.short.credentialsChanged,longMessage:ou.long.invalidUpdatedUsername,buttonType:au.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:ou.short.accountLocked,longMessage:ou.long.accountLocked,buttonType:au.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:ou.short.credentialsChanged,longMessage:ou.long.relinkCredentials,buttonType:au.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:ou.short.supportChanged,longMessage:ou.long.supportChanged,buttonType:au.CHAT},USER_SETUP_REQUIRED:{shortMessage:ou.short.updateNeeded,longMessage:ou.long.updateNeeded,buttonType:au.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:ou.short.supportChanged,longMessage:ou.long.mfaUpdateNeeded,buttonType:au.OPEN_BANK},NO_ACCOUNTS:{shortMessage:ou.short.noAccountsAvailable,longMessage:ou.long.noAccountsUnlink,buttonType:au.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:ou.short.noAccountsAvailable,longMessage:ou.long.noAccountsUnlink,buttonType:au.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:ou.short.connectionError,longMessage:ou.long.connectionError,buttonType:au.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.CHAT},ITEM_NOT_FOUND:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.CHAT},PRODUCT_NOT_READY:{shortMessage:ou.short.serverError,longMessage:ou.long.productNotReady,buttonType:au.CHAT},USER_PERMISSION_REVOKED:{shortMessage:ou.short.connectionError,longMessage:ou.long.permissionRevoked,buttonType:au.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:ou.short.temporarilyDown,longMessage:ou.long.bankMaintenance,buttonType:au.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:ou.short.serverDown,longMessage:ou.long.serverDown,buttonType:au.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:ou.short.temporarilyDown,longMessage:ou.long.bankMaintenance,buttonType:au.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:ou.short.supportChanged,longMessage:ou.long.supportChanged,buttonType:au.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:ou.short.connectionError,longMessage:ou.long.connectionError,buttonType:au.CHAT},PLANNED_MAINTENANCE:{shortMessage:ou.short.temporarilyDown,longMessage:ou.long.bankConnectionMaintenance,buttonType:au.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:ou.short.requestError,longMessage:ou.long.connectionError,buttonType:au.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:ou.short.inputError,longMessage:ou.long.connectionError,buttonType:au.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:ou.short.volumeDown,longMessage:ou.long.bankMaintenance,buttonType:au.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:ou.short.serverError,longMessage:ou.long.connectionError,buttonType:au.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:ou.short.updateNeeded,longMessage:ou.long.partnerCredsChange,buttonType:au.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:ou.short.credentialsExpiring,longMessage:ou.long.credentialsExpiring,buttonType:au.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:ou.short.relinkNeeded,longMessage:ou.long.relinkForStatements,buttonType:au.RELINK}},DEFAULT:{DEFAULT:{shortMessage:ou.short.connectionError,longMessage:ou.long.connectionError,buttonType:au.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:ou.short.generic,longMessage:ou.long.generic,buttonType:au.CHAT}}};function lu({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=iu[e];if(!n)return ta({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),iu.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(ta({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),iu.DEFAULT.DEFAULT)}const su=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:gl({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:gl({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}},cu=Xn(jn["button-secondary"],On({color:"typography.intent.primary",border:"{borderWidths.md} solid",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary","& .Tight-text":{color:"typography.intent.primary"},"& path":{stroke:"icon.intent.primary"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"},"& path":{stroke:"icon.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"},"& path":{stroke:"icon.intent.primary.active"}}}));function du({children:e,stylists:t=[],...n}){return I(Ol,{stylists:[cu,...t],...n,children:e})}function uu({mutationFn:e,onMutateFn:t,...n}){const r=ur(),a=vr(),o=!sr(r);return F({...n,mutationFn:o?t=>e({data:t,accessToken:r,environment:a}):hr,onMutate:o&&ir(t)?e=>t({data:e,accessToken:r,environment:a}):void 0},gr)}const hu=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:ba(n)};return await ha(r)},pu=async({data:e,accessToken:t,environment:n})=>hu({data:e,accessToken:t,environment:n}),gu=async({data:e,accessToken:t,environment:n})=>hu({data:e,accessToken:t,environment:n}),mu=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/accounts",bodyParams:{accounts:e.accounts},accessToken:t,endpointManager:ba(n)};return await ha(r)})({data:{accounts:e},accessToken:t,environment:n});function vu(e){return uu({onSuccess:async()=>{ea("mutation successful, invalidating bank account queries");try{return gr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ta({error:e,severity:"error"})}},...e})}function bu(){return vu({mutationFn:gu})}function fu(){return uu({onSuccess:async()=>{ea("mutation successful, invalidating bank account queries");try{return gr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ta({error:e,severity:"error"})}},mutationFn:mu})}const yu=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,xu=e=>"PLAID"===e,Tu=e=>({id:ml(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),Cu=On({display:"flex",flexDirection:"column",gap:"16px"}),wu=async()=>qd({title:"Merge Accounts",body:R("div",{className:Cu,children:[I(Gl,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(Gl,{wrap:"wrap",children:"This action can't be undone."}),I(Gl,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Rd,label:"Cancel"},{key:Dd,label:"Continue",type:zd}]}),ku=()=>qd({title:"Merge Failed",body:I(Gl,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Rd,label:"OK"}]}),{formContext:Eu,fieldContext:Au,useFieldContext:Su,useFormContext:Iu}=xe(),Nu=Go(e=>p.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{id:"icon/check"},p.createElement("path",{id:"Vector",d:"M0.986511 5L3.66217 7.67566L9.01349 2.32434",stroke:"currentColor",strokeWidth:1.25,strokeMiterlimit:10}))),"Check");function Ru({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(Nd,{type:"submit",disabled:n,children:[e&&I(ai,{Component:Nu}),I(Ga,{children:t})]})}const Du=Xn(null,On({display:"flex",width:{xl:"auto",base:"100%"}}));function Pu({showIcon:e=!0,textContent:t="Save",disabled:n=!1,onClick:r}){return R(du,{type:"submit",disabled:n,stylists:[Du],onClick:r,children:[e&&I(ai,{Component:Nu}),I(Ga,{children:t})]})}const Lu=Wn({base:{},variants:{alignment:{vertical:{width:"{borderWidths.md}",minWidth:"{borderWidths.md}",alignItems:"stretch"},horizontal:{width:"100%",height:"{borderWidths.md}",minHeight:"{borderWidths.md}"}},color:{normal:{backgroundColor:"border.layout"},strong:{backgroundColor:"border.layout.strong"},active:{backgroundColor:"brand.action.strong"}}}});function Mu({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=Xn("vertical"===e?jn["vertical-divider"]:jn["horizontal-divider"],n,Lu({alignment:e,color:t}));return I("div",{...r})}const Fu=On({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}});function Ou({children:e,showIcon:t=!1,textContent:n="Save Changes",disabled:r=!1,onSave:a}){return R(N,{children:[I(Mu,{alignment:"horizontal",color:"normal"}),R("div",{className:Fu,children:[e,I(Pu,{showIcon:t,textContent:n,disabled:r,onClick:a})]})]})}const Uu=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M8.00158 5.48663V9.25659",strokeMiterlimit:10}),p.createElement("path",{d:"M8.00158 10.5132V11.7699",strokeMiterlimit:10})),"Attention"),Bu=[Xn(null,On({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],Vu=Xn(null,On({display:"flex",alignItems:"center",gap:"4px"}));function Wu({errorMessage:e}){return R("div",{...Vu,children:[I(pc,{Component:Uu,stylists:Bu}),I(Ja,{intent:"danger",wrap:"wrap",children:e})]})}const Hu=On.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"}}),ju=On.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function zu({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 qu=On({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},Hu),Ku=On(ju),_u=On({display:"flex",flexDirection:"column",gap:"8px"}),Yu=On({display:"flex",justifyContent:"space-between",alignItems:"center"});function Xu({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:c,errorMessage:d,disableHover:u=!1,type:h,remainingChars:p,hasErrorStyles:g}){const m=Xn(i||null,qu,l,Ku,ti),[v,b]=y(!0),{dataAttributes:f}=zu({isActive:v,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:d,hasErrorStyles:g,disableHover:u});return R("div",{className:_u,children:[R("div",{className:Yu,children:[void 0!==r&&I(Gl,{children:r}),ir(p)&&I(Gl,{children:`${p}`})]}),I("div",{...m,onClick:s,...n,onMouseDown:e=>{b(!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,h)},onBlur:()=>{b(!1),c?.()},...f,children:e}),o&&"open"!==n?.["data-state"]&&d&&I(Wu,{errorMessage:d})]})}const Zu=On({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 Gu({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a}){const o=Su(),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 I(Xu,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:l,isTouched:s,className:jn["discreet-form-input"],additionalStyles:Zu,errorMessage:i,onClick:a,onBlur:o.handleBlur,children:e})}function Qu(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 Ju(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function $u(e){"Enter"===e.key&&e.currentTarget.blur()}const eh=Xn(jn["amount-input"],er({label:"default"}),On({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),th=Xn(null,On({display:"flex",alignItems:"center",gap:"2px"}));function nh({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=y(!1);return R("div",{...th,children:[or(e)&&I(Gl,{children:"$"}),I(we,{...eh,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:or(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:$u,autoFocus:o})]})}const rh=On({backgroundColor:"surface.foreground.disabled",pointerEvents:"none",border:"{borderWidths.lg} solid",borderColor:"border.layout"}),ah=Wn({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function oh({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=Su(),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=ir(c)?c-g:void 0,v=a?rh:ah({kind:e});return I(Xu,{label:t,inputRef:r,popupTriggerProps:o,className:jn["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 ih=Xn(null,On({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function lh({options:e,onSelect:t,selectedLabel:n}){const r=hs();return I("div",{...ih,children:e.map(e=>I(Es,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const sh=Go(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_9779_2922)"},p.createElement("path",{d:"M0.714706 3.99996L6.31472 9.59998L11.9147 3.99996",stroke:"#182428",strokeMiterlimit:10})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_9779_2922"},p.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowDown"),ch=Xn(null,On({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",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}}),ei);function dh({selectedLabel:e,options:t,onSelect:n}){return R(us,{placement:"bottom-start",children:[I(ps,{children:t=>R("div",{...ch,...t,children:[I(Ga,{children:e}),I(ms,{Component:sh})]})}),I(ws,{children:I(lh,{options:t,onSelect:n,selectedLabel:e})})]})}const uh=Xn(null,On({display:"flex",alignItems:"center",gap:"15px"})),hh=ht.map((e,t)=>({value:t,label:e})),ph=pt({}).map(e=>({value:e,label:String(e)}));function gh({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",{...uh,children:[I(dh,{selectedLabel:ht[r],options:hh,onSelect:e=>a(n,e)}),I(dh,{selectedLabel:String(n),options:ph,onSelect:e=>a(e,r)})]})}const mh=Xn(null,On({background:"surface.foreground",padding:"25px",gap:"15px"})),vh=Xn(null,On({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),bh=Xn(null,On({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"8px",borderRadius:"sm",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"},"&:disabled":{opacity:.6,pointerEvents:"none"}}),ei),fh=Xn(null,On({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),yh=Xn(null,On({padding:"8px",textAlign:"center"})),xh=Xn(null,On({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"}}),ei),Th=Xn(null,On({color:"typography.base"}));function Ch({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&>(e,t),l=mt(e),s=e.getMonth()!==n,c=!!a&&vt(e,a),d=!!o&&vt(o,e);return I("button",{...xh,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(Ga,{stylists:s||c||d?[Th]:[],children:e.getDate().toString()})})}function wh({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=hs(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=Xe(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&&vt(a,u),g=or(o)||d.length>0&&vt(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",{...mh,children:[R("div",{...vh,children:[I("button",{...bh,onClick:()=>v(-1),disabled:!g,children:I(ai,{Component:Qo})}),I(gh,{currentMonthYear:l,onMonthYearChange:r}),I("button",{...bh,onClick:()=>v(1),disabled:!p,children:I(ai,{Component:Jo})})]}),R("div",{...fh,children:[ut.map(e=>I("div",{...yh,children:I(Ja,{children:e})},e)),d.map(t=>I(Ch,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const kh=Xn(null,er({label:"default"}),On({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),Eh=Xn(null,er({label:"default"}),On({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 Ah(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant"}),e.current.setAttribute("data-hasscrolled","true"))}async function Sh(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 Ih=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),Nh=[...Ih].map(e=>`.${e}`).join(","),Rh=/* @__PURE__ */new Set(["xls","xlsx","csv"]),Dh={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...Ih].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."},Ph={"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 Lh(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 Mh(e,t,n){return Lh(e,null,e.name,t,!1,!0,n)}async function Fh(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||!Ih.has(r))return Dh.unsupportedFileType;if(e.size>52428800)return Rh.has(r)?Dh.fileTooLargeSpreadsheet:Dh.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await Sh(e);for(const e of a)if(await Sh(e.file)===t)return Dh.duplicate}return null}(e,t);return n?Mh(e,n):Lh(e,null,e.name,Dh.pendingUpload,!0,!1)}const Oh=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=ba(n).getUrl(`/files/upload/${a}`),s=sr(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 Uh(){return uu({mutationFn:Oh,onSuccess:async()=>gr.invalidateQueries({queryKey:["files/attachments"]})})}const Bh=async({data:e,accessToken:t,environment:n})=>{const r=ba(n).getUrl("/files/attachment");return(await fetch(r,{method:"DELETE",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({id:e.id})})).json()};const Vh=On({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Wh=On({display:"none"}),Hh=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=g(null),{mutateAsync:a}=function(){const{mutateAsync:e}=Uh();return{mutateAsync:x(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 Lh(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return Mh(e.file,Dh.uploadError,e.localId)}(e,r[t]))},[e])}}(),o=x(()=>{r.current?.click()},[]),i=x(async o=>{const i=Array.from(o.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>Fh(e,n))),s=l.filter(e=>!e.hasError);e?.(l);try{const e=await a(s);t?.(e)}finally{r.current&&(r.current.value="")}},[n,e,t,a]);return R("div",{children:[I("input",{className:Wh,type:"file",multiple:!0,accept:Nh,ref:r,onChange:i}),I(Bl,{type:"button",onClick:o,children:I("span",{className:Vh,children:I(pc,{Component:Vs})})})]})},jh=h.custom(),zh=h.object({message:h.object({text:h.string(),attachments:h.array(jh)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),qh=On.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),Kh=On.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"}),_h=On(Kh,qh),Yh=On.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),Xh=On(Yh,qh,er.raw({body:"default"})),Zh=On({display:"block",width:"100%"}),Gh=On({position:"relative"}),Qh=On({display:"flex",justifyContent:"flex-end",gap:"15px"}),Jh=On({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),$h=w(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:a,hideFileUpload:o},i){const l=Su(),s=g(null),{startCallback:c}=Ei({delay:50,callback:e=>n(e)});k(i,()=>s.current);const d=!e&&zh.safeParse(l.form.state.values).success;return I(oh,{kind:"text",inputRef:s,disableHover:!0,onClick:()=>(Ah(t),void c(!0)),children:R("div",{className:Zh,children:[R("div",{className:Gh,children:[R("pre",{className:_h,children:[l.state.value.text,I("br",{})]}),I("textarea",{ref:s,placeholder:"Message...",value:l.state.value.text,className:Xh,onChange:e=>l.handleChange({...l.state.value,text:e.target.value})})]}),R("div",{className:Qh,children:[!o&&I(Hh,{onFileSelect:r,onUploadComplete:a,existingAttachments:l.state.value.attachments}),I(Bl,{disabled:!d,type:"submit",children:I("span",{className:Jh,children:I(pc,{Component:vc})})})]})]})})}),ep=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,tp=v(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0}));function np(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 rp(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 ap(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 op(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 ip(e){const[t,n]=y(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:a,isMousing:o,isScrolling:i}=function(e,t){const n=g(null),[r,a]=y(!0),[o,i]=y(!1),l=b(tp),[s,c]=E(np,{focusedIndex:null,maxIndex:e});T(()=>{const e=n.current,t=()=>{or(s.focusedIndex)&&void 0!==l?.popupNodeId&&c({type:"set",focusedIndex:0})};return e?.addEventListener("focus",t),()=>{e?.removeEventListener("focus",t)}},[n,s.focusedIndex,c,l?.popupNodeId]);const d=g(null);return T(()=>{c({type:"max",max:e})},[e]),T(()=>{const e=n.current;if(null!==e){const n=e=>{i(!1);const n=e.target instanceof HTMLElement&&e.target.getAttribute("data-listitem");if(!n)return;const r=Number(e.target.getAttribute("data-index"));s.focusedIndex===r&&d.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(a(!0),d.current=e.target,c({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;a(!1),i(!1),t?(e.preventDefault(),c({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),c({type:"decrement",repeat:e.repeat}))},o=()=>i(!0);return e.addEventListener("mousemove",n),e.addEventListener("keydown",r),e.addEventListener("scroll",o),()=>{e.removeEventListener("mousemove",n),e.removeEventListener("keydown",r),e.removeEventListener("scroll",o)}}},[t,s.focusedIndex]),{listRef:n,focusedState:s,isMousing:r,isScrolling:o}}(t.size-1,e),l=hs(),s=x((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),c=x(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:d,sortedMap:u}=function(e,t){const n=m(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(rp)),n},[e,t]),r=m(()=>{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){T(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=op(r,t,n),{shouldOpenCascade:c,shouldCloseCascade:d}=function(e,t,n){const r=e.placement.includes("left"),a=e?.popupParentNodeId,o=a&&n?.hasCascading&&r?"ArrowLeft":"ArrowRight",i=r?"ArrowRight":"ArrowLeft";return{shouldOpenCascade:n?.hasCascading&&t.key===o,shouldCloseCascade:a&&t.key===i}}(a,e,s),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&&ap(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,d,u,a.focusedIndex,l,e);const{startCallback:h,cancelCallback:p}=Ei({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&ap(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return v=a.focusedIndex,T(()=>{const e=k.current;if(null===v||f)return;const{node:t,metadata:n}=op(v,C,w);return A.lastOpenedIndex!==v&&n?.hasCascading&&(A.closeCurrentCascade(),S({focusedIndex:v,node:t,listElement:e})),()=>I()},[v,f=o,k=r,A=e,I=p,C=d,w=u,S=h]),function(e,t,n,r){T(()=>{const{metadata:a}=op(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(a.focusedIndex,d,u,e),m(()=>({register:s,unregister:c,map:u,focusedIndex:a.focusedIndex,listRef:r,isMousing:o,isScrolling:i,popupNodeId:l?.nodeId}),[s,c,u,a.focusedIndex,r,o,i,l?.nodeId]);var v,f,C,w,k,A,S,I}const lp=v(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{}}));function sp({style:e,children:t}){const n=Xn(jn["popup-list"],is,e),r=function(){const[e,t]=y(null),[n,r]=y(!1),[a,o]=y(null),i=x((n,a)=>{n&&e!==a?(o(a),t(a)):n||e!==a||(r(!1),t(null))},[e,r]),l=x(()=>{t(null),o(null),r(!1)},[t,o,r]),s=x(()=>{t(null),o(null),r(!1)},[]);return{cascadeIndex:e,setCascadeState:i,onScroll:l,focus:n,setFocus:r,lastOpenedIndex:a,closeCurrentCascade:s}}(),a=ip(r);return I("div",{...n,onScroll:r.onScroll,ref:a.listRef,tabIndex:0,children:I(tp.Provider,{value:a,children:I(lp.Provider,{value:r,children:t})})})}function cp({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=cr(e),h=e=>{n?.(e)};return R(N,{children:[d&&I(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?I(o,{...l??{},onClick:h,searchTerm:e}):I(i,{...l??{},onClick:h})]})}const dp=Bn(er({body:"default"}),On({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function up({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=g(null);return T(()=>{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:dp})}function hp({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=hs(),[c,d]=y(""),u=cr(c),h=l?.(u);return I(ws,{children:I(sp,{style:h,children:I(cp,{searchTerm:c,setSearchTerm:d,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:up,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function pp({hasCascading:e=!1}={}){const t=g(null),{register:n,unregister:r,map:a,focusedIndex:o,isMousing:i,listRef:l}=b(tp);A(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const s=m(()=>void 0!==a&&null!==t.current?a.get(t.current)?.index??-1:-1,[a]),c=s===o;A(()=>{c&&(i||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[c,i]);const d=x(()=>{l?.current?.focus()},[l]),u=m(()=>({onFocus:d,"data-focused":c}),[d,c]);return{itemRef:t,isActive:c,index:s,itemProps:u}}const gp=w(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...ss,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),mp=w(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=pp(),l=ge([i,r]);return I(gp,{...ss,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),vp=On({display:"flex",gap:"8px",alignItems:"center"});function bp({promptText:e}){return R("div",{className:vp,children:[I(ai,{Component:Al}),I(Gl,{children:e})]})}function fp({text:e}){return I("div",{...ss,children:e?I(Ga,{children:e}):I(Eo,{styles:On({width:"100%",height:"16px"})})})}const yp=Xn(jn["popup-list"],is),xp=()=>R("div",{...yp,children:[I(fp,{}),I(fp,{}),I(fp,{}),I(fp,{}),I(fp,{})]});function Tp({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(xp,{}):R(N,{children:[r&&I(mp,{onClick:()=>Gi("BankAccountForm"),children:I(bp,{promptText:"Add bank account"})}),e?.map(e=>I(mp,{onClick:()=>t(e),children:I(Ga,{wrap:"wrap",children:Zd(e?.name,e?.mask)})},e?.id))]})}const Cp={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},wp={...Cp,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function kp({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const o=m(()=>new ke(e??[],wp),[e]),i=m(()=>e?o.search(t).map(e=>e.item):[],[e,t,o]);return r?I(xp,{}):R(N,{children:[a&&I(mp,{onClick:()=>Gi("BanksAndIntegrations"),children:I(bp,{promptText:"Add bank account"})}),0===i.length?I(fp,{text:"No results found"}):i.map(e=>I(mp,{onClick:()=>n(e),children:I(Ga,{wrap:"wrap",children:Zd(e?.name,e?.mask)})},e?.id))]})}function Ep({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(hp,{onClick:e,placeholder:"Search bank accounts...",SearchList:kp,DefaultList:Tp,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Ap=On({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function Sp({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=Zd(n?.name??"",n?.mask??"");return R(us,{placement:"bottom-start",children:[I(ps,{children:r=>I(oh,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:Ap,type:"button",disabled:t,children:ir(n)?I(Gl,{children:i}):I(Gl,{intent:"weak",children:"Select bank account"})})})}),I(Ep,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const Ip=e=>{if(or(e))return!1;const t=e.filter(e=>xu(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||ir(e.lastSyncedDate))},Np=()=>{const e=nu({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function Rp(){return nu({select:e=>{return{...e,plaidItemAccountsReadyToSync:Ip(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>xu(e.apiName)))};var t}})}function Dp(e){return e?.filter(e=>yu(e.apiName)&&"ACTIVE"===e.status)}function Pp(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function Lp(e){return nu({select:t=>({...t,data:Pp(t?.data,e)})})}const Mp=e=>{const{query:t}=nu({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data},Fp=()=>["expenses/categories"],Op=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await ki(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:gl({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?gl({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function Up(e){return br({...e,queryKey:["expenses/categories"],queryFn:Op})}function Bp(){return Up({select:e=>({...e,data:e.data?qp(e.data):void 0})})}function Vp(e,t){return(t.get(e)??[]).map(e=>{const n=Vp(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Wp(e){if(0===e.length)return[];const t=jp(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=Vp(e.id,t);return{...e,children:n.length>0?n:void 0}})}function Hp(){return Up({select:e=>({...e,data:e.data?Wp(e.data):void 0})})}function jp(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 zp(e){if(0===e.length)return[];const t=jp(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function qp(e){if(0===e.length)return[];const t=jp(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function Kp(){return Ai({prefetchFn:bi(Fp,Op)})}const _p=e=>({id:e.id,name:e.name});function Yp(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:Kd("Category","Categories",n.size,!0),list:[...n].join(", ")}}const Xp=Xn(jn.text,er({label:"strongLabel"}),On({maxWidth:"100%"}),Pa);function Zp({children:e,stylists:t=[]}){const n=$n([Xp,...t]);return I("div",{...n,children:e})}const Gp={keys:[{name:"name"}],threshold:.1};function Qp(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Jp(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?Qp(a,r,n):o?Qp(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Qp(e,n,t)})}(r,n)}),n}const $p=On({objectFit:"contain"});function eg(e,t,n){const r=({size:n=24})=>{const{icons:r}=b(Xo);return I("img",{src:e,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},className:$p})};return r.displayName=t,r}const tg=Xn(null,On({whiteSpace:"normal"})),ng=[Xn(null,On({marginLeft:"6px",marginRight:"6px"}))];function rg({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=Up({select:e=>({...e,data:e.data?zp(e.data):void 0})}),o=n?.data,i=!a&&r&&(void 0===o||0===o.length),l=m(()=>new ke(o??[],Gp),[o]),s=m(()=>o?Jp(l.search(e),o):[],[o,e,l]);return a?I(xp,{}):i?I(fp,{text:"No data"}):0===s.length?I(fp,{text:"No results found"}):I(N,{children:s.map(({parent:e,child:n})=>{const r=e.id===n.id,a=eg(n.iconUrl,"Expense Icon");return R(mp,{onClick:()=>t(_p(n)),children:[I(pc,{Component:a}),I(Zp,{stylists:[tg],children:r?n.name:R(N,{children:[e.name,I(ai,{Component:Jo,stylists:ng}),n.name]})})]},`${e.id}_${n.id}`)})})}const ag=w(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=ge([a,t?.ref]);return I(gp,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function og({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=b(lp),{itemRef:o,index:i,itemProps:l}=pp({hasCascading:!0}),{isScrolling:s}=b(tp);return R(us,{open:n===i,onOpenChange:e=>{s||r(e,i)},placement:"right-start",children:[I(ps,{children:t=>I(ag,{itemProps:l,index:i,ref:o,popupTriggerProps:t,children:e})}),I(ws,{initialFocus:a,children:t})]})}const ig=On({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"}),lg=On({display:"flex",gap:"8px"});function sg({Icon:e,iconUrl:t,displayLabel:n}){const r=t?eg(t,"Icon"):void 0;return R("div",{className:ig,children:[R("div",{className:lg,children:[!or(e)&&e,or(e)&&r&&I(pc,{Component:r}),I(Ga,{wrap:"wrap",children:n})]}),I(ai,{Component:Jo})]})}function cg({category:e,handleCategoryChange:t}){return I(sp,{children:e.children?.map(e=>{const n=eg(e.iconUrl,"Expense Icon");return R(mp,{onClick:()=>t(_p(e)),children:[I(pc,{Component:n}),I(Ga,{wrap:"wrap",children:e.name})]},e.id)})})}function dg({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=Bp(),a=t?.data,o=!r&&n&&void 0===a;return r?I(xp,{}):o?I(fp,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(og,{triggerChildren:I(sg,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(cg,{category:t,handleCategoryChange:e})},t.id);const n=eg(t.iconUrl,"Expense Category Icon");return R(mp,{onClick:()=>e(_p(t)),children:[I(pc,{Component:n}),I(Ga,{wrap:"wrap",children:t.name})]},t.id)})})}const ug=({onClick:e})=>{const{query:{data:t}}=Bp();return I(hp,{onClick:e,placeholder:"Search expense categories...",SearchList:rg,DefaultList:dg,listLength:(t?.data??[]).length})},hg=Xn(jn["category-text"],On({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"}}}),ni),pg=Xn(null,On({color:"inherit"})),gg=Xn(jn["amount-input-container"],On({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"}}),ni);function mg({options:e,onClick:t}){const n=hs();return I(ws,{children:I(sp,{children:e.map((e,r)=>I(mp,{onClick:()=>(t(e),void n.close()),children:I(Gl,{children:e.label})},`${e.label}_${r}`))})})}const vg=Xn(null,On({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),bg=On.raw({color:"typography.base.weak"}),fg=(e,t)=>e===t,yg=On({border:"none",outline:"none",backgroundColor:"transparent",fontWeight:"label.strong",fontSize:{sm:"label.strong",base:"lg"},fontFamily:"label",color:"typography.label.strong",lineHeight:{sm:"16px",base:"18px"},letterSpacing:"0.84px"}),xg=e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M14.9092 4.60259V6.39635H1.78418V4.60259L8.34669 1.62134L14.9092 4.60259Z",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M14.9092 12.3589H1.78418V14.7464H14.9092V12.3589Z",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M2.97803 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M6.55908 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M10.1343 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M13.7153 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"})),Tg=Go(xg,"Bank",{styleIconKey:"bank"}),Cg=Wn({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 wg({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?Zd(e,t):e;return R("div",{className:Cg({active:r}),children:[n&&I(Ja,{intent:r?"normal":"weak",children:n}),I(Gl,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const kg=e=>["plaidInstitutionLogo",e??{}],Eg=On({display:"flex",gap:"10px",maxWidth:"100%"});function Ag({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=ur(),n=vr();return L({queryKey:kg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Ad({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?eg(i,"Logo"):void 0;return R("div",{className:Eg,children:[I(dc,{Component:l&&o?l:Tg}),I(wg,{accountName:e,accountNo:t,active:a,syncText:r})]})}const Sg=On({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Ig({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(Bl,{...r,disabled:n,width:"fill-parent",children:I(Zp,{children:e?Zd(e.name,e.mask):R("div",{className:Sg,children:[I(Gl,{children:t}),I(ai,{Component:Al})]})})})}const Ng="TRIGGER_ACCOUNT",Rg="FORM_SELECTABLE_ACCOUNT",Dg=On({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Pg({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Dg,children:[R(us,{placement:"bottom-start",children:[I(ps,{children:t=>I(Ig,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Ng?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(Ep,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I(Wu,{errorMessage:o})]})}const Lg=(e,t,n)=>{if(!n)return;const r=e===Rg?t:n,a=e===Rg?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,xu(c)&&yu(d));var c,d;const u=(h=r?.status,p=a?.status,"ACTIVE"===h&&"INACTIVE"===p);var h,p;return o?"Selected account number does not match destination account number":s?"Merging a linked account into a manually tracked account may result in duplicate transactions":u?"You selected an active account to be merged into an archived account":void 0},Mg=On({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Fg=On({display:{base:"block",sm:"none"}}),Og=On({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Ug=On({display:"flex",justifyContent:"center",alignItems:"center"}),Bg=On({display:{base:"none",sm:"block"}}),Vg=On({display:{base:"block",sm:"none"}});function Wg({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return R("div",{className:Mg,children:[R("div",{className:Og,children:[o?I(Pg,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Ng,bankAccounts:n,isFilling:r,warningMessage:Lg(Ng,e,t??null)}):I(Ig,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Ug,children:[I("div",{className:Bg,children:I(pc,{Component:Jo})}),I("div",{className:Vg,children:I(pc,{Component:sh})})]}),I(Ag,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:Fg,children:I(Mu,{alignment:"horizontal"})})]})}const Hg=async e=>{const t=e.queryKey,n={path:"/expenses/vendors",accessToken:t[1].accessToken,environment:t[1].environment},r=await ki(n),a=void 0!==r.data?r.data.map(e=>({...e,id:gl({id:e.id,prefix:"VENDOR"})})):[];return{...r,data:a}};function jg(){return br({queryKey:["expenses/vendors"],queryFn:Hg})}const zg=async({data:e,accessToken:t,environment:n})=>{const r={path:"/expenses/vendor",bodyParams:{vendor:{name:e}},accessToken:t,endpointManager:ba(n)};return await ha(r)},qg=Bn(er({body:"default"}),On({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),Kg=On({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),_g=Xn(jn["button-inline"],On({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function Yg({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:Kg,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:qg}),I("button",{type:"button",onClick:r,..._g,children:I(Ja,{children:"Add"})})]})}function Xg({promptText:e,placeholderText:t,onSubmit:n}){const[r,a]=y(!1),[o,i]=y(""),l=g(null);return T(()=>{r&&l.current&&l.current.focus({preventScroll:!0})},[r]),I(mp,{onClick:r?void 0:()=>{a(!0)},children:r?I(Yg,{placeholder:t,value:o,onChange:i,onSubmit:()=>{o.trim()&&(n(o.trim()),i(""),a(!1))},onCancel:()=>{i(""),a(!1)},inputRef:l}):I(bp,{promptText:e})})}function Zg({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const o=m(()=>new ke(e??[],Cp),[e]),i=m(()=>e?o.search(t).map(e=>e.item):[],[e,t,o]);return r?I(xp,{}):R(N,{children:[I(Xg,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===i.length?I(fp,{text:"No results found"}):i.map(e=>I(mp,{onClick:()=>n(e),children:I(Gl,{children:e.name})},e.id))]})}function Gg({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(xp,{}):R(N,{children:[I(Xg,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(mp,{onClick:()=>t(e),children:I(Gl,{children:e.name})},e.id))]})}function Qg({onClick:e}){const{query:{data:t,isLoading:n}}=jg(),{mutate:r}=uu({mutationFn:zg,onSuccess:async()=>gr.invalidateQueries({queryKey:["expenses/vendors"]})}),a=t?.data??[];return I(hp,{onClick:e,placeholder:"Search vendors...",SearchList:Zg,DefaultList:Gg,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r(e)}},listLength:a.length})}const Jg=async e=>{const t=e.queryKey,n={path:"/clientMgmt/clients",accessToken:t[1].accessToken,environment:t[1].environment},r=await ki(n),a=void 0!==r.data?r.data.map(e=>({...e,id:gl({id:e.id,prefix:"CUSTOMER"})})):[];return{...r,data:a}};function $g(){return br({queryKey:["clientMgmt/clients"],queryFn:Jg})}const em=async({data:e,accessToken:t,environment:n})=>{const r={path:"/clientMgmt/client",bodyParams:{client:{name:e}},accessToken:t,endpointManager:ba(n)};return await ha(r)},tm={type:"tween",duration:.3},nm={x:"100%"},rm={x:0},am={x:"100%"};function om({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(ws,{style:r,forceMount:t,children:e})}const im=On({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 lm({children:e}){const t=hs(),n=x(e=>{e.stopPropagation()},[]);return I(Ee,{children:t.context.open&&I(om,{fadeIn:!1,forceMount:!0,children:I(Ae.div,{transition:tm,initial:nm,animate:rm,exit:am,className:im,onAnimationEnd:n,children:e})})})}const sm=On.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",width:"100%",padding:"8px 16px"}),cm=Xn(jn["drawer-header"],On(sm));function dm({hideDivider:e=!1,children:t}){return R(N,{children:[I("header",{...cm,children:t}),!e&&I(Mu,{alignment:"horizontal",color:"normal"})]})}const um=Bn(On({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px"}),Pa);function hm({children:e}){return I(N,{children:I("div",{className:um,children:e})})}const pm=On({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),gm=Wn({base:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",flex:"1 1 0",alignSelf:"stretch",overflowY:"auto",width:"100%",scrollbar:"hidden"},variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function mm({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=hs();return R(N,{children:[I(dm,{children:R(hm,{children:[I(Wd,{Icon:Qo,handleClose:()=>{r?.(),i.close()}}),I(Ga,{children:o}),!or(t)&&I("div",{className:pm,children:t})]})}),I("div",{className:gm({padChildren:a}),children:n}),e]})}function vm(e){return I(lm,{children:I(mm,{...e})})}const bm=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M15.05 15.3L9.67714 9.92712",stroke:"#182428",strokeMiterlimit:10})),"Search",{styleIconKey:"search"}),fm=On({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),ym=On({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"}),xm=Bn(On({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px",flex:"1 0 0",border:"none",outline:"none",_placeholder:{color:"typography.label.sub"}}),er({label:"strongLabel"})),Tm=Xn(null,On({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Cm({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:fm,children:[I(Ga,{children:"Search"}),R("div",{className:ym,children:[I(pc,{Component:bm}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:xm}),cr(e)&&I(Bl,{stylists:[Tm],onClick:()=>t(""),children:I(pc,{Component:gs})})]})]})}function wm({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=y("");return I(cp,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Cm,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function km({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:o,onExpandedChange:i,hasMultiSelect:l=!1,getCanSelect:s,getCanExpand:c}){const[d,u]=cs({},a?.selected,o),[h,p]=cs({},a?.expanded,i),g=x((e,t)=>{const n=t??!d[e],r={[e]:n};u(l?{...d,...r}:r)},[d,u,l]),v=x((e,t)=>{const n=t??!h[e],r={[e]:n};p({...h,...r})},[h,p]),b=m(()=>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:h[r]??!1,getCanSelect:()=>s?.(e)??!0,getIsSelected:()=>d[r]??!1,toggleSelected:e=>g(r,e),getCanExpand:()=>c?.(e)??!0,getIsExpanded:()=>h[r]??!1,toggleExpanded:()=>v(r,!h[r])}})})),[e,r,t,n,d,g,h,v,s,c]);return m(()=>({groups:b,toggleSelected:g,toggleExpanded:v,expandedKeys:new Set(Object.keys(h))}),[b,g,v,h])}const Em=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_9779_2768)"},p.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"}),p.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"}),p.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"),Am=On({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function Sm({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:Am,children:[I(pc,{Component:Em}),I(Ga,{wrap:"wrap",children:`No ${t} found`}),n&&I(Ja,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const Im=On({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Nm({children:e}){return I("div",{className:Im,children:e})}const Rm=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"CircleCheck",{styleIconKey:"checkmark"}),Dm=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.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"),Pm=Xn(null,On({fill:"surface.intent.action.active"}));function Lm({selected:e,showEmptyIndicator:t}){return e?I(pc,{Component:Rm,stylists:[Pm]}):t?I(pc,{Component:Dm}):null}const Mm=Wn({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 Fm({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=Xn(jn["selector-row"],Mm({selected:r}),ti);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function Om({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(Fm,{handleClick:t,selected:n,children:[e,I(Lm,{selected:n,showEmptyIndicator:r})]})}const Um=On.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function Bm(){return I(Eo,{styles:On(ls,Um)})}const Vm=On({width:"70px",height:"24px"}),Wm=On({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function Hm(){return R("div",{className:Wm,children:[I(Eo,{styles:Vm}),R(Nm,{children:[I(Bm,{}),I(Bm,{}),I(Bm,{})]}),I(Eo,{styles:Vm}),R(Nm,{children:[I(Bm,{}),I(Bm,{}),I(Bm,{})]})]})}function jm({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=m(()=>new ke(e,Cp),[e]),l=km({data:m(()=>i.search(t).map(e=>e.item),[i,t]).map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return n?I(Hm,{}):0===l.groups.length?I(Sm,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):R(Nm,{children:[I(Gl,{children:"Search Results"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I(Om,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(Gl,{children:t.value.name})},t.key)})})]})}const zm=On({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),qm=On({width:"100%"});function Km({promptText:e,placeholderText:t,onSubmit:n}){const[r,a]=y(!1),[o,i]=y(""),l=g(null);T(()=>{r&&l.current&&l.current.focus({preventScroll:!0})},[r]);const s=()=>{i(""),a(!1)};return R("div",{className:qm,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||s()},children:[I(Mu,{alignment:"horizontal"}),I(Fm,{handleClick:r?void 0:()=>{a(!0)},children:r?I(Yg,{placeholder:t,value:o,onChange:i,onSubmit:()=>{o.trim()&&(n(o.trim()),i(""),a(!1))},onCancel:s,inputRef:l}):I(bp,{promptText:e})})]})}function _m({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=km({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(Hm,{}):R(Nm,{children:[I(Km,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n}),R("div",{className:zm,children:[I(Gl,{children:"Customers"}),I("div",{children:i.groups.map(e=>{const[t]=e.getRows();return I(Om,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(Gl,{children:t.value.name})},t.key)})})]})]})}function Ym({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=$g(),{mutateAsync:a}=uu({mutationFn:em,onSuccess:async()=>gr.invalidateQueries({queryKey:["clientMgmt/clients"]})}),o=hs(),i=n?.data??[],[l,s]=y(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(vm,{title:"Back",Footer:I(Ou,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t)??null;e(n),o.close()},disabled:!c}),onClose:()=>s(t?{[t.id]:!0}:{}),children:I(wm,{placeholder:"Search customers...",onClick:e=>{s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:jm,DefaultList:_m,listLength:i.length,extraProps:{customers:i,isLoading:r,onCreateCustomer:async e=>{const t=await a(e);s({[gl({id:t.id,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function Xm({frequencies:e,onClick:t}){const n=hs();return I(ws,{children:I(sp,{children:e.map(e=>I(mp,{onClick:()=>(t(e),void n.close()),children:I(Ga,{children:e.name})},e.value))})})}const Zm=Wn({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:"brand.action.strong",zIndex:1}},corners:{rounded:{_first:{borderTopLeftRadius:"sm",borderBottomLeftRadius:"sm"},_last:{borderTopRightRadius:"sm",borderBottomRightRadius:"sm"}}}}});function Gm({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=Xn(jn["button-group"],Bn(Zm({width:a,backgroundColor:o,active:t,corners:i}),Dl,Il,Nl,ei));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(Ga,{wrap:"wrap",textAlign:"center",children:e.label}):I(Gl,{wrap:"wrap",alignment:"center",children:e.label})})}const Qm=Wn({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"}}}});function Jm({width:e,children:t}){return I("div",{className:Qm({width:e}),children:t})}function $m({options:e,handleClick:t,selectedIndex:n}){const[r,a]=y(null);return I(Jm,{width:"full",children:e.map((e,o)=>R(S,{children:[0!==o&&I(Mu,{color:o!==n&&o!==n+1||r===n?"normal":"active"}),I(Gm,{option:e,isActive:o===n,handleClick:()=>t(o),onHoverChange:e=>a(e?o:null),width:"full",backgroundColor:"foreground",corners:"rounded"})]},e.value))})}const ev=Go(e=>p.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M0.668689 4.04687L0.668689 0.650082L11.3313 0.650083L11.3313 4.04688",strokeMiterlimit:10}),p.createElement("path",{d:"M6.00008 3.55915L6.00008 11.7998",strokeMiterlimit:10}),p.createElement("path",{d:"M2.60834 6.46875L6.00005 3.07703L9.39177 6.46875",strokeMiterlimit:10})),"Upload"),tv=On({display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",alignSelf:"stretch",border:"{borderWidths.md} dashed {colors.border.layout}",borderRadius:"2px",padding:"16px",gap:"8px",outline:"none"});function nv({getRootProps:e,getInputProps:t}){return R("div",{...e({className:tv}),children:[I("input",{...t()}),I(pc,{Component:ev}),I(Gl,{children:"Add Files"})]})}const rv=On({display:"flex",flexDirection:"column",gap:"8px"}),av=On({display:"flex",justifyContent:"space-between",alignItems:"center"}),ov=On({display:"flex",flexDirection:"column",outline:"none",borderRadius:"2px"},Hu),iv=On(ju);function lv({getRootProps:e,getInputProps:t,dataAttrs:n,popupTriggerProps:r,onMouseDown:a,onBlur:o,label:i,errorMessage:l,isTouched:s}){const c=Xn(null,ov,void 0,iv,ti);return R("div",{className:rv,children:[i&&I("div",{className:av,children:I(Gl,{children:i})}),I("div",{...c,...r,onMouseDown:a,onBlur:o,...n,children:I(nv,{getRootProps:e,getInputProps:t})}),s&&"open"!==r?.["data-state"]&&l&&I(Wu,{errorMessage:l})]})}const sv=Go(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_9779_2940)"},p.createElement("path",{d:"M11.9147 7.99997L6.31472 2.39996L0.714716 7.99997",stroke:"#182428",strokeMiterlimit:10})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_9779_2940"},p.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowUp"),cv=Wn({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"}}}}),dv=On({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"}}),uv=On({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 hv({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=Xn(jn["selector-row"],cv({active:r,expanded:a}),ti);return R("div",{...i,children:[o?R("button",{type:"button",className:dv,onClick:t,children:[I(Lm,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:dv,children:e}),!or(n)&&I("button",{type:"button",className:uv,onClick:n,children:I(pc,{Component:a?sv:sh})})]})}const pv=On({display:"flex",justifyContent:"start",width:"100%"}),gv=On({display:"flex",alignItems:"center",gap:"9px"}),mv=On({width:"100%"}),vv=Wn({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function bv(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function fv({classSegmentRows:e,onClick:t}){return e.map(e=>I(Fm,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:gv,children:[I(Lm,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(Gl,{children:e.value.name})]})},e.key))}function yv({fieldLabel:e,classSegmentOptions:t,classSegmentLabels:n,selectedRow:r,setSelectedRow:a,onClick:o}){const i=t.map(e=>({id:e[0].id,displayName:e[0].name??""})),l=km({data:t,groups:i,getRowKey:e=>e.id,getGroupKey:({originalGroup:e,groupIndex:t})=>e?.id??t.toString(),state:{selected:r},onSelectedChange:e=>a(e),getCanSelect:e=>{const t=n.find(t=>t.id===e.label?.id);return!t||!bv(t)}}),s=l.groups.some(e=>e.getRows().length>1);return R(N,{children:[I("div",{className:pv,children:I(Gl,{children:e})}),I("div",{className:vv({nested:s}),children:l.groups.map((e,t)=>{if(s){const[n,...r]=e.getRows();return R("div",{className:mv,children:[(s||0===t)&&I(Mu,{alignment:"horizontal"}),I(hv,{onClick:n.getCanSelect()?()=>o(n.value):void 0,onExpandToggle:r.length>0?n.toggleExpanded:void 0,active:n.getIsSelected(),expanded:n.expanded,canSelect:n.getCanSelect(),children:I(Gl,{children:n.value.name})}),n.expanded&&R(N,{children:[I(Mu,{alignment:"horizontal"}),I(fv,{classSegmentRows:r,onClick:o})]})]},e.key)}return I(fv,{classSegmentRows:e.getRows(),onClick:o},e.key)})})]})}function xv({flatClassSegments:e,classSegmentLabels:t,classSegmentOptions:n,selectedRow:r,searchTerm:a,onClick:o}){const i=m(()=>e.filter(e=>{const n=t.find(t=>t.id===e.label?.id);return!n||!bv(n)}),[e,t]),l=m(()=>new ke(i,Cp),[i]),s=m(()=>new Set(l.search(a).map(e=>e.item.id)),[l,a]),c=m(()=>n.map(e=>e.filter(e=>s.has(e.id))).filter(e=>e.length>0),[s,n]);if(0===c.length)return I(Sm,{singularSearchCTANoun:"class segment",pluralNounNotFound:"class segments",showSearchCTA:!0});const d=c.some(e=>e.length>1);return R(N,{children:[I("div",{className:pv,children:I(Gl,{children:"Search Results"})}),I("div",{className:vv({nested:d}),children:c.map(e=>I("div",{className:mv,children:e.map(e=>I(Fm,{handleClick:()=>o(e),selected:r[e.id],children:R("div",{className:gv,children:[I(Lm,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(Gl,{children:e.name})]})},e.id))},e[0].id))})]})}function Tv({fieldLabel:e,selectedSegment:t,classSegmentOptions:n,classSegmentLabels:r,onSave:a}){const o=m(()=>n.filter(([e,...t])=>{if(t.length>0)return!0;const n=r.find(t=>t.id===e.label?.id);return!n||!bv(n)}),[n,r]),[i,l]=y(()=>t?.id&&o.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),s=m(()=>o.flat(),[o]),c=hs(),d=Object.values(i).some(Boolean);return I(mm,{title:"Back",Footer:I(Ou,{onSave:()=>{const e=Object.keys(i).find(e=>i[e]),t=s.find(t=>t.id===e);t&&(a(t),c.close())},disabled:!d}),children:I(wm,{placeholder:`Search ${e.toLowerCase()}...`,onClick:e=>{l(t=>({[e.id]:!t[e.id]}))},SearchList:xv,DefaultList:yv,listLength:s.length,extraProps:{fieldLabel:e,classSegmentOptions:o,classSegmentLabels:r,flatClassSegments:s,selectedRow:i,setSelectedRow:l}})})}function Cv(e){const t=hs();return I(lm,{children:t.open&&I(Tv,{...e})})}const wv=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),kv=On.raw({color:"typography.base.weak"}),{useAppForm:Ev,withForm:Av}=Ce({formContext:Eu,fieldContext:Au,formComponents:{SaveButton:Ru,FormSaveButton:Pu,FormFooter:Ou},fieldComponents:{DiscreetAmountField:function({label:e}){const t=g(null),n=Su();return I(Gu,{inputRef:t,label:e,children:I(nh,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=g(null),a=Su();return I(oh,{inputRef:r,label:e,hasErrorStyles:t,children:I(nh,{value:a.state.value,onChange:a.handleChange,inputRef:r,autofocus:n})})},DateInput:function({label:e,maxDate:t,minDate:n,autofocus:r=!1,editable:a=!1,hasErrorStyles:o}){const i=Su(),l=Te(i.store,e=>e.meta.isDefaultValue),s=g(null),[c,d]=y(()=>i.state.value?xt(i.state.value):/* @__PURE__ */new Date),u=i.state.value?xt(i.state.value):null,[h,p]=y(""),m=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);p(r);const a=yt(r);if(a){let e=a;t&&n?e=wt(Ct(a,t),n):t?e=Ct(a,t):n&&(e=wt(a,n)),i.handleChange(Tt(e)),d(e)}else i.handleChange("")},v=h||(u?bt(u):""),[b,f]=y(!1),x=e=>{b&&(()=>{if(u&&!l){const e=yt(h);(t&&e&&vt(e,t)||n&&e&&vt(n,e))&&p(bt(u))}})(),f(e)},T=e=>{"Enter"===e.key&&(e.preventDefault(),x(!b))},C=a?oh:Gu;return R(us,{placement:"bottom-start",onOpenChange:x,open:b,children:[I(ps,{children:t=>I(C,{label:e,inputRef:s,popupTriggerProps:t,onClick:()=>f(!0),hasErrorStyles:o,children:I("input",{...kh,ref:s,type:"text",id:i.name,value:v,onChange:m,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:T,autoComplete:"off"})})}),I(ws,{initialFocus:!1,children:I(wh,{selectedDate:u,onDateSelect:e=>{i.handleChange(Tt(e)),p(bt(e)),d(e)},viewDate:c,onViewDateChange:d,maxDate:t,minDate:n})})]})},TextAreaInput:function({label:e,placeholder:t,autofocus:n=!1,resizeable:r=!0}){const a=Su(),o=g(null);return I(oh,{label:e,inputRef:o,children:I("textarea",{...Eh,ref:o,value:a.state.value||"",onChange:e=>a.handleChange(e.target.value),placeholder:t??"Add note...",rows:4,style:{resize:r?"both":"none"},autoFocus:n})})},MessageAreaInput:$h,SplitExpenseCategoryField:function({value:e,onChange:t}){const n=e?.iconUrl?eg(e.iconUrl,"Expense Icon"):void 0;return R(us,{placement:"bottom-start",children:[I(ps,{children:t=>R("button",{...hg,...t,type:"button",children:[n&&I(pc,{Component:n}),I(Ga,{stylists:[pg],children:e?.name||"Uncategorized"})]})}),I(ug,{onClick:t})]})},SplitExpenseAmountField:function({value:e,onChange:t,onBlur:n}){const[r,a]=y(!1);return I("div",{...gg,"data-clicked":r,children:I(nh,{value:e,onChange:t,onClick:()=>a(!0),onBlur:()=>(a(!1),void n())})})},ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Su(),a=Mp(t.id),{query:{data:o},isFilling:i}=nu({select:e=>({...e,data:Dp(e?.data)})}),l=o?.data,s=ir(e)&&!ep(e);return I(Sp,{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=Su(),r=t.findIndex(e=>e.value===n.state.value);return I(oh,{label:e,disableHover:!0,children:I($m,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:function({options:e,label:t,isEqual:n=fg,isEmpty:r,disabled:a}){const o=Su(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!or(o.state.value)&&!r?.(o.state.value);return R(us,{placement:"bottom-start",children:[I(ps,{children:n=>I(oh,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...vg,type:"button",children:I(Gl,l?{children:i(e,o.state.value)}:{extraClassNames:[bg],children:`Select ${t.toLowerCase()}...`})})})}),I(mg,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})},TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:a="Enter value..."}){const o=Su(),i=g(null);return I(oh,{label:e,disabled:r,inputRef:i,kind:"text",type:t,maxLength:n,children:I("input",{className:yg,value:o.state.value,onChange:e=>o.handleChange(e.target.value),type:t,maxLength:n,ref:i,placeholder:a})})},BulkMergeAccountRowField:Wg,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const a=g(null),o=r?oh:Gu,{handleBlur:i}=Su();return R(us,{placement:"bottom-start",children:[I(ps,{children:t=>I(o,{inputRef:a,label:e,popupTriggerProps:t,children:I(Gl,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})}),I(Qg,{onClick:e=>{t(e),i()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const a=g(null),o=r?oh:Gu;return R(us,{placement:"bottom-start",children:[I(ps,{children:t=>I(o,{inputRef:a,label:e,popupTriggerProps:t,children:I(Gl,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})}),I(Ym,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=g(null),a=`${n?.name??tl[0].name}`;return R(us,{placement:"bottom-start",children:[I(ps,{children:t=>I(oh,{inputRef:r,label:e,popupTriggerProps:t,children:I(Ga,{children:a})})}),I(Xm,{frequencies:tl,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=Ph,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,popupTriggerProps:i,hasErrorStyles:l=!1,disableHover:s=!1}){const c=Su(),{mutateAsync:d}=Uh(),[u,h]=y(!0),{dataAttributes:p}=zu({isActive:u,isDefaultValue:!1,isTouched:o,popupTriggerProps:i,errorMessage:a,hasErrorStyles:l,disableHover:s}),{getRootProps:g,getInputProps:m}=Se({maxFiles:e,accept:t,disabled:n,onDrop:async t=>{const n=c.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=>Fh(e,n))),...i.map(e=>Mh(e,Dh.maxAttachmentsReached))];c.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const s=l.filter(e=>!e.hasError);if(0===s.length)return;const u=s.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);c.setValue(e=>(e??[]).map(e=>{if(e.hasError)return e;const t=s.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(lv,{getRootProps:g,getInputProps:m,dataAttrs:p,popupTriggerProps:i,onMouseDown:()=>h(!0),onBlur:()=>h(!1),label:r,errorMessage:a,isTouched:o})},ClassSegmentField:function({fieldLabel:e,selectedSegment:t,classSegmentOptions:n,classSegmentLabels:r,onSave:a}){return R(us,{children:[I(ps,{children:n=>I(oh,{label:e,popupTriggerProps:n,children:I("button",{className:wv,type:"button",children:I(Gl,t?{children:t.name}:{extraClassNames:[kv],children:`Select ${e.toLowerCase()}...`})})})}),I(Cv,{fieldLabel:e,selectedSegment:t,classSegmentOptions:n,classSegmentLabels:r,onSave:a})]})}}});const Sv=[Xn(null,On({"& path":{stroke:"icon.base"}}))];function Iv({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(Bl,{type:"button",onClick:n,children:[e&&I(ai,{Component:gs,stylists:Sv}),I(Ga,{children:t})]})}const Nv=On({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),Rv=On({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),Dv=On({maxWidth:"600px"}),Pv=On({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),Lv=On({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Mv=On({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Fv=On({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Ov=On({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),Uv=On({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),Bv=e=>{Qu(e),Ju(e)};function Vv({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=nu(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=fu(),a=ur(),o=vr(),i=ir(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,el({queryKey:ar(al({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:il,accessToken:n,environment:r}))}),Ev({defaultValues:l,onSubmit:async e=>{if(await wu()===Dd){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await ku());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=ar(al({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await $i({queryKey:r,queryFn:il,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=xt(e.tranStartDate||""),l=xt(n||""),s=xt(e.tranMinStartDate||""),or(l)?i:ir(s)?wt(l,s):(ir(i)&&wt(l,i),i));var i,l,s;return or(r)?null:Tt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...Tu(t),duplicateBankAccountIds:[ml(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await ku()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:Nv,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:Bv,children:[R("div",{className:Rv,children:[I(Ga,{children:"Merge Accounts"}),I("div",{className:Dv,children:I(Gl,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:Pv,children:[R("div",{className:Lv,children:[I("div",{className:Mv,children:I(Ga,{children:"Duplicate Account"})}),I("div",{className:Fv,children:I(Ga,{children:"Into"})}),I("div",{className:Ov,children:I(Ga,{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)&&yu(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return I(Wg,{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:Uv,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[I(Iv,{showIcon:!1,onClick:()=>n()}),I(du,{onClick:()=>i.reset(o),disabled:!t,children:I(Ga,{children:"Clear Selections"})}),I(Ru,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Wv=On({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"}),Hv=fe.createConfirmation(ye(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I(Ud,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:Wv,children:I(Vv,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function jv({plaidItemAccounts:e,matchingAccountPairs:t}){await Hv({matchingAccountPairs:t,plaidItemAccounts:e})}const zv=On({display:"flex",flexDirection:"column",gap:"12px"}),qv=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:Ed(n)},{url:a,headers:o}=sa(r);return Ti({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(ea("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(ta({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),Jd("NO_LINK_TOKEN"))}catch(r){return ta({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),Jd("LINK_TOKEN_FAILED")}};async function Kv(e,t,n){const r=await async function(e,t){const n=ar(Td({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await $i({queryKey:n,queryFn:Cd,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function _v(e,t,n,r){ea("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||ea("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,el({queryKey:ar($d({filter:eu}),{}),queryFn:tu,accessToken:r,environment:a});const o=await Kv(e,t,n);if(o){const e=await ru(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:Ed(r)},{url:o,headers:i}=sa(a);return await ca({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(ea("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([gr.invalidateQueries({queryKey:["integrations"]}),gr.invalidateQueries({queryKey:["banks/accounts",{}]}),gr.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===lu({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return ta({error:new Error("Plaid Item requires relink, plaid reopened automatically"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),{relinkPlaidItemId:i.id};const s=await ru(n,r),c=s?.data?.filter(e=>yu(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=l(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(ta({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await qd({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:Rd,label:"Cancel"},{key:Pd,label:"Chat",type:jd}]})===Pd&&Gd({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void ta({error:new Error("No new accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}});if(!i.some(e=>"ACTIVE"===e.status))return ta({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),qd({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Rd,label:"OK"}]});const s=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&s&&s.length>0)return ta({error:new Error("Accounts saved successfully with unsupported accounts"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),function(e,t,n){const r=e.length;return qd({title:"All set! Ready to track your transactions?",body:R("div",{className:Qd,children:[I(Gl,{wrap:"wrap",children:`Your ${n} ${t} ${Kd("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(Gl,{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(Gl,{wrap:"wrap",children:Zd(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:Pd,label:"Get Started",type:jd}]})}(s,o,e.plaidItemAccounts.length);const c=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:su(r),duplicateAccount:e})}return n}(i,a);return c.length>0?async function({institutionName:e,matchingAccountPairs:t,plaidItemAccounts:n}){const r=t.slice(0,3),a=t.length>3;await qd({title:"Your transactions are being categorized",body:R("div",{className:zv,children:[I(Gl,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(Gl,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),R("ul",{children:[r.map(({duplicateAccount:e})=>I("li",{children:I(Gl,{wrap:"wrap",children:Zd(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(Gl,{wrap:"wrap",children:"and more..."})})]}),I(Gl,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Rd,label:"No thanks"},{key:Pd,label:"Review",type:jd}]})===Pd&&await jv({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:c,plaidItemAccounts:c.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(ta({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>qd({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${Kd("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:Pd,label:"Get started",type:jd}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,c),{}}catch(o){return ta({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await qd({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Rd,label:"Cancel"},{key:Pd,label:"Chat",type:jd}]})===Pd&&Gd({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 Yv(e,t,n){return or(e)?(ea("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(ea("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(ta({error:new Error("Plaid Item sync failed, refreshing Plaid Items"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),!0):("INVALID_UPDATED_USERNAME"===e.error_code&&(ta({error:new Error("Plaid Item sync failed due to invalid updated username"),severity:"error",extraData:{metadata:t,error:e,linkToken:n}}),await async function(e){const t=await qd({title:e||"Invalid Updated Username",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:Rd,label:"Cancel"},{key:"chat",label:"Chat"},{key:Pd,label:"Banks & Integrations",type:jd}]});"chat"===t?Gd({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==Pd||(e=>{const t=Yt.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||Gi("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Xv=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Et(t.lastSyncedDate)}`},Zv=e=>{let t;return t=e.isSupported?"ACTIVE"!==e.status?"Archived":e.syncTransactions?"Processing":"Not Synced":"Not Supported",t},Gv="PLAID_LINK_NEW",Qv="PLAID_LINK_UPDATE",Jv="PLAID_LINK_UNLINK";function $v({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 eb=v({});function tb({onPlaidLink:e,children:t}){return I(eb.Provider,{value:{onPlaidLink:e},children:t})}function nb(){return b(eb)}async function rb(e){const{url:t,headers:n}=sa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=oa({extraHeaders:n,authorization:t});ea("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return ea("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),ia(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}const ab=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:ba(n)};return await ha(r)};function ob(){return uu({mutationFn:ab,onSuccess:()=>{const e=["integrations"];return gr.invalidateQueries({queryKey:e})}})}const ib=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:ba(t)};return await ha(n)};function lb(){return uu({mutationFn:ib,onSuccess:()=>{const e=["integrations"];return gr.invalidateQueries({queryKey:e})}})}const sb=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(ml(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:ba(n)};return await async function(e){return rb(e)}(r)};function cb(){const{mutate:e}=lb();return uu({mutationFn:sb,onSuccess:()=>{const e=["integrations"];return gr.invalidateQueries({queryKey:e})},onError:async t=>{ta({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await qd({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Rd,label:"Cancel"},{key:Pd,label:"Try Again",type:jd}]})===Pd&&e()}})}function db(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)=>{ea(`Plaid event: ${e}`,{metadata:t,eventName:e})}}).open()})}async function ub(e,t,n,r){const a=await qv(e,t,n);if(!a)return;const o=await db(a);if("success"===o?.status){const{public_token:e,metadata:a}=o;ea("Plaid link successful",{public_token:e,metadata:a});const i=await _v(e,a,t,n);if(i.relinkPlaidItemId)return ub(i.relinkPlaidItemId,t,n,r)}else if("exit"===o?.status){const{metadata:e,error:t}=o;ea("Plaid link exited",{metadata:e,error:t}),await Yv(t,e,a)&&r()}else ta({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:o,token:a}})}function hb(){const[e,t]=xd({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=ur(),r=vr(),{mutate:a}=lb(),{onPlaidLink:o}=nb();return{linkPlaid:e=>{if(ir(o)){const t=$v(e);o(t)}else ub(e.plaidItemId?ml(e.plaidItemId):void 0,n,r,a)},loading:e||ir(t),hasOnPlaidLinkOverride:ir(o)}}function pb(){const[e,t]=xd({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=ur(),r=vr(),{mutate:a}=lb(),{apiPartnerName:o}=b(Us),{onPlaidLink:i}=nb();return{linkPlaid:e=>{if(ir(i)){const t=$v(e);i(t)}else!async function(e,t,n,r,a){const o=await qv(e,t,n);if(!o)return;const i=await db(o);if("success"===i?.status){const{public_token:e,metadata:o}=i;ea("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 Kv(t.institution.institution_id,n,r);if(i)return ta({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,qd({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:Rd,label:"Cancel"},{key:Pd,label:"Relink",type:jd}]}))===Pd?{relinkPlaidItemId:ml(i.id)}:{}}var o;return ea("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),_v(e,t,n,r)}(e,o,t,n,r);l.relinkPlaidItemId&&ub(l.relinkPlaidItemId,t,n,a)}else if("exit"===i?.status){const{metadata:e,error:t}=i;ea("Plaid link from search exited",{metadata:e,error:t}),await Yv(t,e,o)&&a()}}(e.plaidItemId?ml(e.plaidItemId):void 0,n,r,o,a)},loading:e||ir(t),hasOnPlaidLinkOverride:ir(i)}}const gb=Xn(null,Il,On({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"}}}}),ei);function mb(){const{linkPlaid:e,loading:t}=hb();return R("button",{onClick:()=>e({plaidEvent:Gv,message:"Tile Plaid Link button pressed"}),...gb,disabled:t,children:[I(pc,{Component:vd}),I(Gl,{intent:"primary",children:"Link Account"})]})}const vb=On({width:266,minHeight:32});function bb(){return I(Eo,{styles:vb})}const fb=Xn(jn.text,On({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.66px",maxWidth:"100%"}),Pa);function yb({children:e}){return I("div",{...fb,children:e})}const xb={SUCCESS:On({backgroundColor:"surface.intent.success.highlight"}),DANGER:On({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:On({backgroundColor:"surface.intent.secondary"})},Tb=On({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"});function Cb({variant:e,children:t}){return I("div",{className:Bn(Tb,xb[e]),children:I(yb,{children:t})})}const wb=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function kb({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${_a(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return I(Cb,{variant:wb(r,n,t),children:a})}const Eb=On({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function Ab({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:Eb,children:[I(Wa,{title:e,label:t}),ir(n)&&I(kb,{difference:n,invertDirection:r})]})}const Sb={netIncome:0,income:0,expenses:0,absoluteSum:0},Ib=e=>{if(or(e))return Sb;const t=e.income?.total??0,n=e.expenses?.total??0,r=B(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},Nb=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Ib):[]},Rb=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0}),Db=({defaultRange:e=nt.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r})=>{const a=t?It(t):e,{query:{data:o},isFilling:i}=function({filter:e,grouping:t}){return xa({filter:e,grouping:t,select:Nb})}({filter:a,grouping:t?Ea:void 0}),{profitLossData:l,profitDifference:s}=m(()=>{if(n)return{profitLossData:Oo,profitDifference:null};if(!o||0===o.length)return{profitLossData:Rb,profitDifference:null};if(2===o.length){const[e,t]=o;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:o[0],profitDifference:null}},[o,n]);return R(Da,{isSample:n,children:[I(Sa,{title:"Profit + Loss"}),I(Na,{children:i?R(So,{children:[I(bb,{}),I(bb,{})]}):R(N,{children:[I(Ab,{title:Ya(l.netIncome),label:"Profit",comparison:s}),R(ja,{children:[I(md,{amount:l.income,total:l.absoluteSum,color:"positive",label:"Income"}),I(md,{amount:l.expenses,total:l.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(Lo,{size:"sm"}),r&&I(mb,{})]})},Pb=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],Lb=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...dt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:ba(a)};return await ha(o)},Mb={moneyIn:0,moneyOut:0,netMoneyIn:0},Fb=e=>{if(or(e)||or(e.operatingActivities)||!e.operatingActivities.children)return Mb;let t=new B(0),n=new B(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(B(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Ob=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Fb):[]};const Ub=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0}),Bb=({defaultRange:e=nt.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r})=>{const a=t?It(t):e,{query:{data:o,isFetched:i},isFilling:l}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return br({queryKey:Pb({filter:e,grouping:t}),queryFn:Lb,select:n})}({filter:e,grouping:t,select:Ob})}({filter:a,grouping:t?Ea:void 0}),{cashFlowData:s,difference:c}=m(()=>{if(n)return{cashFlowData:Bo,difference:null};if(!o||0===o.length)return{cashFlowData:Ub,difference:null};if(2===o.length){const[e,t]=o;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:o[0],difference:null}},[o,n]),d=n||i?Math.abs(s.moneyIn)+Math.abs(s.moneyOut):0;return R(Da,{isSample:n,children:[I(Sa,{title:"Cash Flow"}),I(Na,{children:l?R(So,{children:[I(bb,{}),I(bb,{})]}):R(N,{children:[I(Ab,{title:Ya(s.netMoneyIn),label:"Change in Cash",comparison:c}),R(ja,{children:[I(md,{amount:s.moneyIn,total:d,color:"positive",label:"Money In"}),I(md,{amount:s.moneyOut,total:d,color:"negative",label:"Money Out"})]})]})}),n&&I(Lo,{size:"sm"}),r&&I(mb,{})]})},Vb=Xn(null,On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"})),Wb=Xn(null,On({display:"flex",justifyContent:"end"}));function Hb({color:e,bulletLabel:t,moneySummary:n}){return R("div",{...Vb,children:[I(io,{color:e,label:t}),I("div",{...Wb,children:I(Gl,{children:n})})]})}const jb=Xn(null,On({display:"flex",gap:"10px",alignItems:"center"})),zb=On({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),qb=Xn(null,zb);function Kb({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>R("div",{...jb,children:[I(io,{color:no.var("colors.brand.secondary")}),t?I(Eo,{styles:zb}):I("div",{...qb})]},n))})}const _b={total:0,children:[]},Yb=e=>{return or(e)||or(e.expenses)||!e.expenses.children?_b:{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},Xb=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Yb):[]},Zb=[no.var("colors.brand.primary"),no.var("colors.brand.success"),no.var("colors.brand.action")],Gb=Object.freeze({total:0,children:[]});function Qb({defaultRange:e=nt.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const o=Yt(e=>e.externalOptions).dataVisualizationColors??Zb,i=t?It(t):e,{query:{data:l},isFilling:s}=function({filter:e,grouping:t}){return xa({filter:e,grouping:t,select:Xb})}({filter:i,grouping:t?Ea:void 0}),{expenseData:c,expensesDifference:d}=m(()=>{if(r)return{expenseData:Uo,expensesDifference:null};if(!l||0===l.length)return{expenseData:Gb,expensesDifference:null};if(2===l.length){const[e,t]=l;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:l[0],expensesDifference:null}},[l,r]),u=void 0===n?"Total Expenses":`${ht[n]} Total`,h=c.children.length>0;return R(Da,{isSample:r,children:[I(Sa,{title:"Expenses"}),I(Na,{children:s?I(So,{children:I(Kb,{shimmer:!0})}):R(N,{children:[I(Ab,{title:Ya(c.total),label:u,comparison:d,invertDirection:!0}),I(ja,{children:h?c.children.map((e,t)=>I(Hb,{color:o[t],bulletLabel:e.name,moneySummary:Ya(e.total)},t)):I(Kb,{})})]})}),r&&I(Lo,{size:"sm"}),a&&I(mb,{})]})}const Jb=Xn(null,On({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function $b({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:Xe(l=e.year,i,1),endDate:Xe(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Jb,children:[R(Gn,{children:[I(nr,{children:"Monthly Review"}),I(nd,{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(ad,{children:[I(Db,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(Bb,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(Qb,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const ef="Oldest to Newest",tf="Newest to Oldest",nf="A-Z",rf="Z-A",af="Lowest to Highest",of="Highest to Lowest",lf="A-Z",sf="Z-A";function cf(){const[e,t]=y(void 0),n=m(()=>{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 nl)??!1,n=(e.direction&&e.direction in rl)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const df=On({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"}}}),uf=On({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),hf=On({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function pf({checked:e,onClick:t,Icon:n=Nu}){const[r,a]=y(e??!1),o=void 0===e?r:e;return I("button",{...Xn(jn["checkbox-input"],df,o?hf:uf,ti),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&I(ms,{Component:n})})}const gf=Xn(null,On({paddingLeft:"20px",paddingRight:"5px"}));function mf({checked:e,onClick:t,Icon:n=Nu}){return I("div",{...gf,children:I(pf,{checked:e,onClick:t,Icon:n})})}const vf=Xn(jn["date-cell"],On({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function bf({date:e,annotation:t}){const n=bt(xt(e));return R("div",{...vf,children:[t&&I(yb,{children:t}),I(Gl,{children:n})]})}const ff=On({color:"money.negative"}),yf=On({color:"money.positive"}),xf=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>lr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),Tf=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M10 14.375L13.75 10.625L10 6.875",stroke:"currentColor",strokeMiterlimit:10})),"ChildRow"),Cf=Xn(jn["transaction-date-cell-container"],On({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function wf({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=(e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{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?yf:ff}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":"Income",css:t?ff:yf}})(e);break;case"BANK_TRANSFER":t={type:"BANK_TRANSFER",displayName:"Bank Transfer",css:e.amount<0?ff:yf};break;case"PAYOUT":t={type:"PAYOUT",displayName:"Payout",css:e.amount<0?ff:yf};break;case"TAX_PAYMENT":t={type:"TAX_PAYMENT",displayName:"Tax Payment",css:ff};break;case"INVOICE_PAYMENT":t=(e=>{let t="Invoice Payment",n=yf;return e.amount<0&&(t="Invoice Payment Refund",n=ff),{type:"INVOICE_PAYMENT",displayName:t,css:n}})(e);break;default:t=(e=>({type:e.type,displayName:xf(e.type),css:e.amount<0?ff:yf}))(e)}return t})(e),a=Xn(jn["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?R("div",{...Cf,children:[I(pc,{Component:Tf}),I(bf,{date:e.date,annotation:o})]}):I(bf,{date:e.date,annotation:o})}const kf=On({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),Ef=On({display:"flex",flexDirection:"column",width:"100%"}),Af=On({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function Sf({label:e,subLabel:t,iconUrl:n}){return R("div",{className:kf,children:[n?I("img",{src:n,className:Af,alt:void 0,width:24,height:24}):I("span",{className:Af}),R("div",{className:Ef,children:[I(Gl,{children:e}),I(Ja,{children:t})]})]})}function If({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:On({paddingLeft:"25px"}),children:I(Sf,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I(Sf,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}function Nf(e){return Xa(_d(e.amount))}const Rf=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M6.9187 2.10632H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 5.69366H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 9.28131H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 12.8687H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M5.71875 10.4749L3.33125 12.8686L0.9375 10.4749",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M3.33118 1.50635V12.8688",stroke:"currentColor",strokeMiterlimit:10})),"NestedRows"),Df=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M6.9187 2.13135H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 5.71851H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 9.30682H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 12.8934H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M0.9375 4.5251L3.33125 2.13135L5.71875 4.5251",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M3.33118 13.4938V2.13135",stroke:"currentColor",strokeMiterlimit:10})),"NestedRowsExpanded"),Pf=On({display:"flex",alignItems:"center",gap:"8px"}),Lf=On({padding:"6px"});function Mf({row:e}){const t=e.original,n=I(Gl,{children:Nf(t)});if(e?.getCanExpand()){const t=e.getIsExpanded();return I(Rs,{ariaLabel:t?"Collapse children":"Expand children",ariaExpanded:t,children:R("div",{className:Pf,children:[I(pc,{Component:t?Df:Rf}),n]})})}return I("div",{className:Lf,children:n})}const Ff=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M13.75 1.25L1.25 13.75",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M13.75 9.84375V1.25H5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Withdraw"),Of=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M13.75 13.75L1.25 1.25",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M5.15625 13.75H13.75V5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Deposit"),Uf=On({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px"}),Bf=On({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function Vf({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return Ff;case"Deposited to":return Of;default:return null}})(e);return R("div",{className:Uf,children:[n&&I(pc,{Component:n}),R("div",{className:Bf,children:[e&&I(Ja,{children:e}),t&&I(Gl,{children:t})]})]})}const Wf=On({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"}}),Hf=Bn(Wf,On({padding:"2.5px"})),jf=Bn(Wf,On({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),zf=On({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"}}),qf=Bn(zf,On({_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"}}})),Kf=On({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"}}}),_f=Bn(Kf,On({_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"}}})),Yf=On({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"}}),Xf=Bn(Yf,On({_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"}}})),Zf=On({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"}}),Gf=Bn(Zf,On({_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"}}})),Qf=On({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"}}),Jf=Bn(Qf,On({_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"}}})),$f=On({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"}}),ey={default:qf,neutral:qf,warning:Gf,success:Xf,critical:Jf,highlight:_f},ty=w(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=$n([Xn(jn["selector-button"],Bn($f,ey[e]),ti),...n]);return I("button",{ref:a,...o,...r,children:t})}),ny=()=>["accounting/glAccounts"],ry=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await ki(n);return iy(r)};function ay(e){return br({...e,queryKey:["accounting/glAccounts"],queryFn:ry})}function oy(){return ay({select:gy})}const iy=e=>e.map(e=>({...e,id:gl({id:e.id,prefix:"GL_ACCOUNT"})}));function ly(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 sy(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>sy(e,t))}const cy=e=>!e.parentAccountNo;function dy(e){const t=ly(e);return e.filter(cy).map(e=>({...e,children:sy(e,t)}))}function uy(e,t){return(t.get(e)??[]).map(e=>{const n=uy(e.accountNo,t);return{...e,children:n}})}function hy(e){const t=ly(e);return e.filter(cy).map(e=>({...e,children:uy(e.accountNo,t)}))}function py(){return ay({select:hy})}function gy(e){return dy(e).flatMap(e=>[e,...e.children])}const my=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function vy(e,t){return m(()=>e?.filter(e=>t.includes(e.type))??[],[e,t])}const by={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function fy(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function yy(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=>{fy(e,n,t)})}(r,n):a?fy(a,r,n):i&&fy(r,r,n)}),n}const xy=[Xn(null,On({marginLeft:"6px",marginRight:"6px"}))],Ty=Xn(null,On({whiteSpace:"normal"}));function Cy({types:e,onClick:t,searchTerm:n}){const{query:{data:r},isFilling:a}=oy(),o=vy(r,e),i=m(()=>new ke(o,by),[o]),l=m(()=>yy(i.search(n),o),[o,n,i]);return a?I(xp,{}):l.map(({parent:e,child:n})=>I(mp,{onClick:()=>t(n),children:R(Zp,{stylists:[Ty],children:[e.name,I(ai,{Component:Jo,stylists:xy}),n.name]})},`${n.accountNo}`))}function wy({types:e,onClick:t}){const{query:{data:n,isFetching:r},isFilling:a}=ay({select:dy}),o=vy(n,e);return a?I(xp,{}):a||r||void 0!==n?o.map(e=>I(og,{triggerChildren:I(sg,{displayLabel:e.name}),popupChildren:I(ky,{glAccount:e,onClick:t})},e.accountNo)):I(fp,{text:"No data"})}function ky({glAccount:e,onClick:t}){return I(sp,{children:e.children.map(e=>I(mp,{onClick:()=>t(e),children:I(Ga,{children:e.name})},e.accountNo))})}const Ey=On({maxWidth:"420px",width:"fit-content"});function Ay({onClick:e,types:t}){const{query:{data:n}}=py(),r=vy(n,t);return I(hp,{onClick:e,placeholder:"Search revenue accounts...",getSearchActiveStyles:e=>e?Ey:void 0,SearchList:Cy,DefaultList:wy,extraProps:{types:t},listLength:r.length,forceSearchVisible:!0})}const Sy={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 Iy(e,t=!0){const n=lu({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 Ny(){return wd({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 Ry={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"},Dy=e=>["tasks",e??{}],Py={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},Ly={filter:{status:{in:["ACTIVE"]}}},My=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:vi(t[2].environment)},a=await ua(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};const Fy=e=>{const t=zo[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},Oy=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Vy({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),Uy=async({data:e,accessToken:t,environment:n})=>Vy({data:{data:e},accessToken:t,environment:n}),By=async({data:e,accessToken:t,environment:n})=>Uy({data:[e],accessToken:t,environment:n}),Vy=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:vi(n)};return await ua(r)};function Wy(){return uu({onSuccess:async()=>{const e=["banks/transactions"];return ea("mutation successful, invalidating BT queries"),gr.invalidateQueries({queryKey:e}).catch(e=>ta({error:e,severity:"error"}))},mutationFn:Uy})}function Hy(){return jy({mutationFn:By})}function jy(e){return uu({onSuccess:async()=>(ea("mutation successful, invalidating BT queries"),gr.invalidateQueries({predicate:e=>e.queryKey.includes("tasks")||e.queryKey.includes("banks/transactions")||e.queryKey.includes("reports")}).catch(e=>ta({error:e,severity:"error"}))),...e})}function zy({transaction:e,parentTransaction:t,accountName:n}){const{startPrefetch:r,cancelPrefetch:a}=Ai({prefetchFn:bi(ny,ry)}),{mutate:o}=Hy(),i=void 0!==t,l=or(e.glAccount?.iconUrl)?void 0:eg(e.glAccount.iconUrl,"Revenue Icon");return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>R(ty,{...e,onMouseEnter:r,onMouseLeave:a,children:[l&&I(pc,{Component:l}),I(Gl,{children:n})]})}),I(Ay,{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:my})]})}const qy=e=>e>0?"Deposited to":"Withdrawn from",Ky=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M4.31676 1.37476L1.67926 4.01226L4.31676 6.64976",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M12.2292 6.64976L14.8667 4.01226L12.2292 1.37476",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10})),"Split"),_y=Xn(null,On({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),Yy=Xn(null,On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function Xy({transaction:e}){const{label:t,list:n}=Yp(e.children);return I(Xl,{children:R("div",{...Yy,children:[I(pc,{Component:Ky}),R("div",{..._y,children:[I(Ga,{children:t}),I(Ja,{children:n})]})]})})}function Zy({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=Kp(),a=e.category?.name??"",{mutate:o}=Hy(),i=void 0!==t,l=or(e.category?.iconUrl)?void 0:eg(e.category.iconUrl,"Expense Icon");return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>R(ty,{...e,onMouseEnter:n,onMouseLeave:r,children:[l&&I(pc,{Component:l}),I(Gl,{children:a})]})}),I(ug,{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()})}})]})}const Gy={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT",TAX_EXPENSE:"TAX_EXPENSE",INVOICE_REVENUE:"INVOICE_REVENUE",PAYMENT_IN:"PAYMENT_IN",PAYMENT_OUT:"PAYMENT_OUT",PAYROLL_EXPENSE:"PAYROLL_EXPENSE",BILL_EXPENSE:"BILL_EXPENSE",LOAN_EXPENSE:"LOAN_EXPENSE",BANK_TRANSFER:"BANK_TRANSFER",LOAN_PAYMENT:"LOAN_PAYMENT",BILL_PAYMENT:"BILL_PAYMENT",PAYOUT:"PAYOUT",TAX_PAYMENT:"TAX_PAYMENT",INVOICE_PAYMENT:"INVOICE_PAYMENT"},Qy={Expense:[{name:"Expense",value:Gy.EXPENSE},{name:"Tax Expense",value:Gy.TAX_EXPENSE},{name:"Payment Out",value:Gy.PAYMENT_OUT},{name:"Bill Expense",value:Gy.BILL_EXPENSE},{name:"Loan Expense",value:Gy.LOAN_EXPENSE}],Income:[{name:"Income",value:Gy.REVENUE},{name:"Invoice Revenue",value:Gy.INVOICE_REVENUE},{name:"Payment In",value:Gy.PAYMENT_IN}],Transfer:[{name:"Bank Transfer In",value:Gy.TRANSFER_IN},{name:"Bank Transfer Out",value:Gy.TRANSFER_OUT}]},Jy={[Gy.EXPENSE]:"Expense",[Gy.REVENUE]:"Income",[Gy.TRANSFER_IN]:"Transfer",[Gy.TRANSFER_OUT]:"Transfer",[Gy.TAX_EXPENSE]:"Expense",[Gy.INVOICE_REVENUE]:"Income",[Gy.PAYMENT_IN]:"Income",[Gy.PAYMENT_OUT]:"Expense",[Gy.PAYROLL_EXPENSE]:"Expense",[Gy.BILL_EXPENSE]:"Expense",[Gy.LOAN_EXPENSE]:"Expense",[Gy.BANK_TRANSFER]:"Transfer",[Gy.LOAN_PAYMENT]:"Expense",[Gy.BILL_PAYMENT]:"Expense",[Gy.PAYOUT]:"Income",[Gy.TAX_PAYMENT]:"Expense",[Gy.INVOICE_PAYMENT]:"Income"},$y=Object.fromEntries(Object.entries(Jy).map(([e,t])=>[e,`Add ${t}`])),ex=Object.fromEntries(Object.entries(Jy).map(([e,t])=>[e,`Edit ${t}`])),tx=e=>{switch(e){case"EXPENSE":case"PAYROLL_EXPENSE":case"BILL_EXPENSE":case"LOAN_EXPENSE":case"LOAN_PAYMENT":case"BILL_PAYMENT":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":case"BANK_TRANSFER":return"TRANSFER";case"PAYMENT_IN":case"PAYMENT_OUT":case"PAYOUT":return"PAYMENT";default:return"GL_ACCOUNT"}},nx=e=>e===Gy.TRANSFER_IN||e===Gy.TRANSFER_OUT||e===Gy.BANK_TRANSFER;function rx({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(Xy,{transaction:e});switch(tx(e.type)){case"EXPENSE_CATEGORY":return I(Zy,{transaction:e,parentTransaction:t});case"TRANSFER":return I(Vf,{annotation:qy(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return ta({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(zy,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function ax({name:e}){return I(N,{children:e&&I(Gl,{children:e})})}const ox=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],ix=[{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 lx({onClick:e}){const t=hs(),{userRole:n}=b(Us),r=(e=>{switch(e){case"OWNER":default:return ox;case"ACCOUNTANT":return ix}})(n)||[];return I(ws,{children:I(sp,{children:r.map(({status:n,displayName:r})=>I(mp,{onClick:()=>(e(n),void t.close()),children:I(Ga,{children:r})},n))})})}const sx=Go(e=>p.createElement("svg",{width:13,height:15,viewBox:"0 0 13 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M0.743464 14.9687V0.96875H11.6465L9.22218 4.59886L11.6465 8.24166H0.743464",stroke:"#182428",strokeMiterlimit:10})),"Flag",{styleIconKey:"flag"}),cx=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M7.81985 0.464722V3.49919",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M7.81985 12.0008V15.0353",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M15.1051 7.75H12.0706",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M3.56907 7.75H0.534607",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M12.9702 2.59967L10.8227 4.74724",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M4.81706 10.7528L2.66949 12.9004",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M12.9702 12.9004L10.8227 10.7528",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M4.81706 4.74724L2.66949 2.59967",stroke:"black",strokeMiterlimit:10})),"Processing"),dx=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M7.49998 14.4244C11.3242 14.4244 14.4244 11.3242 14.4244 7.49998C14.4244 3.67573 11.3242 0.575562 7.49998 0.575562"}),p.createElement("path",{d:"M7.49997 0.575562C3.67572 0.575561 0.575547 3.67573 0.575547 7.49998C0.575547 11.3242 3.67572 14.4244 7.49997 14.4244",strokeDasharray:"2 2"}),p.createElement("path",{d:"M3.72124 7.50001L6.24041 10.0192L11.2787 4.98083"})),"Staged"),ux=v(void 0);function hx(){return b(ux)}const px=e=>["sdk/introspect",e];function gx(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 ki(r)}(n[2].accessToken,n[2].environment,e)}}function mx(){const e=hx();return br({queryKey:px(e),queryFn:gx(e)})}const vx={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",RECONCILIATION_STAGED:"RECONCILIATION_STAGED",RECONCILIATION_AWAITING:"RECONCILIATION_AWAITING"},bx=[{name:"Needs Review",value:[vx.USER_REVIEW_REQUIRED,vx.STAGED],icon:sx,variant:"warning"},{name:"Discrepancy",value:[vx.RECONCILIATION_DISCREPANCY],icon:Uu,variant:"danger"},{name:"Processing",value:[vx.AWAITING_MATCH],icon:cx,variant:"neutral"},{name:"Reconciled",value:[vx.RECONCILED],icon:Rm,variant:"success"}],fx=[{name:"Needs Review",value:[vx.USER_REVIEW_REQUIRED],icon:sx,variant:"warning"},{name:"Discrepancy",value:[vx.RECONCILIATION_DISCREPANCY],icon:Uu,variant:"danger"},{name:"Processing",value:[vx.AWAITING_MATCH,vx.ACCOUNTANT_REVIEW_REQUIRED,vx.STAGED],icon:cx,variant:"neutral"},{name:"Reconciled",value:[vx.RECONCILED],icon:Rm,variant:"success"}],yx=[{name:"Discrepancy",value:[vx.RECONCILIATION_DISCREPANCY],icon:Uu,variant:"danger"},{name:"Client Review",value:[vx.USER_REVIEW_REQUIRED],icon:sx,variant:"warning"},{name:"Needs Review",value:[vx.ACCOUNTANT_REVIEW_REQUIRED],icon:sx,variant:"warning"},{name:"Staged",value:[vx.STAGED],icon:dx,variant:"success"}],xx=[{name:"Needs Review",value:[vx.USER_REVIEW_REQUIRED,vx.ACCOUNTANT_REVIEW_REQUIRED],icon:sx,variant:"neutral"},{name:"Discrepancy",value:[vx.RECONCILIATION_DISCREPANCY],icon:Uu,variant:"neutral"},{name:"Processing",value:[vx.AWAITING_MATCH,vx.STAGED],icon:cx,variant:"neutral"},{name:"Reconciled",value:[vx.RECONCILED],icon:Rm,variant:"neutral"}];function Tx(){const{query:{data:e}}=mx();return t=e,"ACCOUNTANT"===t?.userRole?t.isDfy?yx:bx:t?.isDfy?fx:bx;var t}function Cx(e){return e in vx}const wx=(e,t)=>{const n=((e,t)=>{switch(t){case"ACCOUNTANT":return e===vx.ACCOUNTANT_REVIEW_REQUIRED;case"OWNER":return e===vx.USER_REVIEW_REQUIRED}})(e,t),r=(l=e,"OWNER"===t&&l===vx.ACCOUNTANT_REVIEW_REQUIRED||l===vx.RECONCILIATION_AWAITING),a=((e,t)=>"ACCOUNTANT"===t&&e===vx.USER_REVIEW_REQUIRED)(e,t),o=/* @__PURE__ */(e=>"RECONCILIATION_DISCREPANCY"===e)(e),i=/* @__PURE__ */(e=>"RECONCILED"===e)(e);var l;let s,c,d;return r?(s="Pending Review",c=cx,d="neutral"):a?(s="Pending User Review",c=cx,d="neutral"):n?(s="Needs Review",c=sx,d="warning"):o?(s="Discrepancy",c=Uu,d="critical"):i?(s="Reconciled",c=Rm,d="success"):(s="Processing",c=cx,d="neutral"),{text:s,variant:d,Icon:c}},kx=Xn(jn["review-status-selector-button"],On({width:"151px",justifyContent:"center"})),Ex=Xn(jn["review-status-dropdown-arrow"],On({display:"none"}));function Ax({status:e,transactionId:t}){const[n,r]=y(!1),{mutate:a}=Hy(),o=()=>{r(!1)},i=()=>{r(!n)},{userRole:l}=b(Us),{text:s,variant:c,Icon:d}=wx(e,l);return t&&((u=t).startsWith(hl.TRANSACTION_LINE_ITEM)||u.startsWith(hl.PROCESSOR_TRANSACTION))?null:R(us,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(ps,{children:e=>R(ty,{variant:c,...e,stylists:[kx],onClick:i,children:[I(pc,{Component:d}),I(Gl,{children:s}),I("div",{...Ex,children:I(ai,{Component:sh})})]})}),I(lx,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function Sx({status:e,transactionId:t}){return I(Ax,{status:e,transactionId:t},t)}function Ix(){return I(pc,{Component:Jo})}function Nx(){return I(Ix,{})}const Rx=e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M0.495239 8.15601H14.7767",strokeMiterlimit:10})),Dx=Go(Rx,"Dash"),Px=Xn(null,On({stroke:"icon.base.weak"}));function Lx({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(Dc,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(ms,{Component:Dx,stylists:[Px]})})})}function Mx({conversationId:e}){const{query:{data:t}}=Mi(e??null),{startPrefetch:n,cancelPrefetch:r}=Oi(),{startPrefetch:a,cancelPrefetch:o}=xl(),i=ir(t),l=i&&"READ"===t?.readStatus,s=x(()=>{ir(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=x(()=>{ir(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I(Lx,{hasConversation:i,hasUnread:!l})})}const Fx=Xn(jn["badge-chip"],Hf),Ox=Xn(null,Ma),Ux=Xn(null,ti),Bx=Xn(jn["neutral-badge"],zf),Vx=Xn(jn["highlight-badge"],Kf),Wx=Xn(jn["success-badge"],Yf),Hx=Xn(jn["warning-badge"],Zf),jx=Xn(jn["critical-badge"],Qf);function zx({type:e,children:t}){let n;switch(e){case"critical":n=jx;break;case"warning":n=Hx;break;case"neutral":n=Bx;break;case"success":n=Wx;break;case"highlight":n=Vx}const r=$n([Fx,Ox,n,Ux]);return I("div",{...r,children:t})}function qx({reviewStatus:e}){const{userRole:t}=b(Us),{variant:n,Icon:r}=wx(e,t);return I(zx,{type:n,children:I(pc,{Component:r})})}const Kx=On({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),_x=On({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),Yx=On({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),Xx=On({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),Zx=On({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),Gx=On({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function Qx({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=Yp(e.children);return`${t}: ${n}`}switch(tx(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${qy(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void ta({error:new Error("Should not get here. Payout without line items."),severity:"error"});default:return e.glAccount?.name}}(t),r=void 0!==e.getParentRow();return R("div",{className:Kx,children:[r&&I(pc,{Component:Tf}),R("div",{className:Zx,children:[R("div",{className:Yx,children:[t.iconUrl?I("img",{src:t.iconUrl,className:Gx,alt:void 0,width:24,height:24}):I("span",{className:Gx}),I(Ga,{children:t.description})]}),R("div",{className:Xx,children:[I(qx,{reviewStatus:t.reviewStatus}),I(Ja,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:_x,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(Mf,{row:e}),I(ai,{Component:Jo})]})]})}const Jx=Go(Rx,"Minus");function $x({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(mf,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?Jx:Nu})}const eT=G(),tT=[eT.display({id:Zt.SELECT,header:({table:e})=>I($x,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(mf,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),eT.accessor("date",{id:Zt.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(Xl,{children:I(wf,{transaction:e.row.original,isChild:t})})},header:()=>I(Ms,{columnName:"Date",sortDef:"DATE",sortAscDisplay:ef,sortDescDisplay:tf}),size:130,maxSize:144}),eT.accessor("description",{id:Zt.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(Xl,{children:I(If,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(Ms,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:nf,sortDescDisplay:rf}),size:180}),eT.accessor("amount",{id:Zt.AMOUNT,cell:e=>I(Xl,{alignVariant:"flexEnd",children:I(Mf,{row:e.row})}),header:()=>I(Ms,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:af,sortDescDisplay:of,align:"right"}),size:130,maxSize:130}),eT.accessor("category.id",{id:Zt.CATEGORY,cell:({row:e})=>I(rx,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(Ms,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),eT.accessor(e=>e.classSegments[0]?.id,{id:Zt.CLASS_SEGMENT,cell:e=>I(Xl,{children:I(ax,{name:e.row.original.classSegments[0]?.name})}),header:()=>I(Ms,{columnName:"Business"}),size:130}),eT.accessor("reviewStatus",{id:Zt.REVIEW_STATUS,cell:e=>I(Xl,{children:I(Sx,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(Ms,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:lf,sortDescDisplay:sf,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),eT.display({id:Zt.COMMENTS,cell:e=>{const t=e.row.original;return I(Xl,{alignVariant:"center",children:I(Mx,{conversationId:t.conversation?.id})})},header:()=>I(Ms,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),eT.display({id:Zt.EXPAND,cell:()=>I("div",{className:On({paddingRight:"20px"}),children:I(Nx,{})}),size:40,maxSize:60})],nT=eT.display({id:"MOBILE",cell:e=>I(Qx,{row:e.row})}),rT=v(!0);function aT(){return b(rT)}const oT=[];function iT({transactions:e,columns:t}){const n=aT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(Zt).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[nT]:(i=t)?tT.filter(e=>i.includes(e.id)):tT;var i;return Q({data:e??oT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??oT.length,columns:o,getCoreRowModel:J(),getRowCanExpand:e=>e.original.children.length>0,getSubRows:e=>e.children.map(e=>{return t=e,{...t,iconUrl:t.iconUrl??"",reconciliationMatch:null,rule:null,tax:{paymentInfo:null},customData:null,children:[],attachments:[],suggestedCategories:[],conversation:null,status:"ACTIVE"};var t}),getExpandedRowModel:$(),paginateExpandedRows:!1,getRowId:e=>e.id,state:{columnOrder:r,columnVisibility:a}})}const lT=[Zt.COMMENTS,Zt.DATE,Zt.DESCRIPTION,Zt.AMOUNT,Zt.CATEGORY,Zt.REVIEW_STATUS];function sT({Component:e,stylists:t}){return I(e,{stylists:[Xn(jn["xx-large-icon"],jn.icon),...t??[]],size:50})}function cT(){return R(N,{children:[I(sT,{Component:Rm}),I(Ga,{wrap:"wrap",children:"All caught up"}),I(Ja,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}const dT=Xn(jn["button-warning"],On({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"}}));function uT({children:e,stylists:t=[],...n}){return I(Ol,{stylists:[dT,...t],...n,children:e})}function hT(){const{linkPlaid:e,loading:t}=hb();return I(uT,{onClick:()=>e({plaidEvent:Gv,message:"Plaid Link button pressed"}),disabled:t,children:I(Ga,{children:"Link your bank"})})}function pT(){return R(N,{children:[I(sT,{Component:Tg}),I(nr,{children:"Link Bank Account"}),I(Ja,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(hT,{})]})}const gT=On({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function mT(){return R(N,{children:[I("div",{className:gT,children:I(sT,{Component:cx})}),I(nr,{children:"Transactions are being processed"}),I(Ja,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}function vT(e,t=500,n){const r=g();!function(e){const t=g(e);t.current=e,T(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const a=m(()=>{const a=s(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 T(()=>{r.current=s(e,t,n)},[e,t,n]),a}const bT=On({animation:"linear 1s spin infinite"}),fT={background:"conic-gradient(from 90deg,rgba(255, 255, 255, 0) 0deg,rgba(148, 216, 232, 1) 360deg)",height:"100%",width:"100%",opacity:1};function yT({size:e}){const t=e??15;return R("svg",{className:bT,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",{style:fT})})})}),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 xT=Xn(jn["filter-bar"],On({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"}})),TT=Xn(jn["filter-search-bar"],On({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),CT=Xn(null,On({stroke:"icon.base",flexShrink:0,marginRight:"15px"})),wT=Xn(null,On({border:"none",outline:"none",background:"transparent",fontSize:"lg",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px",letterSpacing:"0.96px",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"}}));function kT({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const[a,o]=y(t),[i,l]=y(!1);T(()=>{o(t)},[t]);const s=vT(x(t=>{e(t),l(!1)},[e,l]),280),c=On({width:25});return I("div",{...xT,children:R("div",{...TT,children:[I("div",{className:c,children:n||i?I(yT,{}):I(pc,{stylists:[CT],Component:bm})}),I("input",{...wT,value:a,onChange:e=>{return t=e.target.value,o(t),i||l(!0),void s(t);var t},placeholder:r,onKeyDown:Ju})]})})}const ET=On({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"});function AT({formattedDate:e,formattedSum:t}){return R("div",{className:ET,children:[I(Ga,{wrap:"wrap",children:e}),I(Ga,{wrap:"wrap",children:t})]})}function ST(e,t){return Gi("BankTransactionFormRouter",{routeProps:{transactionId:e,initialTab:t}})}function IT(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=nx(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();ST(e?.original.id??t.original.id,"conversation")}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();ST(e?.original.id??t.original.id)}}function NT({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=dl(),a=x(()=>n({id:e.original.id}),[n,e.original]);return I(Zi,{rowData:e,onMouseEnter:a,onMouseLeave:r,onCellClick:IT,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 RT({rows:e}){const t=m(()=>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=Xa(_d(r.netSumCents)),r.rows.push(n))}else{const r=xt(e);t.set(e,{date:e,formattedDate:r?bt(r):e,netSumCents:n.original.amount,formattedSumDollars:Xa(_d(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>R(S,{children:[I(AT,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(NT,{rowData:e},e.id))]},e.date))})}function DT({table:e,hasSelect:t}){const n=aT();return I(ji,{children:n?I(RT,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(NT,{rowData:e,hasSelect:t},e.id))})}function PT(e){return e?"Search":"Search transactions..."}function LT(e,t){return e.get(t)??[]}function MT(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function FT(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function OT({buttonText:e,onButtonClick:t}){return R(N,{children:[I(dc,{Component:Em}),I(Ga,{children:"No results"}),I(Ja,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(Rs,{onClick:t,children:e})]})}const UT=On({xl:{minWidth:"900px"}}),BT=On({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function VT({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){const c=function({transactions:e}){return function({transactions:e,columns:t}){return iT({transactions:e,columns:t?[...t,Zt.EXPAND]:void 0})}({transactions:e,columns:lT})}({transactions:i}),{query:{data:d},isFilling:u}=ll({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=aT(),p=!or(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(OT,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(cT,{})):a=I(mT,{}):a=I(pT,{}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:UT,children:[I("div",{id:jo}),R(ri.Provider,{value:o,children:[R(Gn,{children:[I(nr,{children:"Transactions for review"}),I(yc,{children:I(ci,{})})]}),I(ql,{dashboard:"businessOwnerDashboard",children:r?I(mi,{}):R(N,{children:[!h&&I("div",{className:BT,children:I(kT,{placeholder:PT(h),searchTerm:l,onChange:s,isFetching:a})}),I(Kl.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(Wi,{headerGroups:c.getHeaderGroups()})}),or(g)?I(DT,{table:c,hasSelect:!1}):I(sc,{children:g})]})})]})]})}function WT(){const[e,t]=y(""),{sortInstance:n,setSortInstance:r,apiSort:a}=cf(),o=m(()=>({...qo,search:e.length>0?e:void 0}),[e]),{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=ll({filter:o,sort:a,limit:10}),d=i?.data??_o,{hasPlaidLinkedBankAccount:u,isFilling:h}=Np();return I(VT,{sortInstance:n,setSortInstance:r,isFilling:s||h,isFetching:l,paginationControls:c,transactions:d,hasLinkedAccount:u??!1,searchTerm:e,onSearchChange:t})}const HT=Xn(jn["button-table-header"]),jT=On({height:{xl:"auto",base:"44px"}});function zT(){const e=nu({select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:jT,children:R(Bl,{onClick:()=>{Gi(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[HT],children:[I(ai,{Component:vd}),I(as,{children:"Banks & Integrations"})]})})}const qT=Xn(null,On({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function KT({children:e}){return I("div",{...qT,children:e})}const _T=Xn(jn["button-action"],On({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"}}));function YT({children:e,stylists:t=[],...n}){return I(Ol,{stylists:[_T,...t],...n,children:e})}const XT=Go(e=>p.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M4.66504 7.91458H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M4.66504 10.6418H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M12.8125 3.95627V13.9937H2.1875V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10}),p.createElement("path",{d:"M12.8125 3.95627V4.54998H9.26877V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10})),"Doc"),ZT=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:uc,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:sx,buttonText:"Review"};case"LINK_BANK":return{Icon:Tg,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:Tg,buttonText:"Fix"};case"RELINK":return{Icon:Tg,buttonText:"Relink"};case"CHAT":return{Icon:Uu,buttonText:"Learn more"};case"ONBOARDING_FORM":return{Icon:XT,buttonText:"Complete"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:Rm,buttonText:""};default:return{Icon:Uu,buttonText:""}}},GT=Xn(jn["banner-title"],On({display:"flex",alignItems:"center",gap:"8px"})),QT=Xn(jn["banner-icon"],On({width:"20px",height:"20px"}));function JT({title:e,type:t}){const{Icon:n}=ZT(t);return R("div",{...GT,children:[I(pc,{Component:n,stylists:[QT]}),I(Ga,{wrap:"wrap",children:e})]})}const $T=Xn(null,On({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:{base:"4px",xl:"5px"},flex:{xl:"1 1 0"},minWidth:{xl:"200px"},width:"100%"}));function eC({title:e,description:t,type:n}){return R("div",{...$T,children:[I(JT,{title:e,type:n}),I(Ja,{wrap:"wrap",children:t})]})}const tC=Xn(jn["banner-button"],On({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}})),nC=Xn(jn["banner-button-text"]),rC=Xn(jn["banner-button-icon"]);function aC({priority:e,type:t,handleClick:n}){const{buttonText:r}=ZT(t),{Button:a}=(e=>{switch(e){case"URGENT":return{Button:Sd};case"HIGH":return{Button:uT};case"MEDIUM":return{Button:YT};default:return{Button:Ol}}})(e);return R(a,{onClick:n,stylists:[tC],children:[I(Ga,{stylists:[nC],children:r}),I(ai,{stylists:[rC],Component:Jo})]})}const oC=Wn({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"}}}}),iC={HIGH:jn["banner-high"],MEDIUM:jn["banner-medium"],LOW:jn["banner-low"],URGENT:jn["banner-urgent"]};function lC({task:e,handleClick:t}){const{name:n,description:r,shortDescription:a,type:o,priority:i}=e,l=aT()?a:r,s=Xn(jn.banner,iC[i],oC({priority:i}));return R("div",{...s,children:[I(eC,{title:n,description:l,type:o}),I(aC,{priority:i,type:o,handleClick:t})]})}function sC(e,t){Gd({message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}})}function cC(e,t,n,r,a){return()=>qd({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function dC(e){const{mutateAsync:t}=cb(),n=ur(),r=vr(),{apiPartnerName:a}=b(Us),o=aT(),{linkPlaid:i,loading:l,hasOnPlaidLinkOverride:s}=hb(),{linkPlaid:c,loading:d}=hb(),u=lu({apiErrorType:e?.apiErrorType,apiErrorCode:e?.apiErrorCode});if(or(u)||or(e))return null;const h="ITEM_LOCKED"===e.apiErrorCode;switch(u.buttonType){case au.DELETE_OR_RELINK:case au.RELINK:return l?null:(g=i,m=a,v=o,{alert:cC(u,(p=e).apiInstitutionName,m,v,[{key:Rd,label:"Cancel"},{key:Pd,label:"Relink",type:jd}]),actions:{success:()=>{g({plaidEvent:Qv,plaidItemId:p.id,apiAccessToken:p.apiAccessToken,apiErrorCode:p.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case au.UNLINK_RELINK:return d?null:function(e,t,n,r,a,o,i){return{alert:cC(e,t.apiInstitutionName,a,o,[{key:Rd,label:"Cancel"},{key:au.CHAT,label:"Chat"},{key:Pd,label:"Unlink and Relink",type:jd}]),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"})},[au.CHAT]:()=>sC(t.apiInstitutionName,t.apiErrorCode)}}}(u,e,t,c,a,o,s);case au.OPEN_BANK:return l?null:function(e,t,n,r,a,o,i,l){return{alert:cC(e,t.apiInstitutionName,i,l,[{key:Rd,label:"Cancel"},{key:au.CHAT,label:"Chat"},{key:au.RELINK,label:"Relink"},{key:Pd,label:"Go To Bank",type:jd}]),actions:{success:async()=>{const e=await Ad({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;window.open(o,"_blank")},[au.RELINK]:()=>{o({plaidEvent:Qv,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[au.CHAT]:()=>sC(t.apiInstitutionName,t.apiErrorCode)}}}(u,e,h,n,r,i,a,o);case au.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:cC(e,t.apiInstitutionName,a,o,[{key:Rd,label:"Cancel"},{key:Pd,label:"Unlink",type:jd}]),actions:{success:()=>{i?r({plaidEvent:Jv,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(u,e,t,c,a,o,s);default:return function(e,t,n,r,a,o){return{alert:cC(e,t,a,o,[{key:Rd,label:"Cancel"},{key:au.CHAT,label:"Chat",type:jd}]),actions:{[au.CHAT]:()=>sC(t,r)}}}(u,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var p,g,m,v}const uC=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){ta({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function hC({task:e}){const{linkPlaid:t,loading:n}=hb(),{linkPlaid:r,loading:a}=pb(),o=dC(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type&&!1,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&or(o);return i||l||s?null:I(lC,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:Qv,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?(ea("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Gv,message:"Plaid Banner Link Bank pressed"})):ir(o)&&(ea("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),uC(o))}})}const pC=Xn(jn.banner,jn["banner-default"],oC({priority:"DEFAULT"}));function gC(){const e=aT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...pC,children:I(eC,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const mC=Xn(jn.banner,jn["banner-default"],oC({priority:"DEFAULT"}));function vC(){const e=aT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...mC,children:I(eC,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const bC=On({width:"100%",height:72,minWidth:"300px"});function fC(){return R(N,{children:[I(Eo,{styles:bC}),I(Eo,{styles:bC}),I(Eo,{styles:bC})]})}function yC({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(fC,{}):a?e.map(e=>{if(void 0===Ry[e.type]||"ONBOARDING_FORM"===e.type&&or(e.actionLink))return null;if("LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(au).includes(e.type))return I(hC,{task:e},e.id);const n=e.actionLink,r=ir(n)?()=>window.open(n,"_blank"):()=>t(e.type);return I(lC,{task:e,handleClick:r},e.id)}):I(n?vC:gC,{})}function xC(){const{taskBanners:e,isFilling:t}=function(){const{query:{data:e},isFilling:t}=(n={select:e=>{return or(t=e)||or(t.data)?[]:[...t.data].sort((e,t)=>Py[e.priority]-Py[t.priority]);var t}},r=Ly,br({...n,queryKey:r?Dy(r):["tasks",{}],queryFn:My}));var n,r;const{query:{data:a},isFilling:o}=Rp(),{query:{data:i},isFilling:l}=kd({select:e=>({...e,data:e?.data?.filter(({status:e,apiErrorType:t,apiErrorCode:n})=>"ACTIVE"===e&&t&&n)})});return{taskBanners:m(()=>{let t=[];const n=i?.data;n&&(t=n.map(e=>Iy(e)));let r=[];!1===a?.hasPlaidLinkedBankAccount&&(r=[Sy]);const o=e??[];return[...t,...r,...o]},[e,a,i]),isFilling:t||o||l}}(),n=ul(),{query:{data:r}}=Rp();return R(N,{children:[R(Gn,{children:[I(nr,{children:"Action Items"}),I(zT,{})]}),I(KT,{children:I(yC,{taskBanners:e,handleScrollAction:Fy,isWaitingForPlaidItemAccountsSync:!n&&!0===r?.plaidItemAccountsReadyToSync,isFilling:t})})]})}const TC=Xn(jn["business-owner-dashboard"],On({gap:10,display:"flex",flexDirection:"column",width:"100%",maxWidth:1440})),CC=On({display:"flex",width:"100%",justifyContent:"center"}),wC={status:{in:["ACTIVE","INACTIVE"]}};function kC({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=y(void 0);return{sortInstance:e,setSortInstance:x(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Si)??!1,n=(e.direction&&e.direction in Ii)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:i,paginationControls:l}=Pi({limit:10,sort:a,filter:Ko}),s=o?.data??Yo,c=aT(),{query:{data:d}}=Rp(),u=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=ll({filter:wC,limit:1});return(e?.data?.length??0)>0}(),d),h=/* @__PURE__ */new Date,p={month:h.getMonth(),year:h.getFullYear()};const[g,m]=cs(p,e,t),v=(b=g.month,{beginDate:Xe((f=g.year)-1,b+1,1),endDate:Xe(f,b+1,0)});var b,f;return I("div",{className:CC,children:R("div",{...TC,children:[I(xC,{}),!c&&R(N,{children:[I($b,{period:g,handleDateChange:e=>{var t,n;(t=p).year===(n=e).year&&n.month>t.month||n.year>t.year||m(e)},todayPeriod:p,showSamples:u,showLinkAccountButton:u&&!d?.plaidItemAccountsReadyToSync}),I(Gn,{children:I(nr,{children:"Financial Summary"})}),I(Qc,{isSample:u,period:g})]}),!c&&I(N,{children:I(Wo,{filter:v,isSample:u})}),I(Cc,{sortInstance:n,setSortInstance:r,conversations:s,paginationControls:l,isFilling:i,isMobile:c}),I(WT,{})]})})}function EC(e){return I(ra||N,{children:e.children})}function AC({children:e}){return I(EC,{children:I("div",{className:qn(jn.component),children:e})})}function SC(e){return I(AC,{children:I(kC,{...e})})}const IC=On({display:"flex",flexDirection:"column"});function NC({task:e}){return I("div",{className:IC,children:I(hC,{task:e})})}const RC=On({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),DC=On({width:"80px",height:"12px"}),PC=On({width:"150px",height:"16px"}),LC=On({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),MC=On({userSelect:"none",cursor:"pointer"});function FC(){return R("div",{className:LC,children:[R("div",{className:MC,children:[R("div",{className:RC,children:[I(Eo,{styles:PC}),I(Eo,{styles:DC})]}),R("div",{className:RC,children:[I(Eo,{styles:PC}),I(Eo,{styles:DC})]})]}),I("div",{className:MC,children:R("div",{className:RC,children:[I(Eo,{styles:PC}),I(Eo,{styles:DC})]})})]})}const OC=On.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function UC({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=aT(),a=n||r?Rs:Bl;return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(a,{extraClassNames:[OC],popupTriggerProps:e,children:I(ai,{Component:Em,stylists:t})})}),I(ws,{children:e})]})}const BC=Go(e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},p.createElement("path",{d:"M14.075 2.10645H0.924988V5.09395H14.075V2.10645Z",strokeMiterlimit:10}),p.createElement("path",{d:"M14.075 5.09375H0.924988V14.0625H14.075V5.09375Z",strokeMiterlimit:10}),p.createElement("path",{d:"M3.3125 8.08105H4.5125",strokeMiterlimit:10}),p.createElement("path",{d:"M5.70624 8.08105H6.89999",strokeMiterlimit:10}),p.createElement("path",{d:"M8.10004 8.08105H9.29379",strokeMiterlimit:10}),p.createElement("path",{d:"M10.4875 8.08105H11.6875",strokeMiterlimit:10}),p.createElement("path",{d:"M10.4875 11.0752H11.6875",strokeMiterlimit:10}),p.createElement("path",{d:"M3.3125 11.0752H4.5125",strokeMiterlimit:10}),p.createElement("path",{d:"M5.70624 11.0752H6.89999",strokeMiterlimit:10}),p.createElement("path",{d:"M8.10004 11.0752H9.29379",strokeMiterlimit:10}),p.createElement("path",{d:"M3.91254 0.3125V3.3",strokeMiterlimit:10}),p.createElement("path",{d:"M7.5 0.3125V3.3",strokeMiterlimit:10}),p.createElement("path",{d:"M11.0875 0.3125V3.3",strokeMiterlimit:10})),"Date"),VC=On({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),WC=Xn(null,VC);function HC({children:e,clickHandler:t}){const n=hs();return t||(t=()=>{n.close()}),I(me,{lockScroll:!0,...WC,onClick:t,children:e})}const jC=Wn({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 zC({width:e="lg",children:t}){const n=Xn(jn["modal-popup"],jC({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const qC=On({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),KC=On({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),_C=On({display:"flex",flexDirection:"column",gap:"12px"}),YC=On({display:"flex",flexDirection:"row",gap:"10px"}),XC=On({display:"flex",flexDirection:"column",gap:"10px"}),ZC=({acknowledged:e,setAcknowledged:t})=>R("div",{className:_C,children:[I(Gl,{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:YC,children:[I(pf,{checked:e,onClick:()=>t(!e)}),I(Gl,{wrap:"wrap",children:"I understand."})]})]});function GC({bankAccounts:e}){const{apiPartnerName:t}=b(Us),n=e.reduce((e,t)=>{const n=xt(t.tranStartDate||""),r=xt(e.tranStartDate||"");return n&&r&&vt(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutate:n}=fu();return Ev({defaultValues:{tranStartDate:t},onSubmit:t=>{var r,a;qd({title:"Start Date Updated",body:R("div",{className:XC,children:[I(Gl,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(Gl,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:Pd,type:jd}]}),n((r=e,a=t.value.tranStartDate,r.map(e=>({id:ml(e.id),tranStartDate:a,duplicateBankAccountIds:[]}))))}})})(e,n),a=hs(),o=()=>{a.close()},[i,l]=y(!1),{query:{data:s}}=kd(),c=s?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",d=xt(e.reduce((e,t)=>{const n=xt(t.tranMinStartDate||""),r=xt(e.tranMinStartDate||"");return n&&r&&vt(n,r)?t:e}).tranMinStartDate||""),u=1===e.length?`${t} can pull your transactions for your ${Zd(e[0]?.name,e[0]?.mask)} account dating back to ${At(d)}.`:`${t} can pull your transactions for your ${c} account(s) dating back to ${At(d)}.`;return R("form",{className:qC,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit(),a.close()},children:[I(Ga,{children:"Set Bank Transaction Start Date"}),I(Gl,{wrap:"wrap",children:u}),I(Gl,{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:d,editable:!0})}),I(r.Subscribe,{selector:e=>e,children:e=>{const t=xt(e.values.tranStartDate||""),r=xt(n),a=t&&r&&vt(t,r);return R(N,{children:[e.isDirty&&a&&I(ZC,{acknowledged:i,setAcknowledged:l}),R("div",{className:KC,children:[I(Iv,{showIcon:!1,onClick:o}),I(Ru,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!i})]})]})}})]})}function QC({bankAccounts:e}){return R(us,{placement:"right-start",modal:!0,children:[I(ps,{children:e=>R(mp,{...e,children:[I(pc,{Component:BC}),I(Ga,{children:"Edit Start Date"})]})}),I(om,{children:I(HC,{children:I(zC,{width:"sm",children:I(GC,{bankAccounts:e})})})})]})}const JC=Go(e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},p.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}),p.createElement("path",{d:"M2.88599 12.625L12.6672 2.84375"})),"Stop"),$C=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M5.68701 1.1875L5.68701 14.5",strokeMiterlimit:10}),p.createElement("path",{d:"M3.26538 3.60911L5.68699 1.1875L8.10859 3.60911",strokeMiterlimit:10}),p.createElement("path",{d:"M5.68701 7.24146L5.68701 2.39825",strokeMiterlimit:10})),"Combine"),ew={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 tw(e){const{apiPartnerName:t,unitIntegrationBankName:n}=b(Us);return"UNIT"===e?n??t??"Unit":ew[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const nw=On({display:"flex",flexDirection:"column",gap:"16px"}),rw=Xn(null,On({color:"brand.danger"}));function aw({integration:e,accounts:t}){const{mutate:n}=cb(),r=hs(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=hb(),{query:{data:l}}=(s=e.id,wd({},{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}}=Lp(e.id),u=d?.data,h=tw(e.apiName),p="PLAID"===e.apiName;return R(sp,{children:[p&&!o&&R(mp,{onClick:()=>(a({plaidEvent:Qv,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(pc,{Component:Al}),I(Ga,{children:"Add Account"})]}),p&&u&&I(QC,{bankAccounts:u}),ze(t)&&R(mp,{onClick:()=>jv({plaidItemAccounts:t}),children:[I(pc,{Component:$C}),I(Ga,{children:"Merge Accounts"})]}),p&&R(mp,{onClick:()=>(async()=>{let o;var l;o=ze(t)?await(async e=>qd({title:"Remove Institution",body:I("div",{className:nw,children:I(Gl,{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:Rd,label:"Cancel"},{key:Dd,label:"Remove",type:zd}]}))(e.apiInstitutionName??h):await(async e=>qd({title:"Remove Institution",body:I("div",{className:nw,children:I(Gl,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Rd,label:"Cancel"},{key:Dd,label:"Remove",type:zd}]}))(h),r.close(),o===Dd&&(p&&i?a({plaidEvent:Jv,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(pc,{stylists:[rw],Component:JC}),I(Ga,{stylists:[rw],children:"Delete Connection"})]})]})}const ow=On({userSelect:"none"});function iw({children:e}){return I("div",{className:ow,children:e})}const lw=On({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 sw({children:e}){return I("div",{className:lw,children:e})}const cw=Xn(jn.badge,jf),dw=Xn(null,Ma),uw=Xn(null,ti),hw=Xn(jn["neutral-badge"],qf),pw=Xn(jn["highlight-badge"],_f),gw=Xn(jn["success-badge"],Xf),mw=Xn(jn["warning-badge"],Gf),vw=Xn(jn["critical-badge"],Jf);function bw({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"critical":o=vw;break;case"warning":o=mw;break;case"neutral":o=hw;break;case"success":o=gw;break;case"highlight":o=pw}const i=$n([cw,dw,o,uw]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function fw({plaidItem:e}){const t=dC(e);return R(bw,{type:"critical",onClick:n=>{n.stopPropagation(),t&&(ea(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),uC(t))},disabled:or(t),children:[I(pc,{Component:Uu}),I(Ja,{children:"Fix Bank Error"}),I(ai,{Component:Jo})]})}const yw=Wn({base:{padding:"16px 16px 16px 24px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",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"}}}}}),xw=On({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function Tw({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=Bn(yw({active:a}),ti);return R("button",{className:l,onClick:t=>{t.stopPropagation(),Gi("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:xw,children:[I(pc,{Component:i?Tf:Tg}),I(wg,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(pc,{Component:Jo})]})}const Cw=On({display:"flex",flexDirection:"column",gap:"4px"}),ww=On({display:"flex",alignItems:"center",gap:"8px"}),kw=Xn(null,On({color:"brand.primary.weak"})),Ew=On({overflow:"hidden"});function Aw({integration:e,isCompact:t=!1}){const{query:{data:n}}=Lp(e.id),r=n?.data,a="PLAID"===e.apiName,o=tw(e.apiName);if(!ze(r))return null;const i=e.iconUrl?eg(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(iw,{children:[R(sw,{children:[R(hm,{children:[I(dc,{Component:i??Tg}),R("div",{className:Cw,children:[I(Gl,{children:e.apiInstitutionName??o}),I(Ja,{children:Xv(r)})]})]}),R("div",{className:ww,children:[a&&ir(e.apiErrorCode)&&I(fw,{plaidItem:e}),I(UC,{stylists:[kw],shouldUseButtonDiscreteStyles:t,children:I(aw,{integration:e,accounts:r})})]})]}),I("div",{className:Ew,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(Tw,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Zv(t),active:n,integration:e},t.id)})})]})}const Sw=eg("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAGttJREFUeAHFnFuMXVd5x9c5c/GMZxxf4sTxNfcmJDSQFGhSkGhRCFChSqWIoqqtkJoXitQHXoqqVkKVWlFVQuIBIdo8oD4g1BYqFVTahLqg0JYSriExARInsXGwncSJPb7N7Uz/v/+3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iJ8QFW6hsy+FESkEqCnVjllhsH+RSCtJOFCAVjrQBTprI4SYnQiiTGibxO8VSFsEHQuOUvE8IhYXa2tpDpMYXbJDjLXKhYH55+YDDnChC1NQcLRW+zu0kSyzMBwr/5bruV50og44v2eWL+IlcaFhNuzROHNDVrT5RaFjD7TRLzDNzwVsppb7pxAmuW3MCLdLZIGOkhU7XRFBCcOII13WPEQpf5XaiJbYjLlwU2gZ2oBN/jfNskDFSQhcaXoz8hD5fuK57qF0nwyhlrocoJk7CUEa13HZbCTnFlWteoY/WImoxQSW3UkEj96e45Khws/SyVU4pgKowpIZ6dqeXChUuq9L6+04pgWqMhIbRdsjEgAUGk6h2zylVCJ39lVD4PvunPGEUGjaEXuYc5fUyW4KNxROXgsfolkruuEYOMuNdJhT+h/vTH1/COqFRcscx0qBTw7ScQfcf8AcsHhTkKwWj6PQ9d/xiA5GpOYlSvf0SgB2Ji0rVp1W42W9zxyu2EJ53phUaflFcCp6nu9u445MYSJ09lzqplnJGEwp20Z2oKYXncMcjsahE/B6tn5XSHE1o3EHrWe01+rQIqkrDw1qpYSm3AAKjwlXCw6F2yYEZUmfPFxrujUsrQtlRtlLwoVAwNu/GUhbhgXoVphV2aV60fZdbLDJvwjvUKTblZS91Xfdgq5mYIN0Nz6DGXtRQIlJXHCholApmC+VdV6mqT+f2k0URUFdXd5C/5KGhD2ULoeBlunsheDHhZqnhH/57auhDoidbbFBLA2W0oJvyvItTGnv4VyAomEgNBppFsYrmRFJhwz5ipJ8VNjT/btXuv4Wn6X+FwhH0WiIDFzXfxJzc4r488H9C0rMPxyn4LQAAAABJRU5ErkJggg==","Bank"),Mw={GUSTO:Rw,FRESHBOOKS:Dw,FRESHBOOKS2:Dw,SHOPIFY:Nw,STRIPE:Sw,SQUARE:Iw,UBER:Pw};function Fw(e){return Mw[e]??Lw}const Ow=On({display:"flex",flexDirection:"column",gap:"4px"});function Uw({integration:e,isCompact:t}){const n=tw(e.apiName),r=function(e){if(e)return`Last synced ${Et(e)}`}(e.lastSyncedDate),a=Fw(e.apiName);return I(iw,{children:R(sw,{children:[R(hm,{children:[I(dc,{Component:a}),R("div",{className:Ow,children:[I(Gl,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(Ja,{intent:"normal",children:r})]})]}),I(UC,{shouldUseButtonDiscreteStyles:t,children:I(aw,{integration:e})})]})})}const Bw=On({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),Vw=On.raw({color:"typography.base.weak"}),Ww=On({overflow:"hidden"});function Hw({manualBankAccounts:e,isCompact:t=!1}){const n=aT(),r=t||n?Rs:Bl;return R(iw,{children:[R("div",{className:Bw,children:[I(Gl,{extraClassNames:[Vw],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>Gi("BankAccountForm"),active:!1,children:I(ai,{Component:Al})})]}),I("div",{className:Ww,children:e.map(e=>I(Tw,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const jw=Xn(jn["selector-row"],Bn(On(Ll,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),ei)),zw=On({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),qw=On({display:"flex",alignItems:"center",gap:"8px"}),Kw=On({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),_w=Xn(null,On({width:"20px",height:"20px"}));function Yw(){const{linkPlaid:e,loading:t}=pb();return I("button",{...jw,disabled:t,onClick:()=>{ea("Add New Connection button pressed"),e({plaidEvent:Gv,message:"Add New Connection button pressed"})},children:R("div",{className:zw,children:[R("div",{className:qw,children:[I(dc,{stylists:[_w],Component:Tg}),R("div",{className:Kw,children:[I(Gl,{children:"Connect your bank"}),I(Ja,{children:"Find your banking institution with Plaid"})]})]}),I(pc,{Component:Jo})]})})}const Xw=On({paddingInline:"16px",paddingBottom:"8px"}),Zw=On.raw({color:"typography.base.weak",fontWeight:"label"});function Gw({title:e,children:t}){return R("div",{children:[I("div",{className:Xw,children:I(Gl,{extraClassNames:[Zw],children:e})}),t]})}const Qw=On({minWidth:"100%",height:"45px"});function Jw(){return R(N,{children:[I(Eo,{styles:Qw}),I(Eo,{styles:Qw}),I(Eo,{styles:Qw})]})}const $w=Xn(jn["selector-row"],Bn(On(Ll,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ei)),ek=On({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),tk=On({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),nk=On({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function rk({integration:e}){const{linkPlaid:t,loading:n}=hb(),r="PLAID"===e.apiName,a=tw(e.apiName),o=e.iconUrl?eg(e.iconUrl,"Institution Icon"):Tg;return I("button",{...$w,disabled:n||!r,onClick:()=>{ea(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:Qv,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:ek,children:[R("div",{className:tk,children:[I(dc,{Component:o}),I(Gl,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:nk,children:[I(ai,{Component:vd}),I(Gl,{children:"Relink"})]})]})})}const ak=e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:224,height:64,viewBox:"0 0 224 64",...e},p.createElement("g",{fill:"none",fillRule:"nonzero"},p.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"}),p.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"}),p.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"}),p.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"}),p.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"}))),ok=Xn(jn["selector-row"],Bn(On(Ll,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ei)),ik=On({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),lk=On({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),sk=On({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),ck=On({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"},letterSpacing:"0.84px",padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),dk=On({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function uk(){const e=hs(),{mutateAsync:t}=ob(),[n,r]=y("");return R("div",{className:lk,children:[I(Ga,{children:"Enter your shop name"}),I("div",{className:dk,children:I(ak,{})}),I(Gl,{children:"Please enter the name of your shop below."}),I("input",{className:ck,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:sk,children:[I(Iv,{showIcon:!1,onClick:()=>{e.close()}}),I(Nd,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(Ga,{children:"Connect"})})]})]})}function hk(){const e=Fw("SHOPIFY")??vd;return R(us,{placement:"bottom",modal:!0,children:[I(ps,{children:t=>R("button",{...ok,...t,children:[R("div",{className:ik,children:[I(dc,{Component:e}),I(Gl,{children:"Shopify"})]}),I(pc,{Component:Jo})]})}),I(om,{children:I(HC,{children:I(zC,{width:"sm",children:I(uk,{})})})})]})}const pk=Xn(jn["selector-row"],Bn(On(Ll,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ei)),gk=On({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function mk({apiName:e}){const{mutateAsync:t}=ob(),n=tw(e);if("SHOPIFY"===e)return I(hk,{});const r=Fw(e)??vd;return R("button",{...pk,onClick:async()=>{const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:gk,children:[I(dc,{Component:r}),I(Gl,{children:n})]}),I(pc,{Component:Jo})]})}const vk=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function bk(e){return vk.includes(e)}const fk=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],yk=On({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),xk=On({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function Tk(){const{query:{data:e},isFilling:t}=Ny(),n=e?.multiAccountIntegrations,r=e?.integrations,a=ir(n)&&n.length>0||ir(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=b(Us),n=Yt(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(bk),a=e?.map(e=>e.apiName)||[];let o=r??fk;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:yk,children:[(t||a)&&I(Gw,{title:"Already Connected",children:t?I(Jw,{}):R(N,{children:[n?.map(e=>I(rk,{integration:e},e.id)),r?.map(e=>I(rk,{integration:e},e.id))]})}),I(Gw,{title:"Available Banks",children:I(Yw,{})}),o&&o.length>0&&I(Gw,{title:"Integrations",children:I("div",{className:xk,children:o.map(e=>I(mk,{apiName:e},e))})})]})}const Ck=On({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),wk=On({marginTop:"16px"}),kk=On.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function Ek({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(Tk,{}):t?R(N,{children:[R("div",{className:wk,children:[I(Gl,{extraClassNames:[kk],children:"Connected Accounts"}),r?.map(t=>I(Aw,{integration:t,isCompact:e},t.id)),a?.map(t=>I(Uw,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(Hw,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(Hw,{manualBankAccounts:o}):R("div",{className:Ck,children:[I(dc,{Component:Tg}),I(Ga,{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 Ak=Xn(null,On({color:"typography.base.weak"})),Sk=Xn(jn["drawer-header"],On({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},sm)),Ik=On({display:"flex",gap:"8px"}),Nk=On({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),Rk=Wn({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),Dk=On({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),Pk=On({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),Lk=Xn(null,On({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),Mk=Wn({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function Fk({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=aT()||e;hb();const{query:{data:a},isFilling:o}=Ny(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=nu({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>xu(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:Dp(e?.data)};var t}}),{mutate:c,isPending:d}=lb(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&Iy(p,!1),m="connected"===Yt(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,b=m?"Add New Connection":"Add New Account",f=()=>{Gi(m?"NewConnection":"BankAccountForm")},y=r?Rs:Bl;return R(tb,{onPlaidLink:n,children:[R("div",{...Sk,children:[R(hm,{children:[t&&I(Wd,{}),r?I(Ga,{children:"Banks & Integrations"}):I(nr,{stylists:[Ak],children:"Banks & Integrations"})]}),R("div",{className:Ik,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(pc,{Component:vd,stylists:[Xn(null,Mk({refreshLoading:d}))]}),!r&&I(Gl,{children:"Sync Accounts"})]}),R(y,{onClick:()=>f(),active:!1,children:[I(pc,{Component:Al}),!r&&I(Gl,{children:"Add New Connection"})]})]})]}),g&&I("div",{className:Pk,children:I(NC,{task:g})}),o?I(FC,{}):R(N,{children:[I("div",{className:Rk({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:Nk,children:I(Ek,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&I("div",{className:Dk,children:R(Bl,{stylists:[Lk],onClick:()=>f(),disabled:m&&!1,children:[I(pc,{Component:Al}),I(Ga,{children:b})]})})]})]})}const Ok=On({display:"flex",justifyContent:"center"}),Uk=On({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"});function Bk({onPlaidLink:e}){return I(AC,{children:I("div",{className:Ok,children:I("div",{className:Uk,children:I(Fk,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})}function Vk(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 Wk=On({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0"});function Hk({children:e}){return I("div",{className:Wk,children:e})}const jk=Go(e=>p.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_24404_41655)"},p.createElement("path",{d:"M1 1V3.366L6.317 9.866V14L8.683 12.817V9.866L14 3.366V1H1Z",strokeWidth:1,strokeMiterlimit:10}))),"Filter");function zk({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(us,{children:[I(ps,{children:e=>R(Fm,{popupTriggerChildrenProps:e,children:[R(Hk,{children:[t&&I(pc,{imageUrl:t,Component:jk}),I(Gl,{wrap:"wrap",children:i})]}),I(pc,{Component:Jo})]})}),I(vm,{title:r,Footer:o??null,children:a})]})}function qk(e,t){const{items:n,fuseOptions:r,processResults:a}=t,o=m(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),i=m(()=>new ke(o??[],r),[o,r]);return m(()=>{if(!o)return{};const t=i.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,o))},[o,i,e,a])}function Kk({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 _k=On({display:"flex",flexDirection:"column",gap:"8px"});function Yk({groupLabel:e,children:t}){return R("div",{className:_k,children:[e&&I(Ga,{children:e}),I("div",{children:t})]})}const Xk=On({display:"flex",flexDirection:"column",gap:"16px"});function Zk({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I(Om,{handleClick:t,selected:n,isMultiSelect:r,children:R(Hk,{children:[e.iconUrl&&I(pc,{Component:eg(e.iconUrl,"")}),I(Gl,{wrap:"wrap",children:e.name??""})]})},e.id)}function Gk({groupedResults:e,onItemClick:t,selectedIds:n,isMultiSelect:r}){const a=m(()=>Object.entries(e),[e]),o=m(()=>a.map(([,e])=>{const t=e.children;return t.length>0?t:[e.parent]}),[a]);return I(Nm,{children:I("div",{className:Xk,children:I(Kk,{groupedList:o,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>I(Zk,{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(Yk,{groupLabel:r,children:e})}})})})}function Qk({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=qk(e,{items:n,fuseOptions:Gp,processResults:Jp});return r?I(Hm,{}):0===Object.keys(i).length?I(Sm,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(Gk,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function Jk(e,t){return yy(e,t).map(e=>({parent:e.parent,child:e.child}))}function $k({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=qk(e,{items:n,fuseOptions:by,processResults:Jk});return r?I(Hm,{}):0===Object.keys(i).length?I(Sm,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(Gk,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function eE(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...eE(n));return t}function tE(e,t){return e.value?.[t]?.value?.id?.in??[]}function nE(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&tE(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{tE(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function rE(e,t){const n=[];return e.forEach(e=>tE(e,t).forEach(e=>n.push(e))),new Set(n)}function aE(e,t,n,r){return x(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!tE(t,e).some(e=>n.includes(e)));return MT(t,e,r)})},[t,r,e])}const oE=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout}",marginTop:"auto",width:"100%"});function iE({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:oE,children:[I(Rs,{onClick:e,children:I(Gl,{children:"Clear All"})}),R(Bl,{type:"button",onClick:t,disabled:n,children:[I(Gl,{children:"Apply"}),I(ai,{Component:Nu})]})]})}function lE({onApply:e,onClearAll:t}){const n=hs();return I(iE,{onApply:()=>{e(),n.close()},onClearAll:t})}function sE({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){const u=m(()=>eE(e),[e]),h=x(()=>{o(u)},[u,o]),p=x(()=>{if(u&&i&&l){const e=LT(l,"category"),t=nE(i,e,u,"category");c(t)}},[u,i,l,c]),g=I(lE,{onApply:p,onClearAll:h});return I(zk,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:g,children:I(wm,{placeholder:"Search expense categories...",onClick:a,SearchList:Qk,DefaultList:cE,listLength:e.children?.length??0,extraProps:{categories:e.children??[],label:e.name??"",isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}})})}function cE({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(Hm,{}):R(Nm,{children:[I(Ga,{children:t}),I("div",{children:e.map(e=>{if(e.hasChilds){const t=eE(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(sE,{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(Om,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(Hk,{children:[e.iconUrl&&I(pc,{Component:eg(e.iconUrl,e.name??"")}),I(Gl,{wrap:"wrap",children:e.name??""})]})},e.id)})})]})}const dE=[];function uE({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Hp(),s=i?.data??dE,c=rE(LT(t,"category"),"category"),d=x(e=>{const t=hE(e);n(t)},[n]),u=aE("category",r,0,a);return a&&o?I(wm,{placeholder:"Search expense categories...",onClick:d,SearchList:Qk,DefaultList:cE,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:u,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function hE(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 pE(){const{query:{data:e},isFilling:t}=Up(),n=e?.data,r=m(()=>n?.map(hE),[n]);return x(()=>({values:r??[],isFilling:t}),[r,t])}function gE(e){return qe({key:"category",name:"Category",NestedListComponent:uE,possibleValues:e})}const mE=[{value:"in",label:"In"}];function vE(e){return qe({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:mE})}function bE(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const fE=h.object({minAmount:h.number().nullable(),maxAmount:h.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 yE(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:ir((a=t).greaterThanEqual)?_d(a.greaterThanEqual):null,maxAmount:ir(a.lessThanEqual)?_d(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const xE=On({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function TE({children:e,title:t}){return I(vm,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:xE,children:e})})}const CE=On({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),wE=On({display:"flex",flexDirection:"column",flex:1}),kE=On({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function EE({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(TE,{title:"Amount",children:I(AE,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function AE({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=hs();return Ev({defaultValues:yE(0,r),validators:{onChange:fE},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=_a(e,{dollarSign:!0,signage:"default"}),a=Yd(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=_a(t,{dollarSign:!0,signage:"default"}),r=Yd(t),i=n.createFilter({name:`${a.label} ${e}`,value:{[n.key]:{name:"",value:{[a.value]:r}}}});o.push(i)}return o}(o.getFieldValue("minAmount"),o.getFieldValue("maxAmount"),e);r(t)};return R(N,{children:[I("div",{className:kE,children:R(Nm,{children:[R("div",{className:CE,children:[I("div",{className:wE,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(Ga,{children:"To"}),I("div",{className:wE,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I(Wu,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(iE,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const SE=[{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 IE(){return qe({key:"amount",name:"Amount",operators:SE,ModalComponent:EE})}function NE(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 RE=On({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function DE({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(TE,{title:"Back",children:I(PE,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function PE({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=hs();return Ev({defaultValues:{[e.key]:NE(e.key,0,r)},onSubmit:()=>{if(!n||!r)return;const o=[...n.filter(t=>t.modelKey!==e.key),...r];t(o),a.close()}})}({model:e,setFilters:t,filters:n,pendingFilters:a});return R(N,{children:[I("div",{className:RE,children:I(Nm,{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(iE,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const LE=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function ME(){return qe({key:"description",name:"Description",operators:LE,ModalComponent:DE})}function FE(){const{query:{data:e},isFilling:t}=nu(),n=e?.data,r=function({institutionIds:e}){const t=ur(),n=vr(),r=[...new Set(e)],a=O({queries:r.map(e=>({queryKey:kg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Ad({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:m(()=>n?.map(e=>e.integration?.apiInstitutionId).filter(e=>ir(e))??[],[n])}),a=m(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=Zd(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return x(()=>({values:a??[],isFilling:t}),[a,t])}function OE(e){return qe({key:"bankAccount",name:"Bank Account",possibleValues:e})}const UE=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:[];function BE(e){return qe({key:"customer",name:"Customer",possibleValues:e})}function VE(e){return qe({key:"vendor",name:"Vendor",possibleValues:e})}function WE(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 qe({key:"type",name:"Type",possibleValues:()=>({values:t})})}const HE=Go(e=>p.createElement("svg",{stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",...e},p.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}),p.createElement("circle",{fill:"currentColor",cx:8,cy:8,r:3.2})),"CircleFilled"),jE=Xn(null,On({fill:"surface.intent.action.active"}));function zE({isSelected:e}){return I(pc,e?{Component:HE,stylists:[jE]}:{Component:Dm})}function qE({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 R(Nm,{children:[I(Ja,{children:"Filter by"}),I("div",{children:r.values.map((r,o)=>{const l=(s=r,0===a.length?XE(s.value.status?.value):a.some(e=>i(e.value,s.value)));var s;return R(Fm,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:l,children:[I(Hk,{children:I(Gl,{wrap:"wrap",children:r.name})}),I(zE,{isSelected:l})]},`${r.name}_${o}`)})})]})}const KE="status",_E=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function YE(){const e="in";return{values:_E.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function XE(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function ZE(e){return XE(e.value.status?.value)}function GE(){return qe({key:KE,name:"Status",possibleValues:YE,singleSelect:!0,SimpleListComponent:qE})}const QE=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function JE(){return qe({key:"notes",name:"Notes",operators:QE,ModalComponent:DE})}function $E({onApply:e,onClearAll:t}){const n=hs();return I(iE,{onApply:()=>{e(),n.close()},onClearAll:t})}function eA({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){const u=m(()=>eE(e),[e]),h=x(()=>{o(u)},[u,o]),p=x(()=>{if(u&&i&&l){const e=LT(l,"glAccount"),t=nE(i,e,u,"glAccount");c(t)}},[u,i,l,c]),g=I($E,{onApply:p,onClearAll:h});return I(zk,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:g,children:I(wm,{placeholder:"Search GL accounts...",onClick:a,SearchList:$k,DefaultList:tA,listLength:e.children?.length??0,extraProps:{glAccounts:e.children??[],label:e.name,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}})})}function tA({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(Hm,{}):R(Nm,{children:[I(Ga,{children:t}),I("div",{children:e.map(e=>{if(e.hasChilds){const t=eE(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(eA,{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(Om,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(Hk,{children:I(Gl,{wrap:"wrap",children:e.name})})},e.id)})})]})}const nA=[];function rA({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=py(),s=i??nA,c=rE(LT(t,"glAccount"),"glAccount"),d=x(e=>{const t=aA(e);n(t)},[n]),u=aE("glAccount",r,0,a);return a&&o?I(wm,{placeholder:"Search GL accounts...",onClick:d,SearchList:$k,DefaultList:tA,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:u,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function aA(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function oA(e){return qe({key:"glAccount",name:"GL Account",NestedListComponent:rA,possibleValues:e})}const iA=async e=>{const t=e.queryKey,n={path:"/v6/classes/segments/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:vi(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 lA(){return br({queryKey:["classSegments"],queryFn:iA})}const sA=(cA={bankAccount:!0,vendor:!0,classSegments:!0,customer:!0,category:!0,glAccount:!0,rule:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(cA));var cA;function dA(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(at(e)){const t=dt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(it(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,Vk(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 Vk(e,t)}(e.bankAccount,r.bankAccount.value)),r.classSegments&&(n.classSegments=function(e,t){return Vk(e,t)}(e.classSegments,r.classSegments.value)),r.glAccount&&(n.glAccount=function(e,t){return Vk(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 Vk(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return Vk(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function uA(e,t){const n=e.reduce(dA,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return sA.forEach(e=>{const n=t[e];t[e]=c(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const hA=e=>{const t=Yt(e=>e.transactionsDashboardFilters),n=Yt(e=>e.expenseDashboardFilters),r=Yt(e=>e.incomeDashboardFilters),a=Yt(e=>e.setTransactionsDashboardFilters),o=Yt(e=>e.addTransactionsDashboardFilters),i=Yt(e=>e.removeTransactionsDashboardFilter),l=Yt(e=>e.hasInitializedTransactionsDashboardFilters),s=Yt(e=>e.setExpenseDashboardFilters),c=Yt(e=>e.addExpenseDashboardFilters),d=Yt(e=>e.removeExpenseDashboardFilter),u=Yt(e=>e.hasInitializedExpenseDashboardFilters),h=Yt(e=>e.setIncomeDashboardFilters),p=Yt(e=>e.addIncomeDashboardFilters),g=Yt(e=>e.removeIncomeDashboardFilter),m=Yt(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 pA(){return{getCategories:pE(),getBankAccounts:FE(),getCustomers:function(){const{query:{data:e},isFilling:t}=$g(),n=e?.data,r=m(()=>n?.map(e=>{const t=e.name??"Unknown Customer";return{name:t,value:{customer:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return x(()=>({values:r??[],isFilling:t}),[r,t])}(),getVendors:function(){const{query:{data:e},isFilling:t}=jg(),n=e?.data,r=m(()=>n?.map(e=>{const t=e.name??"Unknown Vendor";return{name:t,value:{vendor:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return x(()=>({values:r??[],isFilling:t}),[t,r])}(),getClassSegments:function(){const{query:{data:e},isFilling:t}=lA(),n=e?.data,r=m(()=>n?.map(e=>{const t=e.name??"Unknown Class Segment";return{name:t,value:{classSegments:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return x(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=oy(),n=m(()=>e?.map(e=>aA(e)),[e]);return x(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:function(){const e=Tx(),t=m(()=>function(e){const t="in";return[...e].map(e=>({name:e.name,value:{reviewStatus:{name:e.name,value:{[t]:e.value}}}}))}(e),[e]);return x(()=>({values:t,isFilling:!1}),[t])}()}}const gA=[{name:"Expense",types:Qy.Expense},{name:"Income",types:Qy.Income},{name:"Transfer",types:Qy.Transfer}];function mA(e,t,n,r,a){const o=Yt(e=>e.initializeTransactionsDashboardFilters),i=Yt(e=>e.initializeExpenseDashboardFilters),l=Yt(e=>e.initializeIncomeDashboardFilters),s=Yt(e=>e.hasInitializedTransactionsDashboardFilters),c=Yt(e=>e.hasInitializedExpenseDashboardFilters),d=Yt(e=>e.hasInitializedIncomeDashboardFilters),u=Tx(),h="transactionsDashboard"===e?s:"expenseDashboard"===e?c:d;T(()=>{const s=u.find(e=>"Needs Review"===e.name)?.value??[];!h&&!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}))},[h,r,t,a,e,n,u,o,i,l])}const vA=v(void 0);function bA(){const e=b(vA);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}const fA=On({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),yA=Xn(jn["filter-pill"],On({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"})),xA=Xn(null,On({border:"none",background:"none",padding:0,cursor:"pointer"})),TA=Xn(null,On({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"}));function CA({text:e,onClickRemove:t}){return R("div",{...yA,children:[I("div",{...TA,children:e}),I("button",{...xA,onClick:t,children:I(ms,{Component:gs,stylists:[Xn(null,fA)]})})]})}function wA({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!==Ke&&l.modelKey!==Nt&&(l.modelKey!==KE||!ZE(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(or(n)&&ir(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(or(r)&&ir(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=_a(_d(n),{dollarSign:!0,signage:"default"}),i=_a(_d(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(CA,{text:e.text,onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}function kA({Component:e,stylists:t}){return I(e,{stylists:[Xn(jn["medium-icon"],jn.icon),...t??[]],size:17})}const EA=On({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function AA(){const e=aT(),{dashboardKey:t,filterPopupModels:n}=bA();return I(Bl,{onClick:()=>{Gi("TransactionsFilterList",{routeProps:{dashboardKey:t,filterPopupModels:n}})},stylists:[Xn(null,EA)],children:e?I(kA,{Component:jk}):R(N,{children:[I(ai,{Component:jk}),I(Gl,{children:"Filters"})]})})}const SA=h.object({beginDate:h.string().nullable(),endDate:h.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=xt(e.beginDate),n=xt(e.endDate);if(t&&n)return!vt(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),IA=On({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),NA=On({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),RA=Xn(null,On({marginTop:"22px"}));function DA({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,Ev({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:SA},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:IA,children:[R("div",{className:NA,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(dc,{Component:Jx,stylists:[RA]}),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(Wu,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const PA={width:"fit-content"};function LA({onDateRangeChange:e}){const{filters:t}=bA(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Nt);if(void 0!==t){const e=t.value.date?.value;if(it(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(og,{triggerChildren:I(sg,{displayLabel:"Custom"}),popupChildren:I(ws,{style:PA,children:I(DA,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const MA=On({width:200,minWidth:200});function FA({dateFilter:e,addFilter:t}){return I(mp,{onClick:()=>t(e),children:I(Ga,{children:rt[e]})})}function OA({getModel:e,addFilters:t}){const{setOpen:n}=hs(),r=r=>{const a=e(Nt);if(void 0===a)return;const o=a.createFilter({name:rt[r],value:{[a.key]:{name:rt[r],value:r}}});t([o]),n(!1)};return I(ws,{children:R(sp,{style:MA,children:[I(FA,{dateFilter:nt.ALL_TIME,addFilter:r}),I(Mu,{alignment:"horizontal"}),I(FA,{dateFilter:nt.THIS_MONTH,addFilter:r}),I(FA,{dateFilter:nt.LAST_MONTH,addFilter:r}),I(FA,{dateFilter:nt.LAST_3_MONTHS,addFilter:r}),I(FA,{dateFilter:nt.LAST_12_MONTHS,addFilter:r}),I(Mu,{alignment:"horizontal"}),I(FA,{dateFilter:nt.THIS_QUARTER,addFilter:r}),I(FA,{dateFilter:nt.LAST_QUARTER,addFilter:r}),I(Mu,{alignment:"horizontal"}),I(FA,{dateFilter:nt.THIS_YEAR,addFilter:r}),I(FA,{dateFilter:nt.LAST_YEAR,addFilter:r}),I(Mu,{alignment:"horizontal"}),I(LA,{onDateRangeChange:n=>{const r=e(Nt);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const UA=[Xn(null,EA)];function BA({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Nt);let n=rt[nt.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=at(e)?rt[e]:it(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?xt(e.beginDate):null,n=e.endDate?xt(e.endDate):null;return t&&!n?`After ${At(t)}`:!t&&n?`Before ${At(n)}`:t&&n?`${bt(t)} - ${bt(n)}`:"Custom"}(e):t.name}return n})(e);return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(Bl,{stylists:UA,popupTriggerProps:e,children:I(Gl,{children:r})})}),I(OA,{getModel:t,addFilters:n})]})}function VA({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a}){const o=hs();return R(mp,{onClick:()=>{r&&o.close(),t?.()},popupTriggerProps:a,children:[n&&I(pc,{Component:n}),I(Ga,{children:e})]})}const WA=[{label:Jy[Gy.EXPENSE],type:Gy.EXPENSE},{label:Jy[Gy.REVENUE],type:Gy.REVENUE},{label:Jy[Gy.BANK_TRANSFER],type:Gy.BANK_TRANSFER}],HA=Xn(null,EA);function jA({manualTransactionOptions:e}){const t=WA.filter(t=>e.includes(t.type)),n=aT();return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(Bl,{stylists:[HA],popupTriggerProps:e,children:n?I(kA,{Component:Al}):R(N,{children:[I(ai,{Component:Al}),I(Gl,{children:"Add Transaction"})]})})}),I(ws,{children:I(sp,{children:t.map(({label:e,type:t})=>I(VA,{closeOnClick:!0,onClick:()=>Gi("BankTransactionFormRouter",{routeProps:{initialType:t}}),children:e},t))})})]})}const zA=Xn(jn["dashboard-header"],On({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",gap:"20px"})),qA=Xn(null,On({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),KA=Xn(null,On({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",paddingLeft:"15px",paddingRight:"15px",width:"100%",display:"flex"})),_A=On({display:"none",xl:{display:"flex"}});function YA({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:o}=bA(),i=aT(),l=m(()=>or(n)?"":n.find(e=>e.modelKey===Ke)?.value.search?.value??"",[n]);return R("div",{...zA,children:[R("div",{...qA,children:[I(kT,{isFetching:e,searchTerm:l,onChange:e=>{const t=a(Ke);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});o([n])},placeholder:PT(i)}),I(AA,{}),I(jA,{manualTransactionOptions:t}),!i&&I(BA,{filters:n,getModel:a,addFilters:o}),I("div",{className:_A,children:I(ci,{})})]}),n.length>0&&I("div",{...KA,children:I(wA,{filters:n,removeFilter:r})})]})}const XA=Gt.filter(e=>e!==Zt.COMMENTS&&e!==Zt.CLASS_SEGMENT),ZA=Xn(null,On({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function GA(){return I("div",{...ZA,children:I(ci,{})})}const QA=On.raw({gap:"6px"});function JA({Icon:e,label:t,children:n,onClick:r}){return n?R(us,{placement:"bottom-start",children:[I(ps,{children:n=>R(Rs,{popupTriggerProps:n,extraClassNames:[QA],children:[e&&I(ai,{Component:e}),I(Gl,{children:t})]})}),n]}):R(Rs,{onClick:r,extraClassNames:[QA],children:[e&&I(ai,{Component:e}),I(Gl,{children:t})]})}const $A=Go(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M1.3949 3.22968H13.605",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M9.09821 5.05792V12.384",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M5.90167 5.05792V12.384",stroke:"#182428",strokeMiterlimit:10})),"Delete"),eS=Xn(null,On({whiteSpace:"normal"}));function tS({transactions:e,id:t,label:n,resetSelected:r}){const{mutate:a}=Wy(),o=hs();return Cx(t)?I(mp,{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:I(Zp,{stylists:[eS],children:n})}):null}const nS={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},rS=e=>e.map(e=>({id:e.id,status:nS.INACTIVE})),aS=Go(e=>p.createElement("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M7.18604 10.8838H8.39809",stroke:"#182428",strokeMiterlimit:10})),"Uncategorized"),oS=[{id:"delete",label:"Delete",Icon:$A,component:function({transactions:e,resetSelected:t,...n}){const{mutate:r}=Wy(),a=()=>{const n=rS(e);r(n),t&&t()};return I(JA,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&qd({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:Rd,label:"Cancel"},{key:Dd,label:"Delete",type:zd}]}).then(e=>{e===Dd&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:aS,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=Wy(),o=e.length;return o>0&&I(JA,{label:`${t} ${Kd("Expense","Expenses",o,!0)}`,...r,children:I(ug,{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:aS,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=Wy(),o=e.length;return I(JA,{label:`${t} ${Kd("Revenue","Revenues",o,!0)}`,...r,children:I(Ay,{onClick:function(t){var r,o;a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:my})})}},{id:"review",label:"Change Review Status",Icon:Rm,subActions:[{id:"USER_REVIEW_REQUIRED",label:"Needs Review",component:tS},{id:"RECONCILIATION_DISCREPANCY",label:"Discrepancy",component:tS},{id:"RECONCILED",label:"Reconciled",component:tS}]}];function iS({subActionList:e}){return I(sp,{children:e})}function lS({subActions:e,transactions:t,label:n,Icon:r,resetSelected:a}){const o=m(()=>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(JA,{label:n,Icon:r,children:I(ws,{children:o.length>0?I(iS,{subActionList:o}):I(mp,{children:I(Gl,{children:"No Actions Available for Selection"})},"no-actions")})})}const sS=Xn(jn["bulk-select"],On({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function cS({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=m(()=>t.rows.map(e=>e.original),[t]),o=t.rows.length,i=()=>e.resetRowSelection(!0);return R("div",{...sS,children:[I($x,{table:e}),I(Ga,{children:`${o} selected`}),oS.map(e=>{if("recategorize-expenses"===e.id&&!n)return null;if("recategorize-revenues"===e.id&&!r)return null;const{component:t,subActions:o,id:l,filter:s,...c}=e,d=a.filter(e=>!s||s(e));return o?I(lS,{subActions:o,transactions:a,resetSelected:i,...c},l):t&&I(t,{transactions:d,resetSelected:i,...c},l)})]})}function dS({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r}){const a=aT(),o=function({transactions:e,columns:t}){const n=aT(),r=iT({transactions:e,columns:t?[Zt.SELECT,...t,Zt.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!or(t.getColumn(Xt.SELECT)),a=g(r?e:null);if(r){if(a.current!==e&&void 0!==a.current){const e=t.getSelectedRowModel().rows.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{});t.setRowSelection(e)}a.current=e}}(e,r,!n),r}({transactions:e,columns:t}),{setFilters:i}=bA(),l=o.getIsAllRowsSelected(),s=o.getIsSomeRowsSelected(),c=l||s;let d;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?d=I(OT,{buttonText:"Clear Filters",onButtonClick:()=>i([])}):r&&0===e?.length&&(d=I(mT,{})):d=I(pT,{});const u=c&&or(d)&&!a;return R(ql,{dashboard:"transactionDashboard",children:[u?I(cS,{table:o}):I(Wi,{headerGroups:o.getHeaderGroups()}),or(d)?I(DT,{table:o}):I(sc,{children:d})]})}const uS=On({display:"flex",padding:"16px 12px",border:"0.75px",borderStyle:"solid",borderRadius:["borderWidths.sm"],borderColor:["border.layout"]}),hS=Bn(uS,On({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function pS({children:e}){return I("div",{className:hS,children:e})}const gS=Xn(jn["card-header"],On({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function mS({children:e}){return I("div",{...gS,children:e})}const vS=On({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function bS({children:e}){return I("div",{className:vS,children:e})}const fS=Wn({base:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",alignSelf:"stretch"}});function yS({children:e,type:t,isSample:n=!1}){const r=Xn(jn.card,fS({type:t,isSample:n}));return I("div",{...r,children:e})}const xS=Wn({base:{display:"flex",height:"48px",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",borderRadius:"borderWidth.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 TS({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}=bA();if(!d(t))return null;const h="active"===r,p=Bn(xS({filterStatus:r}),a);return I("div",o?{className:p,children:l}:{className: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 CS=e=>["banks/transactions/summary",e],wS=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:vi(t[2].environment)},r=await ua(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};const kS=Wn({base:{display:"flex",padding:"10px",justifyContent:"center",alignItems:"center",gap:"8px",borderRadius:"borderWidths.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"}}),ES=On({width:"200px",minWidth:"200px"}),AS=On.raw({marginLeft:"auto"}),SS=Xn(null,On({marginLeft:"auto"}));function IS({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=bA(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return br({queryKey:CS({groupBy:e,filter:t}),queryFn:wS})}({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)||!Cx(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,Xn(jn["card-button-icon-container"],kS({intent:c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Cx(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c;return R(TS,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:ES,isZeroState:t,filterEffectiveValueExtractor:bE,children:[I("div",{...l,children:I(ai,{Component:e.icon})}),!t&&i&&R(N,{children:[I(Ga,{children:e.name}),I(Ga,{stylists:[SS],children:s})]}),!t&&!i&&R(N,{children:[I(Gl,{children:e.name}),I(Gl,{wrap:"wrap",extraClassNames:[AS],children:s})]}),t&&R(N,{children:[I(Gl,{intent:"weak",children:e.name}),I(Gl,{intent:"weak",extraClassNames:[AS],children:s})]})]},e.name)}function NS({isZeroState:e}){let t=Tx();return e&&(t=xx),I(yS,{children:R(pS,{children:[I(mS,{children:I(Gl,{intent:"weak",children:"Review Status"})}),I(bS,{children:t.map(t=>I(IS,{labeledReviewStatus:t,isZeroState:e},t.name))})]})})}const RS=On({display:"none",xl:{display:"flex",height:"318px",maxHeight:"318px",alignItems:"flex-start",gap:"16px",alignSelf:"stretch",borderRadius:"borderWidths.sm"}});function DS(e){return I("div",{className:RS,children:e.children})}const PS=On({width:"20px",height:"20px",borderRadius:"sm"});function LS({imageUrl:e,Component:t,stylists:n}){const[r,a]=y(!1);return ir(e)?R(N,{children:[!r&&I(Eo,{styles:PS}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[Xn(jn["medium-icon"],jn.icon),...n??[]],size:20})}const MS=On({width:"270px",minWidth:"269px"}),FS=Xn(null,On({marginLeft:"auto"}));function OS({account:e,isZeroState:t}){const{apiFilters:n}=bA(),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=sr(e.mask)?void 0:Xd(e.mask),c=_a(null!=(d=e.accountBalance)?_d(d):0,{dollarSign:!0});var d;return R(TS,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:MS,isZeroState:t,filterEffectiveValueExtractor:UE,children:[e.iconUrl&&I(LS,{imageUrl:e.iconUrl,Component:Tg}),!t&&a&&R(N,{children:[I(Ga,{children:o}),s&&I(Gl,{wrap:"wrap",children:s}),I(Ga,{wrap:"wrap",stylists:[FS],children:c})]}),!t&&!a&&R(N,{children:[I(Gl,{children:o}),s&&I(Gl,{wrap:"wrap",children:s}),I(Gl,{wrap:"wrap",extraClassNames:[On.raw({marginLeft:"auto"})],children:c})]}),t&&R(N,{children:[I(Gl,{intent:"weak",children:o}),s&&I(Gl,{intent:"weak",wrap:"wrap",children:s}),I(Gl,{intent:"weak",wrap:"wrap",extraClassNames:[On.raw({marginLeft:"auto"})],children:c})]})]},e.id)}const US=[{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 BS({isZeroState:e}){const{query:{data:t}}=nu(),n=(r=t?.data??[],e?US: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 I(yS,{children:R(pS,{children:[I(mS,{children:I(Gl,{intent:"weak",children:"Account Balances"})}),I(bS,{children:n.map((t,n)=>I(OS,{account:t,isZeroState:e},n))})]})})}const VS=On({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px"}),WS=On({display:"flex",justifyContent:"center"}),HS=On({border:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"none",paddingTop:"8px",marginTop:"16px"}),jS=On({border:"{borderWidths.md} solid {colors.border.layout}",borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),zS=On({display:"flex",flexDirection:"column",gap:"10px"}),qS=On({display:"flex",height:"100%",hideBelow:"1.5xl"});function KS({columns:e=XA,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s}){const{filters:c}=bA(),{hasPlaidLinkedBankAccount:d}=Np(),u=d??!1,h=aT();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(mi,{});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===c.length&&ir(c[0].value?.date)?0:c.length,t.length);return I("div",{className:WS,children:R("div",{className:VS,children:[h&&I("div",{className:zS,children:I(xC,{})}),!h&&R(DS,{children:[I(NS,{isZeroState:!i}),I("div",{className:qS,children:I(BS,{isZeroState:!i})}),I(l,{})]}),I("div",{className:HS,children:I(YA,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:jS,children:I(dS,{hasLinkedBankAccount:u,filterState:r,transactions:t,columns:e})}),I(GA,{})]})})}return"zero state"}const _S=On({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),YS=Xn(jn.card,uS,_S);function XS({children:e}){return I("div",{...YS,children:e})}const ZS=On({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function GS({children:e}){return I("div",{className:ZS,children:e})}const QS=On({display:"flex",flexDirection:"column",gap:"8px",minWidth:0});function JS({children:e}){return I("div",{className:QS,children:e})}const $S=On({minWidth:"300px"});function eI({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:$S,children:I($m,{options:e,handleClick:t,selectedIndex:n})})}function tI(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=tt(e);return{beginDate:et(Xe(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:Ye(Xe(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:Ge()}:"LAST_12_MONTHS"}const nI=no.var("colors.border.layout"),rI=Xn(jn["profit-loss-graph"],On({"& .recharts-surface":{outline:"none"}})),aI=no.var("colors.money.positive.weak"),oI=no.var("colors.money.positive"),iI=no.var("colors.money.negative.weak"),lI=no.var("colors.money.negative"),sI=no.var("colors.surface.intent.action"),cI=no.var("colors.surface.intent.action.active"),dI=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],uI=()=>{const[e,t]=y(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=xa({accountingMethod:"CASH",filter:tI(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=xt(e??"");return{longLabel:t?kt(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:Ca(e)}}(e):"QUARTERLY"===t?function(e){const t=Ze(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=Ze(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??[]}(dI[e].value)}};function hI({selectedIndex:e,onSelect:t}){return I(eI,{options:dI,handleClick:t,selectedIndex:e})}const pI={top:20,right:20,left:20,bottom:5},gI={fill:no.var("colors.typography.base"),fontSize:no.var("fontSizes.metric.sm")};function mI({data:e,children:t,tooltip:n}){return I(V,{width:"100%",height:"100%",...rI,style:{flexGrow:1},children:R(W,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:pI,children:[I(z,{dataKey:"label",interval:0,tickLine:!1,stroke:nI,tick:gI}),I(K,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const vI=On({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function bI(){return R("div",{className:vI,children:[I(io,{color:aI,label:"Income",diameter:10}),I(io,{color:iI,label:"Expense",diameter:10})]})}const fI=Xn(null,On({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),yI=Xn(null,On({width:"100%",height:"1px",backgroundColor:"border.layout"})),xI=Xn(null,On({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),TI=no.var("colors.money.positive"),CI=no.var("colors.money.negative");function wI({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",{...fI,children:[I(Ga,{children:a}),I("div",{...yI}),R("div",{...xI,children:[I(io,{color:TI,label:"Income",diameter:12}),I(Ja,{children:Ya(Number(o))})]}),R("div",{...xI,children:[I(io,{color:CI,label:"Expense",diameter:12}),I(Ja,{children:Ya(Number(i))})]})]})}function kI(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=uI(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(XS,{children:[R(GS,{children:[R(JS,{children:[I(Gl,{intent:"weak",children:"All Transactions"}),I(Wa,{title:Ya(r),label:void 0})]}),R(JS,{children:[I(hI,{selectedIndex:e,onSelect:t}),I(bI,{})]})]}),R(mI,{data:n,tooltip:({active:e,payload:t})=>I(wI,{active:e,payload:t}),children:[I(_,{name:"Income",dataKey:"income",minPointSize:2,fill:aI,isAnimationActive:!1,activeBar:{fill:oI}}),I(_,{name:"Expense",dataKey:"expense",minPointSize:2,fill:iI,isAnimationActive:!1,activeBar:{fill:lI}})]})]})}function EI({columns:e,limit:t=100}){const n=function(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=hA("transactionsDashboard"),{getCategories:o,getBankAccounts:i,getVendors:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=pA(),u=m(()=>({reviewStatus:vE(d),amount:IE(),bankAccount:OE(i),category:gE(o),customer:BE(s),date:Dt,description:ME(),glAccount:oA(c),notes:JE(),status:GE(),vendor:VE(l),type:WE(gA),search:_e}),[i,o,l,s,c,d]),h=m(()=>[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor],[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor]),p=/* @__PURE__ */(new Date).getDate(),g=m(()=>uA(e,void 0),[e,p]),v=x(e=>u[e],[u]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:h,setFilters:t,addFilters:n,removeFilter:r,apiFilters:g,getModel:v,hasUserConfiguredFilters:a}}(),{userRole:r}=b(Us),{sortInstance:a,setSortInstance:o,apiSort:i}=cf(),{isFilling:l,paginationControls:s,query:{data:c,isError:d,error:u,isFetching:h}}=ll({limit:t,sort:i,filter:{...n.apiFilters}}),p=c?.data,g=ul();return mA("transactionsDashboard",r,p?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,l,g),I(vA.Provider,{value:n,children:I(ri.Provider,{value:s,children:I(Kl.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(KS,{columns:e,transactions:p,isFetching:h,isFilling:l,isError:d,error:u??null,hasTransactions:g,Chart:kI,manualTransactionOptions:[Gy.EXPENSE,Gy.REVENUE,Gy.BANK_TRANSFER]})})})})}const AI=e=>I(AC,{children:I(EI,{...e})}),SI={in:["EXPENSE","TRANSFER_OUT","PAYMENT_OUT","BILL_EXPENSE","LOAN_EXPENSE","PAYROLL_EXPENSE","TAX_EXPENSE"]},II=[{name:"Expense",types:Qy.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:Gy.TRANSFER_OUT}]}],NI=Xn(jn.text,On({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Pa);function RI({children:e}){return I("div",{...NI,children:e})}const DI=On({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function PI({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:DI,children:[I(yb,{children:n}),I(RI,{children:(a=r,_a(a,{cents:"always",condense:!1,dollarSign:!0,signage:"off"}))})]});var a}const LI=On({width:"160px",height:"32px"}),MI=On({width:"54px",height:"32px"}),FI=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:LI,children:I(Gl,{children:String(t.value)})}),OI=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:MI,children:I(Gl,{alignment:"right",children:(r=n.value,_a(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},UI=({active:e,payload:t})=>I(PI,{active:e,payload:t});function BI({data:e}){return I(V,{width:"100%",height:44*(e?.length??0)+12,...rI,children:R(W,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[I(z,{type:"number",hide:!0,domain:[0,"dataMax"]}),I(q,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:FI,width:172}),I(q,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:OI,width:66}),I(K,{content:UI,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(_,{dataKey:"total",minPointSize:2,fill:sI,isAnimationActive:!1,activeBar:{fill:cI},barSize:32})]})})}const VI=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):[]},WI=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function HI(){const[e,t]=y(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Tt(n),endDate:Tt(t)}})(WI[e].value),{query:{data:r}}=xa({filter:n,select:VI}),a=n?`${bt(xt(n.beginDate))} - ${bt(xt(n.endDate))}`:"";return R(XS,{children:[R(GS,{children:[R(JS,{children:[I(Gl,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(Gl,{intent:"weak",wrap:"ellipsis",children:a})]}),I(eI,{options:WI,handleClick:e=>t(e),selectedIndex:e})]}),I(BI,{data:r})]})}function jI({columns:e,limit:t=100}){const n=function(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=hA("expenseDashboard"),{getCategories:o,getBankAccounts:i,getVendors:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=pA(),u=m(()=>({reviewStatus:vE(d),amount:IE(),bankAccount:OE(i),category:gE(o),customer:BE(s),date:Dt,description:ME(),glAccount:oA(c),notes:JE(),status:GE(),vendor:VE(l),type:WE(II),search:_e}),[i,o,l,s,c,d]),h=m(()=>[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor],[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor]),p=/* @__PURE__ */(new Date).getDate(),g=m(()=>uA(e,SI),[e,p]),v=x(e=>u[e],[u]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:h,setFilters:t,addFilters:n,removeFilter:r,apiFilters:g,getModel:v,hasUserConfiguredFilters:a}}(),{userRole:r}=b(Us),{sortInstance:a,setSortInstance:o,apiSort:i}=cf(),{isFilling:l,paginationControls:s,query:{data:c,isError:d,error:u,isFetching:h}}=ll({limit:t,sort:i,filter:{...n.apiFilters}}),p=c?.data,g=ul();return mA("expenseDashboard",r,p?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,l,g),I(vA.Provider,{value:n,children:I(ri.Provider,{value:s,children:I(Kl.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(KS,{columns:e,transactions:p,isFetching:h,isFilling:l,isError:d,error:u??null,hasTransactions:g,Chart:HI,manualTransactionOptions:[Gy.EXPENSE,Gy.BANK_TRANSFER]})})})})}const zI=e=>I(AC,{children:I(jI,{...e})}),qI={in:["REVENUE","TRANSFER_IN","PAYMENT_IN","INVOICE_REVENUE"]},KI=[{name:"Income",types:Qy.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:Gy.TRANSFER_IN}]}];function _I(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=uI(),r=n.reduce((e,t)=>e+t.income,0);return R(XS,{children:[R(GS,{children:[R(JS,{children:[I(Gl,{intent:"weak",children:"Total Income"}),I(Wa,{title:Ya(r),label:void 0})]}),I(JS,{children:I(hI,{selectedIndex:e,onSelect:t})})]}),I(mI,{data:n,tooltip:({active:e,payload:t})=>I(PI,{active:e,payload:t}),children:I(_,{name:"Revenue",dataKey:"income",minPointSize:2,fill:sI,isAnimationActive:!1,activeBar:{fill:cI}})})]})}function YI({columns:e,limit:t=100}){const n=function(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=hA("incomeDashboard"),{getCategories:o,getBankAccounts:i,getCustomers:l,getGlAccounts:s,getReviewStatuses:c}=pA(),d=m(()=>({reviewStatus:vE(c),amount:IE(),bankAccount:OE(i),category:gE(o),customer:BE(l),date:Dt,description:ME(),glAccount:oA(s),notes:JE(),status:GE(),type:WE(KI),search:_e}),[i,o,l,s,c]),u=m(()=>[d.reviewStatus,d.amount,d.bankAccount,d.category,d.customer,d.date,d.description,d.glAccount,d.notes,d.status,d.type],[d.reviewStatus,d.amount,d.bankAccount,d.category,d.customer,d.date,d.description,d.glAccount,d.notes,d.status,d.type]),h=/* @__PURE__ */(new Date).getDate(),p=m(()=>uA(e,qI),[e,h]),g=x(e=>d[e],[d]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:u,setFilters:t,addFilters:n,removeFilter:r,apiFilters:p,getModel:g,hasUserConfiguredFilters:a}}(),{userRole:r}=b(Us),{sortInstance:a,setSortInstance:o,apiSort:i}=cf(),{isFilling:l,paginationControls:s,query:{data:c,isError:d,error:u,isFetching:h}}=ll({limit:t,sort:i,filter:{...n.apiFilters}}),p=c?.data,g=ul();return mA("incomeDashboard",r,p?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,l,g),I(vA.Provider,{value:n,children:I(ri.Provider,{value:s,children:I(Kl.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(KS,{columns:e,transactions:p,isFetching:h,isFilling:l,isError:d,error:u??null,hasTransactions:g,Chart:_I,manualTransactionOptions:[Gy.REVENUE,Gy.BANK_TRANSFER]})})})})}const XI=e=>I(AC,{children:I(YI,{...e})}),ZI=Ie("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),GI={queryClient:gr,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await ZI).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await ZI).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await ZI).delete("queryClient",e)}(e)}}}(),maxAge:pr,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function QI({children:e}){return I(Ne,{client:gr,persistOptions:GI,children:e})}const JI=On({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"}}),$I=On({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:{base:"transparent",xl:"overlay"},overscrollBehavior:{base:"contain",xl:"none"}}),eN=Xn(null,jn.component,JI);function tN({children:e}){const t=g(null),n=g(null),r=aT();return A(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),I(ve,{children:I(me,{lockScroll:!0,className:$I,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,Yt.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...eN,children:e})})})}const nN=v({closingQueue:[],drawerHistory:[]});function rN({children:e}){const t=Yt(e=>e.drawerHistory),n=Yt(e=>e.closingQueue),r=m(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(nN.Provider,{value:r,children:a&&I(tN,{children:e})})}const aN=v({isActive:!0,isClosing:!1});function oN({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=b(nN),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]),l=void 0!==a?.[t],s=void 0!==i,c=(o&&o[t])??(i&&i[t]);return I(aN.Provider,{value:{isActive:l,isClosing:s},children:c&&I(e,{...c.routeProps})})}const iN=On({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"}}),lN=On({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function sN({children:e}){const t=g(null),{isActive:n,isClosing:r}=b(aN),{onExitAnimationEnd:a,onInitialAnimationComplete:o}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=y(!0),o=x(()=>{Yt.getState().confirmCloseDrawer()},[]),i=x(()=>{a(!1)},[a]);return T(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:n,isClosing:r,focusRef:t});return I(Ee,{onExitComplete:a,children:!r&&I(N,{children:R(Ae.div,{tabIndex:-1,ref:t,onAnimationComplete:()=>o(),transition:tm,initial:nm,animate:rm,exit:am,className:iN,children:[e,!n&&I("div",{className:lN})]})})})}const cN=Wn({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 dN({background:e,children:t}){return I("div",{className:cN({background:e}),children:t})}const uN=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function hN(e){return void 0!==uN[e]}function pN(e){return uN[e]}const gN=Go(e=>p.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},p.createElement("defs",null,p.createElement("style",null,".cls-63ce7444ea57ea6c838005ed-1{fill:none;stroke:currentColor;stroke-miterlimit:10;}")),p.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"}),p.createElement("rect",{className:"cls-63ce7444ea57ea6c838005ed-1",x:1.5,y:9.14,width:4.77,height:13.36})),"ThumbsUp"),mN=On({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function vN({cldrShortName:e}){return I("div",{className:mN,children:pN(e)})}const bN=Wn({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),fN=On({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 yN({reactions:e,type:t,handleClick:n}){return I("div",{className:fN,children:e.map((e,r)=>I("button",{className:bN({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(vN,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const xN=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:vi(n)};return await ua(o)},TN=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:vi(n)};return await async function(e){return rb(e)}(o)};function CN(e,t,n){return rr(vl({id:e}),t,n)}async function wN(e){const t=vl({id:e});return ea("mutation successful, invalidating messages queries"),gr.invalidateQueries({queryKey:t}).catch(e=>ta({error:e,severity:"error"}))}function kN(e,t,n){const r=[...e];return r[n]=t,r}const EN=On({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),AN=Object.keys(uN).filter(hN).map(e=>({emojiCode:e,authorInfo:[]}));function SN({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:i}=b(Us),{mutate:l}=function(e){const{userId:t,userEmail:n}=b(Us);return uu({mutationFn:xN,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=CN(n,t,r);await gr.cancelQueries({queryKey:i});const l=gr.getQueryData(i);return gr.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:kN(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:()=>wN(e)})}(e);return R(us,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(ps,{children:e=>I("button",{className:EN,...e,children:I(pc,{Component:gN})})}),I(ws,{type:"reaction",children:I(yN,{reactions:AN,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===i);return n&&r})||(l({id:t,emojiCode:e}),o(!1))}})})]})}const IN=Wn({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function NN({reactions:e,type:t,handleClick:n}){const r=IN({type:t});return I("div",{className:r,children:I(yN,{reactions:e,handleClick:n,type:t})})}const RN=Wn({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),DN=Wn({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"}}}}),PN=On({position:"relative",display:"flex",flexDirection:"column"});function LN({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:a=[]}){const o=g(null),{isHover:i,setIsHover:l,reactionIsOpen:s,setReactionIsOpen:c}=function(e){const[t,n]=y(!1),[r,a]=y(!1);return T(()=>{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}(o),{mutate:d}=function(e){const{userId:t}=b(Us);return uu({mutationFn:TN,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=CN(n,t,r);await gr.cancelQueries({queryKey:o});const i=gr.getQueryData(o);return gr.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return or(r)||0===r.reactions.length?t:kN(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:()=>wN(e)})}(e),u=n?"sent":"received",h=a.filter(e=>hN(e.emojiCode)),p=h.length>0,m="sent"===u?jn["message-sent"]:jn["message-received"],v=Xn(jn[m],DN({type:u}));return R("div",{className:RN({type:u,hasReactionsOnMessage:p}),ref:o,onMouseEnter:()=>"received"===u&&l(!0),children:[R("div",{className:PN,children:[I("div",{...v,children:r}),p&&I(NN,{reactions:h,type:u,handleClick:e=>d({id:t,emojiCode:e})})]}),i&&I(SN,{conversationId:e,messageId:t,type:u,reactions:h,reactionIsOpen:s,setReactionIsOpen:c})]})}const MN=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M14.1641 9.87903V14.125H0.835876V9.87903",strokeMiterlimit:10}),p.createElement("path",{d:"M7.49988 10.4883V0.1875",strokeMiterlimit:10}),p.createElement("path",{d:"M11.7395 6.85162L7.4999 11.0913L3.26025 6.85162",strokeMiterlimit:10})),"Download"),FN=Wn({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),ON=On({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}),UN=On({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),BN=On({textDecoration:"none",color:"inherit",cursor:"pointer"});function VN({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=aT();return I("div",{className:FN({type:e?"sent":"received"}),children:I("div",{onClick:async()=>{if(o)window.open(a,"_self","noopener,noreferrer");else try{if(a){const e=await fetch(a),t=await e.blob(),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n??"attachment",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}}catch(e){await ta({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:BN,children:R("div",{className:ON,children:[R("div",{className:UN,children:[I(Gl,{children:n}),I(Ja,{children:`${r}`})]}),I(pc,{Component:MN})]})})})}const WN=Xn(null,On({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function HN({children:e}){return I("div",{...WN,children:e})}const jN=Xn(null,On({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"})),zN=On({minHeight:1,width:"100%"}),qN=w(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},a){const o=g(null);t&&r?.current?.focus();const i=x(()=>{t&&ir(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){T(()=>{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])}(o,t,i),R("div",{tabIndex:-1,...jN,ref:o,children:[I("div",{className:zN,ref:a}),e]})}),KN=Object.freeze({message:{text:"",attachments:[]}}),_N=On({width:"24px",height:"24px",objectFit:"contain"});function YN({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:_N})}const XN=On({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"}),ZN=On({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),GN=On({display:"grid",flexDirection:"column",minWidth:0}),QN="LOADING",JN="LOADED",$N="ERROR";function eR({attachment:e,onRemove:t}){const n=e.hasError?$N:e.isPending?QN:JN;return R("div",{className:XN,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:ZN,children:[e.iconUrl&&I(YN,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:GN,children:[I(Gl,{children:e.displayFileName}),n===QN&&e.displayText&&I(Ja,{accent:"strongest",children:e.displayText}),n===JN&&e.fileSize&&I(Ja,{children:e.fileSize}),n===$N&&I(Ja,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(Rs,{onClick:async n=>{n.stopPropagation(),await qd({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Rd,label:"Cancel"},{key:Dd,label:"Remove",type:zd}]})===Dd&&t(e)},children:I(ai,{Component:gs})})]})}const tR=On({width:"100%"});function nR({conversationId:e,addMessage:t,blockSubmit:n,isMobile:r,scrollRef:a,setActiveKeyboard:o,inputRef:i,defaultValues:l}){const{form:s}=function({onSubmit:e,defaultValues:t}){return{form:Ev({defaultValues:t??KN,onSubmit:t=>{zh.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:l}),c=g(null),d=x(e=>{s.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[s]),u=x(e=>{s.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[s]),{mutate:h}=uu({mutationFn:Bh,onSuccess:async()=>{await gr.invalidateQueries({queryKey:["files/attachments"]}),await gr.invalidateQueries({queryKey:["conversations"]})}}),p=x(e=>{s.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&h({id:e.id})},[s,h]);return I("form",{className:tR,ref:c,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,c.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),s.handleSubmit()},children:I(s.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>I(eR,{attachment:e,onRemove:p},e.localId)),I(s.AppField,{name:"message",children:t=>I(t.MessageAreaInput,{blockSubmit:n,scrollRef:a,setActiveKeyboard:o,ref:i,onFileSelect:d,onUploadComplete:u,hideFileUpload:e.length>=5})})]})})})}function rR(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 aR(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return ea("mutation successful, invalidating messages queries"),Promise.all([gr.invalidateQueries({queryKey:e}),gr.invalidateQueries({queryKey:t}),gr.invalidateQueries({queryKey:n})]).catch(e=>ta({error:e,severity:"error"}))}const oR=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Fi({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),iR=async({data:e,accessToken:t,environment:n})=>Fi({data:{data:[e]},accessToken:t,environment:n}),lR=On({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),sR=On({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),cR=On({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),dR="Marked As Resolved";function uR({resolver:e}){const t=e?`${e} ${dR}`:dR;return R("div",{className:sR,children:[I("div",{className:lR}),I("div",{className:cR,children:t}),I("div",{className:lR})]})}const hR=Wn({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 pR({width:e="md",height:t="md"}){return I(Eo,{styles:hR({width:e,height:t})})}const gR=On({display:"flex",flexDirection:"row-reverse"});function mR(){return R(N,{children:[I(pR,{width:"lg",height:"lg"}),I("div",{className:gR,children:I(pR,{width:"md",height:"lg"})}),I("div",{className:gR,children:I(pR,{width:"lg",height:"xl"})}),I(pR,{width:"md",height:"lg"})]})}const vR=On({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function bR({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(HN,{children:I(LN,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(HN,{children:I(mR,{})}):R("div",{className:vR,children:[I(Ga,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(Gl,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const fR=Xn(null,On({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 yR({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:a=!1,attachedEntityId:o,defaultValues:i,defaultSubject:l}){const{userId:s}=b(Us),{mutate:c}=function(){const{userId:e}=b(Us);return uu({mutationFn:yl,onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=rr(vl({id:e.conversationId}),t,n);await gr.cancelQueries({queryKey:a});const o=gr.getQueryData(a);return gr.setQueryData(a,t=>[rR(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:aR})}(),{query:{data:d},isFilling:u}=function(e){const t=ir(e);return br({queryKey:vl({id:e??""}),queryFn:fl,select:bl,enabled:t})}(e),{mutate:h,isPending:p,variables:m}=(k=t,E=o,uu({mutationFn:iR,onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(or(e)||or(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(ir(E)){const e={id:E};pl(E,hl.BANK_TRANSACTION)?o=async()=>{const t=ol(e);return await gr.invalidateQueries({queryKey:t})}:pl(E,hl.FINANCIAL_SUMMARY)&&(i=async()=>await gr.invalidateQueries({queryKey:a}))}return ea("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([gr.invalidateQueries({queryKey:n}),gr.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>ta({error:e,severity:"error"}))}})),{mutate:v}=uu({mutationFn:oR,onSuccess:async()=>{const e=["conversations"],t=["tasks"];return ea("mutation successful, invalidating conversations queries"),Promise.all([gr.invalidateQueries({queryKey:e}),gr.invalidateQueries({queryKey:t})]).catch(e=>ta({error:e,severity:"error"}))}}),[f,x]=y(!1),C=g(null),w=g(null);var k,E;T(()=>{n&&r&&e&&v({id:e,readStatus:"READ"})},[n,r,e,v]),T(()=>{Ah(w)},[d,w]);const A=or(e)||or(d)||u;return R(N,{children:[A?I(qN,{ref:w,inputRef:C,activeKeyboard:f,setActiveKeyboard:x,children:I(bR,{isConversationLoading:p,isFilling:u,message:m?.message?.text})}):R(qN,{ref:w,activeKeyboard:f,setActiveKeyboard:x,inputRef:C,children:[n&&I(uR,{resolver:"Conversation"}),d.map((t,n)=>{const r=t[0].author.userId===s;return I(HN,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!or(e)).map(e=>I(VN,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(LN,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...fR,children:I(nR,{scrollRef:w,inputRef:C,conversationId:e,blockSubmit:p,isMobile:a,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),i=r.filter(e=>null!==e.id&&!e.isPending),s=i.map(e=>`att_${e.id}`),d=a.length>0,u=s.length>0;if(d||u)if(or(e)){const e=function(e,t,n){let r="";return ir(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(l,a,i[0]?.displayFileName),t=(p=a,g=s,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...ir(m=o)&&{attachedEntityId:m},message:{text:p,...g.length>0&&{attachmentIds:g}}});h(t)}else c({conversationId:e,text:a,...u&&{attachmentIds:s}});var p,g,m},setActiveKeyboard:x,defaultValues:i})})]})}function xR({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=y(e),{query:{data:o}}=Mi(r),i="CLOSED"===o?.resolutionStatus;return R(dN,{children:[I(dm,{}),I(yR,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const TR=Xn(jn["form-body"],On({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"16px",overflowY:"auto",overflowX:"hidden",overscrollBehavior:{base:"contain",xl:"none"},minWidth:{base:0,sm:"512px"}}));function CR({children:e}){return I("div",{...TR,children:e})}const wR=Xn(null,On({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),kR=Xn(null,On({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),ER=On({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),AR=e=>{Qu(e),Ju(e)},SR=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:a,conversationId:o,transactionId:i,transaction:l})=>I(sN,{children:R("div",{...wR,children:[I(dN,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:AR,...kR,children:[n,I(CR,{children:e}),r]})}),null!==a&&I("div",{className:ER}),"conversation"===a&&i&&I(xR,{conversationId:o,attachedEntityId:i,defaultSubject:l?.description})]})}),IR={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"},NR=h.object({id:h.string(),type:h.enum(Object.values(Gy)),reviewStatus:h.enum(Object.values(vx)),amount:h.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:h.string("Required").refine(e=>(function(e,t){const n=Xe(e.getFullYear(),e.getMonth(),e.getDate()),r=Xe(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||gt(new Date(e),/* @__PURE__ */new Date))&&vt(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable(),customer:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable(),frequency:h.union([h.object({name:h.string(),value:h.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),h.undefined()]),category:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable(),classSegments:h.array(h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).optional()),bankAccount:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:h.string().nullable(),itemizedByOptions:h.object({category:h.boolean(),customer:h.boolean()}).optional(),attachments:h.array(jh)}),RR=h.object({id:h.string(),name:h.string().optional(),requiredness:h.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),DR=h.object({id:h.string(),name:h.string().optional(),label:RR.optional()}),PR=DR.extend({child:DR.optional()}),LR=h.object({id:h.string().optional(),type:h.enum(Object.values(Gy)),date:h.string(),amount:h.number().nullable(),displayName:h.string(),description:h.string(),notes:h.string().nullable(),reviewStatus:h.enum(Object.values(vx)),apiName:h.enum(Object.values(IR)),iconUrl:h.string().optional(),apiSourceId:h.string().nullable(),bankAccount:h.object({id:h.string(),name:h.string().optional()}),classSegments:h.array(PR),customer:h.object({id:h.string(),name:h.string().optional()}).nullable(),vendor:h.object({id:h.string(),name:h.string().optional()}).nullable(),category:h.object({id:h.string(),name:h.string().optional()}).nullable(),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()}),invoice:h.object({id:h.string(),name:h.string(),date:h.string(),lineItems:h.array(h.object({id:h.string(),amount:h.number()}))}).nullable(),bill:h.object({id:h.string(),name:h.string().optional()}).nullable(),payroll:h.object({id:h.string(),date:h.string().optional(),checkDate:h.string().optional(),description:h.string().optional()}).nullable(),apiItemId:h.string().nullable().optional()}),MR=NR.extend({children:h.array(LR),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()}).nullable()}),FR=NR.extend({id:h.string(),type:h.literal(Object.values(Gy)),description:h.string(),displayName:h.string(),iconUrl:h.string(),status:h.literal(Object.values(nS)),reviewStatus:h.literal(Object.values(vx)),apiName:h.literal(Object.values(IR)),apiSourceId:h.string().nullable(),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()},{message:"Required"}),customer:h.object({id:h.string(),name:h.string().optional(),email:h.string().optional()}).nullable(),vendor:h.object({id:h.string(),name:h.string().optional()}).nullable(),invoice:h.object({id:h.string(),name:h.string(),date:h.string(),lineItems:h.array(h.object({id:h.string(),amount:h.number()}))}).nullable(),bill:h.object({id:h.string(),name:h.string().optional()}).nullable(),payroll:h.object({id:h.string(),date:h.string().optional(),checkDate:h.string().optional(),description:h.string().optional()}).nullable(),apiItemId:h.string().nullable()}),OR=h.looseObject({amount:h.number().nullable(),category:h.object({id:h.string(),name:h.string().optional()}).nullable(),customer:h.object({id:h.string(),name:h.string().optional()}).nullable()}),UR=h.object({children:h.array(OR),itemizeByOptions:h.record(h.string(),h.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"]})})}),BR=MR.extend({vendor:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable()}).check(e=>{const t=e.value?.children?.reduce((e,t)=>e+(t.amount??0),0);0!==e.value?.children.length&&t!==e.value.amount&&e.issues.push({code:"custom",message:"Sum of children amounts must equal total amount",input:e.value,path:["children"]}),e.value.children&&e.value.children.length>0||e.value.category&&""!==e.value.category.id||e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),VR=MR.extend({reconciliationMatch:h.object({id:h.string(),description:h.string().optional(),amount:h.number().optional(),date:h.string().optional(),apiInstitutionId:h.string().nullable().optional(),apiName:h.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"}).optional()}).nullish()}).refine(e=>{const t=e.reconciliationMatch?.amount,n=e.amount;return!!or(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>VR.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),WR=FR.extend({}),HR=h.looseObject({amount:h.number().nullable(),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()}),customer:h.object({id:h.string(),name:h.string().optional()}).nullable()}),jR=h.object({children:h.array(HR),itemizeByOptions:h.record(h.string(),h.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"]})})}),zR=MR.extend({glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.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"]})}),qR=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],KR=["FEDERAL","STATE","SALES"],_R=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function YR(e){if(!or(e))return _R.find(t=>t.value===e)?.name}const XR=h.object({tax:h.object({paymentInfo:h.object({region:h.enum(KR,{message:`Tax region must be one of: ${KR.join(", ")}`}),quarter:h.enum(["Q1","Q2","Q3","Q4"]).optional(),year:h.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: ${KR.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))}),ZR=h.intersection(XR,MR),GR=h.intersection(XR,FR);function QR(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:""},classSegments:e.classSegments??[],customer:e.customer??null,vendor:e.vendor??null,category:e.category??null,invoice:e.invoice??null,bill:e.bill??null,payroll:e.payroll??null,...void 0!==e.apiItemId?{apiItemId:e.apiItemId}:{}}}function JR(e){return e.reduce((e,t)=>new B(e).plus(t??0).toNumber(),0)}function $R(e,t){const n=new B(e).times(100).round(0),r=new B(t).times(100).round(0);return!n.eq(r)}function eD(e,t){return _a(new B(e).minus(t).toNumber(),{cents:"always",condense:!1,dollarSign:!0,signage:"default"})}function tD(e){return _a(e,{dollarSign:!0,cents:"always"})}function nD(e,t){const{labelsToIndex:n,childToRootId:r,labelFieldCount:a}=t,o=new Array(a).fill(void 0);for(const i of e){const e=i.label?.id;if(sr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function rD(e,t){return e.filter(e=>e.label?.id===t).map(e=>[e,...e.children])}function aD(e){return{id:e.id,name:e.name,label:e.label.id?{...e.label,id:e.label.id}:void 0}}const oD={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Tt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:tl[0],notes:null,classSegments:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]},iD={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function lD(e,t,n){const r=(e,t)=>function(e,t,n){if(e(t))return n}(n,e,t),a=r("children",e.children.map(e=>{return{...(t=e).id?{id:t.id}:{},amount:t.amount?Yd(t.amount):0,categoryId:t.category?.id,glAccountId:t.glAccount?.id,classSegmentIds:t.classSegments?.map(e=>e.id),customerId:t.customer?.id,invoiceId:t.invoice?.id,billId:t.bill?.id,payrollId:t.payroll?.id,apiItemId:t.apiItemId,notes:t.notes};var t})),o="TAX_PAYMENT"===e.type||"TAX_EXPENSE"===e.type,i=/* @__PURE__ */new Set;for(const l of e.children)for(const e of l.classSegments??[])e.label?.id&&i.add(e.label.id);return{...{amount:r("amount",e.amount?Yd(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),classSegmentIds:r("classSegments",e.classSegments?.filter(e=>!or(e?.label?.id)&&!i.has(e.label.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 or(t)?e:{...e,glAccountId:gl({id:t,prefix:"GL_ACCOUNT"})}});return or(r)?or(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:gl({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function sD(e,t,n){const{mutate:r}=Hy(),{mutate:a}=jy({mutationFn:Oy}),{query:{data:o}}=Up(),i=e?(c=t,{id:(s=e).id,type:s.type,reviewStatus:s.reviewStatus,amount:_d(s.amount),category:s.category,date:s.date,vendor:s.vendor,customer:s.customer,frequency:s.frequency,bankAccount:s.bankAccount,glAccount:s.glAccount,notes:s.notes,classSegments:nD(s.classSegments,c),children:s.children.map(e=>({...e,amount:_d(e.amount),classSegments:e.classSegments.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])})),reconciliationMatch:s.reconciliationMatch?{...s.reconciliationMatch,amount:_d(s.reconciliationMatch.amount??0)}:void 0,tax:s.tax,attachments:s.attachments?s.attachments.map(e=>({localId:e.id,file:new File([],e.fileName??""),displayFileName:e.fileName??"Unknown",displayText:"",fileSize:e.fileSize??null,id:ml(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...oD,type:e,classSegments:new Array(t.labelFieldCount).fill(void 0)}}(n,t),l=function(e){switch(e){case"EXPENSE":return BR;case"BANK_TRANSFER":case"TRANSFER_IN":case"TRANSFER_OUT":return VR;case"REVENUE":return zR;case"TAX_PAYMENT":case"TAX_EXPENSE":return ZR;default:return}}(e?.type||n||"EXPENSE")||MR;var s,c;return Ev({defaultValues:i,canSubmitWhenInvalid:!0,validators:{onBlur:l,onSubmit:l},onSubmit:t=>{const n=o?.data??[];e?(r(function(e,t,n,r){return{...lD(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,t.value,n,t.formApi.state.fieldMeta)),t.formApi.reset(t.value,{keepDefaultValues:!0})):(a(function(e,t){return{...lD(e,t,()=>!0),amount:e.amount?Yd(e.amount):0,date:e.date,bankAccountId:e.bankAccount.id,description:e.vendor?.name||iD[e.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}}(t.value,n)),Qi())},onSubmitInvalid:()=>{}})}function cD({transaction:e}){const{mutate:t}=Wy(),n=()=>t(rS([e]));return I(VA,{onClick:()=>{return e=n,void qd({title:"Delete transaction",body:"Are you sure you want to delete this transaction?",buttons:[{key:Rd,label:"Cancel"},{key:Dd,label:"Delete",type:zd}]}).then(t=>{t===Dd&&e()});var e},Icon:$A,children:"Delete"})}function dD({transaction:e}){const{mutate:t}=Wy();return I(VA,{onClick:()=>{t([e].map(e=>({id:e.id,status:nS.ACTIVE})))},children:"Restore"})}const uD=Av({defaultValues:oD,render:function({form:e}){return I(VA,{onClick:()=>{Or()},closeOnClick:!0,children:"Attach Bill(s)"})}}),hD=Av({defaultValues:oD,render:function({form:e}){return I(VA,{onClick:()=>{Or()},closeOnClick:!0,children:"Attach Payroll"})}}),pD=Av({defaultValues:oD,render:function({form:e}){return I(VA,{onClick:()=>{Or()},Icon:XT,closeOnClick:!0,children:"Attach Invoice(s)"})}}),gD=tl.filter(e=>"ONE_TIME"!=e.value);function mD({onClick:e}){const t=hs();return I(og,{triggerChildren:I(sg,{displayLabel:"Make recurring"}),popupChildren:I(Xm,{frequencies:gD,onClick:n=>{e(n),t.close()}})})}function vD({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(Rs,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(dc,{Component:t})})}function bD({activeTab:e,onClick:t,popupTriggerProps:n}){return I(vD,{active:"conversation"===e,onClick:()=>t("conversation"),icon:uc,ariaLabel:"conversation-tab",popupTriggerProps:n})}const fD=On({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function yD({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=hs(),[a,o]=y(e),{query:{data:i}}=Mi(a),l="CLOSED"===i?.resolutionStatus;return I(om,{children:R("div",{className:fD,children:[I(dm,{children:R(hm,{children:[I(Wd,{Icon:Qo,handleClose:()=>r.setOpen(!1)}),I(Ga,{children:"Back"})]})}),I(yR,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const xD={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:"Income"},TAX_EXPENSE:{value:"TAX_EXPENSE",label:"Tax Pmt"},TRANSFER:{value:"TRANSFER_IN",label:"Transfer"}},TD=Object.values(xD);function CD({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=Me();return a?I(Hm,{}):R(Nm,{children:[s&&t&&I(Ga,{children:"Suggested"}),I(Ga,{children:n}),I("div",{children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(zk,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(ED,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I(Om,{handleClick:()=>e(t),selected:n,children:R(Hk,{children:[t.iconUrl&&I(pc,{Component:eg(t.iconUrl,t.name??"")}),I(Gl,{wrap:"wrap",children:t.name??""})]})},t.id)})})]})}const wD="Search expense categories...",kD=[];function ED({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=Hp(),s=r??i?.data??kD,c=hs(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I(wm,{placeholder:wD,onClick:d,SearchList:Qk,DefaultList:CD,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function AD({onClick:e,showSuggestedCategories:t,glAccounts:n,listLabel:r,isFilling:a,glAccount:o,handleConversion:i,parentOnClick:l,selectedIds:s}){const c=Me();return a?I(Hm,{}):R(Nm,{children:[c&&t&&I(Ga,{children:"Suggested"}),I(Ga,{children:r}),I("div",{children:n?.map(t=>{const n=s.has(t.id);return t.hasChilds?I(zk,{text:t.name,iconUrl:t.iconUrl,title:"All Categories",children:I(ND,{headerLabel:"All Categories",listLabel:t.name,nestedGlAccounts:t.children,handleConversion:i,glAccount:o,parentOnClick:l})},t.id):I(Om,{handleClick:()=>e(t),selected:n,children:I(Hk,{children:I(Gl,{wrap:"wrap",children:t.name})})},t.id)})})]})}const SD="Search income categories...",ID=[];function ND({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}=py(),d=r??l??ID,u=vy([...d],my),h=hs(),p=o?.id?/* @__PURE__ */new Set([o.id]):/* @__PURE__ */new Set,g=e=>{i?i(e):t({type:"REVENUE",value:e}),h.close()};return I(wm,{placeholder:SD,onClick:g,SearchList:$k,DefaultList:AD,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 RD({list:e,onClick:t,NestedChildList:n}){return I(Nm,{children:e.groups.map(e=>I(Yk,{groupLabel:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(zk,{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(Om,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(Hk,{children:[e.value.iconUrl&&I(pc,{Component:eg(e.value.iconUrl,e.value.name)}),I(Gl,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const DD="All Tax Categories";function PD({handleConversion:e,region:t}){const n=hs(),r=km({data:[_R],groups:[{label:DD,key:DD}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(RD,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}const LD=On({display:"flex",flexDirection:"column",width:"100%",gap:"4px"}),MD=On({display:"flex",flexDirection:"row",justifyContent:"space-between"});function FD({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:LD,children:[R("div",{className:MD,children:[I(Gl,{children:e}),t&&I(Gl,{children:Xa(t)})]}),R("div",{className:MD,children:[n&&I(Ja,{children:n}),r&&I(Ja,{children:bt(xt(r))})]})]})}function OD({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=Me(),d=!l&&i&&0===r.length;return l?I(Hm,{}):R(Nm,{children:[a&&I("div",{children:I(Fm,{handleClick:t,children:I(Gl,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(Ga,{children:"Suggested"}),!d&&R(N,{children:[I(Ga,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I(Om,{handleClick:()=>e(t),selected:n,children:I(FD,{description:t.description,amount:_d(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const UD={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function BD({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const o=m(()=>new ke(n??[],UD),[n]),i=m(()=>n?o.search(e).map(e=>e.item):[],[n,e,o]);return r?I(Hm,{}):0===i.length?I(Sm,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I(Nm,{children:I("div",{children:i.map(e=>{const n=a?.id===e.id;return I(Om,{handleClick:()=>t(e),selected:n,children:I(FD,{description:e.description,amount:_d(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const VD=[];function WD({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=xt(o),s=(c=r,{filter:{status:{in:["ACTIVE"]},type:{in:["BANK_TRANSFER",(d=a)>0?"EXPENSE":"REVENUE",d>0?"TRANSFER_OUT":"TRANSFER_IN"]},amount:{equal:-d},date:{greaterThanEqual:Tt(St(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Tt(St(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=ll(s,{enabled:null!==l}),m=h?.data??VD,{query:{data:v}}=ay({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),b=hs();return I(wm,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),b.close()},SearchList:BD,DefaultList:OD,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 HD({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=y(function(e){switch(e){case"EXPENSE":return TD.indexOf(xD.EXPENSE);case"REVENUE":return TD.indexOf(xD.REVENUE);case"TAX_PAYMENT":case"TAX_EXPENSE":return TD.indexOf(xD.TAX_EXPENSE);default:return TD.indexOf(xD.TRANSFER)}}(e)),{category:c,glAccount:d,tax:u,date:h,bankAccount:p,reconciliationMatch:g,amount:m}=o,v=u?.paymentInfo?.region,b=p?.id;return R(vm,{title:t,children:[!i&&I($m,{options:TD,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(TD[l].value){case"EXPENSE":return I(ED,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(ND,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:d});case"TAX_EXPENSE":return I(PD,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:v});case"TRANSFER_IN":return I(WD,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:m??0,transactionDate:h,reconciliationMatch:g})}},{})]})}const jD=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),zD=On({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function qD({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!or(o)&&""!==o.id,l=or(o?.iconUrl)?void 0:eg(o.iconUrl,"Expense Icon");return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(oh,{label:"Category",popupTriggerProps:e,children:R("button",{className:jD,type:"button",children:[i?R("div",{className:zD,children:[l&&I(pc,{Component:l}),I(Gl,{wrap:"wrap",children:o.name})]}):I(Gl,{intent:"weak",children:"Select category"}),I(pc,{Component:Jo})]})})}),I(HD,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function KD(){const{query:{data:e}}=lA(),t=m(()=>e?.data??[],[e]),n=m(()=>function(e){return or(e)?[]:function(e){const t=[],n=/* @__PURE__ */new Set;for(const r of e){const{id:e,name:a,requiredness:o}=r.label;if(or(e)||n.has(e))continue;const i=r.children.find(e=>!or(e.label.id)),l=i?.label,s=or(l?.id)?null:{id:l.id,name:l.name??"",status:"ACTIVE",requiredness:l.requiredness??"NOT_REQUIRED",child:null};n.add(e),t.push({id:e,name:a??"",status:"ACTIVE",requiredness:o??"NOT_REQUIRED",child:s})}return t}(e.data??[]).sort((e,t)=>e.id.localeCompare(t.id))}(e),[e]),r=m(()=>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))}),{labelsToIndex:t,childToRootId:n,labelFieldCount:e.length}}(n),[n]);return{nestedClassSegments:t,nestedClassSegmentLabels:n,classSegmentLabelLookup:r}}const _D=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),YD=On({display:"flex",gap:"8px",alignItems:"center"});function XD({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!or(o)&&""!==o.id,l=or(o?.iconUrl)?void 0:eg(o.iconUrl,"Revenue Icon");return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(oh,{label:"Category",popupTriggerProps:e,children:R("button",{className:_D,type:"button",children:[i?R("div",{className:YD,children:[l&&I(pc,{Component:l}),I(Gl,{children:o.name})]}):I(Gl,{intent:"weak",children:"Select category"}),I(pc,{Component:Jo})]})})}),I(HD,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}const ZD=(e,t,n)=>{const r=new Set((e=>{const t=[];for(const n of e)for(const e of n.classSegments)e.label?.id&&t.push(e.label.id);return t})(e).map(e=>n.childToRootId.get(e)??e)),a=e.some(e=>!or(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},GD={id:"customer",name:"Customer"};function QD(e,t,n,r,a){if(1===e.length){const o=e[0];"EXPENSE"===t?n(o.category):r(o.glAccount),a([])}else a(e)}const JD=On({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),$D=On({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),eP=On({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),tP=Av({defaultValues:{children:[],itemizeByOptions:{}},props:{index:0,transactionType:"EXPENSE",onUnitemize:()=>{}},render:function({form:e,index:t,transactionType:n,onUnitemize:r}){const{nestedClassSegments:a,nestedClassSegmentLabels:o,classSegmentLabelLookup:i}=KD(),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",{className:JD,children:[R("div",{className:$D,children:[I(Gl,{children:`Line Item #${t+1}`}),R(Rs,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(Gl,{children:"Remove"}),I(pc,{Component:$A})]})]}),R("div",{className:eP,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(qD,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(XD,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),I(e.Subscribe,{selector:e=>({itemizeByOptions:e.values.itemizeByOptions,childClassSegments:e.values.children[t].classSegments}),children:({itemizeByOptions:n,childClassSegments: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=>!or(t?.label?.id)&&(i.get(t.label.id)??t.label.id)===e);return-1===a?null:{fieldLabel:r.find(t=>t.id===e)?.name??"",classSegmentOptions:rD(n,e),segmentIndex:a}}).filter(e=>null!==e)}(n,r,a,o,GD.id,i).map(({fieldLabel:n,classSegmentOptions:r,segmentIndex:a})=>I(e.AppField,{name:`children[${t}].classSegments[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.ClassSegmentField,{fieldLabel:n,classSegmentOptions:r,classSegmentLabels:o,selectedSegment:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(aD(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})})})]})]})}}),nP=On({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function rP({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=hs();return I(ws,{children:R(sp,{children:[e?.map(e=>{const r=t.includes(e.id);return I(mp,{onClick:()=>{n(e.id,!r)},children:R("div",{className:nP,children:[I(Gl,{children:a(e)}),I(pc,{Component:r?Rm:Dm})]})},e.id)}),!or(r)&&I(mp,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(Gl,{children:"Confirm Selection"})})]})})}const aP=e=>Object.keys(e).filter(t=>e[t]);function oP({classSegmentLabels:e,itemizeByOptions:t,onCheckboxChange:n}){return R(us,{placement:"bottom-end",children:[I(ps,{children:e=>R(Rs,{popupTriggerProps:e,children:[I(Gl,{children:"Itemize By"}),I(pc,{Component:sh})]})}),I(rP,{items:[...e,GD],selectedIds:aP(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const iP=On({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),lP=On({display:"flex",justifyContent:"space-between",alignItems:"center"}),sP=On.raw({color:"surface.intent.danger.active"}),cP=On({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function dP({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=JR(n),i=$R(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:iP,children:[R("div",{className:lP,children:[I(Gl,{children:`${Jy[e]} amount`}),I(Gl,{children:tD(t)})]}),R("div",{className:lP,children:[I(Gl,{children:"Line items total"}),I(Gl,{children:tD(o)})]}),R("div",{className:lP,children:[I(Gl,{extraClassNames:l?[sP]:void 0,children:"Difference"}),I(Gl,{extraClassNames:l?[sP]:void 0,children:eD(t,o)})]}),l&&R("div",{className:cP,children:[I(ai,{Component:Uu}),I(Gl,{extraClassNames:[sP],children:c})]}),s&&R("div",{className:cP,children:[I(ai,{Component:Uu}),I(Gl,{extraClassNames:[sP],children:"At least 2 line items are required"})]})]})}function uP({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(Ou,{onSave:e,children:I(dP,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const hP=On({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function pP(e){const{form:t,classSegmentLabels:n,handleAddLineItem:r,handleUnitemize:a,handleItemizeCheckboxChange:o}=function({childTransactions:e,onSubmit:t,transactionType:n,amount:r,category:a,glAccount:o}){const{nestedClassSegmentLabels:i,classSegmentLabelLookup:l}=KD(),s=m(()=>"EXPENSE"===n?{category:a}:{glAccount:o??void 0},[a,o,n]),c=m(()=>{if(e.length>0)return e;const t=new B(r).div(2).round(2,B.roundDown),n=new B(r).sub(t);return[QR({amount:t.toNumber(),...structuredClone(s)}),QR({amount:n.toNumber(),...structuredClone(s)})]},[e,r,s]),d=hs(),u=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return UR;case"BANK_TRANSFER":case"TRANSFER_IN":case"TRANSFER_OUT":return WR;case"REVENUE":return jR;case"TAX_PAYMENT":case"TAX_EXPENSE":return GR}}(r);return Ev({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=o.safeParse(e),r={};if(!t.success)for(const n of t.error.issues){const e=n.path.reduce((e,t,n)=>"number"==typeof t?`${e}[${t}]`:0===n?String(t):`${e}.${String(t)}`,"");r[e]||(r[e]={message:n.message})}if(e.children.length<2)return{form:"minimum-children",fields:r};const a=JR(e.children.map(e=>e.amount));return $R(n,a)?{form:"amount-mismatch",fields:r}:Object.keys(r).length>0?{fields:r}:void 0}},onSubmit:e=>{a(e.value.children)}})}({childTransactions:c,itemizeByOptions:ZD(c,i,l),parentAmount:r,transactionType:n,onSubmit:e=>{t(e),d.close()}});return{form:u,classSegmentLabels:i,handleAddLineItem:()=>{const e=u.state.values.children,t=e[0];u.setFieldValue("children",[...e,QR({...t,id:"",amount:0,customer:null,...s})])},handleUnitemize:()=>{const e=u.state.values.children[0];t([e]),d.close()},handleItemizeCheckboxChange:(e,t)=>{if(u.setFieldValue("itemizeByOptions",{...u.state.values.itemizeByOptions,[e]:t}),e===GD.id)return void(t||u.setFieldValue("children",u.state.values.children.map(e=>({...e,customer:null}))));if(t){const t=i.find(t=>t.id===e);if(or(t))return;const n={id:"",label:t},r=u.state.values.children.map(e=>({...e,classSegments:[...e.classSegments??[],n]}));return void u.setFieldValue("children",r)}const n=u.state.values.children.map(t=>({...t,classSegments:t.classSegments.filter(t=>t.label?.id!==e)}));u.setFieldValue("children",n)}}}(e),i=I(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>I(oP,{classSegmentLabels:n,itemizeByOptions:e,onCheckboxChange:o})}),l=I(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>I(uP,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(mm,{title:`Itemize ${Jy[e.transactionType]}`,HeaderRightAction:i,Footer:l,padChildren:!1,children:[I(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>I(tP,{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:hP,children:e.length<10&&R(Rs,{onClick:r,active:!1,children:[I(Gl,{children:"Add Line Item"}),I(ai,{Component:Al})]})})})]})}function gP(e){const t=hs();return I(lm,{children:t.open&&I(pP,{...e})})}function mP({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=hs();return R(us,{children:[I(ps,{children:e=>I(VA,{Icon:Ky,popupTriggerProps:e,children:"Itemize"})}),I(gP,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:t.children,onSubmit:e=>{n(e),r.close()}})]})}const vP=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(us,{children:[I(ps,{children:e=>I(bD,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(yD,{conversationId:r,attachedEntityId:a})]}):I(bD,{onClick:n,activeTab:t}),bP=Av({defaultValues:oD,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=Yt(e=>e.FEATUREFLAG_ATTACH_TO_GLSOURCE),s=Le(),c=aT(),d=!or(n)&&ep(n)&&"EXPENSE"===n.type,u=x(t=>{QD(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(dm,{children:R(hm,{children:[I(Wd,{}),I(Ga,{children:t}),i&&I(vP,{isMobile:c,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(UC,{shouldUseButtonDiscreteStyles:!0,children:R(sp,{children:[n?.status===nS.ACTIVE&&I(cD,{transaction:n}),n?.status===nS.INACTIVE&&I(dD,{transaction:n}),I(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:n})=>"EXPENSE"===n||"REVENUE"===n?0===t.length?I(mP,{itemizeModalFormValues:e.state.values,transactionType:n,handleItemizeAction:u}):I(VA,{Icon:Ky,onClick:()=>u([t[0]]),children:"Unitemize"}):null}),l&&R(N,{children:["EXPENSE"===n?.type&&I(uD,{form:e}),"EXPENSE"===n?.type&&I(hD,{form:e}),"REVENUE"===n?.type&&I(pD,{form:e})]}),d&&I(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return s&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&I(mD,{onClick:t=>e.setFieldValue("frequency",t)});var n}})]})})]})})}}),fP=On({display:"flex",flexDirection:"column",gap:"8px",padding:"8px 12px",backgroundColor:"surface.background",border:"1px solid",borderColor:"border.layout",borderRadius:"sm",overflow:"hidden",width:"100%"}),yP=On({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function xP({transactionType:e,amount:t,category:n,glAccount:r,classSegments:a,classSegmentLabels:o,customer:i}){const l=[{label:"Amount",value:tD(t)},{label:"Category",value:"EXPENSE"===e?n?.name??"":r?.name??""},...o.map(e=>{const t=a.find(t=>t.label?.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("div",{className:fP,children:l.map((e,t)=>R(S,{children:[t>0&&I(Mu,{alignment:"horizontal"}),R("div",{className:yP,children:[I(Gl,{children:e.label}),I(Gl,{children:e.value.toString()})]})]},e.label))})}const TP=async e=>{const t=e.queryKey,n={path:"/v6/templates/classes/labels/query",accessToken:t[1].accessToken,endpointManager:vi(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}},CP=On({display:"flex",flexDirection:"column",gap:"8px"}),wP=Av({defaultValues:oD,render:function({form:e}){const{query:{data:t}}=br({queryKey:["classSegmentLabels"],queryFn:TP}),n=e.state.values.children;return R("div",{className:CP,children:[I(Gl,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(xP,{transactionType:e.state.values.type,amount:n.amount??0,category:n.category,glAccount:n.glAccount,classSegments:n.classSegments,classSegmentLabels:t?.data??[],customer:n.customer},`${n.id}_${r}`)),R(us,{children:[I(ps,{children:e=>R(Rs,{popupTriggerProps:e,children:[I(Gl,{children:"Edit Line Items"}),I(ai,{Component:Jo})]})}),I(gP,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n,onSubmit:t=>{QD(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),kP=Av({defaultValues:oD,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=Le();return R(N,{children:[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=>0===e.values.children.length||e.values.children.every(e=>null===e.customer),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=>ze(t)?I(wP,{form:e}):I(e.AppField,{name:"category",children:t=>I(qD,{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})})]})}}),EP=Av({defaultValues:oD,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.Subscribe,{selector:e=>0===e.values.children.length||e.values.children.every(e=>null===e.customer),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=>ze(t)?I(wP,{form:e}):I(e.AppField,{name:"glAccount",children:t=>I(XD,{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})})]})}}),AP=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function SP({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===qy(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(oh,{label:a,popupTriggerProps:e,children:R("button",{className:AP,type:"button",children:[r?I(FD,{description:r.description||"",amount:r.amount||0,date:r.date||bt(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(Gl,{intent:"weak",children:"Needs Match"}),I(pc,{Component:Jo})]})})}),I(HD,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const IP=Av({defaultValues:oD,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})}),I(e.AppField,{name:"reconciliationMatch",children:()=>I(SP,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})]})}}),NP=On({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function RP({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(us,{placement:"bottom-start",children:[I(ps,{children:e=>I(oh,{label:"Category",popupTriggerProps:e,children:R("button",{className:NP,type:"button",children:[I(Gl,{children:YR(r?.paymentInfo?.region)??"Select region..."}),I(pc,{Component:Jo})]})})}),I(HD,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const DP=Av({defaultValues:oD,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(RP,{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:qR})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:pt({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})})]})}}),PP=On({display:"flex",flexDirection:"column",gap:"16px"}),LP=Av({defaultValues:oD,props:{transaction:null,isManual:!1},render:function({form:e,transaction:t,isManual:n}){const{startPrefetch:r,cancelPrefetch:a}=Kp(),o=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 ir(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:_d(t.value.transfer.amount)}),ir(t.value.glAccount)&&(e.setFieldValue("glAccount",t.value.glAccount),e.setFieldValue("reviewStatus","RECONCILIATION_AWAITING"),e.setFieldValue("reconciliationMatch",void 0)),void e.setFieldValue("type","BANK_TRANSFER")}};return I("div",{className:PP,onMouseEnter:r,onMouseLeave:a,children:I(e.Subscribe,{selector:e=>e.values.type,children:r=>{switch(r){case"EXPENSE":return I(kP,{form:e,transaction:t,isManual:n,handleConversion:o});case"REVENUE":return I(EP,{form:e,transaction:t,isManual:n,handleConversion:o});case"TRANSFER_IN":case"TRANSFER_OUT":case"BANK_TRANSFER":return I(IP,{form:e,transaction:t,handleConversion:o});case"TAX_PAYMENT":case"TAX_EXPENSE":return I(DP,{form:e,transaction:t,isManual:n,handleConversion:o});default:return null}}})})}}),MP=Xn(null,On({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function FP({transaction:e,bankAccount:t}){const n=e?e.description:"",r=or(t)||or(e)?"":((e,t)=>{const n=nx(t.type),r=qy(t.amount);return`${n?`${r} `:""}${Zd(e.name,e.mask)}`})(t,e);return R("div",{...MP,children:[I(Ga,{wrap:"wrap",children:n}),t&&I(Ja,{children:r})]})}const OP=On({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),UP=On({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function BP({attachments:e,onRemove:t}){return I("div",{className:OP,children:I("div",{className:UP,children:e.map(e=>I(eR,{attachment:e,onRemove:t},e.localId))})})}const VP=Av({defaultValues:oD,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=uu({mutationFn:Bh,onSuccess:async()=>{await gr.invalidateQueries({queryKey:["files/attachments"]}),await gr.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>R(N,{children:[I(e.AttachmentDropzoneField,{entityId:ml(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(BP,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}});function WP({transaction:e,classSegmentLabels:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedClassSegments:c}=KD(),d=void 0===i?$y[s]:ex[s],[u,h]=y(l??null),p=I(bP,{form:n,transaction:e,title:d,activeTab:u,tabOnClick:e=>h(e===u?null:e),conversationId:o,transactionId:i}),g=I(n.Subscribe,{selector:e=>e.isDefaultValue,children:e=>I(Ou,{disabled:e})});return R(SR,{onSubmit:n.handleSubmit,Header:p,Footer:g,activeTab:u,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(FP,{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(LP,{form:n,transaction:e,isManual:a}),I(n.Subscribe,{selector:e=>e.values.children.flatMap(e=>e.classSegments??[]),children:e=>function(e,t,n){const r=new Set(e.map(e=>e?.label?.id)),a=n.filter(e=>!r.has(e.label?.id));return t.filter(e=>!r.has(e.id)).map(e=>{const n=t.findIndex(t=>t.id===e.id),r=rD(a,e.id);return{fieldLabel:e.name,classSegmentOptions:r,segmentIndex:n,requiredness:e.requiredness}})}(e,t,c).map(({fieldLabel:e,classSegmentOptions:r,requiredness:a,segmentIndex:o})=>I(n.AppField,{name:`classSegments[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>I(n.ClassSegmentField,{fieldLabel:e,classSegmentOptions:r,classSegmentLabels:t,selectedSegment:n.state.value,onSave:e=>n.handleChange(aD(e))})},r[0][0].id))}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(VP,{form:n,transactionId:i})]})}function HP({transactionId:e,initialTab:t,initialType:n}){const{transaction:r,nestedClassSegmentLabels:a,form:o,bankAccount:i,isManual:l,isLoading:s}=function({transactionId:e,initialType:t}){const{nestedClassSegmentLabels:n,classSegmentLabelLookup:r}=KD(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=cl({id:e,enabled:void 0!==e});return{transaction:a,nestedClassSegmentLabels:n,form:sD(a,r,t),bankAccount:Mp(a?.bankAccount?.id??""),isManual:or(a)||ep(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(WP,{transaction:r??null,classSegmentLabels:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function jP({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=cl({id:e});return T(()=>{!r&&or(n)&&Qi()},[n,r]),or(n)?null:I(HP,{transactionId:e,initialTab:t})}function zP({transactionId:e,initialTab:t,initialType:n}){return e?I(jP,{transactionId:e,initialTab:t}):I(HP,{initialTab:t,initialType:n})}const qP={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},KP=(e={})=>{const t=Sn(qP,e);return qP.transform(t,An)},_P=e=>On(KP(e));_P.raw=KP;const YP={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},XP=(e={})=>{const t=Sn(YP,e);return YP.transform(t,An)},ZP=e=>On(XP(e));function GP({subject:e,children:t}){return R(dm,{children:[R(hm,{children:[I(Wd,{}),I(Ga,{children:e})]}),I("div",{className:ZP({alignItems:"center",gap:15}),children:t})]})}function QP({conversationId:e,defaultValues:t}){const[n,r]=y(e),{query:{data:a}}=Mi(n),o="CLOSED"===a?.resolutionStatus;return I(sN,{children:R(dN,{children:[I(GP,{subject:a?.subject??"Conversation"}),I(yR,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}ZP.raw=XP;const JP=Go(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_18201_5557)"},p.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}),p.createElement("path",{d:"M7.49999 10.4812V6.30624H6.30624",strokeWidth:.9375,strokeMiterlimit:10}),p.createElement("path",{d:"M6.30624 10.4813H8.69374",strokeWidth:.9375,strokeMiterlimit:10}),p.createElement("path",{d:"M6.90625 4.51874H8.09375",strokeWidth:.9375,strokeMiterlimit:10})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_18201_5557"},p.createElement("rect",{width:15,height:15,fill:"white"})))),"Info");function $P({onClick:e,active:t}){return I(Bl,{type:"button",onClick:e,active:t,children:I(pc,{Component:JP})})}const eL=On({display:"flex",flexDirection:"column"});function tL({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:eL,children:[I(Ja,{children:e}),n?I(pR,{width:r}):I(Ga,{wrap:"wrap",children:t??""})]})}function nL({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=cl({id:e}),a=Mp(n?.bankAccount.id??"");if(or(n))return null;const o=_P({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:ZP({justifyContent:"space-between"}),children:[I(tL,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(tL,{label:"Amount",data:Xa(_d(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(tL,{label:"Bank Account",data:Zd(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(tL,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function rL({conversationId:e,transactionId:t}){const[n,r]=y(e),[a,o]=y(!0),{query:{data:i}}=Mi(n),l="CLOSED"===i?.resolutionStatus;return I(sN,{children:R(dN,{children:[I(GP,{subject:i?.subject??"Conversation",children:ir(t)&&I($P,{onClick:()=>o(!a),active:a},"infoButton")}),ir(t)&&I(nL,{transactionId:t,isOpen:a}),I(yR,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function aL(){const e=Ji().length>1;return I(sN,{children:R(dN,{background:"foreground",children:[I(dm,{children:R(hm,{children:[I(Wd,e?{Icon:Qo}:{}),I(Ga,{children:"Add New Connection"})]})}),I(Tk,{})]})})}function oL(){return I(dm,{children:R(hm,{children:[I(Wd,{}),I(Ga,{children:"Financial Summary"})]})})}const iL=On({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),lL=er.raw({body:"default"}),sL=On({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},lL);function cL({summaryText:e}){return I("div",{className:iL,children:I("div",{className:sL,children:e})})}const dL=On({display:"flex",flexDirection:"column",overflow:"auto"});function uL({summary:e}){return R("div",{className:dL,children:[I(oL,{}),I(cL,{summaryText:e})]})}const hL=On({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function pL({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return br({queryKey:Cl({id:e}),queryFn:kl})}({id:e});return I(sN,{children:R("div",{className:hL,children:[I(dN,{children:I(uL,{summary:n?.summary})}),I(Mu,{}),I(xR,{conversationId:t??null,attachedEntityId:e})]})})}function gL(){return I(sN,{children:I(dN,{children:I(Fk,{showCloseButton:!0,inOverlay:!0})})})}const mL=h.object({id:h.string(),name:h.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:h.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:h.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;sr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),vL={mergeDestination:Rg,selectedAccount:null};const bL=On({display:"flex",flexDirection:"column",gap:"20px"}),fL=On({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),yL=On.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),xL=On(yL,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),TL=On(yL,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),CL=On(yL,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),wL=On({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),kL=On({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),EL=On({width:"100%",display:"flex",justifyContent:"flex-start"}),AL=On({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),SL=On({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),IL=e=>{Qu(e),Ju(e)};function NL({account:e}){const t=hs(),n=function(e,t){const{mutateAsync:n}=bu();return Ev({defaultValues:vL,onSubmit:async r=>{if(await wu()===Dd&&ir(e)&&ir(r.value.selectedAccount)){const l=(a=e,o=r.value.mergeDestination,i=r.value.selectedAccount,o===Rg?{...Tu(i),duplicateBankAccountIds:[ml(a.id)]}:{...Tu(a),duplicateBankAccountIds:[ml(i.id)]});try{await n(l),t.close(),r.value.mergeDestination===Rg&&Qi()}catch{await ku()}}var a,o,i},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=nu();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:bL,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:IL,children:[I(Ga,{children:"Merge Accounts"}),I("div",{className:fL,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:xL,children:[I("div",{className:EL,children:I(Ga,{children:"Duplicate Account"})}),t===Rg?I(Ag,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Pg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Lg(t,e,n.state.value)})})]}),R("div",{className:TL,children:[I("div",{className:AL,children:I(Ga,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:kL,children:I(Bl,{onClick:()=>e.handleChange(e.state.value===Rg?Ng:Rg),children:I(pc,{Component:Jo})})})})]}),R("div",{className:CL,children:[I("div",{className:SL,children:I(Ga,{children:"Destination Account"})}),t===Rg?I(n.AppField,{name:"selectedAccount",children:n=>I(Pg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Lg(t,e,n.state.value)})}):I(Ag,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:wL,children:[I(Iv,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(Ru,{disabled:or(e),showIcon:!1,textContent:"Merge"})})]})]})}function RL({bankAccount:e}){return I(sp,{children:R(us,{placement:"right-start",modal:!0,children:[I(ps,{children:e=>R(mp,{...e,children:[I(pc,{Component:$C}),I(Ga,{children:"Merge Account"})]})}),I(om,{children:I(HC,{children:I(zC,{children:I(NL,{account:e})})})})]})})}const DL=On({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"}}}),PL=({tranStartDate:e})=>R(N,{children:[I(Ja,{children:"Start Date"}),cr(e)?I(Ga,{children:`${At(xt(e))}`}):I(Ga,{children:"Set Start Date"})]});function LL({bankAccount:e}){return R(us,{placement:"right-start",modal:!0,children:[I(ps,{children:t=>I("button",{className:Bn(DL,ti),...t,type:"button",children:I(PL,{tranStartDate:e.tranStartDate})})}),I(om,{children:I(HC,{children:I(zC,{width:"sm",children:I(GC,{bankAccounts:[e]})})})})]})}const ML=e=>["accounting/manualJournalEntry",e.id],FL=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 ki(a)};function OL({id:e}){return br({queryKey:ML({id:String(ml(e))}),queryFn:FL,enabled:ir(e)})}const UL=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>{const r={path:"/accounting/manualJournalEntry",bodyParams:{manualJournalEntry:e},accessToken:t,endpointManager:ba(n)};return await ha(r)})({data:e,accessToken:t,environment:n});const BL=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:ba(n)};return await ha(r)},VL=h.object({amount:h.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:h.string("Required")}),WL=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===ml(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},HL=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=OL({id:t??null}),r=function(){const{query:{data:e}}=oy();return vy(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutate:a}=uu({mutationFn:BL,onSuccess:async()=>{ea("beginning balance mutation successful, invalidating bank account queries");try{return gr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ta({error:e,severity:"error"})}}});const{mutate:o}=uu({onSuccess:async()=>{ea("mutation successful, invalidating manual journal entry queries");try{return Promise.all([gr.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),gr.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&ta({error:e,severity:"error"})}},mutationFn:UL}),i=hs(),l=((e,t)=>{const n=WL(e,t);return{amount:ir(e.beginningBalanceData.journalEntry?.id)?n:"",date:ir(t?.date)?t.date:""}})(e,n);return Ev({defaultValues:l,validators:{onBlur:VL},onSubmit:l=>{if(i.close(),or(t)||or(n))a({bankAccountId:ml(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(or(e.id))return null;const o={...e,id:e.id},i=a.map(e=>ml(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===ml(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),or(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=Tt(t)??o.date,o)})(n,xt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);ir(t)&&o(t)}}})},jL=On({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),zL=On({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function qL({bankAccount:e}){const t=HL(e),n=hs(),r=()=>{n.close()};return R("form",{className:jL,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(Ga,{children:"Set Beginning Balance"}),I(t.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),I(t.AppField,{name:"amount",children:e=>I(e.EditableAmountField,{label:"Beginning Balance Amount"})}),I(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:zL,children:[I(Iv,{showIcon:!1,onClick:r}),I(Ru,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const KL=Wn({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"}}}}),_L=On({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function YL({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=Bn(KL({layout:a}),ti),i=Bn(KL({layout:"right"}),ti),l=r&&At(r);return R(us,{placement:"right-start",modal:!0,children:[I(ps,{children:e=>R("div",{className:_L,children:[R("button",{className:o,...e,type:"button",children:[I(Ja,{children:"Beginning Balance"}),I(Ga,{children:ir(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{className:i,...e,type:"button",children:[I(Ja,{children:"Migration Date"}),I(Ga,{children:l})]})]})}),I(om,{children:I(HC,{children:I(zC,{width:"sm",children:I(qL,{bankAccount:e})})})})]})}const XL=Wn({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function ZL({bankAccount:e,showStartDate:t}){const{query:{data:n}}=OL({id:e?.beginningBalanceData.journalEntry?.id??null});if(!e)return null;const r=WL(e,n),a=ir(n?.date)?xt(n?.date):null,o=ir(e.tranStartDate)?xt(e.tranStartDate):null,i=ir(a)&&ir(o)&&!gt(a,o),l=i?"left":t?"right":"left";return R("div",{className:XL({layout:i?"stacked":"inline"}),children:[t&&I(LL,{bankAccount:e}),I(YL,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const GL=On({marginTop:"15px",marginBottom:"15px"}),QL={id:"",name:"",mask:"",type:void 0};const JL=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],$L=e=>{Qu(e),Ju(e)};function eM({bankAccountId:e}){const t=Mp(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:QL,[r,a]=y(n),o=function(e,t){const{mutate:n}=bu(),{mutateAsync:r}=vu({mutationFn:pu}),a=cr(String(e.id));return Ev({defaultValues:e,validators:{onBlur:mL},onSubmit:async e=>{if(a)n(Tu(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:gl({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||yu(t.apiName),l=!!t&&xu(t.apiName),s=Zd(r?.name??"",r?.mask??""),c=cr(s)?s:"New Bank Account",d=l&&ir(t?.tranStartDate),u=ir(t)&&(d||!0);return I(sN,{children:I(dN,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:$L,children:[R(dm,{children:[R(hm,{children:[I(Wd,{Icon:Qo}),I(Ga,{children:c}),ir(t)&&I(UC,{shouldUseButtonDiscreteStyles:!0,children:I(RL,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),R(CR,{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:JL,disabled:!i})}),u&&R(N,{children:[I("div",{className:GL,children:I(Mu,{alignment:"horizontal"})}),I(ZL,{bankAccount:t,showStartDate:d})]})]})]})})})}function tM({popupTriggerProps:e,text:t}){return R(Fm,{popupTriggerChildrenProps:e,children:[I(Hk,{children:I(Gl,{wrap:"wrap",children:t})}),I(pc,{Component:Jo})]})}function nM({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=LT(n,e.key),i=FT(e.name,o,1);return R(us,{children:[I(ps,{children:e=>I(tM,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>MT(n,e.key,t))},filters:a})]})}const rM=Go(xg,"Bank");function aM({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(zE,{isSelected:n}):I(Lm,{selected:n,showEmptyIndicator:!0});return R(Fm,{handleClick:t,selected:n,children:[R(Hk,{children:[o&&I(dc,{imageUrl:e.iconUrl,Component:rM}),I(Gl,{wrap:"wrap",children:e.name})]}),i]})}function oM({values:e,model:t,pendingFilters:n,onClick:r}){return R(Nm,{children:[I(Ja,{children:"Filter by"}),I("div",{children:e.length>0?e.map((e,a)=>{const o=LT(n,t.key),l=(s=e,o.some(e=>i(e.value,s.value)));var s;return I(aM,{handleClick:()=>r(e),value:e,isActive:l,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(Sm,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})]})}function iM({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:o}){const i=m(()=>new ke(e,Cp),[e]),l=m(()=>i.search(o).map(e=>e.item),[i,o]);return I(oM,{values:l,model:t,filters:n,pendingFilters:r,onClick:a})}function lM({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I(wm,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:iM,DefaultList:oM,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}const sM=On({padding:"16px",flex:"1 1 0",overflowY:"auto"});function cM({filters:e,filterModels:t,setFilters:n}){const r=Ji().length>1,a=aT(),[o,i]=y(()=>function(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}(e,t));return I(sN,{children:R(dN,{children:[I(dm,{children:R(hm,{children:[I(Wd,r?{Icon:Qo}:{}),I(Gl,{children:"Back"})]})}),I("div",{className:sM,children:R(Nm,{children:[I(Ja,{children:"Filter by"}),I("div",{children:t.filter(e=>{return n=a,(t=e)&&(n||!n&&!t.hideInFilterListOnDesktop);var t,n}).map(t=>{const r=t.possibleValues?t.possibleValues():null;return or(r)?I(nM,{model:t,setFilters:n,pendingFilters:o,setPendingFilters:i,filters:e},t.key):I(dM,{model:t,filters:e,pendingFilters:o,setPendingFilters:i,setFilters:n},t.key)})})]})}),I(iE,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),i(e)},onApply:()=>{const e=function(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}(o);n(e),Qi()}})]})})}function dM({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){if(void 0===e.possibleValues)return;const{values:o,isFilling:i}=e.possibleValues();if(or(o)||!ze(o))return;const l=LT(n,e.key),s=FT(e.name,l);return i?I(Bm,{}):R(us,{children:[I(ps,{children:e=>I(tM,{popupTriggerProps:e,text:s})}),I(uM,{values:o,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})]})}function uM({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o}){const l=hs(),s=e=>{a(n=>{const r=LT(n,t.key),a=t.singleSelect?(o=r,l=e,s=t.createFilter,o.some(e=>i(e.value,l.value))?o:[s(l)]):function(e,t,n){const r=e.findIndex(e=>i(e.value,t.value));return-1!==r?e.filter((e,t)=>t!==r):[...e,n(t)]}(r,e,t.createFilter);var o,l,s;return MT(n,t.key,a)})};return t.SimpleListComponent?I(vm,{title:"Back",children:I(t.SimpleListComponent,{filters:n,pendingFilters:r,onToggle:s,model:t,setPendingFilters:a,setFilters:o})}):I(vm,{title:"Back",Footer:I(iE,{onClearAll:()=>{a(e=>MT(e,t.key,[]))},onApply:()=>{const e=LT(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:s,model:t,setPendingFilters:a,setFilters:o}):I(lM,{values:e,model:t,filters:n,pendingFilters:r,onClick:s})})}function hM({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=hA(e);return I(cM,{filters:n,filterModels:t,setFilters:r})}function pM(){return R(rN,{children:[I(oN,{name:"BankTransactionFormRouter",Component:zP}),I(oN,{name:"Conversation",Component:QP}),I(oN,{name:"MobileConversation",Component:rL}),I(oN,{name:"FinancialSummary",Component:pL}),I(oN,{name:"BanksAndIntegrations",Component:gL}),I(oN,{name:"BankAccountForm",Component:eM}),I(oN,{name:"NewConnection",Component:aL}),I(oN,{name:"TransactionsFilterList",Component:hM})]})}const gM=({environment:e,children:t})=>I(mr.Provider,{value:e,children:t});function mM({children:e}){const{query:{data:t}}=mx(),n={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?gl({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};return I(Us.Provider,{value:n,children:e})}const vM=e=>["whiteLabels",e??{}],bM=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:vi(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 fM({children:e}){const t=hx(),{query:{data:n}}=xi({queryKey:vM({filter:{name:{equal:t}}}),queryFn:bM}),r={icons:n?.data?.[0]?.icons};return I(Xo.Provider,{value:r,children:e})}const yM=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const xM="SSE connection failed with status";function TM({companyId:e,customerPartnerId:t,sseTypes:n}){const r=vr();T(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,va[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 Re(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${xM} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case yM.CONNECTED:return void ea("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case yM.ERROR:throw ta({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case yM.CACHE_BUST:return ea("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(()=>{gr.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>ta({error:e,severity:"error"}))},500*Math.random()),ea(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void ta({error:t instanceof Error?t:new Error("JSON parse error"),severity:"error",extraData:{data:e}})}}(t)}}({event:a.event,data:a.data,env:r,sseTypes:n,customerPartnerId:t,companyId:e}),onclose:()=>function(){throw ta({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(xM))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>ta({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const CM=[yM.CACHE_BUST];function wM({children:e}){const{companyId:t,customerPartnerId:n}=b(Us);return TM({companyId:t,customerPartnerId:n,sseTypes:CM}),e}const kM=v({dimensions:{width:null,height:null}}),EM="undefined"!=typeof window?A:T,AM="undefined"==typeof window;const SM=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;AM&&(t=!1);const[n,r]=y(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),a=vT(r,e.debounceDelay,{leading:!0});function o(){(e.debounceDelay?a:r)({width:window.innerWidth,height:window.innerHeight})}return function(e,t,n,r){const a=g(t);EM(()=>{a.current=t},[t]),T(()=>{const t=window;if(!t||!t.addEventListener)return;const n=e=>{a.current(e)};return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}},[e,void 0,r])}("resize",o),EM(()=>{o()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I(kM.Provider,{value:r,children:e})},IM=({children:e})=>{const{dimensions:t}=b(kM),n=ir(t.width)&&t.width<parseInt(no("sizes.breakpoint-xl"));return I(rT.Provider,{value:n,children:e})};function NM({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return T(()=>{var e,r;e=n,r=t,Zr.setProperties(Jr),Qr=r,Gr=e},[n,t]),I(gM,{environment:t,children:I(QI,{children:I(dr.Provider,{value:r,children:I(mM,{children:I(fM,{children:I(wM,{children:I(SM,{children:R(IM,{children:[I(fe.ConfirmationRoot,{}),e,I(pM,{})]})})})})})})})})}export{Bk as BanksAndIntegrations,SC as BusinessOwnerDashboard,zI as ExpenseDashboard,XI as IncomeDashboard,NM as Tight,AI as TransactionsDashboard,on as useOptions};
|
|
1
|
+
import{create as e}from"zustand";import{devtools as t,persist as n}from"zustand/middleware";import"zustand/react/shallow";import{cloneDeep as r,entries as a,mapValues as o,isEqual as i,differenceBy as l,debounce as s,isEmpty as c}from"lodash-es";import{v4 as d}from"uuid";import*as u from"zod";import{z as h}from"zod";import*as p from"react";import{useRef as g,useMemo as m,createContext as v,useContext as b,Component as f,useState as y,useCallback as x,useEffect as T,createElement as C,forwardRef as w,useLayoutEffect as k,useImperativeHandle as E,useReducer as A,Fragment as S}from"react";import{jsx as I,Fragment as N,jsxs as D}from"react/jsx-runtime";import{QueryClient as R,useIsRestoring as P,useQuery as L,keepPreviousData as M,useMutation as F,useQueries as O,useInfiniteQuery as B}from"@tanstack/react-query";import U from"yocto-queue";import V from"big.js";import{ResponsiveContainer as W,BarChart as H,Legend as q,CartesianGrid as z,XAxis as j,YAxis as K,Tooltip as _,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 Te,useStore as Ce,createFormHook as we}from"@tanstack/react-form";import{NumericFormat as ke}from"react-number-format";import Ee from"fuse.js";import{AnimatePresence as Ae,motion as Se}from"motion/react";import{useDropzone as Ie}from"react-dropzone";import{openDB as Ne}from"idb";import{PersistQueryClientProvider as De}from"@tanstack/react-query-persist-client";import{fetchEventSource as Re}from"@microsoft/fetch-event-source";import{MemoryRouter as Pe,useNavigate as Le,useLocation as Me,Routes as Fe,Route as Oe}from"react-router";function Be(e,t){return`${e.trim()}:${t.trim()}`}const Ue=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,Be("featureFlags","updateFlags"))});function Ve(){return $t(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function We(){return $t(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}let He=null,qe=!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 je(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Ke(){const e=ze();if(!e)return;const{meta:t,params:n}=e;if(qe)return t.remove(),qe=!1,void(He=null);He?n["interactive-widget"]=He:delete n["interactive-widget"],He=null,je(t,n)}const _e="drawerNavigation",Ye=(e,t)=>({drawerHistory:[],closingQueue:[],openDrawer:(t,n={})=>e(e=>{const{replaceHistory:a,routeProps:o}=n,i={[t]:{routeProps:o}};if(a||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),qe=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;He=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",je(t,n)}(),{drawerHistory:[i]};{const t=r(e.drawerHistory);return t.push(i),{drawerHistory:t}}},void 0,Be(_e,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,Be(_e,"closeDrawer")),0===t().drawerHistory.length&&Ke()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,Be(_e,"closeAllDrawers")),Ke()},requestCloseDrawer:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t.length-1,r=t[n];return{drawerHistory:t.slice(0,n),closingQueue:[...e.closingQueue,r]}},void 0,Be(_e,"requestCloseDrawer")),requestCloseAllDrawers:()=>e(e=>{if(0===e.drawerHistory.length)return{};const t=e.drawerHistory,n=t[t.length-1];return{drawerHistory:[],closingQueue:[...e.closingQueue,n]}},void 0,Be(_e,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,Be(_e,"confirmCloseDrawer")),0===t().drawerHistory.length&&Ke()}}),Ze=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,Be("externalOptions","setOptions"))});function Ge(e){return Array.isArray(e)&&e.length>0}function Qe(e){const t={...e,selectedValues:e=>e.filter(e=>e.modelKey===t.key),createFilter:e=>({...e,modelKey:t.key,id:d()}),searchFunc:e.searchFunc?e.searchFunc:e=>{return n=e,t.name.toLowerCase().includes(n.toLowerCase());var n}};return t}const Xe="search",Je=Qe({key:Xe,name:"Search"});function $e(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function et(e,t,n){return new Date(e,t,n)}function tt(e){const[t,n,r]=e.split("-");return et(Number(t),Number(n),Number(r))}function nt(){return $e(et(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function rt(e,t){return $e(et(t,e,1))}function at(){const e=/* @__PURE__ */new Date;return $e(et(e.getFullYear(),e.getMonth()+1,0))}function ot(e){const t=/* @__PURE__ */new Date;return $e(et(t.getFullYear(),t.getMonth()-e,1))}function it(e){const t=e.getMonth(),n=t-t%3;return $e(et(e.getFullYear(),n,1))}function lt(e){const t=e.getMonth(),n=t-t%3+3;return $e(et(e.getFullYear(),n,0))}const st={ALL_TIME:"ALL_TIME",THIS_MONTH:"THIS_MONTH",LAST_MONTH:"LAST_MONTH",LAST_3_MONTHS:"LAST_3_MONTHS",LAST_12_MONTHS:"LAST_12_MONTHS",THIS_QUARTER:"THIS_QUARTER",LAST_QUARTER:"LAST_QUARTER",THIS_YEAR:"THIS_YEAR",LAST_YEAR:"LAST_YEAR"},ct={ALL_TIME:"All Time",THIS_MONTH:"This Month",LAST_MONTH:"Last Month",LAST_3_MONTHS:"Last 3 Months",LAST_12_MONTHS:"Last 12 Months",THIS_QUARTER:"This Quarter",LAST_QUARTER:"Last Quarter",THIS_YEAR:"This Year",LAST_YEAR:"Last Year"},dt=e=>Object.values(st).includes(e),ut={[st.ALL_TIME]:()=>"",[st.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return rt(e.getMonth(),e.getFullYear())}(),[st.LAST_YEAR]:()=>$e(et(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[st.LAST_MONTH]:()=>ot(1),[st.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return $e(et(e.getFullYear(),e.getMonth()-11,1))}(),[st.THIS_YEAR]:()=>$e(et(/* @__PURE__ */(new Date).getFullYear(),0,1)),[st.LAST_3_MONTHS]:()=>ot(2),[st.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return it(et(e.getFullYear(),e.getMonth()-3,1))}(),[st.THIS_QUARTER]:()=>it(/* @__PURE__ */new Date)};function ht(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 pt=e=>ut[e](),gt={[st.ALL_TIME]:()=>"",[st.THIS_MONTH]:()=>at(),[st.LAST_YEAR]:()=>$e(et(/* @__PURE__ */(new Date).getFullYear(),0,0)),[st.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return $e(et(e.getFullYear(),e.getMonth(),0))}(),[st.LAST_12_MONTHS]:()=>at(),[st.THIS_YEAR]:()=>nt(),[st.LAST_3_MONTHS]:()=>at(),[st.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return lt(et(e.getFullYear(),e.getMonth()-3,1))}(),[st.THIS_QUARTER]:()=>lt(/* @__PURE__ */new Date)},mt=e=>gt[e](),vt=e=>{return dt(e)?{beginDate:pt(e),endDate:mt(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:$e((t=e).beginDate),endDate:$e(t.endDate)};var t},bt=["SUN","MON","TUE","WED","THU","FRI","SAT"],ft=["January","February","March","April","May","June","July","August","September","October","November","December"];function yt({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 xt(e,t){return e.toDateString()===t.toDateString()}function Tt(e){return xt(e,/* @__PURE__ */new Date)}function Ct(e,t){const n=et(e.getFullYear(),e.getMonth(),e.getDate()),r=et(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function wt(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 kt(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=et(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Et(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 kt(o,i,l)?et(l,o-1,i):null}function At(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 kt(i,l,o)?et(o,i-1,l):null}function St(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 It(e,t){return Ct(e,t)?t:e}function Nt(e,t){return Ct(t,e)?t:e}const Dt=(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},Rt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return Tt(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Dt(t,{abbreviateMonth:!0,abbreviateYear:!1})},Pt=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Lt(e,t){return et(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Mt(e){const{month:t,year:n}=e;return{beginDate:et(n,t-1,1),endDate:et(n,t+1,0)}}const Ft="date",Ot=Object.values(st).map(e=>{return{name:ct[t=e],value:{date:{name:ct[t],value:t}}};var t}),Bt=Qe({key:Ft,name:"Date",possibleValues:()=>({values:Ot}),singleSelect:!0,hideInFilterListOnDesktop:!0});function Ut(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===Xe);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==Xe)}const Vt=Bt.createFilter({name:ct[st.LAST_12_MONTHS],value:{date:{name:ct[st.LAST_12_MONTHS],value:st.LAST_12_MONTHS}}});function Wt(e,t){return Ut([...t.some(e=>e.modelKey===Ft)?function(e){const t=e.findIndex(e=>e.modelKey===Ft);return-1!==t?(n=e,(r=t)>-1&&r<=n.length-1?[...n.slice(0,r),...n.slice(r+1)]:[...n]):e;var n,r}(e.filters):e.filters,...t])}function Ht(e,t){const n=e.filters[t];return n&&n.modelKey===Ft?function(e,t){const n=[...e];return n[t]=Vt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function qt(e){return Ut(e.some(e=>e.modelKey===Ft)?e:[...e,Vt])}function zt(e,t){if(e.hasInitialized)return e;const n=[];return"OWNER"===t.userRole&&t.hasNonReconciledTransactions&&t.needsReviewStatuses.length>0&&n.push({modelKey:"reviewStatus",id:d(),name:"Needs Review",value:{reviewStatus:{name:"Needs Review",value:{in:t.needsReviewStatuses}}}}),n.push(Vt),{filters:n,hasInitialized:!0}}const jt="transactionsDashboardFilters",Kt=e=>({transactionsDashboardFilters:[Vt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Wt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Be(jt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:Ht({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Be(jt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:qt(t)}),void 0,Be(jt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=zt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,Be(jt,"initialize"))}),_t="expenseDashboardFilters",Yt=e=>({expenseDashboardFilters:[Vt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Wt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Be(_t,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:Ht({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Be(_t,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:qt(t)}),void 0,Be(_t,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=zt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,Be(_t,"initialize"))}),Zt="incomeDashboardFilters",Gt=e=>({incomeDashboardFilters:[Vt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Wt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Be(Zt,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:Ht({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Be(Zt,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:qt(t)}),void 0,Be(Zt,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=zt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,Be(Zt,"initialize"))}),Qt={label:"Connected Accounts",value:"connected"},Xt="banksAndIntegrationsState",Jt=e=>({banksAndIntegrationsSelectedTab:Qt,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,Be(Xt,"setBanksAndIntegrationsSelectedTab")),toggleExpandedIntegration:(t,n)=>e(e=>({expandedPlaidItems:e.expandedPlaidItems.includes(t)||n&&!e.hasExpandedUpdated?e.expandedPlaidItems.filter(e=>e!==t):[...e.expandedPlaidItems,t],hasExpandedUpdated:!0}),void 0,Be(Xt,"toggleExpandedIntegration"))}),$t=e()(t(n((...e)=>({...Ue(...e),...Ye(...e),...Ze(...e),...Kt(...e),...Yt(...e),...Gt(...e),...Jt(...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})),en={SELECT:"select",EXPAND:"expand"},tn={...en,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",CLASS_SEGMENT:"classSegment",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},nn=[tn.COMMENTS,tn.DATE,tn.DESCRIPTION,tn.AMOUNT,tn.CATEGORY,tn.CLASS_SEGMENT,tn.REVIEW_STATUS],rn=u.object({pageSize:u.optional(u.int32().positive()),columns:u.optional(u.array(u.enum(nn)))}),an=e=>{const t=rn.safeParse(e);return t.success?t.data:void 0},on=u.optional(u.string().trim()),ln=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,sn=u.optional(u.array(u.string().trim())),cn=u.object({integrations:u.optional(u.array(u.enum(["UNIT","STRIPE","GUSTO","SHOPIFY","SQUARE","RUTTER","UBER","MOOV","QUALPAY","MANUAL_ENTRY","PARTNER_IMPLEMENTATION","QBO","XERO","FRESHBOOKS"]))),useOnPlaidLink:u.optional(u.boolean()),hideManualBanks:u.optional(u.boolean())}),dn={transactionsDashboard:an,incomeDashboard:an,expenseDashboard:an,accessToken:e=>{const t=on.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=>ln.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=cn.safeParse(e);return t.success?t.data:void 0}},un=(e,t)=>{if(void 0!==dn[e])return(0,dn[e])(t)};function hn(e){const t=g(!1),n=$t(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of a(e)){const e=un(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const o=$t(e=>e.externalOptions);return{options:m(()=>r(o),[o]),setOptions:n}}function pn(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function gn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function mn(e){return String.fromCharCode(e+(e>25?39:97))}function vn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=mn(t%52)+n;return mn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var bn=/\s*!(important)?/i;function fn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var yn=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}},xn=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Tn(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(xn.has(n))return;const r=e[n],a=t[n];pn(r)&&pn(a)?e[n]=Tn(r,a):e[n]=a}),e):e,{})}var Cn=e=>null!=e;function wn(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);Cn(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 wn(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 En={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},An=/([A-Z])/g,Sn=/^ms-/,In=yn(e=>e.startsWith("--")?e:e.replace(An,"-$1").replace(Sn,"-ms-").toLowerCase()),Nn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),Dn=`(?:${"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("|")})`,Rn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${Dn}$`),Pn={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):pn(e)?wn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&Nn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&Rn.test(e)},Ln=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,gn(t))};const Mn=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,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,base".split(",")),Fn=/^@|&|&$/;function On(e){return Mn.has(e)||Fn.test(e)}const Bn=/^_/,Un=/&|@/,Vn=/* @__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(":");Vn.set(t,n)});const Wn={conditions:{shift:function(e){return e.sort((e,t)=>{const n=On(e),r=On(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Mn.has(e)?e.replace(Bn,""):Un.test(e)?`[${fn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1.5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${Vn.get(e)||In(e)}_${fn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},Hn=function(e){const{utility:t,hash:n,conditions:r=En}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return yn(({base:o,...i}={})=>{const l=kn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return wn(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&bn.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(bn,"").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,vn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(Wn),qn=(...e)=>Hn(zn(...e));qn.raw=(...e)=>zn(...e);const{mergeCss:zn}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>pn(e)&&Object.keys(gn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>kn(t,e))}return{mergeCss:yn(function(...e){return Tn(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(Wn);function jn(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const Kn=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function _n(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=Kn(e),o=e=>({...r,...gn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=zn(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=zn(n,e.css))}),n}(a,r);return zn(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(yn(function(e){return qn(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=Kn(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:zn(t,o.base),variants:Object.fromEntries(i.map(e=>[e,zn(n[e],o.variants[e])])),defaultVariants:Tn(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 Yn,Zn=((Yn=Zn||{}).component="component",Yn["dashboard-placeholder-table"]="dashboard-placeholder-table",Yn["dashboard-header"]="dashboard-header",Yn["dashboard-table"]="dashboard-table",Yn["dashboard-table-body"]="dashboard-table-body",Yn["dashboard-table-cell"]="dashboard-table-cell",Yn["dashboard-table-column-header"]="dashboard-table-column-header",Yn["dashboard-table-header"]="dashboard-table-header",Yn.label="label",Yn.popup="popup",Yn["popup-sort-row"]="popup-sort-row",Yn["progress-bar"]="progress-bar",Yn["progress-bar-fill"]="progress-bar-fill",Yn.summation="summation",Yn["table-parent-row"]="table-parent-row",Yn["table-row"]="table-row",Yn["table-sub-row"]="table-sub-row",Yn.tile="tile",Yn["tile-bar-label"]="tile-bar-label",Yn["tile-bar-label-outer"]="tile-bar-label-outer",Yn["tile-body"]="tile-body",Yn["tile-filter-button"]="tile-filter-button",Yn["tile-filter-list"]="tile-filter-list",Yn["tile-filter-row"]="tile-filter-row",Yn["tile-header"]="tile-header",Yn["business-owner-dashboard"]="business-owner-dashboard",Yn["business-owner-dashboard-header"]="business-owner-dashboard-header",Yn["transaction-type-label"]="transaction-type-label",Yn["transaction-date-cell-container"]="transaction-date-cell-container",Yn["selector-row"]="selector-row",Yn["popup-list"]="popup-list",Yn.badge="badge",Yn["badge-chip"]="badge-chip",Yn["date-cell"]="date-cell",Yn["vertical-divider"]="vertical-divider",Yn["horizontal-divider"]="horizontal-divider",Yn["checkbox-input"]="checkbox-input",Yn["bulk-select"]="bulk-select",Yn["button-base"]="button-base",Yn["button-discreet-small"]="button-discreet-small",Yn["button-primary"]="button-primary",Yn["button-secondary"]="button-secondary",Yn["button-success"]="button-success",Yn["button-danger"]="button-danger",Yn["button-warning"]="button-warning",Yn["button-action"]="button-action",Yn["button-table-header"]="button-table-header",Yn["button-inline"]="button-inline",Yn["small-square-button"]="small-square-button",Yn.card="card",Yn["card-button-icon-container"]="card-button-icon-container",Yn["pagination-button"]="pagination-button",Yn.text="text",Yn["cell-button"]="cell-button",Yn["selector-button"]="selector-button",Yn["review-status-selector-button"]="review-status-selector-button",Yn["review-status-dropdown-arrow"]="review-status-dropdown-arrow",Yn["financial-summary-layout"]="financial-summary-layout",Yn["financial-summary-chatbox"]="financial-summary-chatbox",Yn["financial-summary-chatbox-header"]="financial-summary-chatbox-header",Yn["month-picker"]="month-picker",Yn["month-picker-left-button"]="month-picker-left-button",Yn["month-picker-right-button"]="month-picker-right-button",Yn["month-picker-label"]="month-picker-label",Yn["filter-bar"]="filter-bar",Yn["filter-search-bar"]="filter-search-bar",Yn["filter-pill"]="filter-pill",Yn["discreet-form-input"]="discreet-form-input",Yn["editable-form-input"]="editable-form-input",Yn["category-text"]="category-text",Yn["amount-input-container"]="amount-input-container",Yn["amount-input"]="amount-input",Yn["modal-popup"]="modal-popup",Yn["drawer-header"]="drawer-header",Yn["form-body"]="form-body",Yn.body="body",Yn.heading="heading",Yn["sub-label"]="sub-label",Yn["strong-label"]="strong-label",Yn["strong-sub-label"]="strong-sub-label",Yn["weak-label"]="weak-label",Yn["metric-xl"]="metric-xl",Yn["metric-md"]="metric-md",Yn["large-icon"]="large-icon",Yn["medium-icon"]="medium-icon",Yn["small-icon"]="small-icon",Yn["tiny-icon"]="tiny-icon",Yn["x-large-icon"]="x-large-icon",Yn["xx-large-icon"]="xx-large-icon",Yn["card-header"]="card-header",Yn.icon="icon",Yn["neutral-badge"]="neutral-badge",Yn["highlight-badge"]="highlight-badge",Yn["success-badge"]="success-badge",Yn["warning-badge"]="warning-badge",Yn["danger-badge"]="danger-badge",Yn["critical-badge"]="critical-badge",Yn["button-group"]="button-group",Yn["alert-dialog"]="alert-dialog",Yn["alert-header"]="alert-header",Yn["emphasis-label"]="emphasis-label",Yn["profit-loss-graph"]="profit-loss-graph",Yn.banner="banner",Yn["banner-high"]="banner-high",Yn["banner-medium"]="banner-medium",Yn["banner-low"]="banner-low",Yn["banner-urgent"]="banner-urgent",Yn["banner-default"]="banner-default",Yn["banner-button"]="banner-button",Yn["banner-button-text"]="banner-button-text",Yn["banner-button-icon"]="banner-button-icon",Yn["banner-icon"]="banner-icon",Yn["banner-title"]="banner-title",Yn["empty-dashboard-layout"]="empty-dashboard-layout",Yn["emphasis-sub-label"]="emphasis-sub-label",Yn["bar-transactions-positive"]="bar-transactions-positive",Yn["bar-transactions-negative"]="bar-transactions-negative",Yn["message-sent"]="message-sent",Yn["message-received"]="message-received",Yn);const Gn=e=>null==e,Qn=e=>!Gn(e),Xn="Tight-",Jn=e=>`${Xn}${e}`;function $n(e){return e in Zn}function er(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===Xn&&r in Zn}function tr(e){return!$n(e)&&!er(e)}const nr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(Jn(e)),t.forEach(e=>{Gn(e)||(tr(e)?r.push(e):$n(e)&&n.push(Jn(e)))}),{className:jn(...n,...r)}},rr=nr(Zn["business-owner-dashboard-header"],qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function ar({children:e}){return I("div",{...rr,children:e})}function or(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(er(t)&&e.push(t),e),[])],[])}function ir(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(tr(t)&&e.push(t),e),[])],[])}function lr(e){const t=Array.isArray(e)?e:[e];return{className:jn(...or(t),...ir(t))}}const sr=_n({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:{xl:"16px",base:"18px"},letterSpacing:"0.84px"}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:{xl:"16px",base:"18px"},letterSpacing:"0.84px"},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:{xl:"14px",base:"16px"},letterSpacing:"0.66px"},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"20px",letterSpacing:"0.96px",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"16px",letterSpacing:"0.84px"},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"},letterSpacing:"0.96px"},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:{xl:"14px",base:"16px"},letterSpacing:"0.84px"},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:{xl:"14px",base:"16px"},letterSpacing:"0.84px"}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"25px",letterSpacing:"2px"}},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"}}}}),cr=nr(Zn.heading,sr({heading:"default"}));function dr({children:e,stylists:t=[]}){const n=lr([cr,...t]);return I("div",{...n,children:e})}function ur(e,t,n){return[...e,{accessToken:t,environment:n}]}function hr(e,t){return[...e,t]}function pr(e){return""===e.trim()}function gr(e){return Gn(e)||pr(e)}function mr(e){return!gr(e)}const vr=v({activeToken:void 0,accountantToken:void 0});function br(){const{activeToken:e}=b(vr);return e}const fr=()=>{throw new Error("No access token provided")},yr=72e5,xr=new R({defaultOptions:{queries:{gcTime:yr,staleTime:3e4,refetchInterval:6e4}}}),Tr=v("SANDBOX");function Cr(){return b(Tr)}function wr({queryKey:e,queryFn:t,...n}){const r=br(),a=Cr(),o=mr(r),i=ur(e,r??"",a),l=P(),s=L({...n,queryKey:i,queryFn:o?t:fr,placeholderData:n.keepPreviousDataPlaceholder?M:void 0,...o?{}:{retry:!1,staleTime:1/0}},xr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class kr{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 Er=Symbol("Circular"),Ar=Symbol("AccessError");function Sr(e,t,n){return Ir({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Ir({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=Er),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=Nr(()=>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=Nr(()=>s[i]);e.push(Ir({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=Nr(()=>s[c]);e[c]=Ir({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function Nr(e){try{return e()}catch{return Ar}}const Dr=Object.prototype.toString,Rr=Object.getPrototypeOf;function Pr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Lr=/^\s*at .*(\S+:\d+|\(native\))/m,Mr=/^(eval@)?(\[native code])?$/;function Fr(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 Or(e,t){const n=Br(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Pr(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[Ur(n)];return a.push(...Hr(n).map(e=>Ur(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function Br(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===Dr.call(t))return!0;t=Rr(t)}return!1}(e))return e;let n=function(e){if(!Pr(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 Ur(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:Vr(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function Vr(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(Lr)?e.split("\n").filter(e=>!!e.match(Lr)).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=Fr(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(Mr)).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=Fr(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<Wr;){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 Wr=20;function Hr(e){const t=e;if(t.cause){const e=Br(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(Hr(e))}return[]}function qr(...e){console.error}const zr={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 jr=Date.now();const Kr=()=>{jr=Date.now()},_r={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-jr,!0}),{reset:Kr})},Yr=[["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\)$/]],Zr=[["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/]],Gr=(Qr=function(e){const t=""!==(n=e)&&Yr.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 Zr)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,...Qr(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 Qr;class Xr{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 Jr extends f{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}=Or(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 $r={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(Jr,{client:e,onError:t,FallbackComponent:n,children:r})})},ea=new class{breadcrumbs=[];config;delivery=new kr(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return qr(),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}=Or(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=Sr(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/Hurdlr/TraxComponents/tree/dev/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){qr()}}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 ta="",na="";const ra="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",aa=ea.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.4.0",appType:"browser",releaseStage:ra,enabledReleaseStages:["prod","DEV"],plugins:[_r,Gr,zr,(()=>{const e=new Xr(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),$r]}),oa=(e,t)=>{try{ea.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?ia({error:n,severity:"error"}):ia({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},ia=async e=>{try{await ea.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:ta,environment:na}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await ia({error:t,severity:"error"}):await ia({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},la=aa.getPlugin("react"),sa=la?.BugsnagErrorBoundary,ca=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,da=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},ua=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},ha={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function pa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...o(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?ha:{}}});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 ga({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=da({extraHeaders:t,authorization:e});oa("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return oa("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),ua(e)}catch(l){return Promise.reject(l)}}async function ma(e){const{url:t,headers:n}=pa(e);return ga({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function va(e){return ma(e)}async function ba(e){return ma(e)}const fa=(e,t)=>({getUrl:t=>((e,t)=>{let n=t;for(;n.length>0&&"/"===n.charAt(0);)n=n.slice(1);return`${e}/${n}`})(e,t),baseUrl:e,apiVersion:t}),ya={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"},xa={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"},Ta={...xa,LOCAL:"http://localhost:8082"};function Ca(e){return fa(`${t=e,ya[t]}/v5`,"v5");var t}const wa=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],ka=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...vt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Ca(a)};return await ba(o)};function Ea({filter:e,grouping:t,select:n,accountingMethod:r}){return wr({queryKey:wa({filter:e,grouping:t,accountingMethod:r}),queryFn:ka,select:n})}const Aa="noDataHeight";function Sa(e){const t=At(e??"");return null!==t?Dt(t,{abbreviateMonth:!0,abbreviateYear:!0}):""}function Ia(e){const t=Sa(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?V(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?V(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 Na(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(Gn(n))return t;for(const i of n){const{month:e,netIncome:n}=Ia(i);t.total=V(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 Da="MONTHLY",Ra=nr(Zn["tile-header"],qn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Pa({title:e}){return I("div",{...Ra,children:I(dr,{children:e})})}const La=nr(Zn["tile-body"],qn({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 Ma({children:e}){return I("div",{...La,children:e})}const Fa=_n({base:{display:"flex",flexDirection:"column",boxShadow:"box-shadow",transition:"height 0.5s, width 0.5s",position:"relative",borderRadius:"lg"},variants:{type:{default:{width:"400px",flexShrink:0,height:"300px"},chart:{minWidth:"900px",maxWidth:"1440px",height:"481px"}},isSample:{true:{pointerEvents:"none"},false:{}}},defaultVariants:{type:"default"}});function Oa({children:e,type:t,isSample:n=!1}){const r=nr(Zn.tile,Fa({type:t,isSample:n}));return I("div",{...r,children:e})}const Ba=qn({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Ua=qn.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),Va=qn.raw({whiteSpace:"normal",overflowWrap:"break-word"}),Wa=qn({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"12px",letterSpacing:"0.66px"}),Ha=nr(Zn.text,qn({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba);function qa({children:e}){return I("div",{...Ha,children:e})}const za=nr(Zn["metric-xl"],sr({metric:"xl"}));function ja(e){return I("div",{...za,children:e.children})}const Ka=nr(Zn.summation,qn({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function _a({title:e,label:t}){return D("div",{...Ka,children:[I(ja,{children:e}),I(qa,{children:t})]})}const Ya=nr(null,qn({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function Za({children:e}){return I("div",{...Ya,children:e})}const Ga=(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},Qa=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),Xa=1e9;function Ja(e,{cents:t="default",condense:n=!1,dollarSign:r=!1,signage:a="default"}={}){const o="string"==typeof e?parseFloat(e):e;if(Number.isNaN(o))return"";let i;const l=Math.abs(o);let s;if(n&&l>99999){s=Math.sign(o)<0;const e=Math.floor((d=l,Math.log(d)/Math.log(1e3)))-1,t=Math.pow(1e3,e),n=Math.round(l/t),r=n*t;let a,c=n/1e3;l<Xa&&c>=1e3&&(c/=1e3),r>=Xa?a="B":r>=1e6?a="M":(c=Math.round(c),a="K"),i=`${Qa(c,0,1)}${a}`}else{let e;const n=2,r=0;let a,l;"floor"===t?(a=r,l=r,c=o,e=Math.sign(c)*Math.floor(Math.abs(c))):"round"===t?(a=r,l=r,e=Ga(o,a)):"always"===t?(a=n,l=n,e=Ga(o,a)):"default"===t&&Math.abs(o)>=1e3?(a=r,l=r,e=Ga(o,a)):(a=n,e=Ga(o,a),l=e%1==0?r:n),s=Math.sign(e)<0;const d=Math.abs(e);i=Qa(d,l,a)}var c,d;let u=i;const h=r?"$":"";return void 0===a||"off"===a?u=`${h}${i}`:"parens"===a?u=`${h}${s?`(${i})`:i}`:"always"===a?u=`${s?"-":"+"}${h}${i}`:"default"===a&&(u=`${s?"-":""}${h}${i}`),u}function $a(e){return Ja(e,{condense:!0,dollarSign:!0})}function eo(e){return Ja(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function to(e){return Ja(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function no(e,t){return Ja(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const ro=_n({variants:{wrap:{ellipsis:Ua,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function ao({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(gr(n))return null;const a=lr([nr(Zn["strong-label"],Zn.text,sr({label:"strongLabel"}),ro({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const oo=_n({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"16px",letterSpacing:"0.66px",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:Ua,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:Ua,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function io({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=nr(Zn["sub-label"],Zn.text,oo({intent:e,wrap:t,accent:r}),Ba);return gr(n)?null:I("div",{...a,children:n})}const lo=nr(null,qn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"10px",width:"fit-content",height:"fit-content"}));function so({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Aa)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),D("div",{...lo,children:[I(ao,{children:t[0].name??""}),I(io,{children:$a(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.black100":{value:"#CED1D2",variable:"var(--Tight-colors-black100)"},"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.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.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.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.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.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.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.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-green200)",variable:"var(--Tight-colors-brand-success-opaque)"},"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.warning.opaque":{value:"var(--Tight-colors-yellow200)",variable:"var(--Tight-colors-brand-warning-opaque)"},"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.danger.opaque":{value:"var(--Tight-colors-red200)",variable:"var(--Tight-colors-brand-danger-opaque)"},"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.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-weak)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-brand-primary)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-brand-primary-strong)",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)",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-opaque)",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-opaque)",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.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-opaque)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"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.inherit":{value:"inherit",variable:"var(--Tight-colors-inherit)"},"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.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.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.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.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-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.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.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"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.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"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.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.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.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 uo(e,t){return co[e]?.value||t}uo.var=function(e,t){return co[e]?.variable||t};const ho=nr(null,qn({borderRadius:"50%",flexShrink:0})),po=nr(null,qn({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),go=uo.var("colors.surface.foreground.disabled");function mo({color:e=go,diameter:t=17,label:n}){return D("div",{...po,"data-testid":"bullet-row",children:[I("div",{...ho,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(io,{children:n})]})}const vo=nr(null,qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function bo({payload:e}){return void 0===e?null:I("div",{...vo,children:e.map((e,t)=>"none"!==e.type&&I(mo,{color:e.color,label:e.value,diameter:17},t))})}const fo={right:20,left:20},yo=["income","profit","expenses","loss"],xo=e=>yo.findIndex(t=>t===e.dataKey),To={paddingBottom:"20px",marginLeft:"-20px"},Co={stackId:"stack",isAnimationActive:!1},wo=nr(Zn["profit-loss-graph"],qn({"& .recharts-surface":{outline:"none"}})),ko=uo.var("colors.money"),Eo=uo.var("colors.border.layout"),Ao=uo.var("colors.border.layout.strong"),So={fill:uo.var("colors.typography.base"),fontSize:uo.var("fontSizes.metric.sm")},Io={profit:uo.var("colors.money.positive.strong"),income:uo.var("colors.money.positive.weak"),loss:uo.var("colors.money.negative.strong"),expenses:uo.var("colors.money.negative.weak")},No=[0,100],Do=["auto","auto"];function Ro({data:e}){const[t,n]=y(!0);if(void 0===e)return null;const r=e.hasAnyData?Do:No;return I(W,{width:"100%",height:"100%",...wo,children:D(H,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:fo,children:[I(q,{verticalAlign:"top",itemSorter:xo,wrapperStyle:To,content:({payload:e})=>I(bo,{payload:e})}),I(z,{strokeDasharray:"0",vertical:!1,stroke:Eo}),I(j,{dataKey:"month",interval:0,tickLine:!1,stroke:Eo,tick:So}),I(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:Eo,tick:So,tickFormatter:e=>$a(e)}),I(_,{content:({active:e,payload:t})=>I(so,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(Y,{name:"Profit",dataKey:"profit",fill:Io.profit,...Co}),I(Y,{name:"Income",dataKey:"income",fill:Io.income,...Co}),I(Y,{name:"Loss",dataKey:"loss",fill:Io.loss,...Co}),I(Y,{name:"Expenses",dataKey:"expenses",fill:Io.expenses,...Co}),I(Y,{dataKey:Aa,fill:Eo,legendType:"none",...Co}),I(Z,{y:0,stroke:Ao}),I(G,{dataKey:"netIncome",fill:ko,stroke:ko,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const Po=qn({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 Lo({styles:e}){const t=jn(Po,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const Mo=qn({width:"40%",minHeight:65});function Fo({children:e}){return D(N,{children:[I(Lo,{styles:Mo}),I(Za,{children:e})]})}const Oo=nr(null,qn({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),Bo=qn({width:"80px",height:"17px",marginBottom:"10px"}),Uo=qn({width:"100%",height:"100%"});function Vo(){return D(N,{children:[D("div",{...Oo,children:[I(Lo,{styles:Bo}),I(Lo,{styles:Bo}),I(Lo,{styles:Bo}),I(Lo,{styles:Bo})]}),I(Lo,{styles:Uo})]})}const Wo=_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 Ho({size:e}){const t=Wo({size:e});return I("div",{className:t,children:"Sample"})}const qo=20200,zo=5043,jo=Object.freeze({income:qo,expenses:zo,netIncome:15157,absoluteSum:Math.abs(qo)+Math.abs(zo)}),Ko=Object.freeze({total:zo,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),_o=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),Yo=[{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 Zo({filter:e=st.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Ea({filter:e,grouping:t,select:Na})}({filter:e,grouping:Da}),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=Dt(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=Yo[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 D(Oa,{type:"chart",children:[I(Pa,{title:"Profit + Loss"}),I(Ma,{children:r?I(Fo,{children:I(Vo,{})}):D(N,{children:[I(_a,{title:$a(a?.total??0),label:"Profit"}),I(Za,{children:I(Ro,{data:a})})]})}),t&&I(Ho,{size:"xl"})]})}const Go={FinancialOverviewDashboard:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},{CONVERSATIONS:Qo,TRANSACTIONS:Xo}=Go.FinancialOverviewDashboard,Jo={MESSAGE_REVIEW:Qo,TRANSACTION_REVIEW:Xo,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},$o={reviewStatus:{in:["USER_REVIEW_REQUIRED"]},status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},ei={resolutionStatus:{in:["OPEN"]}},ti=[],ni=[],ri=v({}),ai=_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 oi(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:i}=b(ri),l=n?.styleIconKey?i?.[n.styleIconKey]:void 0,s=lr([nr(null,ai()),...o]);return l?I("img",{src:l,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:qn({objectFit:"contain"})}):I(e,{...s,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const ii=oi(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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"),li=oi(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M4.31472 11.6L9.91473 5.99997L4.31472 0.399959",stroke:"currentColor",strokeMiterlimit:10})),"ArrowRight"),si=qn.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"}}),ci=qn(si),di=qn({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),ui=qn({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}});qn({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),qn({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const hi=v({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function pi({Component:e,stylists:t}){return I(e,{stylists:[nr(Zn["small-icon"],Zn.icon),...t??[]],size:12})}const gi=nr(Zn["pagination-button"],qn({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"},gap:0})),mi=nr(null,qn({border:"none",borderRadius:"sm",backgroundColor:"surface.intent.action.discreet",padding:{xl:"4px",base:"12px"},margin:0,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"}}),di),vi=nr(null,qn({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),bi=nr(null,qn({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function fi(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=b(hi);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return D("div",{...gi,children:[I("div",{...vi,children:I("button",{...mi,onClick:r,disabled:!t,children:I(pi,{Component:ii,stylists:[bi]})})}),I("div",{...vi,children:I("button",{...mi,onClick:n,disabled:!e,children:I(pi,{Component:li,stylists:[bi]})})})]})}const yi=qn({width:"100%",height:"50px"});function xi(){return I(Lo,{styles:yi})}const Ti=nr(Zn["dashboard-placeholder-table"],qn({display:"flex",flexDirection:"column",gap:"4px"})),Ci=nr(null,qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),wi=qn({width:"100px",height:"20px"});function ki({numColumns:e=6}){return D("div",{...Ti,children:[I("div",{...Ci,children:Array.from({length:e},(e,t)=>I(Lo,{styles:wi},t))}),I(xi,{}),I(xi,{}),I(xi,{}),I(xi,{}),I(xi,{}),I(xi,{})]})}function Ei(e){return fa(`${t=e,xa[t]}`,"v6");var t}function Ai(e,t){const n=br(),r=Cr();return x(a=>{const o=mr(n),i=o?{}:{retry:!1,staleTime:1/0};return xr.prefetchQuery({queryKey:ur(e(a),n??"",r),queryFn:o?t:fr,...i})},[e,t,n,r])}const Si=Object.freeze({}),Ii=Object.freeze({cursor:"FINAL_PAGE"});function Ni({queryKey:e,queryFn:t,...n}){const[r,a]=y(Si),o=g(e);i(o.current,e)||(o.current=e,a(Si));const l=n.select,s=Qn(l)?e=>({...l(e),cursor:e.cursor}):void 0,c=hr(e,r),d=wr({...n,queryKey:c,queryFn:t,keepPreviousDataPlaceholder:!0,select:s}),u=m(()=>{return e=d.query.data?.cursor,t=a,{getFirstPage:()=>t(Si),getLastPage:()=>t(Ii),hasNextPage:Qn(e?.after),hasPreviousPage:Qn(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[d.query.data?.cursor]),h=Ai(x(t=>hr(e,t),[e]),t),p=Ai(x(t=>hr(e,t),[e]),t);return T(()=>{const e=d.query.data?.cursor;!d.query.isFetching&&e&&(e.after&&h({cursor:e.after}).catch(e=>{ia({error:e,severity:"error"})}),e.before&&p({cursor:e.before}).catch(e=>{ia({error:e,severity:"error"})}))},[d.query.data?.cursor,d.query.isFetching,h,p]),{...d,paginationControls:u}}async function Di({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=da({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=>ca(e,t)).join("&"):ca(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});oa("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return oa("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),ua(e)}catch(s){return Promise.reject(s)}}async function Ri(e){const{url:t,headers:n}=pa(e);return Di({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function Pi(e){return Ri({...e,endpointManager:Ei(e.environment)})}async function Li(e){return Ri({...e,endpointManager:Ca(e.environment)})}function Mi({delay:e,callback:t}){const n=m(()=>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 T(()=>()=>{n.cancelCallback()},[n]),{startCallback:x(e=>{n.startCallback(e)},[n]),cancelCallback:x(()=>{n.cancelCallback()},[n])}}function Fi({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=Mi({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Oi={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"},Bi={ASC:"ASC",DESC:"DESC"},Ui=e=>["conversations",e??{}],Vi=e=>["conversations","conversation",e],Wi=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Hi(e){return Ni({queryKey:e?Ui(e):["conversations",{}],queryFn:Wi})}const qi=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 Pi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function zi(e){const t=Qn(e);return wr({queryKey:Vi({id:e??""}),queryFn:qi,enabled:t})}const ji=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:Ei(n)};return await va(r)};function Ki(){return Fi({prefetchFn:Ai(Vi,qi)})}function _i(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Yi({header:e}){const t=_i(e.column);return I("div",{...nr(Zn["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:Q(e.column.columnDef.header,e.getContext())})}const Zi=nr(Zn["dashboard-table-header"],qn({display:"flex",flexDirection:"row",alignItems:"center"}));function Gi({headerGroups:e}){return I("div",{children:e.map(e=>C("div",{...Zi,key:e.id},e.headers.map(e=>I(Yi,{header:e},e.id))))})}const Qi=nr(Zn["dashboard-table-body"],qn({display:"flex",flexDirection:"column"}));function Xi({children:e}){return I("div",{...Qi,children:e})}function Ji({cell:e,onCellClick:t}){const n=_i(e.column),r=nr(Zn["dashboard-table-cell"],qn({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column"})),a=nr(null,qn({display:"flex",flexDirection:"row",height:"100%"}));return I("div",{...a,style:n,onClick:()=>{t&&t(e)},children:I("div",{style:n,...r,children:Q(e.column.columnDef.cell,e.getContext())})})}const $i=nr(Zn["table-sub-row"],qn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.opaque"}}));function el({rowData:e,onCellClick:t}){const n=e.getVisibleCells();return I("div",{...$i,children:n.map(e=>I(Ji,{cell:e,onCellClick:t,isChild:!0},e.id))})}const tl=qn({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden"}),nl=qn({background:"surface.background"}),rl=nr(Zn["table-row"],qn({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.opaque"}}));function al({rowData:e,onMouseEnter:t,onMouseLeave:n,onCellClick:r,shouldDisplayDivider:a}){const o=e.getIsExpanded(),i=nr(Zn["table-parent-row"],tl,e.index%2==0?nl:void 0),l=e.getVisibleCells();return D("div",{...i,onMouseEnter:t,onMouseLeave:n,children:[I("div",{...rl,children:l.map(e=>I(Ji,{cell:e,onCellClick:r},e.id))}),o&&I("div",{children:e.subRows.map(e=>I(el,{rowData:e,onCellClick:r,shouldDisplayDivider:a},e.id))})]})}const ol=(e,t={})=>{$t.getState().openDrawer(e,t)},il=()=>{$t.getState().requestCloseDrawer()},ll=()=>$t(e=>e.drawerHistory);function sl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=ur(e,n,r);return xr.fetchQuery({queryKey:a,queryFn:t})}function cl({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=ur(e,n,r);return xr.prefetchQuery({queryKey:a,queryFn:t})}const dl=[{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"}],ul={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},hl={ASC:"ASC",DESC:"DESC"},pl=e=>["banks/transactions",e??{}],gl=e=>["banks/transactions",e.id],ml=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function vl(e,t){return Ni({queryKey:pl(e),queryFn:ml,...t})}const bl=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 Pi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function fl({id:e,enabled:t=!0}){return wr({queryKey:gl({id:e??""}),queryFn:bl,enabled:t})}function yl(){return Fi({prefetchFn:Ai(gl,bl)})}function xl(){const{query:{data:e}}=vl({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!Gn(t)&&t.length>0}const Tl={COMPANY:"co",EMPLOYEE:"emp",CLASS_SEGMENT:"cls",CLASS_LABEL:"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 Cl(e,t){return!gr(e)&&e.startsWith(t)}function wl({id:e,prefix:t}){return void 0!==e?`${Tl[t]}_${e}`:""}function kl(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}const El=e=>["conversations/messages",e];function Al(e){if(Gn(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 Sl=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 Pi(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},Il=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:Ei(n),accessToken:t};return await va(r)};function Nl(){return Fi({prefetchFn:Ai(El,Sl)})}const Dl=e=>["summaries",e??{}],Rl=e=>["summaries",e.id],Pl=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:Ei(t[2].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const Ll=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 Pi(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Ml({rowData:e,isMobile:t}){const{startPrefetch:n,cancelPrefetch:r}=Ki(),{startPrefetch:a,cancelPrefetch:o}=Nl(),{startPrefetch:i,cancelPrefetch:l}=yl(),{startPrefetch:s,cancelPrefetch:c}=Fi({prefetchFn:Ai(Rl,Ll)}),d=x(()=>{Qn(e.original.attachedEntityId)&&Cl(e.original.attachedEntityId,Tl.BANK_TRANSACTION)?i({id:e.original.attachedEntityId}):Qn(e.original.attachedEntityId)&&Cl(e.original.attachedEntityId,Tl.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]),u=x(()=>{Qn(e.original.attachedEntityId)&&Cl(e.original.attachedEntityId,Tl.BANK_TRANSACTION)?l():Qn(e.original.attachedEntityId)&&Cl(e.original.attachedEntityId,Tl.FINANCIAL_SUMMARY)&&c(),o(),r()},[l,c,r,o,e.original.attachedEntityId]);return I(al,{rowData:e,onMouseEnter:d,onMouseLeave:u,shouldDisplayDivider:e=>0!==e,onCellClick:()=>((e,t,n)=>{n?ol("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):Qn(t)?Cl(t,Tl.BANK_TRANSACTION)?ol("BankTransactionForm",{routeProps:{transactionId:t,initialTab:"conversation"}}):Cl(t,Tl.FINANCIAL_SUMMARY)&&(r=e,a=t,ol("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){ol("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t)})}const Fl=oi(e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},p.createElement("path",{d:"M0.328064 7.5H14.6719",strokeMiterlimit:10}),p.createElement("path",{d:"M7.5 0.328064V14.6719",strokeMiterlimit:10})),"Plus"),Ol=qn.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}}),Bl=qn(Ol),Ul=qn.raw({color:"typography.intent.secondary",border:"{borderWidths.md} solid",borderColor:"border.layout",backgroundColor:"surface.intent.action.discreet",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",borderColor:"border.layout","& .Tight-text":{color:"typography.intent.secondary.hover"}}},"&:active:enabled, &[data-active='true']:enabled":{backgroundColor:"surface.intent.action.discreet.active","& .Tight-text":{color:"typography.intent.secondary.active"}},"& .Tight-text":{color:"typography.intent.secondary"}}),Vl=qn(Ul),Wl=qn.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Hl=qn(Wl),ql=qn.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});qn(ql);const zl=qn.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"}}),jl=qn.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"}}),Kl=qn.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"}}}),_l=qn.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"}}),Yl=qn.raw({color:"typography.intent.primary",border:"{borderWidths.md} solid",borderColor:"border.intent.primary",backgroundColor:"surface.intent.primary","& .Tight-text":{color:"typography.intent.primary"},"& path":{stroke:"icon.intent.primary"},_supportHover:{_notDisabled:{backgroundColor:"surface.intent.primary.hover",borderColor:"border.intent.primary.hover","& .Tight-text":{color:"typography.intent.primary.hover"},"& path":{stroke:"icon.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"},"& path":{stroke:"icon.intent.primary.active"}}}),Zl=qn.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"}}),Gl=_n({base:qn.raw(Ol,Wl,si),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:Wl,small:ql},intent:{default:{},danger:jl,primary:Ul,secondary:Yl,success:Kl,warning:_l,action:Zl}}}),Ql=w(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 Zn["button-danger"];case"primary":return Zn["button-primary"];case"secondary":return Zn["button-secondary"];case"success":return Zn["button-success"];case"warning":return Zn["button-warning"];case"action":return Zn["button-action"];case"default":return null}}(c),v=lr([nr(Zn["button-base"],m,r,qn(Gl.raw({width:s,size:l,intent:c}),n)),...t]);return I("button",{ref:g,...v,type:a,onClick:o,disabled:i,"data-active":d,onMouseEnter:u,onMouseLeave:h,...p,children:e})}),Xl=w(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I(Ql,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),Jl=()=>{ol("Conversation",{routeProps:{conversationId:null}})},$l=nr(Zn["small-square-button"],void 0),es=qn({width:{xl:"auto",base:"44px"},height:{xl:"auto",base:"44px"}});function ts(){return I("div",{className:es,children:I(Xl,{stylists:[$l],onClick:Jl,width:"fill-parent",children:I(pi,{Component:Fl})})})}const ns=_n({base:{display:"flex",flexDirection:"column",flexGrow:1,animation:"appear.instant",overflow:"hidden"},variants:{dashboard:{transactionDashboard:{border:"none"},businessOwnerDashboard:{marginTop:"16px",border:{base:"none",xl:"{borderWidths.lg} solid {colors.border.layout}"},borderRadius:{base:"zero",xl:"lg"}}}}});function rs({children:e,dashboard:t}){const n=nr(Zn["dashboard-table"],ns({dashboard:t}));return I("div",{...n,children:e})}const as=v(null),os="mobile",is=_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 ls({children:e,alignVariant:t="flexStart"}){const n=nr(null,is({alignVariant:t}));return I("div",{...n,children:e})}const ss=_n({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"18px",letterSpacing:"0.84px",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:Ua,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{overflow:"visible",whiteSpace:"nowrap"}},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function cs({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=nr(Zn.label,Zn.text,qn(ss.raw({intent:t,wrap:n,alignment:r}),a));return gr(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const ds={"sm-sm":nr(Zn.text,qn({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba),"sm-med":nr(Zn.text,qn({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba),"sm-lg":nr(Zn.text,qn({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba),"med-sm":nr(Zn.text,qn({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba),"med-med":nr(Zn.text,qn({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba),"med-lg":nr(Zn.text,qn({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba)};function us({children:e,size:t,weight:n,stylists:r=[]}){const a=lr([ds[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const hs=nr(Zn["emphasis-label"],qn({lineHeight:"16px"}));function ps({children:e}){return I(us,{size:"med",weight:"lg",stylists:[hs],children:e})}function gs({text:e,isRead:t}){return I(t?cs:ps,{children:e})}function ms({date:e,isRead:t=!1}){const n=Rt(e);return I(gs,{text:n,isRead:t})}const vs=nr(Zn["strong-sub-label"],sr({label:"strongSubLabel"}));function bs({children:e,stylists:t=[]}){return gr(e)?null:I(us,{size:"sm",weight:"med",stylists:[vs,...t],children:e})}const fs=v(null),ys=qn({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),xs=qn.raw({display:"flex",alignItems:"center",gap:"9px",cursor:"pointer",borderRadius:"zero",width:"100%",padding:{sm:"10px",base:"16px"},border:"none",backgroundColor:"surface.foreground",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"}}),Ts=nr(Zn["selector-row"],qn(xs));function Cs(e,t,n){const[r,a]=y(e);return[t??r,n??a]}function ws({children:e}){return null===he()?I(pe,{children:e}):e}function ks({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:o,blockInteraction:i=!0,enableClickMiddleware:l=!0}){const s=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:o=!0}={}){const[i,l]=y(),[s,c]=y(),[d,u]=Cs(e,r,a),h=te(),p=ne({placement:t,open:d,nodeId:h,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||u(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})]}),g=p.context,v=se(g,{enabled:o}),b=ce(g,{bubbles:{escapeKey:!0}}),f=de(g),T=ue([v,b,f]),C=x(()=>u(!1),[u]);return m(()=>({open:d,setOpen:u,close:C,...T,...p,modal:!0,labelId:i,descriptionId:s,setLabelId:l,setDescriptionId:c,nodeId:h}),[d,u,C,T,p,i,s,h])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:o,enableClickMiddleware:l}),c=he(),d=i&&null===c,u=s.nodeId;return I(ws,{children:I(ge,{id:u,children:I(fs.Provider,{value:{...s,popupParentNodeId:c,blockInteraction:d},children:e})})})}function Es(){const e=b(fs);if(Gn(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function As({children:e}){const t=Es(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const Ss=oi(e=>p.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M1.23712 1.23718L8.76283 8.76289",stroke:"#182428",strokeWidth:.8,strokeMiterlimit:10}),p.createElement("path",{d:"M8.76288 1.23718L1.23717 8.76289",stroke:"#182428",strokeWidth:.8,strokeMiterlimit:10})),"Cross");function Is({Component:e,stylists:t}){return I(e,{stylists:[nr(Zn["tiny-icon"],Zn.icon),...t??[]],size:9})}const Ns=oi(e=>p.createElement("svg",{width:11,height:10,viewBox:"0 0 11 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M1.03625 2.20312H9.96378",stroke:"#182428"}),p.createElement("path",{d:"M1.03625 5H9.96378",stroke:"#182428"}),p.createElement("path",{d:"M1.03625 7.79688H7.24223",stroke:"#182428"})),"Sort"),Ds=nr(null,qn({display:"flex",alignItems:"center",borderRadius:"md",border:"{borderWidths.lg} solid transparent",maxWidth:"fit-content",justifyContent:"center",_supportHover:{borderColor:"border.intent.action.hover",backgroundColor:"surface.intent.action.discreet.hover"},"&[data-active='true']":{backgroundColor:"surface.intent.action.discreet.active",borderColor:"border.intent.action.active"},"&:has(button:focus-visible)":{outline:"4px solid",outlineColor:"border.layout"}}),ci),Rs=nr(null,qn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),Ps=nr(null,qn({display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",padding:0,margin:"6px 6px 6px 5px",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"}})),Ls=nr(null,qn({padding:"0 6px 0 0",display:"flex",alignItems:"center"}));function Ms({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return D("div",{...Ds,"data-active":a,children:[D("button",{...Rs,...r,children:[I(bs,{children:t}),!a&&I("div",{...Ls,children:I(Is,{Component:Ns})})]}),a&&I("button",{...Ps,onClick:e,children:I(Is,{Component:Ss})})]})}const Fs=_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 Os({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=Es(),d=me([c.refs.setFloating,n]),u=nr(Zn.popup,Fs({type:r}));return a||l.open?D(ve,{children:[s&&I(be,{lockScroll:!0}),I(fe,{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 Bs=nr(Zn["popup-sort-row"],qn({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 Us({onClick:e,children:t,active:n}){return I("button",{onClick:e,...Bs,children:I(io,{accent:n?"active":"action",children:t})})}const Vs=nr(null,qn({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),Ws=nr(null,qn({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Hs({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=Es(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return D("div",{...Vs,children:[I(bs,{stylists:[Ws],children:"Sort by:"}),I(Us,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Us,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const qs=qn.raw(zl,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function zs({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=y(!1),d=nr(Zn["button-discreet-small"],qn(qs,e),ci),u=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",...d,onClick:e=>{void 0===u&&c(!s),a&&a(e)},"data-active":u??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const js={minWidth:"140px"};function Ks({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=b(as);if(!a)return null;const{sortInstance:o,setSortInstance:i}=a,l=o?.orderBy===t,s=()=>{i(void 0)};return t&&n&&r?D(ks,{placement:"bottom-start",children:[I(As,{children:t=>I(Ms,{active:l,onClearClick:s,columnName:e,popupTriggerProps:t})}),I(Os,{style:js,children:I(Hs,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{i(e)},sortInstance:o})})]}):I(zs,{disabled:!0,children:I(bs,{children:e})})}const _s=_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 Ys({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I("div",{className:_s({align:a,padding:o}),children:I(Ks,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Zs="Oldest to Newest",Gs="Newest to Oldest";const Qs=v({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});function Xs({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=b(Qs);let a="";return e===r?a="Me":"OWNER"===n?a="Bookkeeper":"ACCOUNTANT"===n&&(a="User"),I(gs,{text:a,isRead:t})}const Js=oi(e=>p.createElement("svg",{width:15,height:15,stroke:"currentColor",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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"),$s=nr(Zn.text,qn({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",lineHeight:"16px",maxWidth:"100%",fontFamily:"label"}),Ba);function ec({children:e,stylists:t=[]}){const n=lr([$s,...t]);return I("div",{...n,children:e})}const tc=_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"}}}}),nc=jn(qn({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),Ba),rc=qn({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),ac=qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),oc=qn({display:"flex",alignItems:"center",gap:8}),ic=qn({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),lc=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),sc=qn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),cc=qn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function dc({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:tc({isRead:a}),onTouchEnd:o,children:D("div",{className:nc,children:[D("div",{className:lc,children:[!a&&I("div",{className:cc}),I(gs,{text:t,isRead:a})]}),D("div",{className:rc,children:[I("div",{className:sc,children:I(Xs,{authorUserId:e,isRead:a})}),D("div",{className:oc,children:[I("div",{className:ac,children:I(ms,{date:n,isRead:a})}),a?I(pi,{Component:li}):I(ec,{children:I(pi,{Component:li})})]})]}),I("div",{className:ic,children:gr(r)?D(N,{children:[I(pi,{Component:Js}),I(cs,{children:"Shared a file"})]}):I(cs,{children:r})})]})})}const uc=qn({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),hc=qn({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function pc({text:e,isRead:t}){return t?I(cs,{children:e}):D("div",{className:uc,children:[I("div",{className:hc}),I(ps,{children:e})]})}const gc=X(),mc=nr(null,qn({paddingLeft:"25px"})),vc=[gc.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(ls,{children:I(Xs,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(bs,{stylists:[mc],children:"From"}),size:160,maxSize:160}),gc.accessor("subject",{id:"subject",cell:({row:e})=>D(ls,{children:[I(pc,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(cs,{children:e.original.latestMessage.text})]}),header:()=>I(bs,{stylists:[mc],children:"Subject"}),size:200}),gc.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(ls,{children:I(ms,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(Ys,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Gs,sortAscDisplay:Zs}),size:150,maxSize:150}),gc.display({id:os,cell:({row:e})=>I(dc,{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 bc(e){return e?vc.filter(e=>e.id===os):vc.filter(e=>e.id!==os)}const fc=[],yc=qn({display:"flex",flexDirection:"column",height:"250px",paddingBottom:"20px",alignItems:"center",justifyContent:"center",boxSizing:"border-box",textAlign:"center",backgroundColor:"surface.background",gap:"10px"}),xc=nr(Zn["empty-dashboard-layout"],yc);function Tc({children:e}){return I("div",{...xc,"data-testid":"empty-dashboard-layout",children:e})}const Cc=qn({width:"25px",height:"25px",borderRadius:"sm"});function wc({imageUrl:e,Component:t,stylists:n}){const[r,a]=y(!1);return Qn(e)?D(N,{children:[!r&&I(Lo,{styles:Cc}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[nr(Zn["large-icon"],Zn.icon),...n??[]],size:25})}const kc=oi(e=>p.createElement("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M11.05 11.02H12.95",strokeWidth:1.5,strokeMiterlimit:10}),p.createElement("path",{d:"M15.82 11.02H17.73",strokeWidth:1.5,strokeMiterlimit:10}),p.createElement("path",{d:"M6.27 11.02H8.18",strokeWidth:1.5,strokeMiterlimit:10})),"Comment",{styleIconKey:"comment"}),Ec=qn({width:"15px",height:"15px",borderRadius:"sm"});function Ac({imageUrl:e,Component:t,stylists:n}){const[r,a]=y(!1);return Qn(e)?D(N,{children:[!r&&I(Lo,{styles:Ec}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[nr(Zn["medium-icon"],Zn.icon),...n??[]],size:15})}const Sc=()=>{ol("Conversation",{routeProps:{conversationId:null}})};function Ic(){return D(N,{children:[I(wc,{Component:kc}),I(ao,{wrap:"wrap",children:"Need help with your financials?"}),D(Xl,{onClick:Sc,children:[I(ao,{children:"Message Bookkeeper"}),I(Ac,{Component:li})]})]})}const Nc=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M14.0625 2.14374L1.5625 6.90624L11.6813 12.8562L14.0625 2.14374Z",strokeWidth:.9375,strokeMiterlimit:10}),p.createElement("path",{d:"M8.25624 10.8375L5.73124 12.8562L5.33749 9.12499L13.4687 2.73749",strokeWidth:.9375,strokeMiterlimit:10})),"Paperplane",{styleIconKey:"send"});function Dc(){return D(N,{children:[I(wc,{Component:Nc}),I(ao,{wrap:"wrap",children:"All caught up"}),I(io,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const Rc=v({isApp:!1,navigate:()=>{},registerAnchor:()=>{}});function Pc(e){const{registerAnchor:t}=b(Rc);k(()=>{t(e)},[e,t])}const Lc=nr(null,qn({display:"flex",flexDirection:"row",gap:"5px"}));function Mc({children:e}){return I("div",{...Lc,children:e})}const Fc=_n({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Oc(e){return I(e?Dc:Ic,{})}function Bc({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){Pc(Qo);const i=function({conversations:e,isMobile:t}){return J({data:e??fc,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??fc.length,columns:bc(t),getCoreRowModel:$(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Hi({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!Gn(l?.data?.[0])&&!s;return D("div",{className:Fc({isMobile:o}),children:[I("div",{id:Qo}),D(hi.Provider,{value:r,children:[D(ar,{children:[I(dr,{children:"Conversations"}),D(Mc,{children:[I(fi,{}),I(ts,{})]})]}),I(rs,{dashboard:"businessOwnerDashboard",children:a?I(ki,{numColumns:4}):D(N,{children:[!o&&I(as.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(Gi,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(Xi,{children:i.getRowModel().rows.map(e=>I(Ml,{rowData:e,isMobile:o},e.id))}):I(Tc,{children:Oc(c)})]})})]})]})}const Uc=nr(Zn.body,sr({body:"default"}));function Vc({children:e,stylists:t=[]}){if(gr(e))return null;const n=lr([Uc,...t]);return I("div",{...n,children:e})}const Wc=nr(null,qn({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Hc=_n({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),qc=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function zc(){return I("div",{...Wc,children:qc.map((e,t)=>I(Lo,{styles:Hc({width:e?.width})},t))})}const jc=qn({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}"}),Kc=qn({position:"relative",width:"25px",height:"25px"});function _c({hasUnread:e}){return D("div",{className:Kc,children:[I(wc,{Component:kc}),e&&I("div",{"data-testid":"unread-comment-badge",className:jc,"aria-hidden":"true"})]})}const Yc=nr(Zn["financial-summary-chatbox-header"],qn({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Zc({hasUnreadMessages:e=!1,showMessageIndicator:t}){return D("div",{...Yc,children:[I(ao,{children:"Message Bookkeeper"}),t&&I(_c,{hasUnread:e})]})}const Gc=qn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center"});function Qc(){return D("div",{className:Gc,children:[I(wc,{Component:Nc}),I(ao,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(io,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),D(Xl,{onClick:()=>ol("Conversation"),children:[I(ao,{children:"Send a Message"}),I(Ac,{Component:li})]})]})}const Xc=qn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});function Jc({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Ki(),{startPrefetch:a,cancelPrefetch:o}=Nl(),i=x(()=>{a({id:t}),n({id:t})},[t,a,n]),l=x(()=>{o(),r()},[o,r]);return D("div",{className:Xc,children:[I(wc,{Component:Nc}),I(ao,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(io,{wrap:"wrap",children:"Pick up where you left off."}),I(Xl,{onClick:()=>ol("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(ao,{children:"Continue conversation"})})]})}const $c=qn({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});function ed({summaryId:e}){return D("div",{className:$c,children:[I(wc,{Component:Nc}),I(ao,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(io,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(Xl,{onClick:()=>ol("FinancialSummary",{routeProps:{summaryId:e}}),children:I(ao,{children:"Talk to a bookkeeper"})})]})}function td({summaryId:e,conversationId:t}){const n=Qn(t);return Gn(e)?I(Qc,{}):n?I(Jc,{conversationId:t,summaryId:e}):I(ed,{summaryId:e})}const nd=qn({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"}),rd=nr(Zn["financial-summary-chatbox"],qn({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 ad({summaryData:e}){const t=Qn(e?.summary),n=Qn(e?.conversation);return D("div",{className:nd,children:[I(Zc,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...rd,children:I(td,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const od=oi(e=>p.createElement("svg",{stroke:"currentColor",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("circle",{cx:12,cy:12,r:10,strokeWidth:1.5,strokeMiterlimit:10}),p.createElement("path",{d:"M12 6V12L15.5 15.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),"Clock"),id=qn({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"});function ld(){return D("div",{className:id,children:[I(wc,{Component:od}),I(ao,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const sd=qn({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),cd=_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:{}}}}),dd=nr(null,qn({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),ud=qn({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function hd({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},wr({queryKey:(t={limit:1,filter:{date:{equal:rt(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Dl(t):["summaries",{}],queryFn:Pl,...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 $${qo.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${zo.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=nr(Zn["financial-summary-layout"],cd({isSample:e,isZeroState:o}));return D("div",{className:ud,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(zc,{}):o?I(ld,{}):D("div",{className:sd,children:[I(Vc,{stylists:[dd],children:a}),e&&I(Ho,{size:"lg"})]})}),I(ad,{summaryData:n})]})}const pd=nr(Zn["month-picker"],qn({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),gd=nr(Zn["month-picker-left-button"],qn({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),md=nr(Zn["month-picker-right-button"],qn({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),vd=nr(Zn["month-picker-label"],qn({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function bd({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=et(e.year,e.month,1),o=Dt(a,{abbreviateMonth:!0});return D("div",{...pd,children:[I(Xl,{stylists:[gd],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(pi,{Component:ii})}),I("div",{...vd,children:I(ao,{children:o})}),I(Xl,{stylists:[md],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(pi,{Component:li})})]})}const fd=qn({display:"flex",flexWrap:"wrap",justifyContent:"center",rowGap:"10px",columnGap:"max(10px, calc(50% - 600px))",maxWidth:"1440px",width:"100%"});function yd({children:e}){return I("div",{className:fd,children:e})}const xd=_n({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),Td=nr(Zn["progress-bar"],qn({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm"})),Cd=nr(Zn["progress-bar-fill"],qn({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),wd=nr(Zn["tile-bar-label"],qn({paddingLeft:"10px"})),kd=nr(Zn["tile-bar-label-outer"],qn({paddingLeft:"10px"}));function Ed({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?Zn["bar-transactions-positive"]:Zn["bar-transactions-negative"],l=nr(i,xd({color:n})),s=lr([Cd,l]);return D("div",{...Td,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...wd,children:I(cs,{children:e})})}),!o&&I("div",{...kd,children:I(cs,{children:e})})]})}const Ad=nr(Zn["metric-md"],sr({metric:"md"}));function Sd(e){return I("div",{...Ad,children:e.children})}const Id=nr(null,qn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"})),Nd=nr(null,qn({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"})),Dd=({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 D("div",{...Id,children:[I(Ed,{label:e,percentage:a,color:r}),I("div",{...Nd,children:I(Sd,{children:$a(t)})})]})},Rd=oi(e=>p.createElement("svg",{stroke:"#000000",width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M13.3131 0.489685V4.15097H9.65182",strokeMiterlimit:10}),p.createElement("path",{d:"M2.32925 15.1348V11.4735H5.99054",strokeMiterlimit:10}),p.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}),p.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"),Pd={},Ld=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return Pd[e]={loading:!1,error:null,scriptEl:t}},Md="undefined"!=typeof window&&void 0!==window.document;function Fd({src:e,checkForExisting:t=!1,...n}){let r=Pd[e];!r&&t&&e&&Md&&(r=Ld(e));const[a,o]=y(r?r.loading:Boolean(e)),[i,l]=y(r?r.error:null),[s,c]=y(!1);return T(()=>{if(!Md||!e||s||i)return;let a;r=Pd[e],!r&&t&&(r=Ld(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=Pd[e]={loading:!0,error:null,scriptEl:a});const d=()=>{r&&(r.loading=!1),o(!1),c(!0)},u=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",d),a.addEventListener("error",u),document.body.appendChild(a),()=>{a.removeEventListener("load",d),a.removeEventListener("error",u),r&&r.loading&&(a.remove(),delete Pd[e])}},[e]),[a,i]}const Od=e=>["integrations",e??{}],Bd=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Ud(e,t){return Ni({...t,queryKey:Od(e),queryFn:Bd})}function Vd(e){return Ud({filter:{apiName:{equal:"PLAID"}}},e)}function Wd(e){return fa(`${t=e,ya[t]}/v1`,"v1");var t}async function Hd({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:Wd(n)},{url:a,headers:o}=pa(r);return await Di({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const qd="cancel",zd="danger",jd="success",Kd=qn({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),_d=qn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Yd=_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"}}),Zd={transform:"none",willChange:"auto"};function Gd({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0,className:l}){const{context:s}=ne({open:e,strategy:"fixed"}),c=ce(s,{outsidePress:o,escapeKey:i}),d=de(s,{role:t}),{getFloatingProps:u}=ue([c,d]),h=[Yd({size:r,padding:a}),l].filter(Boolean).join(" ");return e?I(ve,{children:I(be,{lockScroll:!0,className:Kd,children:I(fe,{context:s,modal:!0,returnFocus:!0,children:I("div",{...u(),className:h,style:Zd,children:n})})})}):null}const Qd=nr(null,qn({display:"flex",backgroundColor:"surface.intent.action.discreet",border:"none",padding:"6px",margin:0,borderRadius:"sm",outline:"none",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"},"&:focus-visible":{outline:"4px solid",outlineColor:"border.layout"}}),di),Xd=()=>il();function Jd({Icon:e=Ss,handleClose:t=Xd}={}){return I("button",{...Qd,onClick:t,type:"button",children:I(Ac,{Component:e,...Qd})})}const $d=nr(Zn["alert-header"],qn({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"26px",letterSpacing:"1.2px"},Va));function eu({children:e}){return I("div",{...$d,children:e})}const tu=qn({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),nu=qn.raw({width:"100%"}),ru=e=>{switch(e){case au.DANGER:return"danger";case au.SUCCESS:return"success";case au.ACTION:return"action";default:return"primary"}},au={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ou=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 D(Gd,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,className:Zn["alert-dialog"],children:[D("div",{className:_d,children:[I(eu,{children:r}),o&&I(Jd,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(cs,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:tu,children:i.map(e=>I(Ql,{intent:ru(e.type),styles:nu,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(ao,{children:e.label})},e.key))})]})}));function iu(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function lu(e){return new V(e).div(100).toNumber()}function su(e){return new V(e).times(100).toNumber()}function cu(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function du(e,t){return t?e?`${e} ${cu(t)}`:cu(t):e??""}const uu=e=>ol("Conversation",{routeProps:{conversationId:null,defaultValues:e}}),hu=qn({display:"flex",flexDirection:"column",gap:"12px"});async function pu(e){await ou({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:qd,label:"Cancel"},{key:jd,label:"Chat",type:au.SUCCESS}]})===jd&&uu({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const gu=e=>["banks/accounts",e??{}],mu={integration:{expand:!0},status:{notIn:["REMOVED"]}},vu=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:Ei(o)},l=await va(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function bu(e){return Ni({queryKey:gu({filter:mu}),queryFn:vu,enabled:e?.enabled,select:e?.select})}function fu(e,t){return sl({queryKey:hr(gu({filter:mu}),{}),queryFn:vu,accessToken:e,environment:t})}const yu={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},xu={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."}},Tu={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:xu.short.credentialsChanged,longMessage:xu.long.relinkCredentials,buttonType:yu.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:xu.short.credentialsChanged,longMessage:xu.long.relinkCredentials,buttonType:yu.RELINK},INVALID_MFA:{shortMessage:xu.short.credentialsChanged,longMessage:xu.long.relinkCredentials,buttonType:yu.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:xu.short.credentialsChanged,longMessage:xu.long.invalidUpdatedUsername,buttonType:yu.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:xu.short.accountLocked,longMessage:xu.long.accountLocked,buttonType:yu.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:xu.short.credentialsChanged,longMessage:xu.long.relinkCredentials,buttonType:yu.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:xu.short.supportChanged,longMessage:xu.long.supportChanged,buttonType:yu.CHAT},USER_SETUP_REQUIRED:{shortMessage:xu.short.updateNeeded,longMessage:xu.long.updateNeeded,buttonType:yu.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:xu.short.supportChanged,longMessage:xu.long.mfaUpdateNeeded,buttonType:yu.OPEN_BANK},NO_ACCOUNTS:{shortMessage:xu.short.noAccountsAvailable,longMessage:xu.long.noAccountsUnlink,buttonType:yu.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:xu.short.noAccountsAvailable,longMessage:xu.long.noAccountsUnlink,buttonType:yu.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:xu.short.connectionError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},ITEM_NOT_FOUND:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},PRODUCT_NOT_READY:{shortMessage:xu.short.serverError,longMessage:xu.long.productNotReady,buttonType:yu.CHAT},USER_PERMISSION_REVOKED:{shortMessage:xu.short.connectionError,longMessage:xu.long.permissionRevoked,buttonType:yu.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:xu.short.temporarilyDown,longMessage:xu.long.bankMaintenance,buttonType:yu.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:xu.short.serverDown,longMessage:xu.long.serverDown,buttonType:yu.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:xu.short.temporarilyDown,longMessage:xu.long.bankMaintenance,buttonType:yu.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:xu.short.supportChanged,longMessage:xu.long.supportChanged,buttonType:yu.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:xu.short.connectionError,longMessage:xu.long.connectionError,buttonType:yu.CHAT},PLANNED_MAINTENANCE:{shortMessage:xu.short.temporarilyDown,longMessage:xu.long.bankConnectionMaintenance,buttonType:yu.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:xu.short.requestError,longMessage:xu.long.connectionError,buttonType:yu.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:xu.short.inputError,longMessage:xu.long.connectionError,buttonType:yu.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:xu.short.volumeDown,longMessage:xu.long.bankMaintenance,buttonType:yu.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:xu.short.serverError,longMessage:xu.long.connectionError,buttonType:yu.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:xu.short.updateNeeded,longMessage:xu.long.partnerCredsChange,buttonType:yu.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:xu.short.credentialsExpiring,longMessage:xu.long.credentialsExpiring,buttonType:yu.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:xu.short.relinkNeeded,longMessage:xu.long.relinkForStatements,buttonType:yu.RELINK}},DEFAULT:{DEFAULT:{shortMessage:xu.short.connectionError,longMessage:xu.long.connectionError,buttonType:yu.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:xu.short.generic,longMessage:xu.long.generic,buttonType:yu.CHAT}}};function Cu({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=Tu[e];if(!n)return ia({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),Tu.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(ia({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),Tu.DEFAULT.DEFAULT)}const wu=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:wl({id:e.glAccountId,prefix:"GL_ACCOUNT"}),type:n,lastSyncedDate:e.lastApiSyncedDate??null,syncTransactions:e.syncRevenueBoolean||e.syncExpenseBoolean||!1,integration:{id:wl({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}};function ku({children:e,stylists:t=[],...n}){return I(Ql,{intent:"secondary",stylists:t,...n,children:e})}function Eu({mutationFn:e,onMutateFn:t,...n}){const r=br(),a=Cr(),o=!gr(r);return F({...n,mutationFn:o?t=>e({data:t,accessToken:r,environment:a}):fr,onMutate:o&&Qn(t)?e=>t({data:e,accessToken:r,environment:a}):void 0},xr)}const Au=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Ca(n)};return await ba(r)},Su=async({data:e,accessToken:t,environment:n})=>Au({data:e,accessToken:t,environment:n}),Iu=async({data:e,accessToken:t,environment:n})=>Au({data:e,accessToken:t,environment:n}),Nu=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:Ca(n)};return await ba(r)})({data:{accounts:e},accessToken:t,environment:n});function Du(e){return Eu({onSuccess:async()=>{oa("mutation successful, invalidating bank account queries");try{return xr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ia({error:e,severity:"error"})}},...e})}function Ru(){return Du({mutationFn:Iu})}function Pu(){return Eu({onSuccess:async()=>{oa("mutation successful, invalidating bank account queries");try{return xr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ia({error:e,severity:"error"})}},mutationFn:Nu})}const Lu=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,Mu=e=>"PLAID"===e,Fu=e=>({id:kl(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),Ou=qn({display:"flex",flexDirection:"column",gap:"16px"}),Bu=async()=>ou({title:"Merge Accounts",body:D("div",{className:Ou,children:[I(cs,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(cs,{wrap:"wrap",children:"This action can't be undone."}),I(cs,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:qd,label:"Cancel"},{key:zd,label:"Continue",type:au.DANGER}]}),Uu=()=>ou({title:"Merge Failed",body:I(cs,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:qd,label:"OK"}]}),{formContext:Vu,fieldContext:Wu,useFieldContext:Hu,useFormContext:qu}=Te(),zu=oi(e=>p.createElement("svg",{width:10,height:10,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{id:"icon/check"},p.createElement("path",{id:"Vector",d:"M0.986511 5L3.66217 7.67566L9.01349 2.32434",stroke:"currentColor",strokeWidth:1.25,strokeMiterlimit:10}))),"Check");function ju({children:e,stylists:t=[],...n}){return I(Ql,{intent:"success",stylists:t,...n,children:e})}function Ku({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return D(ju,{type:"submit",disabled:n,children:[e&&I(pi,{Component:zu}),I(ao,{children:t})]})}const _u=nr(null,qn({display:"flex",width:{xl:"auto",base:"100%"}}));function Yu({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r}){return D(ku,{type:"submit",disabled:n,stylists:[_u],onClick:r,children:[e&&I(pi,{Component:zu}),I(ao,{children:t})]})}const Zu=_n({base:{},variants:{alignment:{vertical:{width:"{borderWidths.md}",minWidth:"{borderWidths.md}",alignItems:"stretch"},horizontal:{width:"100%",height:"{borderWidths.md}",minHeight:"{borderWidths.md}"}},color:{normal:{backgroundColor:"border.layout"},strong:{backgroundColor:"border.layout.strong"},active:{backgroundColor:"brand.action.strong"}}}});function Gu({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=nr("vertical"===e?Zn["vertical-divider"]:Zn["horizontal-divider"],n,Zu({alignment:e,color:t}));return I("div",{...r})}const Qu=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M8.00158 5.48663V9.25659",strokeMiterlimit:10}),p.createElement("path",{d:"M8.00158 10.5132V11.7699",strokeMiterlimit:10})),"Attention"),Xu=[nr(null,qn({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],Ju=nr(null,qn({display:"flex",alignItems:"center",gap:"4px"}));function $u({errorMessage:e}){return D("div",{...Ju,children:[I(Ac,{Component:Qu,stylists:Xu}),I(io,{intent:"danger",wrap:"wrap",children:e})]})}const eh=qn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),th=qn({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function nh({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o}){return D(N,{children:[I(Gu,{alignment:"horizontal",color:"normal"}),D("div",{className:eh,children:[e,I("div",{className:th,children:o&&I($u,{errorMessage:o})}),I(Yu,{showIcon:t,disabled:r,onClick:a,textContent:n})]})]})}const rh=qn.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"}}),ah=qn.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function oh({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 ih=qn({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},rh),lh=qn(ah),sh=qn({display:"flex",flexDirection:"column",gap:"8px"}),ch=qn({display:"flex",justifyContent:"space-between",alignItems:"center"});function dh({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:c,errorMessage:d,disableHover:u=!1,type:h,remainingChars:p,hasErrorStyles:g}){const m=nr(i||null,ih,l,lh,di),[v,b]=y(!0),{dataAttributes:f}=oh({isActive:v,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:d,hasErrorStyles:g,disableHover:u});return D("div",{className:sh,children:[D("div",{className:ch,children:[void 0!==r&&I(cs,{children:r}),Qn(p)&&I(cs,{children:`${p}`})]}),I("div",{...m,onClick:s,...n,onMouseDown:e=>{b(!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,h)},onBlur:()=>{b(!1),c?.()},...f,children:e}),o&&"open"!==n?.["data-state"]&&d&&I($u,{errorMessage:d})]})}const uh=qn({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 hh({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a}){const o=Hu(),i=Ce(o.store,e=>e.meta.errors[0]?.message),l=Ce(o.store,e=>e.meta.isDefaultValue),s=Ce(o.store,e=>e.meta.isTouched);return I(dh,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:l,isTouched:s,className:Zn["discreet-form-input"],additionalStyles:uh,errorMessage:i,onClick:a,onBlur:o.handleBlur,children:e})}function ph(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 gh(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function mh(e){"Enter"===e.key&&e.currentTarget.blur()}const vh=nr(Zn["amount-input"],sr({label:"default"}),qn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),bh=nr(null,qn({display:"flex",alignItems:"center",gap:"2px"}));function fh({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=y(!1);return D("div",{...bh,children:[Gn(e)&&I(cs,{children:"$"}),I(ke,{...vh,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:Gn(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:mh,autoFocus:o})]})}const yh=qn({backgroundColor:"surface.foreground.disabled",pointerEvents:"none",border:"{borderWidths.lg} solid",borderColor:"border.layout"}),xh=_n({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function Th({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=Hu(),h=Ce(u.store,e=>e.meta.errors[0]?.message),p=Ce(u.store,e=>e.meta.isTouched),g="string"==typeof u.state.value?u.state.value.length:0,m=Qn(c)?c-g:void 0,v=a?yh:xh({kind:e});return I(dh,{label:t,inputRef:r,popupTriggerProps:o,className:Zn["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 Ch=nr(null,qn({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function wh({options:e,onSelect:t,selectedLabel:n}){const r=Es();return I("div",{...Ch,children:e.map(e=>I(Us,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const kh=oi(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_9779_2922)"},p.createElement("path",{d:"M0.714706 3.99996L6.31472 9.59998L11.9147 3.99996",stroke:"#182428",strokeMiterlimit:10})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_9779_2922"},p.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowDown"),Eh=nr(null,qn({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",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"}}),ci);function Ah({selectedLabel:e,options:t,onSelect:n}){return D(ks,{placement:"bottom-start",children:[I(As,{children:t=>D("button",{...Eh,...t,children:[I(ao,{children:e}),I(Is,{Component:kh})]})}),I(Os,{children:I(wh,{options:t,onSelect:n,selectedLabel:e})})]})}const Sh=nr(null,qn({display:"flex",alignItems:"center",gap:"15px"})),Ih=ft.map((e,t)=>({value:t,label:e})),Nh=yt({}).map(e=>({value:e,label:String(e)}));function Dh({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return D("div",{...Sh,children:[I(Ah,{selectedLabel:ft[r],options:Ih,onSelect:e=>a(n,e)}),I(Ah,{selectedLabel:String(n),options:Nh,onSelect:e=>a(e,r)})]})}const Rh=nr(null,qn({background:"surface.foreground",padding:"25px",gap:"15px"})),Ph=nr(null,qn({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),Lh=nr(null,qn({backgroundColor:"surface.intent.action.discreet",border:"{borderWidths.lg} solid transparent",padding:"8px",borderRadius:"sm",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover",border:"{borderWidths.lg} solid",borderColor:"border.intent.action.hover"},"&:disabled":{opacity:.6,pointerEvents:"none"}}),ci),Mh=nr(null,qn({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),Fh=nr(null,qn({padding:"8px",textAlign:"center"})),Oh=nr(null,qn({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"}}),ci),Bh=nr(null,qn({color:"typography.base"}));function Uh({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&xt(e,t),l=Tt(e),s=e.getMonth()!==n,c=!!a&&Ct(e,a),d=!!o&&Ct(o,e);return I("button",{...Oh,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(ao,{stylists:s||c||d?[Bh]:[],children:e.getDate().toString()})})}function Vh({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=Es(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=et(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&&Ct(a,u),g=Gn(o)||d.length>0&&Ct(d[0],o),m=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return D("div",{...Rh,children:[D("div",{...Ph,children:[I("button",{...Lh,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:I(pi,{Component:ii})}),I(Dh,{currentMonthYear:l,onMonthYearChange:r}),I("button",{...Lh,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:I(pi,{Component:li})})]}),D("div",{...Mh,children:[bt.map(e=>I("div",{...Fh,children:I(io,{children:e})},e)),d.map(t=>I(Uh,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const Wh=nr(null,sr({label:"default"}),qn({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),Hh=nr(null,sr({label:"default"}),qn({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 qh(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant"}),e.current.setAttribute("data-hasscrolled","true"))}async function zh(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 jh=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),Kh=[...jh].map(e=>`.${e}`).join(","),_h=/* @__PURE__ */new Set(["xls","xlsx","csv"]),Yh={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...jh].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."},Zh={"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 Gh(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 Qh(e,t,n){return Gh(e,null,e.name,t,!1,!0,n)}async function Xh(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||!jh.has(r))return Yh.unsupportedFileType;if(e.size>52428800)return _h.has(r)?Yh.fileTooLargeSpreadsheet:Yh.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await zh(e);for(const e of a)if(await zh(e.file)===t)return Yh.duplicate}return null}(e,t);return n?Qh(e,n):Gh(e,null,e.name,Yh.pendingUpload,!0,!1)}const Jh=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Ca(n).getUrl(`/files/upload/${a}`),s=gr(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 $h(){return Eu({mutationFn:Jh,onSuccess:async()=>xr.invalidateQueries({queryKey:["files/attachments"]})})}const ep=async({data:e,accessToken:t,environment:n})=>{const r=Ca(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 tp=qn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),np=qn({display:"none"}),rp=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=g(null),{mutateAsync:a}=function(){const{mutateAsync:e}=$h();return{mutateAsync:x(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 Gh(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return Qh(e.file,Yh.uploadError,e.localId)}(e,r[t]))},[e])}}(),o=x(()=>{r.current?.click()},[]),i=x(async o=>{const i=Array.from(o.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>Xh(e,n))),s=l.filter(e=>!e.hasError);e?.(l);try{const e=await a(s);t?.(e)}finally{r.current&&(r.current.value="")}},[n,e,t,a]);return D("div",{children:[I("input",{className:np,type:"file",multiple:!0,accept:Kh,ref:r,onChange:i}),I(Xl,{type:"button",onClick:o,children:I("span",{className:tp,children:I(Ac,{Component:Js})})})]})},ap=h.custom(),op=h.object({message:h.object({text:h.string(),attachments:h.array(ap)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),ip=qn.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),lp=qn.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"}),sp=qn(lp,ip),cp=qn.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),dp=qn(cp,ip,sr.raw({body:"default"})),up=qn({display:"block",width:"100%"}),hp=qn({position:"relative"}),pp=qn({display:"flex",justifyContent:"flex-end",gap:"15px"}),gp=qn({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),mp=w(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:a,hideFileUpload:o},i){const l=Hu(),s=g(null),{startCallback:c}=Mi({delay:50,callback:e=>n(e)});E(i,()=>s.current);const d=!e&&op.safeParse(l.form.state.values).success;return I(Th,{kind:"text",inputRef:s,disableHover:!0,onClick:()=>(qh(t),void c(!0)),children:D("div",{className:up,children:[D("div",{className:hp,children:[D("pre",{className:sp,children:[l.state.value.text,I("br",{})]}),I("textarea",{ref:s,placeholder:"Message...",value:l.state.value.text,className:dp,onChange:e=>l.handleChange({...l.state.value,text:e.target.value})})]}),D("div",{className:pp,children:[!o&&I(rp,{onFileSelect:r,onUploadComplete:a,existingAttachments:l.state.value.attachments}),I(Xl,{disabled:!d,type:"submit",children:I("span",{className:gp,children:I(Ac,{Component:Nc})})})]})]})})}),vp=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,bp=v(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function fp(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 yp(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 xp(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 Tp(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 Cp(e){const[t,n]=y(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:a,isMousing:o,isScrolling:i}=function(e,t){const n=g(null),[r,a]=y(!0),[o,i]=y(!1),l=b(bp),[s,c]=A(fp,{focusedIndex:null,maxIndex:e});T(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&Gn(s.focusedIndex)&&void 0!==l?.popupNodeId&&c({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,s.focusedIndex,c,l?.popupNodeId,t.forceRootCascade]);const d=g(null);return T(()=>{c({type:"max",max:e})},[e]),T(()=>{const e=n.current;if(null!==e){const n=e=>{i(!1);const n=e.target instanceof HTMLElement&&e.target.getAttribute("data-listitem");if(!n)return;const r=Number(e.target.getAttribute("data-index"));s.focusedIndex===r&&d.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(a(!0),d.current=e.target,c({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;a(!1),i(!1),t?(e.preventDefault(),c({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),c({type:"decrement",repeat:e.repeat}))},o=()=>i(!0);return e.addEventListener("mousemove",n),e.addEventListener("keydown",r),e.addEventListener("scroll",o),()=>{e.removeEventListener("mousemove",n),e.removeEventListener("keydown",r),e.removeEventListener("scroll",o)}}},[t,s.focusedIndex]),{listRef:n,focusedState:s,isMousing:r,isScrolling:o}}(t.size-1,e),l=Es(),s=x((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),c=x(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:d,sortedMap:u}=function(e,t){const n=m(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(yp)),n},[e,t]),r=m(()=>{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){T(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=Tp(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&&xp(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,d,u,a.focusedIndex,l,e);const{startCallback:h,cancelCallback:p}=Mi({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&xp(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return v=a.focusedIndex,T(()=>{const e=k.current;if(null===v||f)return;const{node:t,metadata:n}=Tp(v,C,w);return E.lastOpenedIndex!==v&&n?.hasCascading&&(E.closeCurrentCascade(),S({focusedIndex:v,node:t,listElement:e})),()=>I()},[v,f=o,k=r,E=e,I=p,C=d,w=u,S=h]),function(e,t,n,r){T(()=>{const{metadata:a}=Tp(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(a.focusedIndex,d,u,e),m(()=>({register:s,unregister:c,map:u,focusedIndex:a.focusedIndex,listRef:r,isMousing:o,isScrolling:i,popupNodeId:l?.nodeId}),[s,c,u,a.focusedIndex,r,o,i,l?.nodeId]);var v,f,C,w,k,E,S,I}const wp=v(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function kp({style:e,children:t,forceNewCascade:n}){const r=nr(Zn["popup-list"],ys,e),a=function(e){const[t,n]=y(null),[r,a]=y(!1),[o,i]=y(null),l=x((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=x(()=>{n(null),i(null),a(!1)},[n,i,a]),c=x(()=>{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=Cp(a);return I("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:I(bp.Provider,{value:o,children:I(wp.Provider,{value:a,children:t})})})}function Ep({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=mr(e),h=e=>{n?.(e)};return D(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 Ap=jn(sr({body:"default"}),qn({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function Sp({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=g(null);return T(()=>{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:Ap})}function Ip({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=Es(),[c,d]=y(""),u=mr(c),h=l?.(u);return I(Os,{children:I(kp,{style:h,children:I(Ep,{searchTerm:c,setSearchTerm:d,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:Sp,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function Np({hasCascading:e=!1}={}){const t=g(null),{register:n,unregister:r,map:a,focusedIndex:o,isMousing:i,listRef:l}=b(bp);k(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const s=m(()=>void 0!==a&&null!==t.current?a.get(t.current)?.index??-1:-1,[a]),c=s===o;k(()=>{c&&(i||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[c,i]);const d=x(()=>{l?.current?.focus()},[l]),u=m(()=>({onFocus:d,"data-focused":c}),[d,c]);return{itemRef:t,isActive:c,index:s,itemProps:u}}const Dp=w(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...Ts,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),Rp=w(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=Np(),l=me([i,r]);return I(Dp,{...Ts,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),Pp=qn({display:"flex",gap:"8px",alignItems:"center"});function Lp({promptText:e}){return D("div",{className:Pp,children:[I(pi,{Component:Fl}),I(cs,{children:e})]})}function Mp({text:e}){return I("div",{...Ts,children:e?I(ao,{children:e}):I(Lo,{styles:qn({width:"100%",height:"16px"})})})}const Fp=nr(Zn["popup-list"],ys),Op=()=>D("div",{...Fp,children:[I(Mp,{}),I(Mp,{}),I(Mp,{}),I(Mp,{}),I(Mp,{})]});function Bp({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(Op,{}):D(N,{children:[r&&I(Rp,{onClick:()=>ol("BankAccountForm"),children:I(Lp,{promptText:"Add bank account"})}),e?.map(e=>I(Rp,{onClick:()=>t(e),children:I(ao,{wrap:"wrap",children:du(e?.name,e?.mask)})},e?.id))]})}const Up={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Vp={...Up,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function Wp({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const o=m(()=>new Ee(e??[],Vp),[e]),i=m(()=>e?o.search(t).map(e=>e.item):[],[e,t,o]);return r?I(Op,{}):D(N,{children:[a&&I(Rp,{onClick:()=>ol("BanksAndIntegrations"),children:I(Lp,{promptText:"Add bank account"})}),0===i.length?I(Mp,{text:"No results found"}):i.map(e=>I(Rp,{onClick:()=>n(e),children:I(ao,{wrap:"wrap",children:du(e?.name,e?.mask)})},e?.id))]})}function Hp({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(Ip,{onClick:e,placeholder:"Search bank accounts...",SearchList:Wp,DefaultList:Bp,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const qp=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function zp({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=du(n?.name??"",n?.mask??"");return D(ks,{placement:"bottom-start",children:[I(As,{children:r=>I(Th,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:qp,type:"button",disabled:t,children:Qn(n)?I(cs,{children:i}):I(cs,{intent:"weak",children:"Select bank account"})})})}),I(Hp,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const jp=e=>{if(Gn(e))return!1;const t=e.filter(e=>Mu(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||Qn(e.lastSyncedDate))},Kp=()=>{const e=bu({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function _p(){return bu({select:e=>{return{...e,plaidItemAccountsReadyToSync:jp(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>Mu(e.apiName)))};var t}})}function Yp(e){return e?.filter(e=>Lu(e.apiName)&&"ACTIVE"===e.status)}function Zp(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function Gp(e){return bu({select:t=>({...t,data:Zp(t?.data,e)})})}const Qp=e=>{const{query:t}=bu({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data},Xp=()=>["expenses/categories"],Jp=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await Li(n);return{...r,data:r.data?(a=r.data,a.map(e=>({...e,id:wl({id:e.id,prefix:"TRANSACTION_CATEGORY"}),parentCategoryId:e.parentCategoryId?wl({id:e.parentCategoryId,prefix:"TRANSACTION_CATEGORY"}):void 0}))):void 0};var a};function $p(e){return wr({...e,queryKey:["expenses/categories"],queryFn:Jp})}function eg(){return $p({select:e=>({...e,data:e.data?ig(e.data):void 0})})}function tg(e,t){return(t.get(e)??[]).map(e=>{const n=tg(e.id,t);return{...e,children:n.length>0?n:void 0}})}function ng(e){if(0===e.length)return[];const t=ag(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=tg(e.id,t);return{...e,children:n.length>0?n:void 0}})}function rg(){return $p({select:e=>({...e,data:e.data?ng(e.data):void 0})})}function ag(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 og(e){if(0===e.length)return[];const t=ag(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function ig(e){if(0===e.length)return[];const t=ag(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function lg(){return Fi({prefetchFn:Ai(Xp,Jp)})}const sg=e=>({id:e.id,name:e.name});function cg(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:iu("Category","Categories",n.size,!0),list:[...n].join(", ")}}const dg=nr(Zn.text,sr({label:"strongLabel"}),qn({maxWidth:"100%"}),Ba);function ug({children:e,stylists:t=[]}){const n=lr([dg,...t]);return I("div",{...n,children:e})}const hg={keys:[{name:"name"}],threshold:.1};function pg(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function gg(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?pg(a,r,n):o?pg(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{pg(e,n,t)})}(r,n)}),n}const mg=qn({objectFit:"contain"});function vg(e,t,n){const r=({size:n=24})=>{const{icons:r}=b(ri);return I("img",{src:e,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},className:mg})};return r.displayName=t,r}const bg=nr(null,qn({whiteSpace:"normal"})),fg=[nr(null,qn({marginLeft:"6px",marginRight:"6px"}))];function yg({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=$p({select:e=>({...e,data:e.data?og(e.data):void 0})}),o=n?.data,i=!a&&r&&(void 0===o||0===o.length),l=m(()=>new Ee(o??[],hg),[o]),s=m(()=>o?gg(l.search(e),o):[],[o,e,l]);return a?I(Op,{}):i?I(Mp,{text:"No data"}):0===s.length?I(Mp,{text:"No results found"}):I(N,{children:s.map(({parent:e,child:n})=>{const r=e.id===n.id,a=vg(n.iconUrl,"Expense Icon");return D(Rp,{onClick:()=>t(sg(n)),children:[I(Ac,{Component:a}),I(ug,{stylists:[bg],children:r?n.name:D(N,{children:[e.name,I(pi,{Component:li,stylists:fg}),n.name]})})]},`${e.id}_${n.id}`)})})}const xg=w(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=me([a,t?.ref]);return I(Dp,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function Tg({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=b(wp),{itemRef:o,index:i,itemProps:l}=Np({hasCascading:!0}),{isScrolling:s}=b(bp);return D(ks,{open:n===i,onOpenChange:e=>{s||r(e,i)},placement:"right-start",children:[I(As,{children:t=>I(xg,{itemProps:l,index:i,ref:o,popupTriggerProps:t,children:e})}),I(Os,{initialFocus:a,children:t})]})}const Cg=qn({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"}),wg=qn({display:"flex",gap:"8px"});function kg({Icon:e,iconUrl:t,displayLabel:n}){const r=t?vg(t,"Icon"):void 0;return D("div",{className:Cg,children:[D("div",{className:wg,children:[!Gn(e)&&e,Gn(e)&&r&&I(Ac,{Component:r}),I(ao,{wrap:"wrap",children:n})]}),I(pi,{Component:li})]})}function Eg({category:e,handleCategoryChange:t}){return I(kp,{children:e.children?.map(e=>{const n=vg(e.iconUrl,"Expense Icon");return D(Rp,{onClick:()=>t(sg(e)),children:[I(Ac,{Component:n}),I(ao,{wrap:"wrap",children:e.name})]},e.id)})})}function Ag({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=eg(),a=t?.data,o=!r&&n&&void 0===a;return r?I(Op,{}):o?I(Mp,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(Tg,{triggerChildren:I(kg,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(Eg,{category:t,handleCategoryChange:e})},t.id);const n=vg(t.iconUrl,"Expense Category Icon");return D(Rp,{onClick:()=>e(sg(t)),children:[I(Ac,{Component:n}),I(ao,{wrap:"wrap",children:t.name})]},t.id)})})}const Sg=({onClick:e})=>{const{query:{data:t}}=eg();return I(Ip,{onClick:e,placeholder:"Search expense categories...",SearchList:yg,DefaultList:Ag,listLength:(t?.data??[]).length})},Ig=nr(Zn["category-text"],qn({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"}}}),ui),Ng=nr(null,qn({color:"inherit"})),Dg=nr(Zn["amount-input-container"],qn({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"}}),ui);function Rg({options:e,onClick:t}){const n=Es();return I(Os,{children:I(kp,{children:e.map((e,r)=>I(Rp,{onClick:()=>(t(e),void n.close()),children:I(cs,{children:e.label})},`${e.label}_${r}`))})})}const Pg=nr(null,qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),Lg=qn.raw({color:"typography.base.weak"}),Mg=(e,t)=>e===t,Fg=qn({border:"none",outline:"none",backgroundColor:"transparent",fontWeight:"label.strong",fontSize:{sm:"label.strong",base:"lg"},fontFamily:"label",color:"typography.label.strong",lineHeight:{sm:"16px",base:"18px"},letterSpacing:"0.84px"}),Og=e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M14.9092 4.60259V6.39635H1.78418V4.60259L8.34669 1.62134L14.9092 4.60259Z",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M14.9092 12.3589H1.78418V14.7464H14.9092V12.3589Z",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M2.97803 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M6.55908 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M10.1343 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M13.7153 6.39648V12.359",strokeMiterlimit:10,strokeLinecap:"square"})),Bg=oi(Og,"Bank",{styleIconKey:"bank"}),Ug=_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 Vg({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?du(e,t):e;return D("div",{className:Ug({active:r}),children:[n&&I(io,{intent:r?"normal":"weak",children:n}),I(cs,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const Wg=e=>["plaidInstitutionLogo",e??{}],Hg=qn({display:"flex",gap:"10px",maxWidth:"100%"});function qg({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=br(),n=Cr();return L({queryKey:Wg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await Hd({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?vg(i,"Logo"):void 0;return D("div",{className:Hg,children:[I(wc,{Component:l&&o?l:Bg}),I(Vg,{accountName:e,accountNo:t,active:a,syncText:r})]})}const zg=qn({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function jg({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(Xl,{...r,disabled:n,width:"fill-parent",children:I(ug,{children:e?du(e.name,e.mask):D("div",{className:zg,children:[I(cs,{children:t}),I(pi,{Component:Fl})]})})})}const Kg="TRIGGER_ACCOUNT",_g="FORM_SELECTABLE_ACCOUNT",Yg=qn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Zg({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return D("div",{className:Yg,children:[D(ks,{placement:"bottom-start",children:[I(As,{children:t=>I(jg,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Kg?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(Hp,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I($u,{errorMessage:o})]})}const Gg=(e,t,n)=>{if(!n)return;const r=e===_g?t:n,a=e===_g?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,Mu(c)&&Lu(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},Qg=qn({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Xg=qn({display:{base:"block",sm:"none"}}),Jg=qn({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),$g=qn({display:"flex",justifyContent:"center",alignItems:"center"}),em=qn({display:{base:"none",sm:"block"}}),tm=qn({display:{base:"block",sm:"none"}});function nm({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return D("div",{className:Qg,children:[D("div",{className:Jg,children:[o?I(Zg,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Kg,bankAccounts:n,isFilling:r,warningMessage:Gg(Kg,e,t??null)}):I(jg,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),D("div",{className:$g,children:[I("div",{className:em,children:I(Ac,{Component:li})}),I("div",{className:tm,children:I(Ac,{Component:kh})})]}),I(qg,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:Xg,children:I(Gu,{alignment:"horizontal"})})]})}const rm=async e=>{const t=e.queryKey,n={path:"/expenses/vendors",accessToken:t[1].accessToken,environment:t[1].environment},r=await Li(n),a=void 0!==r.data?r.data.map(e=>({...e,id:wl({id:e.id,prefix:"VENDOR"})})):[];return{...r,data:a}};function am(){return wr({queryKey:["expenses/vendors"],queryFn:rm})}const om=async({data:e,accessToken:t,environment:n})=>{const r={path:"/expenses/vendor",bodyParams:{vendor:{name:e}},accessToken:t,endpointManager:Ca(n)};return await ba(r)},im=jn(sr({body:"default"}),qn({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),lm=qn({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),sm=nr(Zn["button-inline"],qn({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function cm({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return D("div",{className:lm,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:im}),I("button",{type:"button",onClick:r,...sm,children:I(io,{children:"Add"})})]})}function dm({promptText:e,placeholderText:t,onSubmit:n}){const[r,a]=y(!1),[o,i]=y(""),l=g(null);return T(()=>{r&&l.current&&l.current.focus({preventScroll:!0})},[r]),I(Rp,{onClick:r?void 0:()=>{a(!0)},children:r?I(cm,{placeholder:t,value:o,onChange:i,onSubmit:()=>{o.trim()&&(n(o.trim()),i(""),a(!1))},onCancel:()=>{i(""),a(!1)},inputRef:l}):I(Lp,{promptText:e})})}function um({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const o=m(()=>new Ee(e??[],Up),[e]),i=m(()=>e?o.search(t).map(e=>e.item):[],[e,t,o]);return r?I(Op,{}):D(N,{children:[I(dm,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===i.length?I(Mp,{text:"No results found"}):i.map(e=>I(Rp,{onClick:()=>n(e),children:I(cs,{children:e.name})},e.id))]})}function hm({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(Op,{}):D(N,{children:[I(dm,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(Rp,{onClick:()=>t(e),children:I(cs,{children:e.name})},e.id))]})}function pm({onClick:e}){const{query:{data:t,isLoading:n}}=am(),{mutate:r}=Eu({mutationFn:om,onSuccess:async()=>xr.invalidateQueries({queryKey:["expenses/vendors"]})}),a=t?.data??[];return I(Ip,{onClick:e,placeholder:"Search vendors...",SearchList:um,DefaultList:hm,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r(e)}},listLength:a.length})}const gm=async e=>{const t=e.queryKey,n={path:"/clientMgmt/clients",accessToken:t[1].accessToken,environment:t[1].environment},r=await Li(n),a=void 0!==r.data?r.data.map(e=>({...e,id:wl({id:e.id,prefix:"CUSTOMER"})})):[];return{...r,data:a}};function mm(){return wr({queryKey:["clientMgmt/clients"],queryFn:gm})}const vm=async({data:e,accessToken:t,environment:n})=>{const r={path:"/clientMgmt/client",bodyParams:{client:{name:e}},accessToken:t,endpointManager:Ca(n)};return await ba(r)},bm={type:"tween",duration:.3},fm={x:"100%"},ym={x:0},xm={x:"100%"};function Tm({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(Os,{style:r,modal:!0,forceMount:t,children:e})}const Cm=qn({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 wm({children:e}){const t=Es(),n=x(e=>{e.stopPropagation()},[]);return I(Ae,{children:t.context.open&&I(Tm,{fadeIn:!1,forceMount:!0,children:I(Se.div,{transition:bm,initial:fm,animate:ym,exit:xm,className:Cm,onAnimationEnd:n,children:e})})})}const km=qn.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Em=qn.raw({display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",flex:"1 1 0",alignSelf:"stretch",overflowY:"auto",width:"100%",scrollbar:"hidden"}),Am=nr(Zn["drawer-header"],qn(km));function Sm({hideDivider:e=!1,children:t}){return D(N,{children:[I("header",{...Am,children:t}),!e&&I(Gu,{alignment:"horizontal",color:"normal"})]})}const Im=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Nm({children:e}){return I("div",{className:Im,children:e})}const Dm=qn({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),Rm=_n({base:Em,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function Pm({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=Es();return D(N,{children:[I(Sm,{children:D(Nm,{children:[I(Jd,{Icon:ii,handleClose:()=>{r?.(),i.close()}}),I(ao,{children:o}),!Gn(t)&&I("div",{className:Dm,children:t})]})}),I("div",{className:Rm({padChildren:a}),children:n}),e]})}function Lm(e){return I(wm,{children:I(Pm,{...e})})}const Mm=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M15.05 15.3L9.67714 9.92712",stroke:"#182428",strokeMiterlimit:10})),"Search",{styleIconKey:"search"}),Fm=qn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),Om=qn({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"}),Bm=jn(qn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px",flex:"1 0 0",border:"none",outline:"none",_placeholder:{color:"typography.label.sub"}}),sr({label:"strongLabel"})),Um=nr(null,qn({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Vm({searchTerm:e,setSearchTerm:t,placeholder:n}){return D("div",{className:Fm,children:[I(ao,{children:"Search"}),D("div",{className:Om,children:[I(Ac,{Component:Mm}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Bm}),mr(e)&&I(Xl,{stylists:[Um],onClick:()=>t(""),children:I(Ac,{Component:Ss})})]})]})}function Wm({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=y("");return I(Ep,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Vm,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function Hm({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:o,onExpandedChange:i,hasMultiSelect:l=!1,getCanSelect:s,getCanExpand:c}){const[d,u]=Cs({},a?.selected,o),[h,p]=Cs({},a?.expanded,i),g=x((e,t)=>{const n=t??!d[e],r={[e]:n};u(l?{...d,...r}:r)},[d,u,l]),v=x((e,t)=>{const n=t??!h[e],r={[e]:n};p({...h,...r})},[h,p]),b=m(()=>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:h[r]??!1,getCanSelect:()=>s?.(e)??!0,getIsSelected:()=>d[r]??!1,toggleSelected:e=>g(r,e),getCanExpand:()=>c?.(e)??!0,getIsExpanded:()=>h[r]??!1,toggleExpanded:()=>v(r,!h[r])}})})),[e,r,t,n,d,g,h,v,s,c]);return m(()=>({groups:b,toggleSelected:g,toggleExpanded:v,expandedKeys:new Set(Object.keys(h))}),[b,g,v,h])}const qm=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_9779_2768)"},p.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"}),p.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"}),p.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"),zm=qn({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function jm({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return D("div",{className:zm,children:[I(Ac,{Component:qm}),I(ao,{wrap:"wrap",children:`No ${t} found`}),n&&I(io,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const Km=qn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function _m({children:e}){return I("div",{className:Km,children:e})}const Ym=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"CircleCheck",{styleIconKey:"checkmark"}),Zm=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.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"),Gm=nr(null,qn({fill:"surface.intent.action.active"}));function Qm({selected:e,showEmptyIndicator:t}){return e?I(Ac,{Component:Ym,stylists:[Gm]}):t?I(Ac,{Component:Zm}):null}const Xm=_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 Jm({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=nr(Zn["selector-row"],Xm({selected:r}),di);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function $m({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return D(Jm,{handleClick:t,selected:n,children:[e,I(Qm,{selected:n,showEmptyIndicator:r})]})}const ev=qn.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function tv(){return I(Lo,{styles:qn(xs,ev)})}const nv=qn({width:"70px",height:"24px"}),rv=qn({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function av(){return D("div",{className:rv,children:[I(Lo,{styles:nv}),D(_m,{children:[I(tv,{}),I(tv,{}),I(tv,{})]}),I(Lo,{styles:nv}),D(_m,{children:[I(tv,{}),I(tv,{}),I(tv,{})]})]})}function ov({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=m(()=>new Ee(e,Up),[e]),l=Hm({data:m(()=>i.search(t).map(e=>e.item),[i,t]).map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return n?I(av,{}):0===l.groups.length?I(jm,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):D(_m,{children:[I(cs,{children:"Search Results"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I($m,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(cs,{children:t.value.name})},t.key)})})]})}const iv=qn({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),lv=qn({width:"100%"});function sv({promptText:e,placeholderText:t,onSubmit:n}){const[r,a]=y(!1),[o,i]=y(""),l=g(null);T(()=>{r&&l.current&&l.current.focus({preventScroll:!0})},[r]);const s=()=>{i(""),a(!1)};return D("div",{className:lv,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||s()},children:[I(Gu,{alignment:"horizontal"}),I(Jm,{handleClick:r?void 0:()=>{a(!0)},children:r?I(cm,{placeholder:t,value:o,onChange:i,onSubmit:()=>{o.trim()&&(n(o.trim()),i(""),a(!1))},onCancel:s,inputRef:l}):I(Lp,{promptText:e})})]})}function cv({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=Hm({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(av,{}):D(_m,{children:[I(sv,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n}),D("div",{className:iv,children:[I(cs,{children:"Customers"}),I("div",{children:i.groups.map(e=>{const[t]=e.getRows();return I($m,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(cs,{children:t.value.name})},t.key)})})]})]})}function dv({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=mm(),{mutateAsync:a}=Eu({mutationFn:vm,onSuccess:async()=>xr.invalidateQueries({queryKey:["clientMgmt/clients"]})}),o=Es(),i=n?.data??[],[l,s]=y(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(Lm,{title:"Back",Footer:I(nh,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t)??null;e(n),o.close()},disabled:!c}),onClose:()=>s(t?{[t.id]:!0}:{}),children:I(Wm,{placeholder:"Search customers...",onClick:e=>{s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:ov,DefaultList:cv,listLength:i.length,extraProps:{customers:i,isLoading:r,onCreateCustomer:async e=>{const t=await a(e);s({[wl({id:t.id,prefix:"CUSTOMER"})]:!0})},selectedRow:l,onSelectedChange:s}})})}function uv({frequencies:e,onClick:t}){const n=Es();return I(Os,{children:I(kp,{children:e.map(e=>I(Rp,{onClick:()=>(t(e),void n.close()),children:I(ao,{children:e.name})},e.value))})})}const hv=_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:"brand.action.strong",zIndex:1}},corners:{rounded:{_first:{borderTopLeftRadius:"sm",borderBottomLeftRadius:"sm"},_last:{borderTopRightRadius:"sm",borderBottomRightRadius:"sm"}}}}});function pv({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=nr(Zn["button-group"],jn(hv({width:a,backgroundColor:o,active:t,corners:i}),Hl,Bl,Vl,ci));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(ao,{wrap:"wrap",textAlign:"center",children:e.label}):I(cs,{wrap:"wrap",alignment:"center",children:e.label})})}const gv=_n({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"}}}});function mv({width:e,children:t}){return I("div",{className:gv({width:e}),children:t})}function vv({options:e,handleClick:t,selectedIndex:n}){const[r,a]=y(null);return I(mv,{width:"full",children:e.map((e,o)=>D(S,{children:[0!==o&&I(Gu,{color:o!==n&&o!==n+1||r===n?"normal":"active"}),I(pv,{option:e,isActive:o===n,handleClick:()=>t(o),onHoverChange:e=>a(e?o:null),width:"full",backgroundColor:"foreground",corners:"rounded"})]},e.value))})}const bv=oi(e=>p.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M0.668689 4.04687L0.668689 0.650082L11.3313 0.650083L11.3313 4.04688",strokeMiterlimit:10}),p.createElement("path",{d:"M6.00008 3.55915L6.00008 11.7998",strokeMiterlimit:10}),p.createElement("path",{d:"M2.60834 6.46875L6.00005 3.07703L9.39177 6.46875",strokeMiterlimit:10})),"Upload"),fv=qn({display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",alignSelf:"stretch",border:"{borderWidths.md} dashed {colors.border.layout}",borderRadius:"2px",padding:"16px",gap:"8px",outline:"none"});function yv({getRootProps:e,getInputProps:t}){return D("div",{...e({className:fv}),children:[I("input",{...t()}),I(Ac,{Component:bv}),I(cs,{children:"Add Files"})]})}const xv=qn({display:"flex",flexDirection:"column",gap:"8px"}),Tv=qn({display:"flex",justifyContent:"space-between",alignItems:"center"}),Cv=qn({display:"flex",flexDirection:"column",outline:"none",borderRadius:"2px"},rh),wv=qn(ah);function kv({getRootProps:e,getInputProps:t,dataAttrs:n,popupTriggerProps:r,onMouseDown:a,onBlur:o,label:i,errorMessage:l,isTouched:s}){const c=nr(null,Cv,void 0,wv,di);return D("div",{className:xv,children:[i&&I("div",{className:Tv,children:I(cs,{children:i})}),I("div",{...c,...r,onMouseDown:a,onBlur:o,...n,children:I(yv,{getRootProps:e,getInputProps:t})}),s&&"open"!==r?.["data-state"]&&l&&I($u,{errorMessage:l})]})}const Ev=oi(e=>p.createElement("svg",{width:13,height:12,viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_9779_2940)"},p.createElement("path",{d:"M11.9147 7.99997L6.31472 2.39996L0.714716 7.99997",stroke:"#182428",strokeMiterlimit:10})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_9779_2940"},p.createElement("rect",{width:12,height:12,fill:"white",transform:"translate(0.314728)"})))),"ArrowUp"),Av=_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"}}}}),Sv=qn({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"}}),Iv=qn({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 Nv({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=nr(Zn["selector-row"],Av({active:r,expanded:a}),di);return D("div",{...i,children:[o?D("button",{type:"button",className:Sv,onClick:t,children:[I(Qm,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:Sv,children:e}),!Gn(n)&&I("button",{type:"button",className:Iv,onClick:n,children:I(Ac,{Component:a?Ev:kh})})]})}const Dv=qn({display:"flex",justifyContent:"start",width:"100%"}),Rv=qn({display:"flex",alignItems:"center",gap:"9px"}),Pv=qn({width:"100%"}),Lv=_n({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function Mv(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Fv({classSegmentRows:e,onClick:t}){return e.map(e=>I(Jm,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:D("div",{className:Rv,children:[I(Qm,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(cs,{children:e.value.name})]})},e.key))}function Ov({fieldLabel:e,classSegmentOptions:t,classSegmentLabels:n,selectedRow:r,setSelectedRow:a,onClick:o}){const i=t.map(e=>({id:e[0].id,displayName:e[0].name??""})),l=Hm({data:t,groups:i,getRowKey:e=>e.id,getGroupKey:({originalGroup:e,groupIndex:t})=>e?.id??t.toString(),state:{selected:r},onSelectedChange:e=>a(e),getCanSelect:e=>{const t=n.find(t=>t.id===e.label?.id);return!t||!Mv(t)}}),s=l.groups.some(e=>e.getRows().length>1);return D(N,{children:[I("div",{className:Dv,children:I(cs,{children:e})}),I("div",{className:Lv({nested:s}),children:l.groups.map((e,t)=>{if(s){const[n,...r]=e.getRows();return D("div",{className:Pv,children:[(s||0===t)&&I(Gu,{alignment:"horizontal"}),I(Nv,{onClick:n.getCanSelect()?()=>o(n.value):void 0,onExpandToggle:r.length>0?n.toggleExpanded:void 0,active:n.getIsSelected(),expanded:n.expanded,canSelect:n.getCanSelect(),children:I(cs,{children:n.value.name})}),n.expanded&&D(N,{children:[I(Gu,{alignment:"horizontal"}),I(Fv,{classSegmentRows:r,onClick:o})]})]},e.key)}return I(Fv,{classSegmentRows:e.getRows(),onClick:o},e.key)})})]})}function Bv({flatClassSegments:e,classSegmentLabels:t,classSegmentOptions:n,selectedRow:r,searchTerm:a,onClick:o}){const i=m(()=>e.filter(e=>{const n=t.find(t=>t.id===e.label?.id);return!n||!Mv(n)}),[e,t]),l=m(()=>new Ee(i,Up),[i]),s=m(()=>new Set(l.search(a).map(e=>e.item.id)),[l,a]),c=m(()=>n.map(e=>e.filter(e=>s.has(e.id))).filter(e=>e.length>0),[s,n]);if(0===c.length)return I(jm,{singularSearchCTANoun:"class segment",pluralNounNotFound:"class segments",showSearchCTA:!0});const d=c.some(e=>e.length>1);return D(N,{children:[I("div",{className:Dv,children:I(cs,{children:"Search Results"})}),I("div",{className:Lv({nested:d}),children:c.map(e=>I("div",{className:Pv,children:e.map(e=>I(Jm,{handleClick:()=>o(e),selected:r[e.id],children:D("div",{className:Rv,children:[I(Qm,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(cs,{children:e.name})]})},e.id))},e[0].id))})]})}function Uv({fieldLabel:e,selectedSegment:t,classSegmentOptions:n,classSegmentLabels:r,onSave:a}){const o=m(()=>n.filter(([e,...t])=>{if(t.length>0)return!0;const n=r.find(t=>t.id===e.label?.id);return!n||!Mv(n)}),[n,r]),[i,l]=y(()=>t?.id&&o.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),s=m(()=>o.flat(),[o]),c=Es(),d=Object.values(i).some(Boolean);return I(Pm,{title:"Back",Footer:I(nh,{onSave:()=>{const e=Object.keys(i).find(e=>i[e]),t=s.find(t=>t.id===e);t&&(a(t),c.close())},disabled:!d}),children:I(Wm,{placeholder:`Search ${e.toLowerCase()}...`,onClick:e=>{l(t=>({[e.id]:!t[e.id]}))},SearchList:Bv,DefaultList:Ov,listLength:s.length,extraProps:{fieldLabel:e,classSegmentOptions:o,classSegmentLabels:r,flatClassSegments:s,selectedRow:i,setSelectedRow:l}})})}function Vv(e){const t=Es();return I(wm,{children:t.open&&I(Uv,{...e})})}const Wv=qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),Hv=qn.raw({color:"typography.base.weak"}),{useAppForm:qv,withForm:zv}=we({formContext:Vu,fieldContext:Wu,formComponents:{SaveButton:Ku,FormSaveButton:Yu,FormFooter:nh},fieldComponents:{DiscreetAmountField:function({label:e}){const t=g(null),n=Hu();return I(hh,{inputRef:t,label:e,children:I(fh,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=g(null),a=Hu();return I(Th,{inputRef:r,label:e,hasErrorStyles:t,children:I(fh,{value:a.state.value,onChange:a.handleChange,inputRef:r,autofocus:n})})},DateInput:function({label:e,maxDate:t,minDate:n,autofocus:r=!1,editable:a=!1,hasErrorStyles:o}){const i=Hu(),l=Ce(i.store,e=>e.meta.isDefaultValue),s=g(null),[c,d]=y(()=>i.state.value?At(i.state.value):/* @__PURE__ */new Date),u=i.state.value?At(i.state.value):null,[h,p]=y(""),m=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);p(r);const a=Et(r);if(a){let e=a;t&&n?e=Nt(It(a,t),n):t?e=It(a,t):n&&(e=Nt(a,n)),i.handleChange(St(e)),d(e)}else i.handleChange("")},v=h||(u?wt(u):""),[b,f]=y(!1),x=e=>{b&&(()=>{if(u&&!l){const e=Et(h);(t&&e&&Ct(e,t)||n&&e&&Ct(n,e))&&p(wt(u))}})(),f(e)},T=e=>{"Enter"===e.key&&(e.preventDefault(),x(!b))},C=a?Th:hh;return D(ks,{placement:"bottom-start",onOpenChange:x,open:b,children:[I(As,{children:t=>I(C,{label:e,inputRef:s,popupTriggerProps:t,onClick:()=>f(!0),hasErrorStyles:o,children:I("input",{...Wh,ref:s,type:"text",id:i.name,value:v,onChange:m,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:T,autoComplete:"off"})})}),I(Os,{initialFocus:!1,children:I(Vh,{selectedDate:u,onDateSelect:e=>{i.handleChange(St(e)),p(wt(e)),d(e)},viewDate:c,onViewDateChange:d,maxDate:t,minDate:n})})]})},TextAreaInput:function({label:e,placeholder:t,autofocus:n=!1,resizeable:r=!0}){const a=Hu(),o=g(null);return I(Th,{label:e,inputRef:o,children:I("textarea",{...Hh,ref:o,value:a.state.value||"",onChange:e=>a.handleChange(e.target.value),placeholder:t??"Add note...",rows:4,style:{resize:r?"both":"none"},autoFocus:n})})},MessageAreaInput:mp,SplitExpenseCategoryField:function({value:e,onChange:t}){const n=e?.iconUrl?vg(e.iconUrl,"Expense Icon"):void 0;return D(ks,{placement:"bottom-start",children:[I(As,{children:t=>D("button",{...Ig,...t,type:"button",children:[n&&I(Ac,{Component:n}),I(ao,{stylists:[Ng],children:e?.name||"Uncategorized"})]})}),I(Sg,{onClick:t})]})},SplitExpenseAmountField:function({value:e,onChange:t,onBlur:n}){const[r,a]=y(!1);return I("div",{...Dg,"data-clicked":r,children:I(fh,{value:e,onChange:t,onClick:()=>a(!0),onBlur:()=>(a(!1),void n())})})},ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Hu(),a=Qp(t?.id??""),{query:{data:o},isFilling:i}=bu({select:e=>({...e,data:Yp(e?.data)})}),l=o?.data,s=Qn(e)&&!vp(e);return I(zp,{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=Hu(),r=t.findIndex(e=>e.value===n.state.value);return I(Th,{label:e,disableHover:!0,children:I(vv,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:function({options:e,label:t,isEqual:n=Mg,isEmpty:r,disabled:a}){const o=Hu(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!Gn(o.state.value)&&!r?.(o.state.value);return D(ks,{placement:"bottom-start",children:[I(As,{children:n=>I(Th,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...Pg,type:"button",children:I(cs,l?{children:i(e,o.state.value)}:{extraClassNames:[Lg],children:`Select ${t.toLowerCase()}...`})})})}),I(Rg,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})},TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:a="Enter value..."}){const o=Hu(),i=g(null);return I(Th,{label:e,disabled:r,inputRef:i,kind:"text",type:t,maxLength:n,children:I("input",{className:Fg,value:o.state.value,onChange:e=>o.handleChange(e.target.value),type:t,maxLength:n,ref:i,placeholder:a})})},BulkMergeAccountRowField:nm,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const a=g(null),o=r?Th:hh,{handleBlur:i}=Hu();return D(ks,{placement:"bottom-start",children:[I(As,{children:t=>I(o,{inputRef:a,label:e,popupTriggerProps:t,children:I(cs,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})}),I(pm,{onClick:e=>{t(e),i()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const a=g(null),o=r?Th:hh;return D(ks,{placement:"bottom-start",children:[I(As,{children:t=>I(o,{inputRef:a,label:e,popupTriggerProps:t,children:I(cs,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})}),I(dv,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=g(null),a=`${n?.name??dl[0].name}`;return D(ks,{placement:"bottom-start",children:[I(As,{children:t=>I(Th,{inputRef:r,label:e,popupTriggerProps:t,children:I(ao,{children:a})})}),I(uv,{frequencies:dl,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=Zh,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,popupTriggerProps:i,hasErrorStyles:l=!1,disableHover:s=!1}){const c=Hu(),{mutateAsync:d}=$h(),[u,h]=y(!0),{dataAttributes:p}=oh({isActive:u,isDefaultValue:!1,isTouched:o,popupTriggerProps:i,errorMessage:a,hasErrorStyles:l,disableHover:s}),{getRootProps:g,getInputProps:m}=Ie({maxFiles:e,accept:t,disabled:n,onDrop:async t=>{const n=c.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=>Xh(e,n))),...i.map(e=>Qh(e,Yh.maxAttachmentsReached))];c.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const s=l.filter(e=>!e.hasError);if(0===s.length)return;const u=s.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);c.setValue(e=>(e??[]).map(e=>{if(e.hasError)return e;const t=s.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(kv,{getRootProps:g,getInputProps:m,dataAttrs:p,popupTriggerProps:i,onMouseDown:()=>h(!0),onBlur:()=>h(!1),label:r,errorMessage:a,isTouched:o})},ClassSegmentField:function({fieldLabel:e,selectedSegment:t,classSegmentOptions:n,classSegmentLabels:r,onSave:a}){return D(ks,{children:[I(As,{children:n=>I(Th,{label:e,popupTriggerProps:n,children:I("button",{className:Wv,type:"button",children:I(cs,t?{children:t.name}:{extraClassNames:[Hv],children:`Select ${e.toLowerCase()}...`})})})}),I(Vv,{fieldLabel:e,selectedSegment:t,classSegmentOptions:n,classSegmentLabels:r,onSave:a})]})}}});const jv=[nr(null,qn({"& path":{stroke:"icon.base"}}))];function Kv({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return D(Xl,{type:"button",onClick:n,children:[e&&I(pi,{Component:Ss,stylists:jv}),I(ao,{children:t})]})}const _v=qn({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),Yv=qn({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),Zv=qn({maxWidth:"600px"}),Gv=qn({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),Qv=qn({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Xv=qn({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Jv=qn({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),$v=qn({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),eb=qn({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),tb=e=>{ph(e),gh(e)};function nb({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=bu(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=Pu(),a=br(),o=Cr(),i=Qn(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,cl({queryKey:hr(pl({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:ml,accessToken:n,environment:r}))}),qv({defaultValues:l,onSubmit:async e=>{if(await Bu()===zd){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await Uu());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=hr(pl({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await sl({queryKey:r,queryFn:ml,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=At(e.tranStartDate||""),l=At(n||""),s=At(e.tranMinStartDate||""),Gn(l)?i:Qn(s)?Nt(l,s):(Qn(i)&&Nt(l,i),i));var i,l,s;return Gn(r)?null:St(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...Fu(t),duplicateBankAccountIds:[kl(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await Uu()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return D("form",{className:_v,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:tb,children:[D("div",{className:Yv,children:[I(ao,{children:"Merge Accounts"}),I("div",{className:Zv,children:I(cs,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),D("div",{className:Gv,children:[D("div",{className:Qv,children:[I("div",{className:Xv,children:I(ao,{children:"Duplicate Account"})}),I("div",{className:Jv,children:I(ao,{children:"Into"})}),I("div",{className:$v,children:I(ao,{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)&&Lu(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return I(nm,{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:eb,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return D(N,{children:[I(Kv,{showIcon:!1,onClick:()=>n()}),I(ku,{onClick:()=>i.reset(o),disabled:!t,children:I(ao,{children:"Clear Selections"})}),I(Ku,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const rb=qn({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"}),ab=ye.createConfirmation(xe(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I(Gd,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:rb,children:I(nb,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function ob({plaidItemAccounts:e,matchingAccountPairs:t}){await ab({matchingAccountPairs:t,plaidItemAccounts:e})}const ib=qn({display:"flex",flexDirection:"column",gap:"12px"}),lb=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:Wd(n)},{url:a,headers:o}=pa(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?(oa("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(ia({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),pu("NO_LINK_TOKEN"))}catch(r){return ia({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),pu("LINK_TOKEN_FAILED")}};async function sb(e,t,n){const r=await async function(e,t){const n=hr(Od({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await sl({queryKey:n,queryFn:Bd,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function cb(e,t,n,r){oa("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||oa("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,cl({queryKey:hr(gu({filter:mu}),{}),queryFn:vu,accessToken:r,environment:a});const o=await sb(e,t,n);if(o){const e=await fu(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:Wd(r)},{url:o,headers:i}=pa(a);return await ga({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(oa("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([xr.invalidateQueries({queryKey:["integrations"]}),xr.invalidateQueries({queryKey:["banks/accounts",{}]}),xr.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===Cu({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return ia({error:new Error("Plaid Item requires relink, plaid reopened automatically"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),{relinkPlaidItemId:i.id};const s=await fu(n,r),c=s?.data?.filter(e=>Lu(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=l(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(ia({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ou({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:qd,label:"Cancel"},{key:jd,label:"Chat",type:au.SUCCESS}]})===jd&&uu({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void ia({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 ia({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ou({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:qd,label:"OK"}]});const s=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&s&&s.length>0)return ia({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 ou({title:"All set! Ready to track your transactions?",body:D("div",{className:hu,children:[I(cs,{wrap:"wrap",children:`Your ${n} ${t} ${iu("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(cs,{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(cs,{wrap:"wrap",children:du(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:jd,label:"Get Started",type:au.SUCCESS}]})}(s,o,e.plaidItemAccounts.length);const c=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:wu(r),duplicateAccount:e})}return n}(i,a);return c.length>0?async function({institutionName:e,matchingAccountPairs:t,plaidItemAccounts:n}){const r=t.slice(0,3),a=t.length>3;await ou({title:"Your transactions are being categorized",body:D("div",{className:ib,children:[I(cs,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(cs,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),D("ul",{children:[r.map(({duplicateAccount:e})=>I("li",{children:I(cs,{wrap:"wrap",children:du(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(cs,{wrap:"wrap",children:"and more..."})})]}),I(cs,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:qd,label:"No thanks"},{key:jd,label:"Review",type:au.SUCCESS}]})===jd&&await ob({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:c,plaidItemAccounts:c.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(ia({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ou({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${iu("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:jd,label:"Get started",type:au.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,c),{}}catch(o){return ia({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ou({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:qd,label:"Cancel"},{key:jd,label:"Chat",type:au.SUCCESS}]})===jd&&uu({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 db(e,t,n){return Gn(e)?(oa("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(oa("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(ia({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&&(ia({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 ou({title:e||"Invalid Updated Username",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:qd,label:"Cancel"},{key:"chat",label:"Chat"},{key:jd,label:"Banks & Integrations",type:au.SUCCESS}]});"chat"===t?uu({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==jd||(e=>{const t=$t.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||ol("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const ub=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Rt(t.lastSyncedDate)}`},hb=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},pb="PLAID_LINK_NEW",gb="PLAID_LINK_UPDATE",mb="PLAID_LINK_UNLINK";function vb({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 bb=v({});function fb({onPlaidLink:e,children:t}){return I(bb.Provider,{value:{onPlaidLink:e},children:t})}function yb(){return b(bb)}async function xb(e){const{url:t,headers:n}=pa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=da({extraHeaders:n,authorization:t});oa("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return oa("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),ua(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}const Tb=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Ca(n)};return await ba(r)};function Cb(){return Eu({mutationFn:Tb,onSuccess:()=>{const e=["integrations"];return xr.invalidateQueries({queryKey:e})}})}const wb=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Ca(t)};return await ba(n)};function kb(){return Eu({mutationFn:wb,onSuccess:()=>{const e=["integrations"];return xr.invalidateQueries({queryKey:e})}})}const Eb=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(kl(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Ca(n)};return await async function(e){return xb(e)}(r)};function Ab(){const{mutate:e}=kb();return Eu({mutationFn:Eb,onSuccess:()=>{const e=["integrations"];return xr.invalidateQueries({queryKey:e})},onError:async t=>{ia({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ou({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:qd,label:"Cancel"},{key:jd,label:"Try Again",type:au.SUCCESS}]})===jd&&e()}})}function Sb(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)=>{oa(`Plaid event: ${e}`,{metadata:t,eventName:e})}}).open()})}async function Ib(e,t,n,r){const a=await lb(e,t,n);if(!a)return;const o=await Sb(a);if("success"===o?.status){const{public_token:e,metadata:a}=o;oa("Plaid link successful",{public_token:e,metadata:a});const i=await cb(e,a,t,n);if(i.relinkPlaidItemId)return Ib(i.relinkPlaidItemId,t,n,r)}else if("exit"===o?.status){const{metadata:e,error:t}=o;oa("Plaid link exited",{metadata:e,error:t}),await db(t,e,a)&&r()}else ia({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:o,token:a}})}function Nb(){const[e,t]=Fd({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=br(),r=Cr(),{mutate:a}=kb(),{onPlaidLink:o}=yb();return{linkPlaid:e=>{if(Qn(o)){const t=vb(e);o(t)}else Ib(e.plaidItemId?kl(e.plaidItemId):void 0,n,r,a)},loading:e||Qn(t),hasOnPlaidLinkOverride:Qn(o)}}function Db(){const[e,t]=Fd({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=br(),r=Cr(),{mutate:a}=kb(),{apiPartnerName:o}=b(Qs),{onPlaidLink:i}=yb();return{linkPlaid:e=>{if(Qn(i)){const t=vb(e);i(t)}else!async function(e,t,n,r,a){const o=await lb(e,t,n);if(!o)return;const i=await Sb(o);if("success"===i?.status){const{public_token:e,metadata:o}=i;oa("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 sb(t.institution.institution_id,n,r);if(i)return ia({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ou({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:qd,label:"Cancel"},{key:jd,label:"Relink",type:au.SUCCESS}]}))===jd?{relinkPlaidItemId:kl(i.id)}:{}}var o;return oa("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),cb(e,t,n,r)}(e,o,t,n,r);l.relinkPlaidItemId&&Ib(l.relinkPlaidItemId,t,n,a)}else if("exit"===i?.status){const{metadata:e,error:t}=i;oa("Plaid link from search exited",{metadata:e,error:t}),await db(t,e,o)&&a()}}(e.plaidItemId?kl(e.plaidItemId):void 0,n,r,o,a)},loading:e||Qn(t),hasOnPlaidLinkOverride:Qn(i)}}const Rb=nr(null,Bl,qn({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"}}}}),ci);function Pb(){const{linkPlaid:e,loading:t}=Nb();return D("button",{onClick:()=>e({plaidEvent:pb,message:"Tile Plaid Link button pressed"}),...Rb,disabled:t,children:[I(Ac,{Component:Rd}),I(cs,{intent:"primary",children:"Link Account"})]})}const Lb=qn({width:266,minHeight:32});function Mb(){return I(Lo,{styles:Lb})}const Fb=nr(Zn.text,qn({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",letterSpacing:"0.66px",maxWidth:"100%"}),Ba);function Ob({children:e}){return I("div",{...Fb,children:e})}const Bb={SUCCESS:qn({backgroundColor:"surface.intent.success.highlight"}),DANGER:qn({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:qn({backgroundColor:"surface.intent.secondary"})},Ub=qn({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"});function Vb({variant:e,children:t}){return I("div",{className:jn(Ub,Bb[e]),children:I(Ob,{children:t})})}const Wb=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function Hb({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${Ja(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return I(Vb,{variant:Wb(r,n,t),children:a})}const qb=qn({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function zb({title:e,label:t,comparison:n,invertDirection:r}){return D("div",{className:qb,children:[I(_a,{title:e,label:t}),Qn(n)&&I(Hb,{difference:n,invertDirection:r})]})}const jb={netIncome:0,income:0,expenses:0,absoluteSum:0},Kb=e=>{if(Gn(e))return jb;const t=e.income?.total??0,n=e.expenses?.total??0,r=V(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},_b=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Kb):[]},Yb=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0}),Zb=({defaultRange:e=st.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r})=>{const a=t?Mt(t):e,{query:{data:o},isFilling:i}=function({filter:e,grouping:t}){return Ea({filter:e,grouping:t,select:_b})}({filter:a,grouping:t?Da:void 0}),{profitLossData:l,profitDifference:s}=m(()=>{if(n)return{profitLossData:jo,profitDifference:null};if(!o||0===o.length)return{profitLossData:Yb,profitDifference:null};if(2===o.length){const[e,t]=o;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:o[0],profitDifference:null}},[o,n]);return D(Oa,{isSample:n,children:[I(Pa,{title:"Profit + Loss"}),I(Ma,{children:i?D(Fo,{children:[I(Mb,{}),I(Mb,{})]}):D(N,{children:[I(zb,{title:$a(l.netIncome),label:"Profit",comparison:s}),D(Za,{children:[I(Dd,{amount:l.income,total:l.absoluteSum,color:"positive",label:"Income"}),I(Dd,{amount:l.expenses,total:l.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(Ho,{size:"sm"}),r&&I(Pb,{})]})},Gb=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],Qb=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...vt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Ca(a)};return await ba(o)},Xb={moneyIn:0,moneyOut:0,netMoneyIn:0},Jb=e=>{if(Gn(e)||Gn(e.operatingActivities)||!e.operatingActivities.children)return Xb;let t=new V(0),n=new V(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(V(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},$b=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Jb):[]};const ef=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0}),tf=({defaultRange:e=st.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r})=>{const a=t?Mt(t):e,{query:{data:o,isFetched:i},isFilling:l}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return wr({queryKey:Gb({filter:e,grouping:t}),queryFn:Qb,select:n})}({filter:e,grouping:t,select:$b})}({filter:a,grouping:t?Da:void 0}),{cashFlowData:s,difference:c}=m(()=>{if(n)return{cashFlowData:_o,difference:null};if(!o||0===o.length)return{cashFlowData:ef,difference:null};if(2===o.length){const[e,t]=o;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:o[0],difference:null}},[o,n]),d=n||i?Math.abs(s.moneyIn)+Math.abs(s.moneyOut):0;return D(Oa,{isSample:n,children:[I(Pa,{title:"Cash Flow"}),I(Ma,{children:l?D(Fo,{children:[I(Mb,{}),I(Mb,{})]}):D(N,{children:[I(zb,{title:$a(s.netMoneyIn),label:"Change in Cash",comparison:c}),D(Za,{children:[I(Dd,{amount:s.moneyIn,total:d,color:"positive",label:"Money In"}),I(Dd,{amount:s.moneyOut,total:d,color:"negative",label:"Money Out"})]})]})}),n&&I(Ho,{size:"sm"}),r&&I(Pb,{})]})},nf=nr(null,qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"})),rf=nr(null,qn({display:"flex",justifyContent:"end"}));function af({color:e,bulletLabel:t,moneySummary:n}){return D("div",{...nf,children:[I(mo,{color:e,label:t}),I("div",{...rf,children:I(cs,{children:n})})]})}const of=nr(null,qn({display:"flex",gap:"10px",alignItems:"center"})),lf=qn({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),sf=nr(null,lf);function cf({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>D("div",{...of,children:[I(mo,{color:uo.var("colors.brand.secondary")}),t?I(Lo,{styles:lf}):I("div",{...sf})]},n))})}const df={total:0,children:[]},uf=e=>{return Gn(e)||Gn(e.expenses)||!e.expenses.children?df:{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},hf=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(uf):[]},pf=[uo.var("colors.brand.primary"),uo.var("colors.brand.success"),uo.var("colors.brand.action")],gf=Object.freeze({total:0,children:[]});function mf({defaultRange:e=st.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const o=$t(e=>e.externalOptions).dataVisualizationColors??pf,i=t?Mt(t):e,{query:{data:l},isFilling:s}=function({filter:e,grouping:t}){return Ea({filter:e,grouping:t,select:hf})}({filter:i,grouping:t?Da:void 0}),{expenseData:c,expensesDifference:d}=m(()=>{if(r)return{expenseData:Ko,expensesDifference:null};if(!l||0===l.length)return{expenseData:gf,expensesDifference:null};if(2===l.length){const[e,t]=l;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:l[0],expensesDifference:null}},[l,r]),u=void 0===n?"Total Expenses":`${ft[n]} Total`,h=c.children.length>0;return D(Oa,{isSample:r,children:[I(Pa,{title:"Expenses"}),I(Ma,{children:s?I(Fo,{children:I(cf,{shimmer:!0})}):D(N,{children:[I(zb,{title:$a(c.total),label:u,comparison:d,invertDirection:!0}),I(Za,{children:h?c.children.map((e,t)=>I(af,{color:o[t],bulletLabel:e.name,moneySummary:$a(e.total)},t)):I(cf,{})})]})}),r&&I(Ho,{size:"sm"}),a&&I(Pb,{})]})}const vf=nr(null,qn({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function bf({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:et(l=e.year,i,1),endDate:et(l,i+1,0)});var i,l,s,c,d,u,h,p;return D("div",{...vf,children:[D(ar,{children:[I(dr,{children:"Monthly Review"}),I(bd,{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})]}),D(yd,{children:[I(Zb,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(tf,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(mf,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const ff="Oldest to Newest",yf="Newest to Oldest",xf="A-Z",Tf="Z-A",Cf="Lowest to Highest",wf="Highest to Lowest",kf="A-Z",Ef="Z-A";function Af(){const[e,t]=y(void 0),n=m(()=>{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 ul)??!1,n=(e.direction&&e.direction in hl)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const Sf=qn({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"}}}),If=qn({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),Nf=qn({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function Df({checked:e,onClick:t,Icon:n=zu}){const[r,a]=y(e??!1),o=void 0===e?r:e;return I("button",{...nr(Zn["checkbox-input"],Sf,o?Nf:If,di),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&I(Is,{Component:n})})}const Rf=nr(null,qn({paddingLeft:"20px",paddingRight:"5px"}));function Pf({checked:e,onClick:t,Icon:n=zu}){return I("div",{...Rf,children:I(Df,{checked:e,onClick:t,Icon:n})})}const Lf=nr(Zn["date-cell"],qn({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function Mf({date:e,annotation:t}){const n=wt(At(e));return D("div",{...Lf,children:[t&&I(Ob,{children:t}),I(cs,{children:n})]})}const Ff="Income",Of={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},Bf={Expense:[{name:"Expense",value:Of.EXPENSE}],Income:[{name:Ff,value:Of.REVENUE}],Transfer:[{name:"Bank Transfer In",value:Of.TRANSFER_IN},{name:"Bank Transfer Out",value:Of.TRANSFER_OUT}]},Uf={EXPENSE:"Expense",REVENUE:Ff,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},Vf=Object.fromEntries(Object.entries(Uf).map(([e,t])=>[e,`Add ${t}`])),Wf=Object.fromEntries(Object.entries(Uf).map(([e,t])=>[e,`Edit ${t}`])),Hf=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},qf=e=>e===Of.TRANSFER_IN||e===Of.TRANSFER_OUT,zf=qn({color:"money.negative"}),jf=qn({color:"money.positive"}),Kf=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>pr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),_f=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!Gn(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:zf};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?jf:zf}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":Ff,css:t?zf:jf}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?zf:jf};break;default:t=(e=>({type:e.type,displayName:Kf(e.type),css:e.amount<0?zf:jf}))(e)}var n;return t},Yf=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M10 14.375L13.75 10.625L10 6.875",stroke:"currentColor",strokeMiterlimit:10})),"ChildRow"),Zf=nr(Zn["transaction-date-cell-container"],qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function Gf({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=_f(e),a=nr(Zn["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?D("div",{...Zf,children:[I(Ac,{Component:Yf}),I(Mf,{date:e.date,annotation:o})]}):I(Mf,{date:e.date,annotation:o})}const Qf=qn({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),Xf=qn({display:"flex",flexDirection:"column",width:"100%"}),Jf=qn({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function $f({label:e,subLabel:t,iconUrl:n}){return D("div",{className:Qf,children:[n?I("img",{src:n,className:Jf,alt:void 0,width:24,height:24}):I("span",{className:Jf}),D("div",{className:Xf,children:[I(cs,{children:e}),I(io,{children:t})]})]})}function ey({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:qn({paddingLeft:"25px"}),children:I($f,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I($f,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}function ty(e){return eo(lu(e.amount))}const ny=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M6.9187 2.10632H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 5.69366H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 9.28131H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 12.8687H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M5.71875 10.4749L3.33125 12.8686L0.9375 10.4749",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M3.33118 1.50635V12.8688",stroke:"currentColor",strokeMiterlimit:10})),"NestedRows"),ry=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M6.9187 2.13135H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 5.71851H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 9.30682H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M6.9187 12.8934H14.6875",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M0.9375 4.5251L3.33125 2.13135L5.71875 4.5251",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M3.33118 13.4938V2.13135",stroke:"currentColor",strokeMiterlimit:10})),"NestedRowsExpanded"),ay=qn({display:"flex",alignItems:"center",gap:"8px"}),oy=qn({padding:"6px"});function iy({row:e}){const t=e.original,n=I(cs,{children:ty(t)});if(e?.getCanExpand()){const t=e.getIsExpanded();return I(zs,{ariaLabel:t?"Collapse children":"Expand children",ariaExpanded:t,children:D("div",{className:ay,children:[I(Ac,{Component:t?ry:ny}),n]})})}return I("div",{className:oy,children:n})}const ly=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M13.75 1.25L1.25 13.75",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M13.75 9.84375V1.25H5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Withdraw"),sy=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M13.75 13.75L1.25 1.25",stroke:"currentColor",strokeMiterlimit:10}),p.createElement("path",{d:"M5.15625 13.75H13.75V5.15625",stroke:"currentColor",strokeMiterlimit:10})),"Deposit"),cy=qn({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px"}),dy=qn({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function uy({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return ly;case"Deposited to":return sy;default:return null}})(e);return D("div",{className:cy,children:[n&&I(Ac,{Component:n}),D("div",{className:dy,children:[e&&I(io,{children:e}),t&&I(cs,{children:t})]})]})}const hy=qn({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"}}),py=jn(hy,qn({padding:"2.5px"})),gy=jn(hy,qn({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),my=qn({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"}}),vy=jn(my,qn({_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"}}})),by=qn({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"}}}),fy=jn(by,qn({_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"}}})),yy=qn({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"}}),xy=jn(yy,qn({_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"}}})),Ty=qn({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"}}),Cy=jn(Ty,qn({_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"}}})),wy=qn({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"}}),ky=jn(wy,qn({_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"}}})),Ey=qn({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"}}),Ay={default:vy,neutral:vy,warning:Cy,success:xy,danger:ky,highlight:fy},Sy=w(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=lr([nr(Zn["selector-button"],jn(Ey,Ay[e]),di),...n]);return I("button",{ref:a,...o,...r,children:t})}),Iy=()=>["accounting/glAccounts"],Ny=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await Li(n);return Py(r)};function Dy(e){return wr({...e,queryKey:["accounting/glAccounts"],queryFn:Ny})}function Ry(){return Dy({select:Wy})}const Py=e=>e.map(e=>({...e,id:wl({id:e.id,prefix:"GL_ACCOUNT"})}));function Ly(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 My(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>My(e,t))}const Fy=e=>!e.parentAccountNo;function Oy(e){const t=Ly(e);return e.filter(Fy).map(e=>({...e,children:My(e,t)}))}function By(e,t){return(t.get(e)??[]).map(e=>{const n=By(e.accountNo,t);return{...e,children:n}})}function Uy(e){const t=Ly(e);return e.filter(Fy).map(e=>({...e,children:By(e.accountNo,t)}))}function Vy(){return Dy({select:Uy})}function Wy(e){return Oy(e).flatMap(e=>[e,...e.children])}const Hy=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function qy(e,t){return m(()=>e?.filter(e=>t.includes(e.type))??[],[e,t])}const zy={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function jy(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function Ky(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=>{jy(e,n,t)})}(r,n):a?jy(a,r,n):i&&jy(r,r,n)}),n}const _y=[nr(null,qn({marginLeft:"6px",marginRight:"6px"}))],Yy=nr(null,qn({whiteSpace:"normal"}));function Zy({types:e,onClick:t,searchTerm:n}){const{query:{data:r},isFilling:a}=Ry(),o=qy(r,e),i=m(()=>new Ee(o,zy),[o]),l=m(()=>Ky(i.search(n),o),[o,n,i]);return a?I(Op,{}):l.map(({parent:e,child:n})=>I(Rp,{onClick:()=>t(n),children:D(ug,{stylists:[Yy],children:[e.name,I(pi,{Component:li,stylists:_y}),n.name]})},`${n.accountNo}`))}function Gy({types:e,onClick:t}){const{query:{data:n,isFetching:r},isFilling:a}=Dy({select:Oy}),o=qy(n,e);return a?I(Op,{}):a||r||void 0!==n?o.map(e=>I(Tg,{triggerChildren:I(kg,{displayLabel:e.name}),popupChildren:I(Qy,{glAccount:e,onClick:t})},e.accountNo)):I(Mp,{text:"No data"})}function Qy({glAccount:e,onClick:t}){return I(kp,{children:e.children.map(e=>I(Rp,{onClick:()=>t(e),children:I(ao,{children:e.name})},e.accountNo))})}const Xy=qn({maxWidth:"420px",width:"fit-content"});function Jy({onClick:e,types:t}){const{query:{data:n}}=Vy(),r=qy(n,t);return I(Ip,{onClick:e,placeholder:"Search revenue accounts...",getSearchActiveStyles:e=>e?Xy:void 0,SearchList:Zy,DefaultList:Gy,extraProps:{types:t},listLength:r.length,forceSearchVisible:!0})}const $y={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 ex(e,t=!0){const n=Cu({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 tx(){return Ud({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 nx={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"},rx=e=>["tasks",e??{}],ax={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},ox={filter:{status:{in:["ACTIVE"]}}},ix=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:Ei(t[2].environment)},a=await va(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function lx(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=Gn(r=e)||Gn(r.data)?[]:[...r.data].sort((e,t)=>ax[e.priority]-ax[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=ox,wr({...r,queryKey:a?rx(a):["tasks",{}],queryFn:ix}));var r,a;const{query:{data:o},isFilling:i}=_p(),{query:{data:l},isFilling:s}=Vd({select:e=>({...e,data:e?.data?.filter(({status:e,apiErrorType:t,apiErrorCode:n})=>"ACTIVE"===e&&t&&n)})});return{taskBanners:m(()=>{let e=[];const n=l?.data;n&&(e=n.map(e=>ex(e)));let r=[];!1===o?.hasPlaidLinkedBankAccount&&(r=[$y]);const a=t??[];return[...e,...r,...a]},[t,o,l]),isFilling:n||i||s}}const sx=e=>{const t=Jo[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},cx=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>hx({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),dx=async({data:e,accessToken:t,environment:n})=>hx({data:{data:e},accessToken:t,environment:n}),ux=async({data:e,accessToken:t,environment:n})=>dx({data:[e],accessToken:t,environment:n}),hx=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:Ei(n)};return await va(r)};function px(){return Eu({onSuccess:async()=>{const e=["banks/transactions"];return oa("mutation successful, invalidating BT queries"),xr.invalidateQueries({queryKey:e}).catch(e=>ia({error:e,severity:"error"}))},mutationFn:dx})}function gx(){return mx({mutationFn:ux})}function mx(e){return Eu({onSuccess:async()=>(oa("mutation successful, invalidating BT queries"),xr.invalidateQueries({predicate:e=>e.queryKey.includes("tasks")||e.queryKey.includes("banks/transactions")||e.queryKey.includes("reports")}).catch(e=>ia({error:e,severity:"error"}))),...e})}function vx({transaction:e,parentTransaction:t,accountName:n}){const{startPrefetch:r,cancelPrefetch:a}=Fi({prefetchFn:Ai(Iy,Ny)}),{mutate:o}=gx(),i=void 0!==t,l=Gn(e.glAccount?.iconUrl)?void 0:vg(e.glAccount.iconUrl,"Revenue Icon");return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>D(Sy,{...e,onMouseEnter:r,onMouseLeave:a,children:[l&&I(Ac,{Component:l}),I(cs,{children:n})]})}),I(Jy,{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:Hy})]})}const bx=e=>e>0?"Deposited to":"Withdrawn from",fx=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M4.31676 1.37476L1.67926 4.01226L4.31676 6.64976",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M12.2292 6.64976L14.8667 4.01226L12.2292 1.37476",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10})),"Split"),yx=nr(null,qn({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),xx=nr(null,qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function Tx({transaction:e}){const{label:t,list:n}=cg(e.children);return I(ls,{children:D("div",{...xx,children:[I(Ac,{Component:fx}),D("div",{...yx,children:[I(ao,{children:t}),I(io,{children:n})]})]})})}function Cx({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=lg(),a=e.category?.name??"",{mutate:o}=gx(),i=void 0!==t,l=Gn(e.category?.iconUrl)?void 0:vg(e.category.iconUrl,"Expense Icon");return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>D(Sy,{...e,onMouseEnter:n,onMouseLeave:r,children:[l&&I(Ac,{Component:l}),I(cs,{children:a})]})}),I(Sg,{onClick:i?n=>{if(n?.id&&i){const{id:r,children:a}=t,{id:i}=e,l=a.map(e=>e.id===i?{...e,categoryId:n.id.toString()}:e);o({id:r,children:l})}}:t=>{t?.id&&o({id:e.id,categoryId:t.id.toString()})}})]})}function wx({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(Tx,{transaction:e});switch(Hf(e.type)){case"EXPENSE_CATEGORY":return I(Cx,{transaction:e,parentTransaction:t});case"TRANSFER":return I(uy,{annotation:bx(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return ia({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(vx,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function kx({name:e}){return I(N,{children:e&&I(cs,{children:e})})}const Ex=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],Ax=[{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 Sx({onClick:e}){const t=Es(),{userRole:n}=b(Qs),r=(e=>{switch(e){case"OWNER":default:return Ex;case"ACCOUNTANT":return Ax}})(n)||[];return I(Os,{children:I(kp,{children:r.map(({status:n,displayName:r})=>I(Rp,{onClick:()=>(e(n),void t.close()),children:I(ao,{children:r})},n))})})}const Ix=oi(e=>p.createElement("svg",{width:13,height:15,viewBox:"0 0 13 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M0.743464 14.9687V0.96875H11.6465L9.22218 4.59886L11.6465 8.24166H0.743464",stroke:"#182428",strokeMiterlimit:10})),"Flag",{styleIconKey:"flag"}),Nx=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M7.81985 0.464722V3.49919",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M7.81985 12.0008V15.0353",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M15.1051 7.75H12.0706",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M3.56907 7.75H0.534607",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M12.9702 2.59967L10.8227 4.74724",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M4.81706 10.7528L2.66949 12.9004",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M12.9702 12.9004L10.8227 10.7528",stroke:"black",strokeMiterlimit:10}),p.createElement("path",{d:"M4.81706 4.74724L2.66949 2.59967",stroke:"black",strokeMiterlimit:10})),"Processing"),Dx=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M7.49998 14.4244C11.3242 14.4244 14.4244 11.3242 14.4244 7.49998C14.4244 3.67573 11.3242 0.575562 7.49998 0.575562"}),p.createElement("path",{d:"M7.49997 0.575562C3.67572 0.575561 0.575547 3.67573 0.575547 7.49998C0.575547 11.3242 3.67572 14.4244 7.49997 14.4244",strokeDasharray:"2 2"}),p.createElement("path",{d:"M3.72124 7.50001L6.24041 10.0192L11.2787 4.98083"})),"Staged"),Rx=v(void 0);function Px(){return b(Rx)}const Lx=e=>["sdk/introspect",e];function Mx(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 Li(r)}(n[2].accessToken,n[2].environment,e)}}function Fx(){const e=Px();return wr({queryKey:Lx(e),queryFn:Mx(e)})}const Ox={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"},Bx={DISCREPANCY:{text:"Discrepancy",Icon:Qu,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:Nx,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:Ix,variant:"warning"},PROCESSING:{text:"Processing",Icon:Nx,variant:"neutral"},AWAITING_MATCH:{text:"Awaiting Match",Icon:Nx,variant:"neutral"},STAGED:{text:"Staged",Icon:Dx,variant:"neutral"},RECONCILED:{text:"Reconciled",Icon:Ym,variant:"success"}},Ux="DISCREPANCY",Vx="CLIENT_REVIEW",Wx="NEEDS_REVIEW",Hx="PROCESSING",qx="STAGED",zx="RECONCILED";function jx(e){return Bx[e]}function Kx(e,t,n){return{...jx(e),value:Xx(e,t,n)}}function _x(){const{query:{data:e}}=Fx();return function(e){const t="ACCOUNTANT"===e?.userRole,n=e?.isDfy??!1;return t?[Kx(Ux,!0,n),Kx(Vx,!0,n),Kx(Wx,!0,n),Kx(qx,!0,n)]:[Kx(Wx,!1,n),Kx(Ux,!1,n),Kx(Hx,!1,n),Kx(zx,!1,n)]}(e)}const Yx={[Ox.RECONCILIATION_DISCREPANCY]:Ux,[Ox.USER_REVIEW_REQUIRED]:Vx,[Ox.ACCOUNTANT_REVIEW_REQUIRED]:Wx,[Ox.AWAITING_MATCH]:"AWAITING_MATCH",[Ox.PARTNER_REVIEW_REQUIRED]:Hx,[Ox.STAGED]:qx,[Ox.RECONCILED]:zx},Zx={[Ox.RECONCILIATION_DISCREPANCY]:Ux,[Ox.USER_REVIEW_REQUIRED]:Wx,[Ox.ACCOUNTANT_REVIEW_REQUIRED]:Hx,[Ox.AWAITING_MATCH]:Hx,[Ox.PARTNER_REVIEW_REQUIRED]:Hx,[Ox.STAGED]:Hx,[Ox.RECONCILED]:zx},Gx={[Ox.RECONCILIATION_DISCREPANCY]:Ux,[Ox.USER_REVIEW_REQUIRED]:Wx,[Ox.ACCOUNTANT_REVIEW_REQUIRED]:Hx,[Ox.AWAITING_MATCH]:Hx,[Ox.PARTNER_REVIEW_REQUIRED]:Hx,[Ox.STAGED]:Wx,[Ox.RECONCILED]:zx};function Qx(e,t){return e?Yx:t?Zx:Gx}function Xx(e,t,n){const r=Qx(t,n);return Object.keys(r).filter(t=>r[t]===e)}function Jx(e){return e in Ox}const $x=(e,t)=>function(e,t,n){return jx((r=e,Qx(t,n)[r]));var r}(e,"ACCOUNTANT"===t?.userRole,t?.isDfy??!1),eT=nr(Zn["review-status-selector-button"],qn({width:"151px",justifyContent:"center"})),tT=nr(Zn["review-status-dropdown-arrow"],qn({display:"none"}));function nT({status:e,transactionId:t}){const[n,r]=y(!1),{mutate:a}=gx(),o=()=>{r(!1)},i=()=>{r(!n)},l=b(Qs),{text:s,variant:c,Icon:d}=$x(e,l);return t&&((u=t).startsWith(Tl.TRANSACTION_LINE_ITEM)||u.startsWith(Tl.PROCESSOR_TRANSACTION))?null:D(ks,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(As,{children:e=>D(Sy,{variant:c,...e,stylists:[eT],onClick:i,children:[I(Ac,{Component:d}),I(cs,{children:s}),I("div",{...tT,children:I(pi,{Component:kh})})]})}),I(Sx,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function rT({status:e,transactionId:t}){return I(nT,{status:e,transactionId:t},t)}function aT(){return I(Ac,{Component:li})}function oT(){return I(aT,{})}const iT=e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M0.495239 8.15601H14.7767",strokeMiterlimit:10})),lT=oi(iT,"Dash"),sT=nr(null,qn({stroke:"icon.base.weak"}));function cT({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(_c,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(Is,{Component:lT,stylists:[sT]})})})}function dT({conversationId:e}){const{query:{data:t}}=zi(e??null),{startPrefetch:n,cancelPrefetch:r}=Ki(),{startPrefetch:a,cancelPrefetch:o}=Nl(),i=Qn(t),l=i&&"READ"===t?.readStatus,s=x(()=>{Qn(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=x(()=>{Qn(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I(cT,{hasConversation:i,hasUnread:!l})})}const uT=nr(Zn["badge-chip"],py),hT=nr(null,Wa),pT=nr(null,di),gT=nr(Zn["neutral-badge"],my),mT=nr(Zn["highlight-badge"],by),vT=nr(Zn["success-badge"],yy),bT=nr(Zn["warning-badge"],Ty),fT=nr(Zn["danger-badge"],Zn["critical-badge"],wy);function yT({type:e,children:t}){let n;switch(e){case"danger":n=fT;break;case"warning":n=bT;break;case"neutral":n=gT;break;case"success":n=vT;break;case"highlight":n=mT}const r=lr([uT,hT,n,pT]);return I("div",{...r,children:t})}function xT({reviewStatus:e}){const t=b(Qs),{variant:n,Icon:r}=$x(e,t);return I(yT,{type:n,children:I(Ac,{Component:r})})}const TT=qn({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),CT=qn({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),wT=qn({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),kT=qn({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),ET=qn({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),AT=qn({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function ST({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=cg(e.children);return`${t}: ${n}`}switch(Hf(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${bx(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void ia({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 D("div",{className:TT,children:[r&&I(Ac,{Component:Yf}),D("div",{className:ET,children:[D("div",{className:wT,children:[t.iconUrl?I("img",{src:t.iconUrl,className:AT,alt:void 0,width:24,height:24}):I("span",{className:AT}),I(ao,{children:t.description})]}),D("div",{className:kT,children:[I(xT,{reviewStatus:t.reviewStatus}),I(io,{wrap:"wrapTwice",children:n})]})]}),D("div",{className:CT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(iy,{row:e}),I(pi,{Component:li})]})]})}const IT=oi(iT,"Minus");function NT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(Pf,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?IT:zu})}const DT=X(),RT=[DT.display({id:tn.SELECT,header:({table:e})=>I(NT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(Pf,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),DT.accessor("date",{id:tn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(ls,{children:I(Gf,{transaction:e.row.original,isChild:t})})},header:()=>I(Ys,{columnName:"Date",sortDef:"DATE",sortAscDisplay:ff,sortDescDisplay:yf}),size:130,maxSize:144}),DT.accessor("description",{id:tn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(ls,{children:I(ey,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(Ys,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:xf,sortDescDisplay:Tf}),size:180}),DT.accessor("amount",{id:tn.AMOUNT,cell:e=>I(ls,{alignVariant:"flexEnd",children:I(iy,{row:e.row})}),header:()=>I(Ys,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:Cf,sortDescDisplay:wf,align:"right"}),size:130,maxSize:130}),DT.accessor("category.id",{id:tn.CATEGORY,cell:({row:e})=>I(wx,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(Ys,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),DT.accessor(e=>e.classSegments[0]?.id,{id:tn.CLASS_SEGMENT,cell:e=>I(ls,{children:I(kx,{name:e.row.original.classSegments[0]?.name})}),header:()=>I(Ys,{columnName:"Business"}),size:130}),DT.accessor("reviewStatus",{id:tn.REVIEW_STATUS,cell:e=>I(ls,{children:I(rT,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(Ys,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:kf,sortDescDisplay:Ef,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),DT.display({id:tn.COMMENTS,cell:e=>{const t=e.row.original;return I(ls,{alignVariant:"center",children:I(dT,{conversationId:t.conversation?.id})})},header:()=>I(Ys,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),DT.display({id:tn.EXPAND,cell:()=>I("div",{className:qn({paddingRight:"20px"}),children:I(oT,{})}),size:40,maxSize:60})],PT=DT.display({id:"MOBILE",cell:e=>I(ST,{row:e.row})}),LT=v(!0);function MT(){return b(LT)}const FT=[];function OT({transactions:e,columns:t}){const n=MT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(tn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[PT]:(i=t)?RT.filter(e=>i.includes(e.id)):RT;var i;return J({data:e??FT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??FT.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,rule: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 BT=[tn.COMMENTS,tn.DATE,tn.DESCRIPTION,tn.AMOUNT,tn.CATEGORY,tn.REVIEW_STATUS];function UT({Component:e,stylists:t}){return I(e,{stylists:[nr(Zn["xx-large-icon"],Zn.icon),...t??[]],size:50})}function VT(){return D(N,{children:[I(UT,{Component:Ym}),I(ao,{wrap:"wrap",children:"All caught up"}),I(io,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function WT({children:e,stylists:t=[],...n}){return I(Ql,{intent:"warning",stylists:t,...n,children:e})}function HT(){const{linkPlaid:e,loading:t}=Nb();return I(WT,{onClick:()=>e({plaidEvent:pb,message:"Plaid Link button pressed"}),disabled:t,children:I(ao,{children:"Link your bank"})})}function qT(){return D(N,{children:[I(UT,{Component:Bg}),I(dr,{children:"Link Bank Account"}),I(io,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(HT,{})]})}const zT=qn({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function jT(){return D(N,{children:[I("div",{className:zT,children:I(UT,{Component:Nx})}),I(dr,{children:"Transactions are being processed"}),I(io,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}const KT=qn({animation:"linear 1s spin infinite"}),_T={background:"conic-gradient(from 90deg,rgba(255, 255, 255, 0) 0deg,rgba(148, 216, 232, 1) 360deg)",height:"100%",width:"100%",opacity:1};function YT({size:e}){const t=e??15;return D("svg",{className:KT,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",{style:_T})})})}),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"})})})]})}function ZT(e,t=500,n){const r=g();!function(e){const t=g(e);t.current=e,T(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const a=m(()=>{const a=s(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 T(()=>{r.current=s(e,t,n)},[e,t,n]),a}function GT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=y(e),[a,o]=y(!1);T(()=>{r(e)},[e]);const i=ZT(x(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const QT=nr(Zn["filter-bar"],qn({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"}})),XT=nr(Zn["filter-search-bar"],qn({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),JT=nr(null,qn({stroke:"icon.base",flexShrink:0,marginRight:"15px"})),$T=nr(null,qn({border:"none",outline:"none",background:"transparent",fontSize:"lg",fontStyle:"normal",fontWeight:"sm",lineHeight:"18px",letterSpacing:"0.96px",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"}})),eC=qn({width:25});function tC({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=GT({debouncedValue:t,onChangeDebouncedValue:e});return I("div",{...QT,children:D("div",{...XT,children:[I("div",{className:eC,children:n||i?I(YT,{}):I(Ac,{stylists:[JT],Component:Mm})}),I("input",{...$T,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:gh})]})})}const nC=qn({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"});function rC({formattedDate:e,formattedSum:t}){return D("div",{className:nC,children:[I(ao,{wrap:"wrap",children:e}),I(ao,{wrap:"wrap",children:t})]})}function aC(e,t){return ol("BankTransactionForm",{routeProps:{transactionId:e,initialTab:t}})}function oC(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=qf(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();aC(e?.original.id??t.original.id,"conversation")}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();aC(e?.original.id??t.original.id)}}function iC({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=yl(),a=x(()=>n({id:e.original.id}),[n,e.original]);return I(al,{rowData:e,onMouseEnter:a,onMouseLeave:r,onCellClick:oC,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 lC({rows:e}){const t=m(()=>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=eo(lu(r.netSumCents)),r.rows.push(n))}else{const r=At(e);t.set(e,{date:e,formattedDate:r?wt(r):e,netSumCents:n.original.amount,formattedSumDollars:eo(lu(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>D(S,{children:[I(rC,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(iC,{rowData:e},e.id))]},e.date))})}function sC({table:e,hasSelect:t}){const n=MT();return I(Xi,{children:n?I(lC,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(iC,{rowData:e,hasSelect:t},e.id))})}function cC(e){return e?"Search":"Search transactions..."}function dC(e,t){return e.get(t)??[]}function uC(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function hC(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function pC({buttonText:e,onButtonClick:t}){return D(N,{children:[I(wc,{Component:qm}),I(ao,{children:"No results"}),I(io,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(zs,{onClick:t,children:e})]})}const gC=qn({xl:{minWidth:"900px"}}),mC=qn({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function vC({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){Pc(Xo);const c=function({transactions:e}){return function({transactions:e,columns:t}){return OT({transactions:e,columns:t?[...t,tn.EXPAND]:void 0})}({transactions:e,columns:BT})}({transactions:i}),{query:{data:d},isFilling:u}=vl({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=MT(),p=!Gn(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(pC,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(VT,{})):a=I(jT,{}):a=I(qT,{}),a}(e??!1,i.length>0,p,l.length>0);return D("div",{className:gC,children:[I("div",{id:Xo}),D(hi.Provider,{value:o,children:[D(ar,{children:[I(dr,{children:"Transactions for review"}),I(Mc,{children:I(fi,{})})]}),I(rs,{dashboard:"businessOwnerDashboard",children:r?I(ki,{}):D(N,{children:[!h&&I("div",{className:mC,children:I(tC,{placeholder:cC(h),searchTerm:l,onChange:s,isFetching:a})}),I(as.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(Gi,{headerGroups:c.getHeaderGroups()})}),Gn(g)?I(sC,{table:c,hasSelect:!1}):I(Tc,{children:g})]})})]})]})}function bC(){const[e,t]=y(""),{sortInstance:n,setSortInstance:r,apiSort:a}=Af(),o=m(()=>({...$o,search:e.length>0?e:void 0}),[e]),{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=vl({filter:o,sort:a,limit:10}),d=i?.data??ti,{hasPlaidLinkedBankAccount:u,isFilling:h}=Kp();return I(vC,{sortInstance:n,setSortInstance:r,isFilling:s||h,isFetching:l,paginationControls:c,transactions:d,hasLinkedAccount:u??!1,searchTerm:e,onSearchChange:t})}const fC=nr(Zn["button-table-header"]),yC=qn({height:{xl:"auto",base:"44px"}});function xC(){const e=bu({select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:yC,children:D(Xl,{onClick:()=>{ol(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[fC],children:[I(pi,{Component:Rd}),I(bs,{children:"Banks & Integrations"})]})})}const TC=nr(null,qn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function CC({children:e}){return I("div",{...TC,children:e})}const wC=oi(e=>p.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M4.66504 7.91458H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M4.66504 10.6418H10.335",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M12.8125 3.95627V13.9937H2.1875V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10}),p.createElement("path",{d:"M12.8125 3.95627V4.54998H9.26877V1.00626H9.86248L12.8125 3.95627Z",strokeMiterlimit:10})),"Doc"),kC=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:kc,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:Ix,buttonText:"Review"};case"LINK_BANK":return{Icon:Bg,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:Bg,buttonText:"Fix"};case"RELINK":return{Icon:Bg,buttonText:"Relink"};case"CHAT":return{Icon:Qu,buttonText:"Learn more"};case"ONBOARDING_FORM":return{Icon:wC,buttonText:"Complete"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:Ym,buttonText:""};default:return{Icon:Qu,buttonText:""}}},EC=nr(Zn["banner-title"],qn({display:"flex",alignItems:"center",gap:"8px"})),AC=nr(Zn["banner-icon"],qn({width:"20px",height:"20px"}));function SC({title:e,type:t}){const{Icon:n}=kC(t);return D("div",{...EC,children:[I(Ac,{Component:n,stylists:[AC]}),I(ao,{wrap:"wrap",children:e})]})}const IC=nr(null,qn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:{base:"4px",xl:"5px"},flex:{xl:"1 1 0"},minWidth:{xl:"200px"},width:"100%"}));function NC({title:e,description:t,type:n}){return D("div",{...IC,children:[I(SC,{title:e,type:n}),I(io,{wrap:"wrap",children:t})]})}const DC=Zn["banner-button"],RC=qn.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),PC=nr(Zn["banner-button-text"]),LC=nr(Zn["banner-button-icon"]);function MC({priority:e,type:t,handleClick:n}){const{buttonText:r}=kC(t),a=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return D(Ql,{onClick:n,intent:a,styles:RC,className:DC,children:[I(ao,{stylists:[PC],children:r}),I(pi,{stylists:[LC],Component:li})]})}const FC=_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"}}}}),OC={HIGH:Zn["banner-high"],MEDIUM:Zn["banner-medium"],LOW:Zn["banner-low"],URGENT:Zn["banner-urgent"]};function BC({task:e,handleClick:t}){const{name:n,description:r,shortDescription:a,type:o,priority:i}=e,l=MT()?a:r,s=nr(Zn.banner,OC[i],FC({priority:i}));return D("div",{...s,children:[I(NC,{title:n,description:l,type:o}),I(MC,{priority:i,type:o,handleClick:t})]})}function UC(e,t){uu({message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}})}function VC(e,t,n,r,a){return()=>ou({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function WC(e){const{mutateAsync:t}=Ab(),n=br(),r=Cr(),{apiPartnerName:a}=b(Qs),o=MT(),{linkPlaid:i,loading:l,hasOnPlaidLinkOverride:s}=Nb(),{linkPlaid:c,loading:d}=Nb(),u=Cu({apiErrorType:e?.apiErrorType,apiErrorCode:e?.apiErrorCode});if(Gn(u)||Gn(e))return null;const h="ITEM_LOCKED"===e.apiErrorCode;switch(u.buttonType){case yu.DELETE_OR_RELINK:case yu.RELINK:return l?null:(g=i,m=a,v=o,{alert:VC(u,(p=e).apiInstitutionName,m,v,[{key:qd,label:"Cancel"},{key:jd,label:"Relink",type:au.SUCCESS}]),actions:{success:()=>{g({plaidEvent:gb,plaidItemId:p.id,apiAccessToken:p.apiAccessToken,apiErrorCode:p.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case yu.UNLINK_RELINK:return d?null:function(e,t,n,r,a,o,i){return{alert:VC(e,t.apiInstitutionName,a,o,[{key:qd,label:"Cancel"},{key:yu.CHAT,label:"Chat"},{key:jd,label:"Unlink and Relink",type:au.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"})},[yu.CHAT]:()=>UC(t.apiInstitutionName,t.apiErrorCode)}}}(u,e,t,c,a,o,s);case yu.OPEN_BANK:return l?null:function(e,t,n,r,a,o,i,l){return{alert:VC(e,t.apiInstitutionName,i,l,[{key:qd,label:"Cancel"},{key:yu.CHAT,label:"Chat"},{key:yu.RELINK,label:"Relink"},{key:jd,label:"Go To Bank",type:au.SUCCESS}]),actions:{success:async()=>{const e=await Hd({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;window.open(o,"_blank")},[yu.RELINK]:()=>{o({plaidEvent:gb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[yu.CHAT]:()=>UC(t.apiInstitutionName,t.apiErrorCode)}}}(u,e,h,n,r,i,a,o);case yu.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:VC(e,t.apiInstitutionName,a,o,[{key:qd,label:"Cancel"},{key:jd,label:"Unlink",type:au.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:mb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(u,e,t,c,a,o,s);default:return function(e,t,n,r,a,o){return{alert:VC(e,t,a,o,[{key:qd,label:"Cancel"},{key:yu.CHAT,label:"Chat",type:au.SUCCESS}]),actions:{[yu.CHAT]:()=>UC(t,r)}}}(u,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var p,g,m,v}const HC=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){ia({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function qC({task:e}){const{linkPlaid:t,loading:n}=Nb(),{linkPlaid:r,loading:a}=Db(),o=WC(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type&&!1,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&Gn(o);return i||l||s?null:I(BC,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:gb,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?(oa("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:pb,message:"Plaid Banner Link Bank pressed"})):Qn(o)&&(oa("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),HC(o))}})}const zC=nr(Zn.banner,Zn["banner-default"],FC({priority:"DEFAULT"}));function jC(){const e=MT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...zC,children:I(NC,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const KC=nr(Zn.banner,Zn["banner-default"],FC({priority:"DEFAULT"}));function _C(){const e=MT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...KC,children:I(NC,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const YC=qn({width:"100%",height:72,minWidth:"300px"});function ZC(){return D(N,{children:[I(Lo,{styles:YC}),I(Lo,{styles:YC}),I(Lo,{styles:YC})]})}function GC({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(ZC,{}):a?e.map(e=>{if(void 0===nx[e.type]||"ONBOARDING_FORM"===e.type&&Gn(e.actionLink))return null;if("LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(yu).includes(e.type))return I(qC,{task:e},e.id);const n=e.actionLink,r=Qn(n)?()=>window.open(n,"_blank"):()=>t(e.type);return I(BC,{task:e,handleClick:r},e.id)}):I(n?_C:jC,{})}function QC({shouldFilterTasks:e=!1}){const{taskBanners:t,isFilling:n}=lx(e),r=xl(),{query:{data:a}}=_p();return D(N,{children:[D(ar,{children:[I(dr,{children:"Action Items"}),I(xC,{})]}),I(CC,{children:I(GC,{taskBanners:t,handleScrollAction:sx,isWaitingForPlaidItemAccountsSync:!r&&!0===a?.plaidItemAccountsReadyToSync,isFilling:n})})]})}const XC=nr(Zn["business-owner-dashboard"],qn({gap:10,display:"flex",flexDirection:"column",width:"100%",maxWidth:1440})),JC=qn({display:"flex",width:"100%",justifyContent:"center"}),$C={status:{in:["ACTIVE","INACTIVE"]}};function ew({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=y(void 0);return{sortInstance:e,setSortInstance:x(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Oi)??!1,n=(e.direction&&e.direction in Bi)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:i,paginationControls:l}=Hi({limit:10,sort:a,filter:ei}),s=o?.data??ni,c=MT(),{query:{data:d}}=_p(),u=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=vl({filter:$C,limit:1});return(e?.data?.length??0)>0}(),d),h=/* @__PURE__ */new Date,p={month:h.getMonth(),year:h.getFullYear()};const[g,m]=Cs(p,e,t),v=(b=g.month,{beginDate:et((f=g.year)-1,b+1,1),endDate:et(f,b+1,0)});var b,f;return I("div",{className:JC,children:D("div",{...XC,children:[I(QC,{shouldFilterTasks:c}),!c&&D(N,{children:[I(bf,{period:g,handleDateChange:e=>{var t,n;(t=p).year===(n=e).year&&n.month>t.month||n.year>t.year||m(e)},todayPeriod:p,showSamples:u,showLinkAccountButton:u&&!d?.plaidItemAccountsReadyToSync}),I(ar,{children:I(dr,{children:"Financial Summary"})}),I(hd,{isSample:u,period:g})]}),!c&&I(N,{children:I(Zo,{filter:v,isSample:u})}),I(Bc,{sortInstance:n,setSortInstance:r,conversations:s,paginationControls:l,isFilling:i,isMobile:c}),!c&&I(bC,{})]})})}function tw(e){return I(sa||N,{children:e.children})}function nw({children:e}){return I(tw,{children:I("div",{className:Jn(Zn.component),children:e})})}function rw(e){return I(nw,{children:I(ew,{...e})})}const aw=qn({display:"flex",flexDirection:"column"});function ow({task:e}){return I("div",{className:aw,children:I(qC,{task:e})})}const iw=qn({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),lw=qn({width:"80px",height:"12px"}),sw=qn({width:"150px",height:"16px"}),cw=qn({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),dw=qn({userSelect:"none",cursor:"pointer"});function uw(){return D("div",{className:cw,children:[D("div",{className:dw,children:[D("div",{className:iw,children:[I(Lo,{styles:sw}),I(Lo,{styles:lw})]}),D("div",{className:iw,children:[I(Lo,{styles:sw}),I(Lo,{styles:lw})]})]}),I("div",{className:dw,children:D("div",{className:iw,children:[I(Lo,{styles:sw}),I(Lo,{styles:lw})]})})]})}const hw=qn.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function pw({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=MT(),a=n||r?zs:Xl;return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(a,{extraClassNames:[hw],popupTriggerProps:e,children:I(pi,{Component:qm,stylists:t})})}),I(Os,{children:e})]})}const gw=oi(e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},p.createElement("path",{d:"M14.075 2.10645H0.924988V5.09395H14.075V2.10645Z",strokeMiterlimit:10}),p.createElement("path",{d:"M14.075 5.09375H0.924988V14.0625H14.075V5.09375Z",strokeMiterlimit:10}),p.createElement("path",{d:"M3.3125 8.08105H4.5125",strokeMiterlimit:10}),p.createElement("path",{d:"M5.70624 8.08105H6.89999",strokeMiterlimit:10}),p.createElement("path",{d:"M8.10004 8.08105H9.29379",strokeMiterlimit:10}),p.createElement("path",{d:"M10.4875 8.08105H11.6875",strokeMiterlimit:10}),p.createElement("path",{d:"M10.4875 11.0752H11.6875",strokeMiterlimit:10}),p.createElement("path",{d:"M3.3125 11.0752H4.5125",strokeMiterlimit:10}),p.createElement("path",{d:"M5.70624 11.0752H6.89999",strokeMiterlimit:10}),p.createElement("path",{d:"M8.10004 11.0752H9.29379",strokeMiterlimit:10}),p.createElement("path",{d:"M3.91254 0.3125V3.3",strokeMiterlimit:10}),p.createElement("path",{d:"M7.5 0.3125V3.3",strokeMiterlimit:10}),p.createElement("path",{d:"M11.0875 0.3125V3.3",strokeMiterlimit:10})),"Date"),mw=qn({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),vw=nr(null,mw);function bw({children:e,clickHandler:t}){const n=Es();return t||(t=()=>{n.close()}),I(be,{lockScroll:!0,...vw,onClick:t,children:e})}const fw=_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 yw({width:e="lg",children:t}){const n=nr(Zn["modal-popup"],fw({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const xw=qn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),Tw=qn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),Cw=qn({display:"flex",flexDirection:"column",gap:"12px"}),ww=qn({display:"flex",flexDirection:"row",gap:"10px"}),kw=qn({display:"flex",flexDirection:"column",gap:"10px"}),Ew=({acknowledged:e,setAcknowledged:t})=>D("div",{className:Cw,children:[I(cs,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),D("div",{className:ww,children:[I(Df,{checked:e,onClick:()=>t(!e)}),I(cs,{wrap:"wrap",children:"I understand."})]})]});function Aw({bankAccounts:e}){const{apiPartnerName:t}=b(Qs),n=e.reduce((e,t)=>{const n=At(t.tranStartDate||""),r=At(e.tranStartDate||"");return n&&r&&Ct(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutate:n}=Pu();return qv({defaultValues:{tranStartDate:t},onSubmit:t=>{var r,a;ou({title:"Start Date Updated",body:D("div",{className:kw,children:[I(cs,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(cs,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:jd,type:au.SUCCESS}]}),n((r=e,a=t.value.tranStartDate,r.map(e=>({id:kl(e.id),tranStartDate:a,duplicateBankAccountIds:[]}))))}})})(e,n),a=Es(),o=()=>{a.close()},[i,l]=y(!1),{query:{data:s}}=Vd(),c=s?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",d=At(e.reduce((e,t)=>{const n=At(t.tranMinStartDate||""),r=At(e.tranMinStartDate||"");return n&&r&&Ct(n,r)?t:e}).tranMinStartDate||""),u=1===e.length?`${t} can pull your transactions for your ${du(e[0]?.name,e[0]?.mask)} account dating back to ${Pt(d)}.`:`${t} can pull your transactions for your ${c} account(s) dating back to ${Pt(d)}.`;return D("form",{className:xw,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit(),a.close()},children:[I(ao,{children:"Set Bank Transaction Start Date"}),I(cs,{wrap:"wrap",children:u}),I(cs,{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:d,editable:!0})}),I(r.Subscribe,{selector:e=>e,children:e=>{const t=At(e.values.tranStartDate||""),r=At(n),a=t&&r&&Ct(t,r);return D(N,{children:[e.isDirty&&a&&I(Ew,{acknowledged:i,setAcknowledged:l}),D("div",{className:Tw,children:[I(Kv,{showIcon:!1,onClick:o}),I(Ku,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!i})]})]})}})]})}function Sw({bankAccounts:e}){return D(ks,{placement:"right-start",children:[I(As,{children:e=>D(Rp,{...e,children:[I(Ac,{Component:gw}),I(ao,{children:"Edit Start Date"})]})}),I(Tm,{children:I(bw,{children:I(yw,{width:"sm",children:I(Aw,{bankAccounts:e})})})})]})}const Iw=oi(e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},p.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}),p.createElement("path",{d:"M2.88599 12.625L12.6672 2.84375"})),"Stop"),Nw=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M5.68701 1.1875L5.68701 14.5",strokeMiterlimit:10}),p.createElement("path",{d:"M3.26538 3.60911L5.68699 1.1875L8.10859 3.60911",strokeMiterlimit:10}),p.createElement("path",{d:"M5.68701 7.24146L5.68701 2.39825",strokeMiterlimit:10})),"Combine"),Dw={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 Rw(e){const{apiPartnerName:t,unitIntegrationBankName:n}=b(Qs);return"UNIT"===e?n??t??"Unit":Dw[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Pw=qn({display:"flex",flexDirection:"column",gap:"16px"}),Lw=nr(null,qn({color:"brand.danger"}));function Mw({integration:e,accounts:t}){const{mutate:n}=Ab(),r=Es(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=Nb(),{query:{data:l}}=(s=e.id,Ud({},{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}}=Gp(e.id),u=d?.data,h=Rw(e.apiName),p="PLAID"===e.apiName;return D(kp,{children:[p&&!o&&D(Rp,{onClick:()=>(a({plaidEvent:gb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(Ac,{Component:Fl}),I(ao,{children:"Add Account"})]}),p&&u&&I(Sw,{bankAccounts:u}),Ge(t)&&D(Rp,{onClick:()=>ob({plaidItemAccounts:t}),children:[I(Ac,{Component:Nw}),I(ao,{children:"Merge Accounts"})]}),p&&D(Rp,{onClick:()=>(async()=>{let o;var l;o=Ge(t)?await(async e=>ou({title:"Remove Institution",body:I("div",{className:Pw,children:I(cs,{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:qd,label:"Cancel"},{key:zd,label:"Remove",type:au.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ou({title:"Remove Institution",body:I("div",{className:Pw,children:I(cs,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:qd,label:"Cancel"},{key:zd,label:"Remove",type:au.DANGER}]}))(h),r.close(),o===zd&&(p&&i?a({plaidEvent:mb,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(Ac,{stylists:[Lw],Component:Iw}),I(ao,{stylists:[Lw],children:"Delete Connection"})]})]})}const Fw=qn({userSelect:"none"});function Ow({children:e}){return I("div",{className:Fw,children:e})}const Bw=qn({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 Uw({children:e}){return I("div",{className:Bw,children:e})}const Vw=nr(Zn.badge,gy),Ww=nr(null,Wa),Hw=nr(null,di),qw=nr(Zn["neutral-badge"],vy),zw=nr(Zn["highlight-badge"],fy),jw=nr(Zn["success-badge"],xy),Kw=nr(Zn["warning-badge"],Cy),_w=nr(Zn["danger-badge"],Zn["critical-badge"],ky);function Yw({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=_w;break;case"warning":o=Kw;break;case"neutral":o=qw;break;case"success":o=jw;break;case"highlight":o=zw}const i=lr([Vw,Ww,o,Hw]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function Zw({plaidItem:e}){const t=WC(e);return D(Yw,{type:"danger",onClick:n=>{n.stopPropagation(),t&&(oa(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),HC(t))},disabled:Gn(t),children:[I(Ac,{Component:Qu}),I(io,{children:"Fix Bank Error"}),I(pi,{Component:li})]})}const Gw=_n({base:{padding:"16px 16px 16px 24px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",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"}}}}}),Qw=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function Xw({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=jn(Gw({active:a}),di);return D("button",{className:l,onClick:t=>{t.stopPropagation(),ol("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[D("div",{className:Qw,children:[I(Ac,{Component:i?Yf:Bg}),I(Vg,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(Ac,{Component:li})]})}const Jw=qn({display:"flex",flexDirection:"column",gap:"4px"}),$w=qn({display:"flex",alignItems:"center",gap:"8px"}),ek=nr(null,qn({color:"brand.primary.weak"})),tk=qn({overflow:"hidden"});function nk({integration:e,isCompact:t=!1}){const{query:{data:n}}=Gp(e.id),r=n?.data,a="PLAID"===e.apiName,o=Rw(e.apiName);if(!Ge(r))return null;const i=e.iconUrl?vg(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return D(Ow,{children:[D(Uw,{children:[D(Nm,{children:[I(wc,{Component:i??Bg}),D("div",{className:Jw,children:[I(cs,{children:e.apiInstitutionName??o}),I(io,{children:ub(r)})]})]}),D("div",{className:$w,children:[a&&Qn(e.apiErrorCode)&&I(Zw,{plaidItem:e}),I(pw,{stylists:[ek],shouldUseButtonDiscreteStyles:t,children:I(Mw,{integration:e,accounts:r})})]})]}),I("div",{className:tk,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(Xw,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:hb(t),active:n,integration:e},t.id)})})]})}const rk=vg("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAGttJREFUeAHFnFuMXVd5x9c5c/GMZxxf4sTxNfcmJDSQFGhSkGhRCFChSqWIoqqtkJoXitQHXoqqVkKVWlFVQuIBIdo8oD4g1BYqFVTahLqg0JYSriExARInsXGwncSJPb7N7Uz/v/+3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W6hsy+FESkEqCnVjllhsH+RSCtJOFCAVjrQBTprI4SYnQiiTGibxO8VSFsEHQuOUvE8IhYXa2tpDpMYXbJDjLXKhYH55+YDDnChC1NQcLRW+zu0kSyzMBwr/5bruV50og44v2eWL+IlcaFhNuzROHNDVrT5RaFjD7TRLzDNzwVsppb7pxAmuW3MCLdLZIGOkhU7XRFBCcOII13WPEQpf5XaiJbYjLlwU2gZ2oBN/jfNskDFSQhcaXoz8hD5fuK57qF0nwyhlrocoJk7CUEa13HZbCTnFlWteoY/WImoxQSW3UkEj96e45Khws/SyVU4pgKowpIZ6dqeXChUuq9L6+04pgWqMhIbRdsjEgAUGk6h2zylVCJ39lVD4PvunPGEUGjaEXuYc5fUyW4KNxROXgsfolkruuEYOMuNdJhT+h/vTH1/COqFRcscx0qBTw7ScQfcf8AcsHhTkKwWj6PQ9d/xiA5GpOYlSvf0SgB2Ji0rVp1W42W9zxyu2EJ53phUaflFcCp6nu9u445MYSJ09lzqplnJGEwp20Z2oKYXncMcjsahE/B6tn5XSHE1o3EHrWe01+rQIqkrDw1qpYSm3AAKjwlXCw6F2yYEZUmfPFxrujUsrQtlRtlLwoVAwNu/GUhbhgXoVphV2aV60fZdbLDJvwjvUKTblZS91Xfdgq5mYIN0Nz6DGXtRQIlJXHCholApmC+VdV6mqT+f2k0URUFdXd5C/5KGhD2ULoeBlunsheDHhZqnhH/57auhDoidbbFBLA2W0oJvyvItTGnv4VyAomEgNBppFsYrmRFJhwz5ipJ8VNjT/btXuv4Wn6X+FwhH0WiIDFzXfxJzc4r488H9C0rMPxyn4LQAAAABJRU5ErkJggg==","Bank"),dk={GUSTO:ik,FRESHBOOKS:lk,FRESHBOOKS2:lk,SHOPIFY:ok,STRIPE:rk,SQUARE:ak,UBER:sk};function uk(e){return dk[e]??ck}const hk=qn({display:"flex",flexDirection:"column",gap:"4px"});function pk({integration:e,isCompact:t}){const n=Rw(e.apiName),r=function(e){if(e)return`Last synced ${Rt(e)}`}(e.lastSyncedDate),a=uk(e.apiName);return I(Ow,{children:D(Uw,{children:[D(Nm,{children:[I(wc,{Component:a}),D("div",{className:hk,children:[I(cs,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(io,{intent:"normal",children:r})]})]}),I(pw,{shouldUseButtonDiscreteStyles:t,children:I(Mw,{integration:e})})]})})}const gk=qn({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),mk=qn.raw({color:"typography.base.weak"}),vk=qn({overflow:"hidden"});function bk({manualBankAccounts:e,isCompact:t=!1}){const n=MT(),r=t||n?zs:Xl;return D(Ow,{children:[D("div",{className:gk,children:[I(cs,{extraClassNames:[mk],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>ol("BankAccountForm"),active:!1,children:I(pi,{Component:Fl})})]}),I("div",{className:vk,children:e.map(e=>I(Xw,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const fk=nr(Zn["selector-row"],jn(qn(zl,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),ci)),yk=qn({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),xk=qn({display:"flex",alignItems:"center",gap:"8px"}),Tk=qn({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),Ck=nr(null,qn({width:"20px",height:"20px"}));function wk(){const{linkPlaid:e,loading:t}=Db();return I("button",{...fk,disabled:t,onClick:()=>{oa("Add New Connection button pressed"),e({plaidEvent:pb,message:"Add New Connection button pressed"})},children:D("div",{className:yk,children:[D("div",{className:xk,children:[I(wc,{stylists:[Ck],Component:Bg}),D("div",{className:Tk,children:[I(cs,{children:"Connect your bank"}),I(io,{children:"Find your banking institution with Plaid"})]})]}),I(Ac,{Component:li})]})})}const kk=qn({paddingInline:"16px",paddingBottom:"8px"}),Ek=qn.raw({color:"typography.base.weak",fontWeight:"label"});function Ak({title:e,children:t}){return D("div",{children:[I("div",{className:kk,children:I(cs,{extraClassNames:[Ek],children:e})}),t]})}const Sk=qn({minWidth:"100%",height:"45px"});function Ik(){return D(N,{children:[I(Lo,{styles:Sk}),I(Lo,{styles:Sk}),I(Lo,{styles:Sk})]})}const Nk=nr(Zn["selector-row"],jn(qn(zl,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ci)),Dk=qn({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),Rk=qn({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),Pk=qn({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function Lk({integration:e}){const{linkPlaid:t,loading:n}=Nb(),r="PLAID"===e.apiName,a=Rw(e.apiName),o=e.iconUrl?vg(e.iconUrl,"Institution Icon"):Bg;return I("button",{...Nk,disabled:n||!r,onClick:()=>{oa(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:gb,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:D("span",{className:Dk,children:[D("div",{className:Rk,children:[I(wc,{Component:o}),I(cs,{children:e.apiInstitutionName??a??void 0})]}),r&&D("div",{className:Pk,children:[I(pi,{Component:Rd}),I(cs,{children:"Relink"})]})]})})}const Mk=e=>p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:224,height:64,viewBox:"0 0 224 64",...e},p.createElement("g",{fill:"none",fillRule:"nonzero"},p.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"}),p.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"}),p.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"}),p.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"}),p.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"}))),Fk=nr(Zn["selector-row"],jn(qn(zl,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ci)),Ok=qn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),Bk=qn({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),Uk=qn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),Vk=qn({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"},letterSpacing:"0.84px",padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),Wk=qn({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function Hk(){const e=Es(),{mutateAsync:t}=Cb(),[n,r]=y("");return D("div",{className:Bk,children:[I(ao,{children:"Enter your shop name"}),I("div",{className:Wk,children:I(Mk,{})}),I(cs,{children:"Please enter the name of your shop below."}),I("input",{className:Vk,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),D("div",{className:Uk,children:[I(Kv,{showIcon:!1,onClick:()=>{e.close()}}),I(ju,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(ao,{children:"Connect"})})]})]})}function qk(){const e=uk("SHOPIFY")??Rd;return D(ks,{placement:"bottom",children:[I(As,{children:t=>D("button",{...Fk,...t,children:[D("div",{className:Ok,children:[I(wc,{Component:e}),I(cs,{children:"Shopify"})]}),I(Ac,{Component:li})]})}),I(Tm,{children:I(bw,{children:I(yw,{width:"sm",children:I(Hk,{})})})})]})}const zk=nr(Zn["selector-row"],jn(qn(zl,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ci)),jk=qn({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function Kk({apiName:e}){const{mutateAsync:t}=Cb(),n=Rw(e);if("SHOPIFY"===e)return I(qk,{});const r=uk(e)??Rd;return D("button",{...zk,onClick:async()=>{const n=await t({apiName:e});window.open(n.url)},children:[D("div",{className:jk,children:[I(wc,{Component:r}),I(cs,{children:n})]}),I(Ac,{Component:li})]})}const _k=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function Yk(e){return _k.includes(e)}const Zk=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],Gk=qn({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),Qk=qn({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function Xk(){const{query:{data:e},isFilling:t}=tx(),n=e?.multiAccountIntegrations,r=e?.integrations,a=Qn(n)&&n.length>0||Qn(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=b(Qs),n=$t(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(Yk),a=e?.map(e=>e.apiName)||[];let o=r??Zk;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return D("div",{className:Gk,children:[(t||a)&&I(Ak,{title:"Already Connected",children:t?I(Ik,{}):D(N,{children:[n?.map(e=>I(Lk,{integration:e},e.id)),r?.map(e=>I(Lk,{integration:e},e.id))]})}),I(Ak,{title:"Available Banks",children:I(wk,{})}),o&&o.length>0&&I(Ak,{title:"Integrations",children:I("div",{className:Qk,children:o.map(e=>I(Kk,{apiName:e},e))})})]})}const Jk=qn({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),$k=qn({marginTop:"16px"}),eE=qn.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function tE({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(Xk,{}):t?D(N,{children:[D("div",{className:$k,children:[I(cs,{extraClassNames:[eE],children:"Connected Accounts"}),r?.map(t=>I(nk,{integration:t,isCompact:e},t.id)),a?.map(t=>I(pk,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(bk,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(bk,{manualBankAccounts:o}):D("div",{className:Jk,children:[I(wc,{Component:Bg}),I(ao,{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 nE=nr(null,qn({color:"typography.base.weak"})),rE=nr(Zn["drawer-header"],qn({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},km)),aE=qn({display:"flex",gap:"8px"}),oE=qn({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),iE=_n({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),lE=qn({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),sE=qn({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),cE=nr(null,qn({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),dE=_n({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function uE({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=MT()||e;Nb();const{query:{data:a},isFilling:o}=tx(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=bu({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>Mu(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:Yp(e?.data)};var t}}),{mutate:c,isPending:d}=kb(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&ex(p,!1),m="connected"===$t(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,b=m?"Add New Connection":"Add New Account",f=()=>{ol(m?"NewConnection":"BankAccountForm")},y=r?zs:Xl;return D(fb,{onPlaidLink:n,children:[D("div",{...rE,children:[D(Nm,{children:[t&&I(Jd,{}),r?I(ao,{children:"Banks & Integrations"}):I(dr,{stylists:[nE],children:"Banks & Integrations"})]}),D("div",{className:aE,children:[0!==h&&D(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(Ac,{Component:Rd,stylists:[nr(null,dE({refreshLoading:d}))]}),!r&&I(cs,{children:"Sync Accounts"})]}),D(y,{onClick:()=>f(),active:!1,children:[I(Ac,{Component:Fl}),!r&&I(cs,{children:"Add New Connection"})]})]})]}),g&&I("div",{className:sE,children:I(ow,{task:g})}),o?I(uw,{}):D(N,{children:[I("div",{className:iE({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:oE,children:I(tE,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&I("div",{className:lE,children:D(Xl,{stylists:[cE],onClick:()=>f(),disabled:m&&!1,children:[I(Ac,{Component:Fl}),I(ao,{children:b})]})})]})]})}const hE=qn({display:"flex",justifyContent:"center"}),pE=qn({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"});function gE({onPlaidLink:e}){return I(nw,{children:I("div",{className:hE,children:I("div",{className:pE,children:I(uE,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})}function mE(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 vE=qn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0"});function bE({children:e}){return I("div",{className:vE,children:e})}const fE=oi(e=>p.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_24404_41655)"},p.createElement("path",{d:"M1 1V3.366L6.317 9.866V14L8.683 12.817V9.866L14 3.366V1H1Z",strokeWidth:1,strokeMiterlimit:10}))),"Filter");function yE({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return D(ks,{children:[I(As,{children:e=>D(Jm,{popupTriggerChildrenProps:e,children:[D(bE,{children:[t&&I(Ac,{imageUrl:t,Component:fE}),I(cs,{wrap:"wrap",children:i})]}),I(Ac,{Component:li})]})}),I(Lm,{title:r,Footer:o??null,children:a})]})}function xE(e,t){const{items:n,fuseOptions:r,processResults:a}=t,o=m(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),i=m(()=>new Ee(o??[],r),[o,r]);return m(()=>{if(!o)return{};const t=i.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,o))},[o,i,e,a])}function TE({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 CE=qn({display:"flex",flexDirection:"column",gap:"8px"});function wE({groupLabel:e,children:t}){return D("div",{className:CE,children:[e&&I(ao,{children:e}),I("div",{children:t})]})}const kE=qn({display:"flex",flexDirection:"column",gap:"16px"});function EE({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I($m,{handleClick:t,selected:n,isMultiSelect:r,children:D(bE,{children:[e.iconUrl&&I(Ac,{Component:vg(e.iconUrl,"")}),I(cs,{wrap:"wrap",children:e.name??""})]})},e.id)}function AE({groupedResults:e,onItemClick:t,selectedIds:n,isMultiSelect:r}){const a=m(()=>Object.entries(e),[e]),o=m(()=>a.map(([,e])=>{const t=e.children;return t.length>0?t:[e.parent]}),[a]);return I(_m,{children:I("div",{className:kE,children:I(TE,{groupedList:o,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>I(EE,{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(wE,{groupLabel:r,children:e})}})})})}function SE({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=xE(e,{items:n,fuseOptions:hg,processResults:gg});return r?I(av,{}):0===Object.keys(i).length?I(jm,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(AE,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function IE(e,t){return Ky(e,t).map(e=>({parent:e.parent,child:e.child}))}function NE({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=xE(e,{items:n,fuseOptions:zy,processResults:IE});return r?I(av,{}):0===Object.keys(i).length?I(jm,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(AE,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function DE(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...DE(n));return t}function RE(e,t){return e.value?.[t]?.value?.id?.in??[]}function PE(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&RE(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{RE(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function LE(e,t){const n=[];return e.forEach(e=>RE(e,t).forEach(e=>n.push(e))),new Set(n)}function ME(e,t,n,r){return x(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!RE(t,e).some(e=>n.includes(e)));return uC(t,e,r)})},[t,r,e])}const FE=qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout}",marginTop:"auto",width:"100%"});function OE({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return D("div",{className:FE,children:[I(zs,{onClick:e,children:I(cs,{children:"Clear All"})}),D(Xl,{type:"button",onClick:t,disabled:n,children:[I(cs,{children:"Apply"}),I(pi,{Component:zu})]})]})}function BE({onApply:e,onClearAll:t}){const n=Es();return I(OE,{onApply:()=>{e(),n.close()},onClearAll:t})}function UE({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){const u=m(()=>DE(e),[e]),h=x(()=>{o(u)},[u,o]),p=x(()=>{if(u&&i&&l){const e=dC(l,"category"),t=PE(i,e,u,"category");c(t)}},[u,i,l,c]),g=I(BE,{onApply:p,onClearAll:h});return I(yE,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:g,children:I(Wm,{placeholder:"Search expense categories...",onClick:a,SearchList:SE,DefaultList:VE,listLength:e.children?.length??0,extraProps:{categories:e.children??[],label:e.name??"",isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}})})}function VE({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(av,{}):D(_m,{children:[I(ao,{children:t}),I("div",{children:e.map(e=>{if(e.hasChilds){const t=DE(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(UE,{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($m,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:D(bE,{children:[e.iconUrl&&I(Ac,{Component:vg(e.iconUrl,e.name??"")}),I(cs,{wrap:"wrap",children:e.name??""})]})},e.id)})})]})}const WE=[];function HE({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=rg(),s=i?.data??WE,c=LE(dC(t,"category"),"category"),d=x(e=>{const t=qE(e);n(t)},[n]),u=ME("category",r,0,a);return a&&o?I(Wm,{placeholder:"Search expense categories...",onClick:d,SearchList:SE,DefaultList:VE,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:u,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function qE(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 zE(){const{query:{data:e},isFilling:t}=$p(),n=e?.data,r=m(()=>n?.map(qE),[n]);return x(()=>({values:r??[],isFilling:t}),[r,t])}function jE(e){return Qe({key:"category",name:"Category",NestedListComponent:HE,possibleValues:e})}const KE=[{value:"in",label:"In"}];function _E(e){return Qe({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:KE})}function YE(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const ZE=h.object({minAmount:h.number().nullable(),maxAmount:h.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 GE(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:Qn((a=t).greaterThanEqual)?lu(a.greaterThanEqual):null,maxAmount:Qn(a.lessThanEqual)?lu(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const QE=qn({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function XE({children:e,title:t}){return I(Lm,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:QE,children:e})})}const JE=qn({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),$E=qn({display:"flex",flexDirection:"column",flex:1}),eA=qn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function tA({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(XE,{title:"Amount",children:I(nA,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function nA({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Es();return qv({defaultValues:GE(0,r),validators:{onChange:ZE},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=Ce(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=Ja(e,{dollarSign:!0,signage:"default"}),a=su(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=Ja(t,{dollarSign:!0,signage:"default"}),r=su(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 D(N,{children:[I("div",{className:eA,children:D(_m,{children:[D("div",{className:JE,children:[I("div",{className:$E,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(ao,{children:"To"}),I("div",{className:$E,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I($u,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(OE,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const rA=[{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 aA(){return Qe({key:"amount",name:"Amount",operators:rA,ModalComponent:tA})}function oA(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 iA=qn({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function lA({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(XE,{title:"Back",children:I(sA,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function sA({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Es();return qv({defaultValues:{[e.key]:oA(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 D(N,{children:[I("div",{className:iA,children:I(_m,{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(OE,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const cA=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function dA(){return Qe({key:"description",name:"Description",operators:cA,ModalComponent:lA})}function uA(){const{query:{data:e},isFilling:t}=bu(),n=e?.data,r=function({institutionIds:e}){const t=br(),n=Cr(),r=[...new Set(e)],a=O({queries:r.map(e=>({queryKey:Wg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await Hd({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:m(()=>n?.map(e=>e.integration?.apiInstitutionId).filter(e=>Qn(e))??[],[n])}),a=m(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=du(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return x(()=>({values:a??[],isFilling:t}),[a,t])}function hA(e){return Qe({key:"bankAccount",name:"Bank Account",possibleValues:e})}const pA=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:[];function gA(e){return Qe({key:"customer",name:"Customer",possibleValues:e})}function mA(e){return Qe({key:"vendor",name:"Vendor",possibleValues:e})}function vA(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 Qe({key:"type",name:"Type",possibleValues:()=>({values:t})})}const bA=oi(e=>p.createElement("svg",{stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",...e},p.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}),p.createElement("circle",{fill:"currentColor",cx:8,cy:8,r:3.2})),"CircleFilled"),fA=nr(null,qn({fill:"surface.intent.action.active"}));function yA({isSelected:e}){return I(Ac,e?{Component:bA,stylists:[fA]}:{Component:Zm})}function xA({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 D(_m,{children:[I(io,{children:"Filter by"}),I("div",{children:r.values.map((r,o)=>{const l=(s=r,0===a.length?kA(s.value.status?.value):a.some(e=>i(e.value,s.value)));var s;return D(Jm,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:l,children:[I(bE,{children:I(cs,{wrap:"wrap",children:r.name})}),I(yA,{isSelected:l})]},`${r.name}_${o}`)})})]})}const TA="status",CA=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function wA(){const e="in";return{values:CA.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function kA(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function EA(e){return kA(e.value.status?.value)}function AA(){return Qe({key:TA,name:"Status",possibleValues:wA,singleSelect:!0,SimpleListComponent:xA})}const SA=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function IA(){return Qe({key:"notes",name:"Notes",operators:SA,ModalComponent:lA})}function NA({onApply:e,onClearAll:t}){const n=Es();return I(OE,{onApply:()=>{e(),n.close()},onClearAll:t})}function DA({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){const u=m(()=>DE(e),[e]),h=x(()=>{o(u)},[u,o]),p=x(()=>{if(u&&i&&l){const e=dC(l,"glAccount"),t=PE(i,e,u,"glAccount");c(t)}},[u,i,l,c]),g=I(NA,{onApply:p,onClearAll:h});return I(yE,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:g,children:I(Wm,{placeholder:"Search GL accounts...",onClick:a,SearchList:NE,DefaultList:RA,listLength:e.children?.length??0,extraProps:{glAccounts:e.children??[],label:e.name,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}})})}function RA({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(av,{}):D(_m,{children:[I(ao,{children:t}),I("div",{children:e.map(e=>{if(e.hasChilds){const t=DE(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(DA,{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($m,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(bE,{children:I(cs,{wrap:"wrap",children:e.name})})},e.id)})})]})}const PA=[];function LA({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=Vy(),s=i??PA,c=LE(dC(t,"glAccount"),"glAccount"),d=x(e=>{const t=MA(e);n(t)},[n]),u=ME("glAccount",r,0,a);return a&&o?I(Wm,{placeholder:"Search GL accounts...",onClick:d,SearchList:NE,DefaultList:RA,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:u,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function MA(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function FA(e){return Qe({key:"glAccount",name:"GL Account",NestedListComponent:LA,possibleValues:e})}const OA=async e=>{const t=e.queryKey,n={path:"/v6/classes/segments/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:Ei(t[1].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function BA(){return wr({queryKey:["classSegments"],queryFn:OA})}const UA=(VA={bankAccount:!0,vendor:!0,classSegments:!0,customer:!0,category:!0,glAccount:!0,rule:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(VA));var VA;function WA(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(dt(e)){const t=vt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(ht(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,mE(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 mE(e,t)}(e.bankAccount,r.bankAccount.value)),r.classSegments&&(n.classSegments=function(e,t){return mE(e,t)}(e.classSegments,r.classSegments.value)),r.glAccount&&(n.glAccount=function(e,t){return mE(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 mE(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return mE(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function HA(e,t){const n=e.reduce(WA,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return UA.forEach(e=>{const n=t[e];t[e]=c(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const qA=e=>{const t=$t(e=>e.transactionsDashboardFilters),n=$t(e=>e.expenseDashboardFilters),r=$t(e=>e.incomeDashboardFilters),a=$t(e=>e.setTransactionsDashboardFilters),o=$t(e=>e.addTransactionsDashboardFilters),i=$t(e=>e.removeTransactionsDashboardFilter),l=$t(e=>e.hasInitializedTransactionsDashboardFilters),s=$t(e=>e.setExpenseDashboardFilters),c=$t(e=>e.addExpenseDashboardFilters),d=$t(e=>e.removeExpenseDashboardFilter),u=$t(e=>e.hasInitializedExpenseDashboardFilters),h=$t(e=>e.setIncomeDashboardFilters),p=$t(e=>e.addIncomeDashboardFilters),g=$t(e=>e.removeIncomeDashboardFilter),m=$t(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 zA(){return{getCategories:zE(),getBankAccounts:uA(),getCustomers:function(){const{query:{data:e},isFilling:t}=mm(),n=e?.data,r=m(()=>n?.map(e=>{const t=e.name??"Unknown Customer";return{name:t,value:{customer:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return x(()=>({values:r??[],isFilling:t}),[r,t])}(),getVendors:function(){const{query:{data:e},isFilling:t}=am(),n=e?.data,r=m(()=>n?.map(e=>{const t=e.name??"Unknown Vendor";return{name:t,value:{vendor:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return x(()=>({values:r??[],isFilling:t}),[t,r])}(),getClassSegments:function(){const{query:{data:e},isFilling:t}=BA(),n=e?.data,r=m(()=>n?.map(e=>{const t=e.name??"Unknown Class Segment";return{name:t,value:{classSegments:{name:t,value:{id:{in:[e.id]}}}}}}),[n]);return x(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=Ry(),n=m(()=>e?.map(e=>MA(e)),[e]);return x(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:function(){const e=_x(),t=m(()=>function(e){const t="in";return[...e].map(e=>({name:e.text,value:{reviewStatus:{name:e.text,value:{[t]:e.value}}}}))}(e),[e]);return x(()=>({values:t,isFilling:!1}),[t])}()}}const jA=[{name:"Expense",types:Bf.Expense},{name:"Income",types:Bf.Income},{name:"Transfer",types:Bf.Transfer}];function KA(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=qA("transactionsDashboard"),{getCategories:o,getBankAccounts:i,getVendors:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=zA(),u=m(()=>({reviewStatus:_E(d),amount:aA(),bankAccount:hA(i),category:jE(o),customer:gA(s),date:Bt,description:dA(),glAccount:FA(c),notes:IA(),status:AA(),vendor:mA(l),type:vA(jA),search:Je}),[i,o,l,s,c,d]),h=m(()=>[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor],[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor]),p=/* @__PURE__ */(new Date).getDate(),g=m(()=>HA(e,void 0),[e,p]),v=x(e=>u[e],[u]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:h,setFilters:t,addFilters:n,removeFilter:r,apiFilters:g,getModel:v,hasUserConfiguredFilters:a}}function _A(e,t,n,r,a){const o=$t(e=>e.initializeTransactionsDashboardFilters),i=$t(e=>e.initializeExpenseDashboardFilters),l=$t(e=>e.initializeIncomeDashboardFilters),s=$t(e=>e.hasInitializedTransactionsDashboardFilters),c=$t(e=>e.hasInitializedExpenseDashboardFilters),d=$t(e=>e.hasInitializedIncomeDashboardFilters),u=_x(),h="transactionsDashboard"===e?s:"expenseDashboard"===e?c:d;T(()=>{const s=u.find(e=>"Needs Review"===e.text)?.value??[];!h&&!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}))},[h,r,t,a,e,n,u,o,i,l])}const YA=v(void 0);function ZA(){const e=b(YA);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}const GA=qn({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),QA=nr(Zn["filter-pill"],qn({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"})),XA=nr(null,qn({border:"none",background:"none",padding:0,cursor:"pointer"})),JA=nr(null,qn({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"}));function $A({text:e,onClickRemove:t}){return D("div",{...QA,children:[I("div",{...JA,children:e}),I("button",{...XA,onClick:t,children:I(Is,{Component:Ss,stylists:[nr(null,GA)]})})]})}function eS({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!==Xe&&l.modelKey!==Ft&&(l.modelKey!==TA||!EA(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(Gn(n)&&Qn(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(Gn(r)&&Qn(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=Ja(lu(n),{dollarSign:!0,signage:"default"}),i=Ja(lu(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($A,{text:e.text,onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}function tS({Component:e,stylists:t}){return I(e,{stylists:[nr(Zn["medium-icon"],Zn.icon),...t??[]],size:17})}const nS=qn({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),rS={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function aS(){const e=MT(),{dashboardKey:t}=ZA();return I(Xl,{onClick:()=>{ol(rS[t],{routeProps:{}})},stylists:[nr(null,nS)],children:e?I(tS,{Component:fE}):D(N,{children:[I(pi,{Component:fE}),I(cs,{children:"Filters"})]})})}const oS=h.object({beginDate:h.string().nullable(),endDate:h.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=At(e.beginDate),n=At(e.endDate);if(t&&n)return!Ct(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),iS=qn({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),lS=qn({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),sS=nr(null,qn({marginTop:"22px"}));function cS({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,qv({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:oS},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=Ce(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return D("div",{className:iS,children:[D("div",{className:lS,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(wc,{Component:IT,stylists:[sS]}),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($u,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const dS={width:"fit-content"};function uS({onDateRangeChange:e}){const{filters:t}=ZA(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Ft);if(void 0!==t){const e=t.value.date?.value;if(ht(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(Tg,{triggerChildren:I(kg,{displayLabel:"Custom"}),popupChildren:I(Os,{style:dS,children:I(cS,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const hS=qn({width:200,minWidth:200});function pS({dateFilter:e,addFilter:t}){return I(Rp,{onClick:()=>t(e),children:I(ao,{children:ct[e]})})}function gS({getModel:e,addFilters:t}){const{setOpen:n}=Es(),r=r=>{const a=e(Ft);if(void 0===a)return;const o=a.createFilter({name:ct[r],value:{[a.key]:{name:ct[r],value:r}}});t([o]),n(!1)};return I(Os,{children:D(kp,{style:hS,children:[I(pS,{dateFilter:st.ALL_TIME,addFilter:r}),I(Gu,{alignment:"horizontal"}),I(pS,{dateFilter:st.THIS_MONTH,addFilter:r}),I(pS,{dateFilter:st.LAST_MONTH,addFilter:r}),I(pS,{dateFilter:st.LAST_3_MONTHS,addFilter:r}),I(pS,{dateFilter:st.LAST_12_MONTHS,addFilter:r}),I(Gu,{alignment:"horizontal"}),I(pS,{dateFilter:st.THIS_QUARTER,addFilter:r}),I(pS,{dateFilter:st.LAST_QUARTER,addFilter:r}),I(Gu,{alignment:"horizontal"}),I(pS,{dateFilter:st.THIS_YEAR,addFilter:r}),I(pS,{dateFilter:st.LAST_YEAR,addFilter:r}),I(Gu,{alignment:"horizontal"}),I(uS,{onDateRangeChange:n=>{const r=e(Ft);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const mS=[nr(null,nS)];function vS({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Ft);let n=ct[st.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=dt(e)?ct[e]:ht(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?At(e.beginDate):null,n=e.endDate?At(e.endDate):null;return t&&!n?`After ${Pt(t)}`:!t&&n?`Before ${Pt(n)}`:t&&n?`${wt(t)} - ${wt(n)}`:"Custom"}(e):t.name}return n})(e);return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(Xl,{stylists:mS,popupTriggerProps:e,children:I(cs,{children:r})})}),I(gS,{getModel:t,addFilters:n})]})}const bS=qn({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),fS=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function yS({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=Es();return I(Rp,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:D("div",{className:bS,children:[D("span",{className:fS,children:[n&&I(Ac,{Component:n}),I(ao,{children:e})]}),o&&I(Ac,{Component:li})]})})}const xS=[{label:Uf[Of.EXPENSE],type:Of.EXPENSE},{label:Uf[Of.REVENUE],type:Of.REVENUE},{label:Uf.BANK_TRANSFER,type:"TRANSFER_IN"},{label:Uf.BANK_TRANSFER,type:"TRANSFER_OUT"}],TS=nr(null,nS);function CS({manualTransactionOptions:e}){const t=xS.filter(t=>e.includes(t.type)),n=MT();return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(Xl,{stylists:[TS],popupTriggerProps:e,children:n?I(tS,{Component:Fl}):D(N,{children:[I(pi,{Component:Fl}),I(cs,{children:"Add Transaction"})]})})}),I(Os,{children:I(kp,{children:t.map(({label:e,type:t})=>I(yS,{closeOnClick:!0,onClick:()=>ol("BankTransactionForm",{routeProps:{initialType:t}}),children:e},t))})})]})}const wS=nr(Zn["dashboard-header"],qn({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",gap:"20px"})),kS=nr(null,qn({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),ES=nr(null,qn({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",paddingLeft:"15px",paddingRight:"15px",width:"100%",display:"flex"})),AS=qn({display:"none",xl:{display:"flex"}});function SS({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:o}=ZA(),i=MT(),l=m(()=>Gn(n)?"":n.find(e=>e.modelKey===Xe)?.value.search?.value??"",[n]);return D("div",{...wS,children:[D("div",{...kS,children:[I(tC,{isFetching:e,searchTerm:l,onChange:e=>{const t=a(Xe);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});o([n])},placeholder:cC(i)}),I(aS,{}),I(CS,{manualTransactionOptions:t}),!i&&I(vS,{filters:n,getModel:a,addFilters:o}),I("div",{className:AS,children:I(fi,{})})]}),n.length>0&&I("div",{...ES,children:I(eS,{filters:n,removeFilter:r})})]})}const IS=nn.filter(e=>e!==tn.COMMENTS&&e!==tn.CLASS_SEGMENT),NS=nr(null,qn({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function DS(){return I("div",{...NS,children:I(fi,{})})}const RS=qn.raw({gap:"6px"});function PS({Icon:e,label:t,children:n,onClick:r}){return n?D(ks,{placement:"bottom-start",children:[I(As,{children:n=>D(zs,{popupTriggerProps:n,extraClassNames:[RS],children:[e&&I(pi,{Component:e}),I(cs,{children:t})]})}),n]}):D(zs,{onClick:r,extraClassNames:[RS],children:[e&&I(pi,{Component:e}),I(cs,{children:t})]})}const LS=oi(e=>p.createElement("svg",{width:16,height:16,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M1.3949 3.22968H13.605",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M9.09821 5.05792V12.384",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M5.90167 5.05792V12.384",stroke:"#182428",strokeMiterlimit:10})),"Delete"),MS=nr(null,qn({whiteSpace:"normal"}));function FS({transactions:e,id:t,label:n,resetSelected:r}){const{mutate:a}=px(),o=Es();return Jx(t)?I(Rp,{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:I(ug,{stylists:[MS],children:n})}):null}const OS={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},BS=e=>e.map(e=>({id:e.id,status:OS.INACTIVE})),US=oi(e=>p.createElement("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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",stroke:"#182428",strokeMiterlimit:10}),p.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",stroke:"#182428",strokeMiterlimit:10}),p.createElement("path",{d:"M7.18604 10.8838H8.39809",stroke:"#182428",strokeMiterlimit:10})),"Uncategorized"),VS=[{id:"delete",label:"Delete",Icon:LS,component:function({transactions:e,resetSelected:t,...n}){const{mutate:r}=px(),a=()=>{const n=BS(e);r(n),t&&t()};return I(PS,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ou({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:qd,label:"Cancel"},{key:zd,label:"Delete",type:au.DANGER}]}).then(e=>{e===zd&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:US,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=px(),o=e.length;return o>0&&I(PS,{label:`${t} ${iu("Expense","Expenses",o,!0)}`,...r,children:I(Sg,{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:US,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutate:a}=px(),o=e.length;return I(PS,{label:`${t} ${iu("Revenue","Revenues",o,!0)}`,...r,children:I(Jy,{onClick:function(t){var r,o;a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:Hy})})}},{id:"review",label:"Change Review Status",Icon:Ym,subActions:[{id:"USER_REVIEW_REQUIRED",label:"Needs Review",component:FS},{id:"RECONCILIATION_DISCREPANCY",label:"Discrepancy",component:FS},{id:"RECONCILED",label:"Reconciled",component:FS}]}];function WS({subActionList:e}){return I(kp,{children:e})}function HS({subActions:e,transactions:t,label:n,Icon:r,resetSelected:a}){const o=m(()=>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(PS,{label:n,Icon:r,children:I(Os,{children:o.length>0?I(WS,{subActionList:o}):I(Rp,{children:I(cs,{children:"No Actions Available for Selection"})},"no-actions")})})}const qS=nr(Zn["bulk-select"],qn({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function zS({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=m(()=>t.rows.map(e=>e.original),[t]),o=t.rows.length,i=()=>e.resetRowSelection(!0);return D("div",{...qS,children:[I(NT,{table:e}),I(ao,{children:`${o} selected`}),VS.map(e=>{if("recategorize-expenses"===e.id&&!n)return null;if("recategorize-revenues"===e.id&&!r)return null;const{component:t,subActions:o,id:l,filter:s,...c}=e,d=a.filter(e=>!s||s(e));return o?I(HS,{subActions:o,transactions:a,resetSelected:i,...c},l):t&&I(t,{transactions:d,resetSelected:i,...c},l)})]})}function jS({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r}){const a=MT(),o=function({transactions:e,columns:t}){const n=MT(),r=OT({transactions:e,columns:t?[tn.SELECT,...t,tn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!Gn(t.getColumn(en.SELECT)),a=g(r?e:null);if(r){if(a.current!==e&&void 0!==a.current){const e=t.getSelectedRowModel().rows.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{});t.setRowSelection(e)}a.current=e}}(e,r,!n),r}({transactions:e,columns:t}),{setFilters:i}=ZA(),l=o.getIsAllRowsSelected(),s=o.getIsSomeRowsSelected(),c=l||s;let d;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?d=I(pC,{buttonText:"Clear Filters",onButtonClick:()=>i([])}):r&&0===e?.length&&(d=I(jT,{})):d=I(qT,{});const u=c&&Gn(d)&&!a;return D(rs,{dashboard:"transactionDashboard",children:[u?I(zS,{table:o}):I(Gi,{headerGroups:o.getHeaderGroups()}),Gn(d)?I(sC,{table:o}):I(Tc,{children:d})]})}const KS=qn({display:"flex",padding:"16px 12px",border:"0.75px",borderStyle:"solid",borderRadius:["borderWidths.sm"],borderColor:["border.layout"]}),_S=jn(KS,qn({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function YS({children:e}){return I("div",{className:_S,children:e})}const ZS=nr(Zn["card-header"],qn({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function GS({children:e}){return I("div",{...ZS,children:e})}const QS=qn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function XS({children:e}){return I("div",{className:QS,children:e})}const JS=_n({base:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",alignSelf:"stretch"}});function $S({children:e,type:t,isSample:n=!1}){const r=nr(Zn.card,JS({type:t,isSample:n}));return I("div",{...r,children:e})}const eI=_n({base:{display:"flex",height:"48px",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",borderRadius:"borderWidth.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 tI({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}=ZA();if(!d(t))return null;const h="active"===r,p=jn(eI({filterStatus:r}),a);return I("div",o?{className:p,children:l}:{className: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 nI=e=>["banks/transactions/summary",e],rI=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:Ei(t[2].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};const aI=_n({base:{display:"flex",padding:"10px",justifyContent:"center",alignItems:"center",gap:"8px",borderRadius:"borderWidths.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"}}),oI=qn({width:"200px",minWidth:"200px"}),iI=qn.raw({marginLeft:"auto"}),lI=nr(null,qn({marginLeft:"auto"}));function sI({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=ZA(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return wr({queryKey:nI({groupBy:e,filter:t}),queryFn:rI})}({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)||!Jx(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,nr(Zn["card-button-icon-container"],aI({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Jx(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return D(tI,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:oI,isZeroState:t,filterEffectiveValueExtractor:YE,children:[I("div",{...l,children:I(pi,{Component:e.Icon})}),!t&&i&&D(N,{children:[I(ao,{children:e.text}),I(ao,{stylists:[lI],children:s})]}),!t&&!i&&D(N,{children:[I(cs,{children:e.text}),I(cs,{wrap:"wrap",extraClassNames:[iI],children:s})]}),t&&D(N,{children:[I(cs,{intent:"weak",children:e.text}),I(cs,{intent:"weak",extraClassNames:[iI],children:s})]})]},e.text)}function cI({isZeroState:e}){const t=_x();return I($S,{children:D(YS,{children:[I(GS,{children:I(cs,{intent:"weak",children:"Review Status"})}),I(XS,{children:t.map(t=>I(sI,{labeledReviewStatus:t,isZeroState:e},t.text))})]})})}const dI=qn({display:"none",xl:{display:"flex",height:"318px",maxHeight:"318px",alignItems:"flex-start",gap:"16px",alignSelf:"stretch",borderRadius:"borderWidths.sm"}});function uI(e){return I("div",{className:dI,children:e.children})}const hI=qn({width:"20px",height:"20px",borderRadius:"sm"});function pI({imageUrl:e,Component:t,stylists:n}){const[r,a]=y(!1);return Qn(e)?D(N,{children:[!r&&I(Lo,{styles:hI}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[nr(Zn["medium-icon"],Zn.icon),...n??[]],size:20})}const gI=qn({width:"270px",minWidth:"269px"}),mI=nr(null,qn({marginLeft:"auto"}));function vI({account:e,isZeroState:t}){const{apiFilters:n}=ZA(),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=gr(e.mask)?void 0:cu(e.mask),c=Ja(null!=(d=e.accountBalance)?lu(d):0,{dollarSign:!0});var d;return D(tI,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:gI,isZeroState:t,filterEffectiveValueExtractor:pA,children:[e.iconUrl&&I(pI,{imageUrl:e.iconUrl,Component:Bg}),!t&&a&&D(N,{children:[I(ao,{children:o}),s&&I(cs,{wrap:"wrap",children:s}),I(ao,{wrap:"wrap",stylists:[mI],children:c})]}),!t&&!a&&D(N,{children:[I(cs,{children:o}),s&&I(cs,{wrap:"wrap",children:s}),I(cs,{wrap:"wrap",extraClassNames:[qn.raw({marginLeft:"auto"})],children:c})]}),t&&D(N,{children:[I(cs,{intent:"weak",children:o}),s&&I(cs,{intent:"weak",wrap:"wrap",children:s}),I(cs,{intent:"weak",wrap:"wrap",extraClassNames:[qn.raw({marginLeft:"auto"})],children:c})]})]},e.id)}const bI=[{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 fI({isZeroState:e}){const{query:{data:t}}=bu(),n=(r=t?.data??[],e?bI: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 I($S,{children:D(YS,{children:[I(GS,{children:I(cs,{intent:"weak",children:"Account Balances"})}),I(XS,{children:n.map((t,n)=>I(vI,{account:t,isZeroState:e},n))})]})})}const yI=qn({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px"}),xI=qn({display:"flex",justifyContent:"center"}),TI=qn({border:"{borderWidths.md} solid {colors.border.layout}",borderBottom:"none",paddingTop:"8px",marginTop:"16px"}),CI=qn({border:"{borderWidths.md} solid {colors.border.layout}",borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),wI=qn({display:"flex",flexDirection:"column",gap:"10px"}),kI=qn({display:"flex",height:"100%",hideBelow:"1.5xl"});function EI({columns:e=IS,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s}){const{filters:c}=ZA(),{hasPlaidLinkedBankAccount:d}=Kp(),u=d??!1,h=MT();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(ki,{});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===c.length&&Qn(c[0].value?.date)?0:c.length,t.length);return I("div",{className:xI,children:D("div",{className:yI,children:[h&&I("div",{className:wI,children:I(QC,{})}),!h&&D(uI,{children:[I(cI,{isZeroState:!i}),I("div",{className:kI,children:I(fI,{isZeroState:!i})}),I(l,{})]}),I("div",{className:TI,children:I(SS,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:CI,children:I(jS,{hasLinkedBankAccount:u,filterState:r,transactions:t,columns:e})}),I(DS,{})]})})}return"zero state"}const AI=qn({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),SI=nr(Zn.card,KS,AI);function II({children:e}){return I("div",{...SI,children:e})}const NI=qn({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function DI({children:e}){return I("div",{className:NI,children:e})}const RI=qn({display:"flex",flexDirection:"column",gap:"8px",minWidth:0});function PI({children:e}){return I("div",{className:RI,children:e})}const LI=qn({minWidth:"300px"});function MI({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:LI,children:I(vv,{options:e,handleClick:t,selectedIndex:n})})}function FI(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=lt(e);return{beginDate:it(et(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:$e(et(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:nt()}:"LAST_12_MONTHS"}const OI=uo.var("colors.border.layout"),BI=nr(Zn["profit-loss-graph"],qn({"& .recharts-surface":{outline:"none"}})),UI=uo.var("colors.money.positive.weak"),VI=uo.var("colors.money.positive"),WI=uo.var("colors.money.negative.weak"),HI=uo.var("colors.money.negative"),qI=uo.var("colors.surface.intent.action"),zI=uo.var("colors.surface.intent.action.active"),jI=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],KI=()=>{const[e,t]=y(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Ea({accountingMethod:"CASH",filter:FI(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=At(e??"");return{longLabel:t?Dt(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:Sa(e)}}(e):"QUARTERLY"===t?function(e){const t=tt(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=tt(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??[]}(jI[e].value)}};function _I({selectedIndex:e,onSelect:t}){return I(MI,{options:jI,handleClick:t,selectedIndex:e})}const YI={top:20,right:20,left:20,bottom:5},ZI={fill:uo.var("colors.typography.base"),fontSize:uo.var("fontSizes.metric.sm")};function GI({data:e,children:t,tooltip:n}){return I(W,{width:"100%",height:"100%",...BI,style:{flexGrow:1},children:D(H,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:YI,children:[I(j,{dataKey:"label",interval:0,tickLine:!1,stroke:OI,tick:ZI}),I(_,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const QI=qn({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function XI(){return D("div",{className:QI,children:[I(mo,{color:UI,label:"Income",diameter:10}),I(mo,{color:WI,label:"Expense",diameter:10})]})}const JI=nr(null,qn({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),$I=nr(null,qn({width:"100%",height:"1px",backgroundColor:"border.layout"})),eN=nr(null,qn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),tN=uo.var("colors.money.positive"),nN=uo.var("colors.money.negative");function rN({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 D("div",{...JI,children:[I(ao,{children:a}),I("div",{...$I}),D("div",{...eN,children:[I(mo,{color:tN,label:"Income",diameter:12}),I(io,{children:$a(Number(o))})]}),D("div",{...eN,children:[I(mo,{color:nN,label:"Expense",diameter:12}),I(io,{children:$a(Number(i))})]})]})}function aN(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=KI(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return D(II,{children:[D(DI,{children:[D(PI,{children:[I(cs,{intent:"weak",children:"All Transactions"}),I(_a,{title:$a(r),label:void 0})]}),D(PI,{children:[I(_I,{selectedIndex:e,onSelect:t}),I(XI,{})]})]}),D(GI,{data:n,tooltip:({active:e,payload:t})=>I(rN,{active:e,payload:t}),children:[I(Y,{name:"Income",dataKey:"income",minPointSize:2,fill:UI,isAnimationActive:!1,activeBar:{fill:VI}}),I(Y,{name:"Expense",dataKey:"expense",minPointSize:2,fill:WI,isAnimationActive:!1,activeBar:{fill:HI}})]})]})}function oN({columns:e,limit:t=100}){const n=KA(),{userRole:r}=b(Qs),{sortInstance:a,setSortInstance:o,apiSort:i}=Af(),{isFilling:l,paginationControls:s,query:{data:c,isError:d,error:u,isFetching:h}}=vl({limit:t,sort:i,filter:{...n.apiFilters}}),p=c?.data,g=xl();return _A("transactionsDashboard",r,p?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,l,g),I(YA.Provider,{value:n,children:I(hi.Provider,{value:s,children:I(as.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(EI,{columns:e,transactions:p,isFetching:h,isFilling:l,isError:d,error:u??null,hasTransactions:g,Chart:aN,manualTransactionOptions:[Of.EXPENSE,Of.REVENUE,"TRANSFER_IN"]})})})})}const iN=e=>I(nw,{children:I(oN,{...e})}),lN={in:["EXPENSE","TRANSFER_OUT"]},sN=[{name:"Expense",types:Bf.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:Of.TRANSFER_OUT}]}];function cN(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=qA("expenseDashboard"),{getCategories:o,getBankAccounts:i,getVendors:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=zA(),u=m(()=>({reviewStatus:_E(d),amount:aA(),bankAccount:hA(i),category:jE(o),customer:gA(s),date:Bt,description:dA(),glAccount:FA(c),notes:IA(),status:AA(),vendor:mA(l),type:vA(sN),search:Je}),[i,o,l,s,c,d]),h=m(()=>[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor],[u.reviewStatus,u.amount,u.bankAccount,u.category,u.customer,u.date,u.description,u.glAccount,u.notes,u.status,u.type,u.vendor]),p=/* @__PURE__ */(new Date).getDate(),g=m(()=>HA(e,lN),[e,p]),v=x(e=>u[e],[u]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:h,setFilters:t,addFilters:n,removeFilter:r,apiFilters:g,getModel:v,hasUserConfiguredFilters:a}}const dN=nr(Zn.text,qn({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",letterSpacing:"0.84px",maxWidth:"100%"}),Ba);function uN({children:e}){return I("div",{...dN,children:e})}const hN=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function pN({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 D("div",{className:hN,children:[I(Ob,{children:n}),I(uN,{children:to(r)})]})}const gN=qn({width:"160px",height:"32px"}),mN=qn({width:"54px",height:"32px"}),vN=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:gN,children:I(cs,{children:String(t.value)})}),bN=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:mN,children:I(cs,{alignment:"right",children:(r=n.value,Ja(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},fN=({active:e,payload:t})=>I(pN,{active:e,payload:t});function yN({data:e}){return I(W,{width:"100%",height:44*(e?.length??0)+12,...BI,children:D(H,{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:vN,width:172}),I(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:bN,width:66}),I(_,{content:fN,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(Y,{dataKey:"total",minPointSize:2,fill:qI,isAnimationActive:!1,activeBar:{fill:zI},barSize:32})]})})}const xN=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):[]},TN=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function CN(){const[e,t]=y(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:St(n),endDate:St(t)}})(TN[e].value),{query:{data:r}}=Ea({filter:n,select:xN}),a=n?`${wt(At(n.beginDate))} - ${wt(At(n.endDate))}`:"";return D(II,{children:[D(DI,{children:[D(PI,{children:[I(cs,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(cs,{intent:"weak",wrap:"ellipsis",children:a})]}),I(MI,{options:TN,handleClick:e=>t(e),selectedIndex:e})]}),I(yN,{data:r})]})}function wN({columns:e,limit:t=100}){const n=cN(),{userRole:r}=b(Qs),{sortInstance:a,setSortInstance:o,apiSort:i}=Af(),{isFilling:l,paginationControls:s,query:{data:c,isError:d,error:u,isFetching:h}}=vl({limit:t,sort:i,filter:{...n.apiFilters}}),p=c?.data,g=xl();return _A("expenseDashboard",r,p?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,l,g),I(YA.Provider,{value:n,children:I(hi.Provider,{value:s,children:I(as.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(EI,{columns:e,transactions:p,isFetching:h,isFilling:l,isError:d,error:u??null,hasTransactions:g,Chart:CN,manualTransactionOptions:[Of.EXPENSE,"TRANSFER_OUT"]})})})})}const kN=e=>I(nw,{children:I(wN,{...e})}),EN={in:["REVENUE","TRANSFER_IN"]},AN=[{name:Ff,types:Bf.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:Of.TRANSFER_IN}]}];function SN(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=qA("incomeDashboard"),{getCategories:o,getBankAccounts:i,getCustomers:l,getGlAccounts:s,getReviewStatuses:c}=zA(),d=m(()=>({reviewStatus:_E(c),amount:aA(),bankAccount:hA(i),category:jE(o),customer:gA(l),date:Bt,description:dA(),glAccount:FA(s),notes:IA(),status:AA(),type:vA(AN),search:Je}),[i,o,l,s,c]),u=m(()=>[d.reviewStatus,d.amount,d.bankAccount,d.category,d.customer,d.date,d.description,d.glAccount,d.notes,d.status,d.type],[d.reviewStatus,d.amount,d.bankAccount,d.category,d.customer,d.date,d.description,d.glAccount,d.notes,d.status,d.type]),h=/* @__PURE__ */(new Date).getDate(),p=m(()=>HA(e,EN),[e,h]),g=x(e=>d[e],[d]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:u,setFilters:t,addFilters:n,removeFilter:r,apiFilters:p,getModel:g,hasUserConfiguredFilters:a}}function IN(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=KI(),r=n.reduce((e,t)=>e+t.income,0);return D(II,{children:[D(DI,{children:[D(PI,{children:[I(cs,{intent:"weak",children:"Total Income"}),I(_a,{title:$a(r),label:void 0})]}),I(PI,{children:I(_I,{selectedIndex:e,onSelect:t})})]}),I(GI,{data:n,tooltip:({active:e,payload:t})=>I(pN,{active:e,payload:t}),children:I(Y,{name:"Revenue",dataKey:"income",minPointSize:2,fill:qI,isAnimationActive:!1,activeBar:{fill:zI}})})]})}function NN({columns:e,limit:t=100}){const n=SN(),{userRole:r}=b(Qs),{sortInstance:a,setSortInstance:o,apiSort:i}=Af(),{isFilling:l,paginationControls:s,query:{data:c,isError:d,error:u,isFetching:h}}=vl({limit:t,sort:i,filter:{...n.apiFilters}}),p=c?.data,g=xl();return _A("incomeDashboard",r,p?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,l,g),I(YA.Provider,{value:n,children:I(hi.Provider,{value:s,children:I(as.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(EI,{columns:e,transactions:p,isFetching:h,isFilling:l,isError:d,error:u??null,hasTransactions:g,Chart:IN,manualTransactionOptions:[Of.REVENUE,"TRANSFER_IN"]})})})})}const DN=e=>I(nw,{children:I(NN,{...e})}),RN=Ne("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),PN={queryClient:xr,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await RN).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await RN).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await RN).delete("queryClient",e)}(e)}}}(),maxAge:yr,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function LN({children:e}){return I(De,{client:xr,persistOptions:PN,children:e})}const MN=qn({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"}}),FN=qn({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:{base:"transparent",xl:"overlay"},overscrollBehavior:{base:"contain",xl:"none"}}),ON=nr(null,Zn.component,MN);function BN({children:e}){const t=g(null),n=g(null),r=MT();return k(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),I(ve,{children:I(be,{lockScroll:!0,className:FN,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,$t.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...ON,children:e})})})}const UN=v({closingQueue:[],drawerHistory:[]});function VN({children:e}){const t=$t(e=>e.drawerHistory),n=$t(e=>e.closingQueue),r=m(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(UN.Provider,{value:r,children:a&&I(BN,{children:e})})}const WN=v({isActive:!0,isClosing:!1});function HN({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=b(UN),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]),l=void 0!==a?.[t],s=void 0!==i,c=(o&&o[t])??(i&&i[t]);return I(WN.Provider,{value:{isActive:l,isClosing:s},children:c&&I(e,{...c.routeProps})})}const qN=qn({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"}}),zN=qn({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function jN({children:e}){const t=g(null),{isActive:n,isClosing:r}=b(WN),{onExitAnimationEnd:a,onInitialAnimationComplete:o}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=y(!0),o=x(()=>{$t.getState().confirmCloseDrawer()},[]),i=x(()=>{a(!1)},[a]);return T(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:n,isClosing:r,focusRef:t}),{context:i,refs:l}=ne({open:n&&!r}),s=me([t,l.setFloating]);return I(Ae,{onExitComplete:a,children:!r&&I(fe,{context:i,modal:!0,initialFocus:-1,children:D(Se.div,{tabIndex:-1,ref:s,onAnimationComplete:()=>o(),transition:bm,initial:fm,animate:ym,exit:xm,className:qN,children:[e,!n&&I("div",{className:zN})]})})})}const KN=_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 _N({background:e,children:t}){return I("div",{className:KN({background:e}),children:t})}const YN=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function ZN(e){return void 0!==YN[e]}function GN(e){return YN[e]}const QN=oi(e=>p.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},p.createElement("defs",null,p.createElement("style",null,".cls-63ce7444ea57ea6c838005ed-1{fill:none;stroke:currentColor;stroke-miterlimit:10;}")),p.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"}),p.createElement("rect",{className:"cls-63ce7444ea57ea6c838005ed-1",x:1.5,y:9.14,width:4.77,height:13.36})),"ThumbsUp"),XN=qn({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function JN({cldrShortName:e}){return I("div",{className:XN,children:GN(e)})}const $N=_n({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),eD=qn({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 tD({reactions:e,type:t,handleClick:n}){return I("div",{className:eD,children:e.map((e,r)=>I("button",{className:$N({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(JN,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const nD=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:Ei(n)};return await va(o)},rD=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:Ei(n)};return await async function(e){return xb(e)}(o)};function aD(e,t,n){return ur(El({id:e}),t,n)}async function oD(e){const t=El({id:e});return oa("mutation successful, invalidating messages queries"),xr.invalidateQueries({queryKey:t}).catch(e=>ia({error:e,severity:"error"}))}function iD(e,t,n){const r=[...e];return r[n]=t,r}const lD=qn({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),sD=Object.keys(YN).filter(ZN).map(e=>({emojiCode:e,authorInfo:[]}));function cD({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:i}=b(Qs),{mutate:l}=function(e){const{userId:t,userEmail:n}=b(Qs);return Eu({mutationFn:nD,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=aD(n,t,r);await xr.cancelQueries({queryKey:i});const l=xr.getQueryData(i);return xr.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:iD(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:()=>oD(e)})}(e);return D(ks,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(As,{children:e=>I("button",{className:lD,...e,children:I(Ac,{Component:QN})})}),I(Os,{type:"reaction",children:I(tD,{reactions:sD,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===i);return n&&r})||(l({id:t,emojiCode:e}),o(!1))}})})]})}const dD=_n({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function uD({reactions:e,type:t,handleClick:n}){const r=dD({type:t});return I("div",{className:r,children:I(tD,{reactions:e,handleClick:n,type:t})})}const hD=_n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),pD=_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"}}}}),gD=qn({position:"relative",display:"flex",flexDirection:"column"});function mD({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:a=[]}){const o=g(null),{isHover:i,setIsHover:l,reactionIsOpen:s,setReactionIsOpen:c}=function(e){const[t,n]=y(!1),[r,a]=y(!1);return T(()=>{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}(o),{mutate:d}=function(e){const{userId:t}=b(Qs);return Eu({mutationFn:rD,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=aD(n,t,r);await xr.cancelQueries({queryKey:o});const i=xr.getQueryData(o);return xr.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return Gn(r)||0===r.reactions.length?t:iD(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:()=>oD(e)})}(e),u=n?"sent":"received",h=a.filter(e=>ZN(e.emojiCode)),p=h.length>0,m="sent"===u?Zn["message-sent"]:Zn["message-received"],v=nr(Zn[m],pD({type:u}));return D("div",{className:hD({type:u,hasReactionsOnMessage:p}),ref:o,onMouseEnter:()=>"received"===u&&l(!0),children:[D("div",{className:gD,children:[I("div",{...v,children:r}),p&&I(uD,{reactions:h,type:u,handleClick:e=>d({id:t,emojiCode:e})})]}),i&&I(cD,{conversationId:e,messageId:t,type:u,reactions:h,reactionIsOpen:s,setReactionIsOpen:c})]})}const vD=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{d:"M14.1641 9.87903V14.125H0.835876V9.87903",strokeMiterlimit:10}),p.createElement("path",{d:"M7.49988 10.4883V0.1875",strokeMiterlimit:10}),p.createElement("path",{d:"M11.7395 6.85162L7.4999 11.0913L3.26025 6.85162",strokeMiterlimit:10})),"Download"),bD=_n({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),fD=qn({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}),yD=qn({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),xD=qn({textDecoration:"none",color:"inherit",cursor:"pointer"});function TD({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=MT();return I("div",{className:bD({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 ia({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:xD,children:D("div",{className:fD,children:[D("div",{className:yD,children:[I(cs,{children:n}),I(io,{children:`${r}`})]}),I(Ac,{Component:vD})]})})})}const CD=nr(null,qn({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function wD({children:e}){return I("div",{...CD,children:e})}const kD=nr(null,qn({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"})),ED=qn({minHeight:1,width:"100%"}),AD=w(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},a){const o=g(null);t&&r?.current?.focus();const i=x(()=>{t&&Qn(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){T(()=>{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])}(o,t,i),D("div",{tabIndex:-1,...kD,ref:o,children:[I("div",{className:ED,ref:a}),e]})}),SD=Object.freeze({message:{text:"",attachments:[]}}),ID=qn({width:"24px",height:"24px",objectFit:"contain"});function ND({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:ID})}const DD=qn({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"}),RD=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),PD=qn({display:"grid",flexDirection:"column",minWidth:0}),LD="LOADING",MD="LOADED",FD="ERROR";function OD({attachment:e,onRemove:t}){const n=e.hasError?FD:e.isPending?LD:MD;return D("div",{className:DD,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[D("div",{className:RD,children:[e.iconUrl&&I(ND,{iconUrl:e.iconUrl,fileName:e.displayFileName}),D("div",{className:PD,children:[I(cs,{children:e.displayFileName}),n===LD&&e.displayText&&I(io,{accent:"strongest",children:e.displayText}),n===MD&&e.fileSize&&I(io,{children:e.fileSize}),n===FD&&I(io,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(zs,{onClick:async n=>{n.stopPropagation(),await ou({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:qd,label:"Cancel"},{key:zd,label:"Remove",type:au.DANGER}]})===zd&&t(e)},children:I(pi,{Component:Ss})})]})}const BD=qn({width:"100%"});function UD({conversationId:e,addMessage:t,blockSubmit:n,isMobile:r,scrollRef:a,setActiveKeyboard:o,inputRef:i,defaultValues:l}){const{form:s}=function({onSubmit:e,defaultValues:t}){return{form:qv({defaultValues:t??SD,onSubmit:t=>{op.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:l}),c=g(null),d=x(e=>{s.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[s]),u=x(e=>{s.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[s]),{mutate:h}=Eu({mutationFn:ep,onSuccess:async()=>{await xr.invalidateQueries({queryKey:["files/attachments"]}),await xr.invalidateQueries({queryKey:["conversations"]})}}),p=x(e=>{s.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&h({id:e.id})},[s,h]);return I("form",{className:BD,ref:c,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,c.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),s.handleSubmit()},children:I(s.Subscribe,{selector:e=>e.values.message.attachments,children:e=>D(N,{children:[e.map(e=>I(OD,{attachment:e,onRemove:p},e.localId)),I(s.AppField,{name:"message",children:t=>I(t.MessageAreaInput,{blockSubmit:n,scrollRef:a,setActiveKeyboard:o,ref:i,onFileSelect:d,onUploadComplete:u,hideFileUpload:e.length>=5})})]})})})}function VD(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 WD(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return oa("mutation successful, invalidating messages queries"),Promise.all([xr.invalidateQueries({queryKey:e}),xr.invalidateQueries({queryKey:t}),xr.invalidateQueries({queryKey:n})]).catch(e=>ia({error:e,severity:"error"}))}const HD=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>ji({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),qD=async({data:e,accessToken:t,environment:n})=>ji({data:{data:[e]},accessToken:t,environment:n}),zD=qn({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),jD=qn({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),KD=qn({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),_D="Marked As Resolved";function YD({resolver:e}){const t=e?`${e} ${_D}`:_D;return D("div",{className:jD,children:[I("div",{className:zD}),I("div",{className:KD,children:t}),I("div",{className:zD})]})}const ZD=_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 GD({width:e="md",height:t="md"}){return I(Lo,{styles:ZD({width:e,height:t})})}const QD=qn({display:"flex",flexDirection:"row-reverse"});function XD(){return D(N,{children:[I(GD,{width:"lg",height:"lg"}),I("div",{className:QD,children:I(GD,{width:"md",height:"lg"})}),I("div",{className:QD,children:I(GD,{width:"lg",height:"xl"})}),I(GD,{width:"md",height:"lg"})]})}const JD=qn({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function $D({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(wD,{children:I(mD,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(wD,{children:I(XD,{})}):D("div",{className:JD,children:[I(ao,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(cs,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const eR=nr(null,qn({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 tR({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:a=!1,attachedEntityId:o,defaultValues:i,defaultSubject:l}){const{userId:s}=b(Qs),{mutate:c}=function(){const{userId:e}=b(Qs);return Eu({mutationFn:Il,onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=ur(El({id:e.conversationId}),t,n);await xr.cancelQueries({queryKey:a});const o=xr.getQueryData(a);return xr.setQueryData(a,t=>[VD(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:WD})}(),{query:{data:d},isFilling:u}=function(e){const t=Qn(e);return wr({queryKey:El({id:e??""}),queryFn:Sl,select:Al,enabled:t})}(e),{mutate:h,isPending:p,variables:m}=(k=t,E=o,Eu({mutationFn:qD,onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(Gn(e)||Gn(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(Qn(E)){const e={id:E};Cl(E,Tl.BANK_TRANSACTION)?o=async()=>{const t=gl(e);return await xr.invalidateQueries({queryKey:t})}:Cl(E,Tl.FINANCIAL_SUMMARY)&&(i=async()=>await xr.invalidateQueries({queryKey:a}))}return oa("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([xr.invalidateQueries({queryKey:n}),xr.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>ia({error:e,severity:"error"}))}})),{mutate:v}=Eu({mutationFn:HD,onSuccess:async()=>{const e=["conversations"],t=["tasks"];return oa("mutation successful, invalidating conversations queries"),Promise.all([xr.invalidateQueries({queryKey:e}),xr.invalidateQueries({queryKey:t})]).catch(e=>ia({error:e,severity:"error"}))}}),[f,x]=y(!1),C=g(null),w=g(null);var k,E;T(()=>{n&&r&&e&&v({id:e,readStatus:"READ"})},[n,r,e,v]),T(()=>{qh(w)},[d,w]);const A=Gn(e)||Gn(d)||u;return D(N,{children:[A?I(AD,{ref:w,inputRef:C,activeKeyboard:f,setActiveKeyboard:x,children:I($D,{isConversationLoading:p,isFilling:u,message:m?.message?.text})}):D(AD,{ref:w,activeKeyboard:f,setActiveKeyboard:x,inputRef:C,children:[n&&I(YD,{resolver:"Conversation"}),d.map((t,n)=>{const r=t[0].author.userId===s;return I(wD,{children:t.map(t=>D(N,{children:[t.attachments.filter(e=>!Gn(e)).map(e=>I(TD,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(mD,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...eR,children:I(UD,{scrollRef:w,inputRef:C,conversationId:e,blockSubmit:p,isMobile:a,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),i=r.filter(e=>null!==e.id&&!e.isPending),s=i.map(e=>`att_${e.id}`),d=a.length>0,u=s.length>0;if(d||u)if(Gn(e)){const e=function(e,t,n){let r="";return Qn(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(l,a,i[0]?.displayFileName),t=(p=a,g=s,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...Qn(m=o)&&{attachedEntityId:m},message:{text:p,...g.length>0&&{attachmentIds:g}}});h(t)}else c({conversationId:e,text:a,...u&&{attachmentIds:s}});var p,g,m},setActiveKeyboard:x,defaultValues:i})})]})}function nR({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=y(e),{query:{data:o}}=zi(r),i="CLOSED"===o?.resolutionStatus;return D(_N,{children:[I(Sm,{}),I(tR,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const rR=nr(Zn["form-body"],qn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"16px",overflowY:"auto",overflowX:"hidden",overscrollBehavior:{base:"contain",xl:"none"},minWidth:{base:0,sm:"512px"}}));function aR({children:e}){return I("div",{...rR,children:e})}const oR=nr(null,qn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),iR=nr(null,qn({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),lR=qn({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),sR=e=>{ph(e),gh(e)},cR=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:a,conversationId:o,transactionId:i,transaction:l})=>I(jN,{children:D("div",{...oR,children:[I(_N,{children:D("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:sR,...iR,children:[n,I(aR,{children:e}),r]})}),null!==a&&I("div",{className:lR}),"conversation"===a&&i&&I(nR,{conversationId:o,attachedEntityId:i,defaultSubject:l?.description})]})}),dR=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],uR=["FEDERAL","STATE","SALES"],hR=["Q1","Q2","Q3","Q4"],pR=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function gR(e){if(!Gn(e))return pR.find(t=>t.value===e)?.name}const mR=h.object({id:h.string(),type:h.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:h.enum(Object.values(Ox)),amount:h.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:h.string("Required").refine(e=>(function(e,t){const n=et(e.getFullYear(),e.getMonth(),e.getDate()),r=et(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||xt(new Date(e),/* @__PURE__ */new Date))&&Ct(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable(),customer:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable(),frequency:h.union([h.object({name:h.string(),value:h.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),h.undefined()]),category:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).nullable(),classSegments:h.array(h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).optional()),bankAccount:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:h.string().nullable(),itemizedByOptions:h.object({category:h.boolean(),customer:h.boolean()}).optional(),attachments:h.array(ap)}),vR=h.object({id:h.string(),name:h.string().optional(),requiredness:h.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),bR=h.object({id:h.string(),name:h.string().optional(),label:vR.optional()}),fR=bR.extend({child:bR.optional()}),yR=h.object({id:h.string().optional(),lineItemType:h.literal("itemized"),category:h.object({id:h.string(),name:h.string().optional()}).nullable(),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()}).optional(),classSegments:h.array(fR),customer:h.object({id:h.string(),name:h.string().optional()}).nullable(),amount:h.number()}),xR=h.object({lineItemType:h.literal("invoice"),amount:h.number().nullable(),invoice:h.object({id:h.string(),amount:h.number(),date:h.string(),name:h.string()})}),TR=h.object({lineItemType:h.literal("bill"),amount:h.number().nullable(),bill:h.object({id:h.string(),amount:h.number(),date:h.string(),name:h.string()})}),CR=h.object({lineItemType:h.literal("fee"),amount:h.number()}),wR=h.object({lineItemType:h.literal("payment"),amount:h.number(),payment:h.object({id:h.string(),amount:h.number(),date:h.string(),name:h.string(),bankAccount:h.object({id:h.string(),displayName:h.string()})})}),kR=h.discriminatedUnion("lineItemType",[yR,xR,CR,TR,wR]),ER=mR.extend({children:h.array(kR),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()}).nullable()});ER.extend({tax:h.object({paymentInfo:h.object({region:h.enum(uR).optional(),year:h.number().optional(),quarter:h.enum(hR).optional()}).nullable().optional()}).optional()});const AR=mR.extend({id:h.string(),type:h.literal(Object.values(Of)),description:h.string(),displayName:h.string(),iconUrl:h.string(),status:h.literal(Object.values(OS)),reviewStatus:h.literal(Object.values(Ox)),apiName:h.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:h.string().nullable(),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()},{message:"Required"}),customer:h.object({id:h.string(),name:h.string().optional(),email:h.string().optional()}).nullable(),vendor:h.object({id:h.string(),name:h.string().optional()}).nullable(),invoice:h.object({id:h.string(),name:h.string(),date:h.string(),lineItems:h.array(h.object({id:h.string(),amount:h.number()}))}).nullable(),bill:h.object({id:h.string(),name:h.string().optional()}).nullable(),payroll:h.object({id:h.string(),date:h.string().optional(),checkDate:h.string().optional(),description:h.string().optional()}).nullable(),apiItemId:h.string().nullable()}),SR=h.looseObject({amount:h.number().nullable(),category:h.object({id:h.string(),name:h.string().optional()}).nullable(),customer:h.object({id:h.string(),name:h.string().optional()}).nullable()}),IR=h.object({children:h.array(SR),itemizeByOptions:h.record(h.string(),h.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"]})})}),NR=ER.extend({type:h.literal("EXPENSE"),vendor:h.object({id:h.string(),name:h.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:h.object({id:h.string(),name:h.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&&gr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),DR=ER.extend({type:h.literal("BANK_TRANSFER"),reconciliationMatch:h.object({id:h.string(),description:h.string().optional(),amount:h.number().optional(),date:h.string().optional(),apiInstitutionId:h.string().nullable().optional(),apiName:h.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"}).optional()}).nullish()}).refine(e=>{const t=e.reconciliationMatch?.amount,n=e.amount;return!!Gn(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>DR.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),RR=AR.extend({}),PR=h.looseObject({amount:h.number().nullable(),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.string().optional()}),customer:h.object({id:h.string(),name:h.string().optional()}).nullable()}),LR=h.object({children:h.array(PR),itemizeByOptions:h.record(h.string(),h.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"]})})}),MR=ER.extend({type:h.literal("REVENUE"),glAccount:h.object({id:h.string(),name:h.string().optional(),accountNo:h.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 FR(e){return e.reduce((e,t)=>new V(e).plus(t??0).toNumber(),0)}function OR(e,t){const n=new V(e).times(100).round(0),r=new V(t).times(100).round(0);return!n.eq(r)}function BR(e,t){const{labelsToIndex:n,childToRootId:r,labelFieldCount:a}=t,o=new Array(a).fill(void 0);for(const i of e){const e=i.label?.id;if(gr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function UR(e,t){return e.filter(e=>e.label?.id===t).map(e=>[e,...e.children])}function VR(e){return{id:e.id,name:e.name,label:e.label.id?{...e.label,id:e.label.id}:void 0}}function WR(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function HR(e){return"EXPENSE"!==e.type||Gn(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}const qR={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function zR(e){return gr(e)?void 0:e}function jR(e,t,n){const r=(e,t)=>function(e,t,n){if(e(t))return n}(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:zR((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:zR(e.id),amount:e.amount?su(e.amount):0,categoryId:e.category?.id,glAccountId:e.glAccount?.id,classSegmentIds:e.classSegments?.map(e=>e.id),customerId:e.customer?.id}}(e);case"fee":return function(e){return{id:zR(e.id),amount:su(e.amount)}}(e);case"bill":return function(e){return{id:zR(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:zR(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.classSegments??[])e.label?.id&&i.add(e.label.id);return{...{amount:r("amount",e.amount?su(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),classSegmentIds:r("classSegments",e.classSegments?.filter(e=>!Gn(e?.label?.id)&&!i.has(e.label.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 Gn(t)?e:{...e,glAccountId:wl({id:t,prefix:"GL_ACCOUNT"})}});return Gn(r)?Gn(a)?{}:{glAccountId:void 0,children:a}:{glAccountId:wl({id:r,prefix:"GL_ACCOUNT"}),children:a}}(n("category")?e.category?.id:void 0,a,t):{}}}function KR(e=null){const{mutate:t}=gx(),{mutate:n}=mx({mutationFn:cx}),{query:{data:r}}=$p();return(a,o,i)=>{const l=r?.data??[];var s;e?(t(function(e,t,n,r){return{...jR(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({...jR(s=a,l,()=>!0),amount:s.amount?su(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||qR[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}),il())}}const _R=ER.extend({type:h.literal("TAX_PAYMENT"),tax:h.object({paymentInfo:h.object({region:h.enum(uR,{message:`Tax region must be one of: ${uR.join(", ")}`}),quarter:h.enum(hR,{message:"Required"}),year:h.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: ${uR.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))}),YR={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:St(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:dl[0],notes:null,classSegments:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function ZR(e){const t=/* @__PURE__ */new Map;for(const n of e){if(Gn(n.bill)||!Gn(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 GR(e){const t=/* @__PURE__ */new Map;for(const n of e){if(Gn(n.invoice)||!Gn(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 QR(e){const t=/* @__PURE__ */new Map;for(const n of e){if(Gn(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 XR(e,t){const n=t?.get(e.glAccount.id);return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function JR(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(Gn(e.paymentId)&&Gn(e.bill)&&Gn(e.invoice)||XR(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...ZR(r),...GR(r),...QR(r),...a]}(e.children,t),r=(o=n,void 0===(i=t)||0===i.size?[]:o.filter(e=>{const t=i.get(e.glAccount.id);return void 0===t||"DEFERRED_REVENUE"!==t.liabilityType&&"Prepaid Expenses"!==t.name})),a=r.some(e=>!(Gn(e.invoice)&&Gn(e.payroll)&&Gn(e.bill)&&Gn(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return Gn(e.paymentId)||XR(e,n)?t&&XR(e,n)?(r=e,{...r,lineItemType:"fee",amount:lu(r.amount)}):Gn(e.invoice)?Gn(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:lu(e.amount),classSegments:e.classSegments.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return Gn(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:lu(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:lu(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:lu(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:lu(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=lu(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 $R({value:e}){return{fields:eP(function(e){switch(e){case"EXPENSE":return NR;case"TAX_PAYMENT":return _R;case"BANK_TRANSFER":return DR;case"REVENUE":return MR}}(e.type).safeParse(e))}}function eP(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 tP(e,t,n){const r=KR(e),{query:{data:a}}=Dy({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:HR(i),reviewStatus:i.reviewStatus,amount:lu(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,classSegments:BR(i.classSegments,l),children:JR(i,s),reconciliationMatch:i.reconciliationMatch?{...i.reconciliationMatch,amount:lu(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:kl(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...YR,type:e,classSegments:new Array(t.labelFieldCount).fill(void 0)}}(n,t);var i,l,s;return qv({defaultValues:o,canSubmitWhenInvalid:!0,validators:{onBlur:$R,onSubmit:$R},onSubmit:e=>r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),onSubmitInvalid:()=>{}})}function nP({transaction:e}){const{mutate:t}=px(),n=()=>t(BS([e]));return I(yS,{onClick:()=>{return e=n,void ou({title:"Delete transaction",body:"Are you sure you want to delete this transaction?",buttons:[{key:qd,label:"Cancel"},{key:zd,label:"Delete",type:au.DANGER}]}).then(t=>{t===zd&&e()});var e},Icon:LS,children:"Delete"})}function rP({transaction:e}){const{mutate:t}=px();return I(yS,{onClick:()=>{t([e].map(e=>({id:e.id,status:OS.ACTIVE})))},children:"Restore"})}const aP=oi(e=>p.createElement("svg",{stroke:"currentColor",width:16,height:15,viewBox:"0 0 16 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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"}),p.createElement("path",{d:"M7.63599 3.36011V4.63392",strokeMiterlimit:10,strokeLinecap:"square"}),p.createElement("path",{d:"M7.63599 8.45532V9.72913",strokeMiterlimit:10,strokeLinecap:"square"}),p.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"})),"Bill");function oP({onClick:e,error:t,validate:n}){return I(nh,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const iP=qn({display:"flex",flexDirection:"column",width:"100%"}),lP=qn({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"}),sP=qn({display:"flex",flexDirection:"column",gap:"8px"});function cP({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return I("div",{className:iP,children:D("div",{className:lP,children:[D("div",{className:sP,children:[I(cs,{intent:"weak",children:"Selected Total"}),I(ao,{children:no(lu(e),r)})]}),D("div",{className:sP,children:[I(cs,{intent:"weak",children:`${n} Total`}),I(ao,{children:to(t)})]})]})})}const dP=nr(null,qn({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function uP({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=GT({debouncedValue:e,onChangeDebouncedValue:t});return I("div",{className:Fm,children:D("div",{className:Om,children:[n||i?I(YT,{}):I(Ac,{Component:Mm}),I("input",{className:Bm,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:gh}),mr(e)&&I(Xl,{stylists:[dP],onClick:()=>o(""),children:I(Ac,{Component:Ss})})]})})}const hP=qn({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function pP({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return D("div",{className:hP,children:[I(cs,{intent:"weak",children:"Search"}),I(uP,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function gP(e,t,n){return`${e} | ${wt(At(t))} | ${to(lu(n))}`}const mP=qn({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"}}),vP=qn({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0});function bP({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return D("button",{type:"button",className:mP,onClick:o,children:[D("div",{className:vP,children:[I(Ac,{Component:r}),I(cs,{wrap:"wrap",children:gP(t,n,e)})]}),I(Qm,{selected:a,showEmptyIndicator:!0})]})}const fP={root:null,threshold:1};function yP({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=g(null),r=t??!0,a=x(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return T(()=>{const e=new IntersectionObserver(a,fP);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[a]),n}({onIntersect:t,enable:e});return I("div",{ref:n})}const xP=qn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),TP=qn({display:"flex",flexDirection:"column"});function CP({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return D("div",{className:xP,children:[I(cs,{intent:"weak",children:e}),n?I(jm,{pluralNounNotFound:r,singularSearchCTANoun:a,showSearchCTA:!1}):I("div",{className:TP,children:t})]})}function wP({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return I(N,{children:t.groups.map(t=>D(CP,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>I(bP,{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(yP,{onIntersect:a,enable:!r&&o})]},t.key))})}function kP(e){return Ja(e,{cents:"always",dollarSign:!0})}function EP(e){return kP(Math.abs(e))}function AP({title:e,body:t}){return ou({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 SP(e,t,n){const r=EP(e);return`The selected bills total of ${EP(t)} is less than the expense total of ${r}. Was there a fee of ${EP(n)}?`}const IP=qn(Em,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function NP({children:e}){return I("div",{className:IP,children:e})}function DP({transactionTotal:e,bills:t,onSubmit:n,fetchNextPage:r,hasNextPage:a,isFetching:o,isFetchingNextPage:i,searchTerm:l,onSearchChange:s}){const[c,d]=y({}),u=Hm({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:d,hasMultiSelect:!0,state:{selected:c}}),h=t.filter(e=>c[e.id]).reduce((e,t)=>e+t.amount,0),p=o&&!i;return I(Pm,{title:"Link Bill",Footer:I(oP,{onClick:()=>{const r=new V(h).div(100).times(-1).toNumber(),a=new V(e).sub(r).toNumber(),o=t.filter(e=>c[e.id]);r>e&&o.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AP({title:"Bill Payment",body:SP(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:D(NP,{children:[I(cP,{selectedAmount:h,transactionTotal:e,transactionTypeLabel:"Expense"}),I(pP,{searchTerm:l,onChange:s,isFetching:p,searchPlaceholder:"Search bills..."}),I(wP,{listLabel:"Bills",glSourceList:u,icon:aP,fetchNextPage:r,hasNextPage:a,isFetching:o,pluralNoun:"bills",singularNoun:"bill"})]})})}function RP({queryKey:e,queryFn:t,...n}){const r=br(),a=Cr(),o=mr(r),i=["infinite",...ur(e,r??"",a)],l=P(),s=B({...n,queryKey:i,queryFn:o?t:fr,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},xr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const PP=e=>["bills/bills",e??{}],LP=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:Ei(n)},o=await va(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})},MP=[];function FP(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 OP(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return Gn(e)||(t.search=e),t}function BP(e){const[t,n]=y(""),{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:OP(t)},RP({queryFn:LP,queryKey:PP(s)}));var s,c;const d=(r?.pages??MP).flatMap(e=>(e.data??[]).map(FP));return I(DP,{...e,bills:d,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function UP(e){const t=Es();return I(wm,{children:t.open&&I(BP,{...e})})}function VP(e){return{lineItemType:"fee",amount:e}}function WP(e){return{lineItemType:"bill",amount:lu(-e.amount),bill:{id:e.id,amount:lu(e.amount),date:e.date,name:e.name}}}function HP(e){return e.map(WP)}function qP(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function zP(e){return`Remove ${e}?`}function jP(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function KP({action:e,titleName:t,entityName:n}){return ou({title:zP(t),body:jP(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 _P={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},YP={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function ZP(e,t){const n=YP[t];return KP({titleName:n,entityName:n.toLowerCase(),action:_P[e]})}const GP="bill",QP=zv({defaultValues:YR,render:function({form:e}){const[t,n]=y(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType);return D(ks,{open:t,onOpenChange:n,children:[I(yS,{onClick:async()=>{const t=qP(GP,e.state.values.children);GP!==t?"YES"===await ZP(GP,t)&&n(!0):n(!0)},Icon:aP,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),I(UP,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=HP(t);0!==r&&a.push(VP(r)),e.setFieldValue("children",a),n(!1)}})]})}}),XP=oi(e=>p.createElement("svg",{stroke:"currentColor",width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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}),p.createElement("path",{d:"M7.5 5.11249V6.90624",strokeMiterlimit:10}),p.createElement("path",{d:"M7.5 10.4813V12.275",strokeMiterlimit:10}),p.createElement("path",{d:"M12.8687 3.91875V14.0625H2.13123V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10}),p.createElement("path",{d:"M12.8687 3.91875V4.51875H9.28748V0.9375H9.88748L12.8687 3.91875Z",strokeMiterlimit:10})),"Payroll");function JP(e,t,n){const r=EP(e);return`The selected invoice total of ${EP(t)} is greater than the transaction total of ${r}. Was there a fee of ${EP(n)}?`}const $P=e=>["payments/payments",e??{}],eL=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:Ei(n)},o=await va(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})},tL=qn({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),nL=qn({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),rL=qn({marginLeft:"auto"});function aL({description:e,amount:t,bankAccountDisplayName:n,date:r}){return D("div",{className:tL,children:[D("div",{className:nL,children:[I(cs,{children:e}),t&&I(cs,{wrap:"nowrap",children:eo(t)})]}),D("div",{className:nL,children:[n&&I(io,{children:n}),I("span",{className:rL,children:r&&I(io,{wrap:"nowrap",children:wt(At(r))})})]})]})}function oL({payment:e,selected:t,onClick:n}){return I($m,{handleClick:n,selected:t,isMultiSelect:!0,children:I(aL,{description:e.description,amount:lu(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}const iL=[];function lL(e){return e}function sL(e){return e.pages.flatMap(e=>(e.data??[]).map(lL))}function cL(e){return Object.values(e).some(e=>e)}function dL(e,t){return e===su(t)}function uL(e,t){return(t??[]).filter(t=>e[t.id]).reduce((e,t)=>e+t.amount,0)}function hL(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:pr(t)?void 0:t}}function pL({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const[r,a]=y(""),{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:hL(n,r)},u={select:sL},RP({queryFn:eL,queryKey:$P(d),...u}));var d,u;const[h,p]=y({}),g=uL(h,o),[m,v]=y(void 0),b=x(e=>{const n=uL(e,o),r=cL(e);void 0===m||!dL(n,t)&&r||v(void 0),p(e)},[o,t,m]),f=Hm({data:[o??[]],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:h},onSelectedChange:b}),T=l&&!c;return I(Pm,{title:"Link Transactions",Footer:I(oP,{validate:()=>{const e=dL(g,t),n=cL(h),r=e||!n;return r||v("The selected total must equal the income amount."),r},error:m,onClick:()=>{e(o?.filter(e=>h[e.id])??iL)}}),padChildren:!1,children:D(NP,{children:[I(cP,{selectedAmount:g,transactionTotal:t,transactionTypeLabel:Ff,selectedAmountSignage:"default"}),I(pP,{searchTerm:r,onChange:a,isFetching:T,searchPlaceholder:"Search transactions..."}),f.groups.map(e=>{const t=e.getRows();return I(CP,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return I(oL,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),I(yP,{onIntersect:i,enable:!l&&s})]})})}function gL({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n}){const r=Es();return I(wm,{children:r.open&&I(pL,{transactionTotalDollars:t,parentBankAccountId:n,onSubmit:e})})}function mL({transactionTotal:e,invoices:t,onInvoiceSubmit:n,onPaymentSubmit:r,hasExistingInvoices:a,parentBankAccountId:o,fetchNextPage:i,hasNextPage:l,isFetching:s,isFetchingNextPage:c,searchTerm:d,onSearchChange:u}){const[h,p]=y({}),[g,m]=y(!1),v=Hm({data:[t],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:p,hasMultiSelect:!0,state:{selected:h}}),b=t.filter(e=>h[e.id]).reduce((e,t)=>e+t.amount,0),f=s&&!c;return I(Pm,{title:"Link Invoice",HeaderRightAction:I(pw,{shouldUseButtonDiscreteStyles:!0,children:I(kp,{forceNewCascade:!0,children:D(ks,{open:g,onOpenChange:m,children:[I(yS,{onClick:async()=>{const e=t.some(e=>h[e.id]);if(a){if("YES"!==await ZP("payment","invoice"))return}else if(e&&"YES"!==await async function(){return KP({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;m(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),I(gL,{transactionTotalDollars:e,parentBankAccountId:o,onSubmit:r})]})})}),Footer:I(oP,{onClick:async()=>{const r=lu(b),a=t.filter(e=>h[e.id]);if(r>e&&a.length>0){const t=new V(r).sub(e),o=t.toNumber(),i=t.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return AP({title:"Invoice Payment",body:JP(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:D(NP,{children:[I(cP,{selectedAmount:b,transactionTotal:e,transactionTypeLabel:Ff}),I(pP,{searchTerm:d,onChange:u,isFetching:f,searchPlaceholder:"Search invoices..."}),I(wP,{listLabel:"Invoices",glSourceList:v,icon:XP,fetchNextPage:i,hasNextPage:l,isFetching:s,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const vL=e=>["invoicing/invoices",e??{}],bL=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:Ei(r)},o=await va(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})},fL=[];function yL(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return pr(e)||(t.search=e),t}function xL(e){const[t,n]=y(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return RP({queryFn:bL,queryKey:vL(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:yL(t)}});var s;const c=(r?.pages??fL).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return I(mL,{...e,invoices:c,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function TL(e){const t=Es();return I(wm,{children:t.open&&I(xL,{...e})})}function CL(e){const t=lu(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const wL=(e,t)=>{const n=e.map(CL);return 0!==t&&n.push(VP(t)),n};function kL(e){const t=lu(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 EL(e){return e.map(kL)}const AL="invoice",SL=zv({defaultValues:YR,render:function({form:e}){const[t,n]=y(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType);return D(ks,{open:t,onOpenChange:n,children:[I(yS,{onClick:async()=>{const t=qP(AL,e.state.values.children);AL!==t?"YES"===await ZP(AL,t)&&n(!0):n(!0)},Icon:XP,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),I(TL,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=wL(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:t=>{const r=EL(t);e.setFieldValue("children",r),n(!1)},hasExistingInvoices:r,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),IL=dl.filter(e=>"ONE_TIME"!=e.value);function NL({onClick:e}){const t=Es();return I(Tg,{triggerChildren:I(kg,{displayLabel:"Make recurring"}),popupChildren:I(uv,{frequencies:IL,onClick:n=>{e(n),t.close()}})})}function DL({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(zs,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(wc,{Component:t})})}function RL({activeTab:e,onClick:t,popupTriggerProps:n}){return I(DL,{active:"conversation"===e,onClick:()=>t("conversation"),icon:kc,ariaLabel:"conversation-tab",popupTriggerProps:n})}const PL=qn({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function LL({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=Es(),[a,o]=y(e),{query:{data:i}}=zi(a),l="CLOSED"===i?.resolutionStatus;return I(Tm,{children:D("div",{className:PL,children:[I(Sm,{children:D(Nm,{children:[I(Jd,{Icon:ii,handleClose:()=>r.setOpen(!1)}),I(ao,{children:"Back"})]})}),I(tR,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const ML={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:Ff},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},FL=Object.values(ML);function OL({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=We();return a?I(av,{}):D(_m,{children:[s&&t&&I(ao,{children:"Suggested"}),I(ao,{children:n}),I("div",{children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(yE,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(VL,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I($m,{handleClick:()=>e(t),selected:n,children:D(bE,{children:[t.iconUrl&&I(Ac,{Component:vg(t.iconUrl,t.name??"")}),I(cs,{wrap:"wrap",children:t.name??""})]})},t.id)})})]})}const BL="Search expense categories...",UL=[];function VL({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=rg(),s=r??i?.data??UL,c=Es(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I(Wm,{placeholder:BL,onClick:d,SearchList:SE,DefaultList:OL,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function WL({onClick:e,showSuggestedCategories:t,glAccounts:n,listLabel:r,isFilling:a,glAccount:o,handleConversion:i,parentOnClick:l,selectedIds:s}){const c=We();return a?I(av,{}):D(_m,{children:[c&&t&&I(ao,{children:"Suggested"}),I(ao,{children:r}),I("div",{children:n?.map(t=>{const n=s.has(t.id);return t.hasChilds?I(yE,{text:t.name,iconUrl:t.iconUrl,title:"All Categories",children:I(zL,{headerLabel:"All Categories",listLabel:t.name,nestedGlAccounts:t.children,handleConversion:i,glAccount:o,parentOnClick:l})},t.id):I($m,{handleClick:()=>e(t),selected:n,children:I(bE,{children:I(cs,{wrap:"wrap",children:t.name})})},t.id)})})]})}const HL="Search income categories...",qL=[];function zL({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}=Vy(),d=r??l??qL,u=qy([...d],Hy),h=Es(),p=o?.id?/* @__PURE__ */new Set([o.id]):/* @__PURE__ */new Set,g=e=>{i?i(e):t({type:"REVENUE",value:e}),h.close()};return I(Wm,{placeholder:HL,onClick:g,SearchList:NE,DefaultList:WL,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 jL({list:e,onClick:t,NestedChildList:n}){return I(_m,{children:e.groups.map(e=>I(wE,{groupLabel:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(yE,{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($m,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:D(bE,{children:[e.value.iconUrl&&I(Ac,{Component:vg(e.value.iconUrl,e.value.name)}),I(cs,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const KL="All Tax Categories";function _L({handleConversion:e,region:t}){const n=Es(),r=Hm({data:[pR],groups:[{label:KL,key:KL}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(jL,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function YL({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=We(),d=!l&&i&&0===r.length;return l?I(av,{}):D(_m,{children:[a&&I("div",{children:I(Jm,{handleClick:t,children:I(cs,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(ao,{children:"Suggested"}),!d&&D(N,{children:[I(ao,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I($m,{handleClick:()=>e(t),selected:n,children:I(aL,{description:t.description,amount:lu(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const ZL={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function GL({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const o=m(()=>new Ee(n??[],ZL),[n]),i=m(()=>n?o.search(e).map(e=>e.item):[],[n,e,o]);return r?I(av,{}):0===i.length?I(jm,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I(_m,{children:I("div",{children:i.map(e=>{const n=a?.id===e.id;return I($m,{handleClick:()=>t(e),selected:n,children:I(aL,{description:e.description,amount:lu(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const QL=[];function XL({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=At(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:St(Lt(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:St(Lt(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=vl(s,{enabled:null!==l}),m=h?.data??QL,{query:{data:v}}=Dy({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),b=Es();return I(Wm,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),b.close()},SearchList:GL,DefaultList:YL,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 JL({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=y(function(e){switch(e){case"EXPENSE":return FL.indexOf(ML.EXPENSE);case"REVENUE":return FL.indexOf(ML.REVENUE);case"TAX_PAYMENT":return FL.indexOf(ML.TAX_EXPENSE);default:return FL.indexOf(ML.TRANSFER)}}(e)),{category:c,glAccount:d,tax:u,date:h,bankAccount:p,reconciliationMatch:g,amount:m}=o,v=u?.paymentInfo?.region,b=p?.id;return D(Lm,{title:t,children:[!i&&I(vv,{options:FL,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(FL[l].value){case"EXPENSE":return I(VL,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(zL,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:d});case"TAX_PAYMENT":return I(_L,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:v});case"BANK_TRANSFER":return I(XL,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:m??0,transactionDate:h,reconciliationMatch:g})}},{})]})}const $L=qn({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function eM({children:e}){const{startPrefetch:t,cancelPrefetch:n}=lg();return I("button",{className:$L,type:"button",onMouseEnter:t,onMouseLeave:n,children:e})}const tM=qn({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function nM({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!Gn(o)&&""!==o.id,l=Gn(o?.iconUrl)?void 0:vg(o.iconUrl,"Expense Icon");return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(Th,{label:"Category",popupTriggerProps:e,children:D(eM,{children:[i?D("div",{className:tM,children:[l&&I(Ac,{Component:l}),I(cs,{wrap:"wrap",children:o.name})]}):I(cs,{intent:"weak",children:"Select category"}),I(Ac,{Component:li})]})})}),I(JL,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function rM(){const{query:{data:e}}=BA(),t=m(()=>e?.data??[],[e]),n=m(()=>function(e){return Gn(e)?[]:function(e){const t=[],n=/* @__PURE__ */new Set;for(const r of e){const{id:e,name:a,requiredness:o}=r.label;if(Gn(e)||n.has(e))continue;const i=r.children.find(e=>!Gn(e.label.id)),l=i?.label,s=Gn(l?.id)?null:{id:l.id,name:l.name??"",status:"ACTIVE",requiredness:l.requiredness??"NOT_REQUIRED",child:null};n.add(e),t.push({id:e,name:a??"",status:"ACTIVE",requiredness:o??"NOT_REQUIRED",child:s})}return t}(e.data??[]).sort((e,t)=>e.id.localeCompare(t.id))}(e),[e]),r=m(()=>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))}),{labelsToIndex:t,childToRootId:n,labelFieldCount:e.length}}(n),[n]);return{nestedClassSegments:t,nestedClassSegmentLabels:n,classSegmentLabelLookup:r}}const aM=qn({display:"flex",gap:"8px",alignItems:"center"});function oM({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!Gn(o)&&""!==o.id,l=Gn(o?.iconUrl)?void 0:vg(o.iconUrl,"Revenue Icon");return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(Th,{label:"Category",popupTriggerProps:e,children:D(eM,{children:[i?D("div",{className:aM,children:[l&&I(Ac,{Component:l}),I(cs,{children:o.name})]}):I(cs,{intent:"weak",children:"Select category"}),I(Ac,{Component:li})]})})}),I(JL,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function iM(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:""},classSegments:e.classSegments??[],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 lM=(e,t,n)=>{const r=new Set((e=>{const t=[];for(const n of e)for(const e of n.classSegments)e.label?.id&&t.push(e.label.id);return t})(e).map(e=>n.childToRootId.get(e)??e)),a=e.some(e=>!Gn(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},sM={id:"customer",name:"Customer"};function cM(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,classSegments:e.classSegments,customer:e.customer,amount:e.amount}}function dM(e){return iM({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,classSegments:e.classSegments,customer:e.customer})}function uM(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 hM=qn({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),pM=qn({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),gM=qn({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),mM=zv({defaultValues:{children:[],itemizeByOptions:{}},props:{index:0,transactionType:"EXPENSE",onUnitemize:()=>{}},render:function({form:e,index:t,transactionType:n,onUnitemize:r}){const{nestedClassSegments:a,nestedClassSegmentLabels:o,classSegmentLabelLookup:i}=rM(),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 D("div",{className:hM,children:[D("div",{className:pM,children:[I(cs,{children:`Line Item #${t+1}`}),D(zs,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(cs,{children:"Remove"}),I(Ac,{Component:LS})]})]}),D("div",{className:gM,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(nM,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(oM,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),I(e.Subscribe,{selector:e=>({itemizeByOptions:e.values.itemizeByOptions,childClassSegments:e.values.children[t].classSegments}),children:({itemizeByOptions:n,childClassSegments: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=>!Gn(t?.label?.id)&&(i.get(t.label.id)??t.label.id)===e);return-1===a?null:{fieldLabel:r.find(t=>t.id===e)?.name??"",classSegmentOptions:UR(n,e),segmentIndex:a}}).filter(e=>null!==e)}(n,r,a,o,sM.id,i).map(({fieldLabel:n,classSegmentOptions:r,segmentIndex:a})=>I(e.AppField,{name:`children[${t}].classSegments[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.ClassSegmentField,{fieldLabel:n,classSegmentOptions:r,classSegmentLabels:o,selectedSegment:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(VR(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})})})]})]})}}),vM=qn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function bM({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=Es();return I(Os,{children:D(kp,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return I(Rp,{onClick:()=>{n(e.id,!r)},children:D("div",{className:vM,children:[I(cs,{children:a(e)}),I(Ac,{Component:r?Ym:Zm})]})},e.id)}),!Gn(r)&&I(Rp,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(cs,{children:"Confirm Selection"})})]})})}const fM=e=>Object.keys(e).filter(t=>e[t]);function yM({classSegmentLabels:e,itemizeByOptions:t,onCheckboxChange:n}){return D(ks,{placement:"bottom-end",children:[I(As,{children:e=>D(zs,{popupTriggerProps:e,children:[I(cs,{children:"Itemize By"}),I(Ac,{Component:kh})]})}),I(bM,{items:[...e,sM],selectedIds:fM(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const xM=qn({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),TM=qn({display:"flex",justifyContent:"space-between",alignItems:"center"}),CM=qn.raw({color:"surface.intent.danger.active"}),wM=qn({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function kM({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=FR(n),i=OR(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 D("div",{className:xM,children:[D("div",{className:TM,children:[I(cs,{children:`${Uf[e]} amount`}),I(cs,{children:kP(t)})]}),D("div",{className:TM,children:[I(cs,{children:"Line items total"}),I(cs,{children:kP(o)})]}),D("div",{className:TM,children:[I(cs,{extraClassNames:l?[CM]:void 0,children:"Difference"}),I(cs,{extraClassNames:l?[CM]:void 0,children:(d=t,u=o,no(new V(d).minus(u).toNumber(),"default"))})]}),l&&D("div",{className:wM,children:[I(pi,{Component:Qu}),I(cs,{extraClassNames:[CM],children:c})]}),s&&D("div",{className:wM,children:[I(pi,{Component:Qu}),I(cs,{extraClassNames:[CM],children:"At least 2 line items are required"})]})]});var d,u}function EM({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(nh,{onSave:e,children:I(kM,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const AM=qn({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function SM(e){const{form:t,classSegmentLabels:n,handleAddLineItem:r,handleUnitemize:a,handleItemizeCheckboxChange:o}=function({childTransactions:e,onSubmit:t,transactionType:n,amount:r,category:a,glAccount:o}){const{nestedClassSegmentLabels:i,classSegmentLabelLookup:l}=rM(),s=m(()=>"EXPENSE"===n?{category:a}:{glAccount:o??void 0},[a,o,n]),c=m(()=>{if(e.length>0)return e;const t=new V(r).div(2).round(2,V.roundDown),n=new V(r).sub(t);return[iM({amount:t.toNumber(),...structuredClone(s)}),iM({amount:n.toNumber(),...structuredClone(s)})]},[e,r,s]),d=Es(),u=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return IR;case"BANK_TRANSFER":return RR;case"REVENUE":return LR}}(r);return qv({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=eP(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=FR(e.children.map(e=>e.amount));return OR(n,r)?{form:"amount-mismatch",fields:t}:Object.keys(t).length>0?{fields:t}:void 0}},onSubmit:e=>{a(e.value.children)}})}({childTransactions:c,itemizeByOptions:lM(c,i,l),parentAmount:r,transactionType:n,onSubmit:e=>{t(e),d.close()}});return{form:u,classSegmentLabels:i,handleAddLineItem:()=>{const e=u.state.values.children,t=e[0];u.setFieldValue("children",[...e,iM({...t,id:"",amount:0,customer:null,...s})])},handleUnitemize:()=>{const e=u.state.values.children[0];t([e]),d.close()},handleItemizeCheckboxChange:(e,t)=>{if(u.setFieldValue("itemizeByOptions",{...u.state.values.itemizeByOptions,[e]:t}),e===sM.id)return void(t||u.setFieldValue("children",u.state.values.children.map(e=>({...e,customer:null}))));if(t){const t=i.find(t=>t.id===e);if(Gn(t))return;const n={id:"",label:t},r=u.state.values.children.map(e=>({...e,classSegments:[...e.classSegments??[],n]}));return void u.setFieldValue("children",r)}const n=u.state.values.children.map(t=>({...t,classSegments:t.classSegments.filter(t=>t.label?.id!==e)}));u.setFieldValue("children",n)}}}(e),i=I(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>I(yM,{classSegmentLabels:n,itemizeByOptions:e,onCheckboxChange:o})}),l=I(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>I(EM,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return D(Pm,{title:"Edit Line Items",HeaderRightAction:i,Footer:l,padChildren:!1,children:[I(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>I(mM,{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:AM,children:e.length<10&&D(zs,{onClick:r,active:!1,children:[I(cs,{children:"Add Line Item"}),I(pi,{Component:Fl})]})})})]})}function IM(e){const t=Es();return I(wm,{children:t.open&&I(SM,{...e})})}function NM({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=Es();return D(ks,{children:[I(As,{children:e=>I(yS,{Icon:fx,popupTriggerProps:e,children:"Itemize"})}),I(IM,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(cM)),r.close()}})]})}const DM=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?D(ks,{children:[I(As,{children:e=>I(RL,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(LL,{conversationId:r,attachedEntityId:a})]}):I(RL,{onClick:n,activeTab:t}),RM=zv({defaultValues:YR,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=Ve(),s=MT(),c=!Gn(n)&&vp(n)&&"EXPENSE"===n.type,d=x(t=>{uM(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(Sm,{children:D(Nm,{children:[I(Jd,{}),I(ao,{children:t}),i&&I(DM,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(pw,{shouldUseButtonDiscreteStyles:!0,children:D(kp,{children:[I(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>D(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&I(QP,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&I(SL,{form:e}),0===t.length&&I(NM,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:d}),WR(t)&&I(yS,{Icon:fx,onClick:()=>d([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(NL,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===OS.ACTIVE&&I(nP,{transaction:n}),n?.status===OS.INACTIVE&&I(rP,{transaction:n})]})})]})})}});function PM(e){return 0===e.length||WR(e)&&e.every(e=>null===e.customer)}const LM=zv({defaultValues:YR,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=Ve();return D(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=>PM(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(nM,{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})})]})}}),MM=zv({defaultValues:YR,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return D(N,{children:[I(e.Subscribe,{selector:e=>PM(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(oM,{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 FM({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===bx(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(Th,{label:a,popupTriggerProps:e,children:D(eM,{children:[r?I(aL,{description:r.description||"",amount:r.amount||0,date:r.date||wt(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(cs,{intent:"weak",children:"Needs Match"}),I(Ac,{Component:li})]})})}),I(JL,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const OM=zv({defaultValues:YR,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return D(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(FM,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function BM({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return D(ks,{placement:"bottom-start",children:[I(As,{children:e=>I(Th,{label:"Category",popupTriggerProps:e,children:D(eM,{children:[I(cs,{children:gR(r?.paymentInfo?.region)??"Select region..."}),I(Ac,{Component:li})]})})}),I(JL,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const UM=zv({defaultValues:YR,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return D(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(BM,{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:dR})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:yt({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})})]})}}),VM=zv({defaultValues:YR,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 Qn(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:lu(t.value.transfer.amount)}),Qn(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(LM,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return I(MM,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return I(OM,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return I(UM,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),WM=nr(null,qn({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function HM({transaction:e,bankAccount:t}){const n=e?e.description:"",r=Gn(t)||Gn(e)?"":((e,t)=>{const n=qf(t.type),r=bx(t.amount);return`${n?`${r} `:""}${du(e.name,e.mask)}`})(t,e);return D("div",{...WM,children:[I(ao,{wrap:"wrap",children:n}),t&&I(io,{children:r})]})}const qM=qn({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),zM=qn({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function jM({attachments:e,onRemove:t}){return I("div",{className:qM,children:I("div",{className:zM,children:e.map(e=>I(OD,{attachment:e,onRemove:t},e.localId))})})}const KM=zv({defaultValues:YR,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=Eu({mutationFn:ep,onSuccess:async()=>{await xr.invalidateQueries({queryKey:["files/attachments"]}),await xr.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>D(N,{children:[I(e.AttachmentDropzoneField,{entityId:kl(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(jM,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),_M=qn({display:"flex",flexDirection:"column",gap:"8px"});function YM({children:e}){return I("div",{className:_M,children:e})}const ZM=_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 GM({children:e,surface:t,style:n}){const r=qn(ZM.raw({surface:t}),n);return I("div",{className:r,children:e})}function QM(){return I(Gu,{alignment:"horizontal"})}const XM=qn({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function JM(e){return I("div",{className:XM,children:e.children})}function $M({property:e}){return"string"==typeof e?I(cs,{children:e}):e}function eF({label:e,value:t}){return D(JM,{children:[I($M,{property:e}),I($M,{property:t})]})}function tF(e){return wt(At(e))}function nF({amount:e,date:t,description:n}){return D(GM,{surface:"foreground",children:[I(eF,{label:"Description",value:n}),I(QM,{}),I(eF,{label:"Date",value:tF(t)}),I(QM,{}),I(eF,{label:"Amount",value:kP(e)})]})}const rF=qn.raw({padding:12});function aF({amount:e}){return I(GM,{surface:"background",style:rF,children:I(eF,{label:"Fee",value:kP(e)})})}const oF=qn({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),iF=qn({display:"flex",alignItems:"center",gap:"8px"});function lF({label:e,warning:t}){return D("div",{className:oF,children:[I(cs,{children:e}),t&&D("div",{className:iF,children:[I(Ac,{Component:Qu}),t]})]})}function sF(e){return kP(Math.abs(e))}function cF(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new V(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?`${sF(c)} Overpaid`:"underpaid"===o?function(e){return`${sF(e)} Underpaid`}(c):null}const dF=zv({defaultValues:YR,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=y(!1);return D(YM,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=cF(t,e.amount,e.type);return I(lF,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?I(nF,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?I(aF,{amount:Math.abs(e.amount)},`fee_${t}`):null),D(ks,{open:n,onOpenChange:r,children:[I(As,{children:e=>D(zs,{popupTriggerProps:e,children:[I(cs,{children:"Edit Linked Invoices"}),I(pi,{Component:li})]})}),I(TL,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=wL(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:t=>{const n=EL(t);e.setFieldValue("children",n),r(!1)},hasExistingInvoices:!0,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function uF({transactionType:e,amount:t,category:n,glAccount:r,classSegments:a,classSegmentLabels:o,customer:i}){const l=[{label:"Amount",value:kP(t)},{label:"Category",value:"EXPENSE"===e?n?.name??"":r?.name??""},...o.map(e=>{const t=a.find(t=>t.label?.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(GM,{children:l.map((e,t)=>D(S,{children:[t>0&&I(QM,{}),I(eF,{label:e.label,value:e.value.toString()})]},e.label))})}const hF=async e=>{const t=e.queryKey,n={path:"/v6/templates/classes/labels/query",accessToken:t[1].accessToken,endpointManager:Ei(t[1].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}},pF=zv({defaultValues:YR,render:function({form:e}){const{query:{data:t}}=wr({queryKey:["classSegmentLabels"],queryFn:hF}),n=e.state.values.children;if(WR(n))return D(YM,{children:[I(cs,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(uF,{transactionType:e.state.values.type,amount:n.amount??0,category:n.category??null,glAccount:n.glAccount??null,classSegments:n.classSegments,classSegmentLabels:t?.data??[],customer:n.customer},`${n.id}_${r}`)),D(ks,{children:[I(As,{children:e=>D(zs,{popupTriggerProps:e,children:[I(cs,{children:"Edit Line Items"}),I(pi,{Component:li})]})}),I(IM,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(dM),onSubmit:t=>{uM(t.map(cM),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),gF=zv({defaultValues:YR,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=y(!1);return D(YM,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=cF(t,e.amount,e.type);return I(lF,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?I(nF,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?I(aF,{amount:Math.abs(e.amount)},`fee_${t}`):null),D(ks,{open:n,onOpenChange:r,children:[I(As,{children:e=>D(zs,{popupTriggerProps:e,children:[I(cs,{children:"Edit Linked Bills"}),I(pi,{Component:li})]})}),I(UP,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=HP(t);0!==n&&a.push(VP(n)),e.setFieldValue("children",a),r(!1)}})]})]})}});function mF({amount:e,bankAccountName:t,date:n,description:r}){return D(GM,{surface:"foreground",children:[I(eF,{label:"Description",value:r}),I(QM,{}),t&&D(N,{children:[I(eF,{label:"Account",value:t}),I(QM,{})]}),I(eF,{label:"Date",value:tF(n)}),I(QM,{}),I(eF,{label:"Amount",value:kP(e)})]})}const vF=zv({defaultValues:YR,render:function({form:e}){const[t,n]=y(!1);return D(YM,{children:[I(lF,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?I(mF,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),D(ks,{open:t,onOpenChange:n,children:[I(As,{children:e=>D(zs,{popupTriggerProps:e,children:[I(cs,{children:"Edit Linked Transactions"}),I(pi,{Component:li})]})}),I(gL,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,onSubmit:t=>{const r=EL(t);e.setFieldValue("children",r),n(!1)}})]})]})}}),bF=zv({defaultValues:YR,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?I(dF,{form:e}):t.some(e=>"bill"===e.lineItemType)?I(gF,{form:e}):t.some(e=>"payment"===e.lineItemType)?I(vF,{form:e}):WR(t)?I(pF,{form:e}):null}});function fF({transaction:e,classSegmentLabels:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedClassSegments:c}=rM(),d=void 0===i?Vf[s]:Wf[s],[u,h]=y(l??null),p=I(RM,{form:n,transaction:e,title:d,activeTab:u,tabOnClick:e=>h(e===u?null:e),conversationId:o,transactionId:i}),g=I(n.Subscribe,{selector:e=>e.isDefaultValue,children:e=>I(nh,{disabled:e})});return D(cR,{onSubmit:n.handleSubmit,Header:p,Footer:g,activeTab:u,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(HM,{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(VM,{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?.label?.id)),a=n.filter(e=>!r.has(e.label?.id));return t.filter(e=>!r.has(e.id)).map(e=>{const n=t.findIndex(t=>t.id===e.id),r=UR(a,e.id);return{fieldLabel:e.name,classSegmentOptions:r,segmentIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.classSegments:[]),t,c).map(({fieldLabel:e,classSegmentOptions:r,requiredness:a,segmentIndex:o})=>I(n.AppField,{name:`classSegments[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>I(n.ClassSegmentField,{fieldLabel:e,classSegmentOptions:r,classSegmentLabels:t,selectedSegment:n.state.value,onSave:e=>n.handleChange(VR(e))})},r[0][0].id))}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>Ge(e)&&I(bF,{form:n})}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(KM,{form:n,transactionId:i})]})}function yF({transactionId:e,initialTab:t,initialType:n}){const{transaction:r,nestedClassSegmentLabels:a,form:o,bankAccount:i,isManual:l,isLoading:s}=function({transactionId:e,initialType:t}){const{nestedClassSegmentLabels:n,classSegmentLabelLookup:r}=rM(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=fl({id:e,enabled:void 0!==e});return{transaction:a,nestedClassSegmentLabels:n,form:tP(a,r,t),bankAccount:Qp(a?.bankAccount?.id??""),isManual:Gn(a)||vp(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(fF,{transaction:r??null,classSegmentLabels:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function xF({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=fl({id:e});return T(()=>{!r&&Gn(n)&&il()},[n,r]),Gn(n)?null:I(yF,{transactionId:e,initialTab:t})}function TF({transactionId:e,initialTab:t,initialType:n}){return e?I(xF,{transactionId:e,initialTab:t}):!e&&n?I(yF,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}const CF={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},wF=(e={})=>{const t=Ln(CF,e);return CF.transform(t,Pn)},kF=e=>qn(wF(e));kF.raw=wF;const EF={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},AF=(e={})=>{const t=Ln(EF,e);return EF.transform(t,Pn)},SF=e=>qn(AF(e));function IF({subject:e,children:t}){return D(Sm,{children:[D(Nm,{children:[I(Jd,{}),I(ao,{children:e})]}),I("div",{className:SF({alignItems:"center",gap:15}),children:t})]})}function NF({conversationId:e,defaultValues:t}){const[n,r]=y(e),{query:{data:a}}=zi(n),o="CLOSED"===a?.resolutionStatus;return I(jN,{children:D(_N,{children:[I(IF,{subject:a?.subject??"Conversation"}),I(tR,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}SF.raw=AF;const DF=oi(e=>p.createElement("svg",{width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("g",{clipPath:"url(#clip0_18201_5557)"},p.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}),p.createElement("path",{d:"M7.49999 10.4812V6.30624H6.30624",strokeWidth:.9375,strokeMiterlimit:10}),p.createElement("path",{d:"M6.30624 10.4813H8.69374",strokeWidth:.9375,strokeMiterlimit:10}),p.createElement("path",{d:"M6.90625 4.51874H8.09375",strokeWidth:.9375,strokeMiterlimit:10})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_18201_5557"},p.createElement("rect",{width:15,height:15,fill:"white"})))),"Info");function RF({onClick:e,active:t}){return I(Xl,{type:"button",onClick:e,active:t,children:I(Ac,{Component:DF})})}const PF=qn({display:"flex",flexDirection:"column"});function LF({label:e,data:t,isFilling:n,shimmerWidth:r}){return D("div",{className:PF,children:[I(io,{children:e}),n?I(GD,{width:r}):I(ao,{wrap:"wrap",children:t??""})]})}function MF({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=fl({id:e}),a=Qp(n?.bankAccount.id??"");if(Gn(n))return null;const o=kF({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 D("div",{"data-open":t,className:o,children:[D("div",{className:SF({justifyContent:"space-between"}),children:[I(LF,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(LF,{label:"Amount",data:eo(lu(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(LF,{label:"Bank Account",data:du(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(LF,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function FF({conversationId:e,transactionId:t}){const[n,r]=y(e),[a,o]=y(!0),{query:{data:i}}=zi(n),l="CLOSED"===i?.resolutionStatus;return I(jN,{children:D(_N,{children:[I(IF,{subject:i?.subject??"Conversation",children:Qn(t)&&I(RF,{onClick:()=>o(!a),active:a},"infoButton")}),Qn(t)&&I(MF,{transactionId:t,isOpen:a}),I(tR,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function OF(){const e=ll().length>1;return I(jN,{children:D(_N,{background:"foreground",children:[I(Sm,{children:D(Nm,{children:[I(Jd,e?{Icon:ii}:{}),I(ao,{children:"Add New Connection"})]})}),I(Xk,{})]})})}function BF(){return I(Sm,{children:D(Nm,{children:[I(Jd,{}),I(ao,{children:"Financial Summary"})]})})}const UF=qn({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),VF=sr.raw({body:"default"}),WF=qn({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},VF);function HF({summaryText:e}){return I("div",{className:UF,children:I("div",{className:WF,children:e})})}const qF=qn({display:"flex",flexDirection:"column",overflow:"auto"});function zF({summary:e}){return D("div",{className:qF,children:[I(BF,{}),I(HF,{summaryText:e})]})}const jF=qn({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function KF({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return wr({queryKey:Rl({id:e}),queryFn:Ll})}({id:e});return I(jN,{children:D("div",{className:jF,children:[I(_N,{children:I(zF,{summary:n?.summary})}),I(Gu,{}),I(nR,{conversationId:t??null,attachedEntityId:e})]})})}function _F(){return I(jN,{children:I(_N,{children:I(uE,{showCloseButton:!0,inOverlay:!0})})})}const YF=h.object({id:h.string(),name:h.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:h.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:h.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;gr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),ZF={mergeDestination:_g,selectedAccount:null};const GF=qn({display:"flex",flexDirection:"column",gap:"20px"}),QF=qn({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),XF=qn.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),JF=qn(XF,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),$F=qn(XF,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),eO=qn(XF,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),tO=qn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),nO=qn({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),rO=qn({width:"100%",display:"flex",justifyContent:"flex-start"}),aO=qn({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),oO=qn({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),iO=e=>{ph(e),gh(e)};function lO({account:e}){const t=Es(),n=function(e,t){const{mutateAsync:n}=Ru();return qv({defaultValues:ZF,onSubmit:async r=>{if(await Bu()===zd&&Qn(e)&&Qn(r.value.selectedAccount)){const l=(a=e,o=r.value.mergeDestination,i=r.value.selectedAccount,o===_g?{...Fu(i),duplicateBankAccountIds:[kl(a.id)]}:{...Fu(a),duplicateBankAccountIds:[kl(i.id)]});try{await n(l),t.close(),r.value.mergeDestination===_g&&il()}catch{await Uu()}}var a,o,i},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=bu();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 D("form",{className:GF,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:iO,children:[I(ao,{children:"Merge Accounts"}),I("div",{className:QF,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>D(N,{children:[D("div",{className:JF,children:[I("div",{className:rO,children:I(ao,{children:"Duplicate Account"})}),t===_g?I(qg,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Zg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Gg(t,e,n.state.value)})})]}),D("div",{className:$F,children:[I("div",{className:aO,children:I(ao,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:nO,children:I(Xl,{onClick:()=>e.handleChange(e.state.value===_g?Kg:_g),children:I(Ac,{Component:li})})})})]}),D("div",{className:eO,children:[I("div",{className:oO,children:I(ao,{children:"Destination Account"})}),t===_g?I(n.AppField,{name:"selectedAccount",children:n=>I(Zg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Gg(t,e,n.state.value)})}):I(qg,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),D("div",{className:tO,children:[I(Kv,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(Ku,{disabled:Gn(e),showIcon:!1,textContent:"Merge"})})]})]})}function sO({bankAccount:e}){return I(kp,{children:D(ks,{placement:"right-start",children:[I(As,{children:e=>D(Rp,{...e,children:[I(Ac,{Component:Nw}),I(ao,{children:"Merge Account"})]})}),I(Tm,{children:I(bw,{children:I(yw,{children:I(lO,{account:e})})})})]})})}const cO=qn({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"}}}),dO=({tranStartDate:e})=>D(N,{children:[I(io,{children:"Start Date"}),mr(e)?I(ao,{children:`${Pt(At(e))}`}):I(ao,{children:"Set Start Date"})]});function uO({bankAccount:e}){return D(ks,{placement:"right-start",children:[I(As,{children:t=>I("button",{className:jn(cO,di),...t,type:"button",children:I(dO,{tranStartDate:e.tranStartDate})})}),I(Tm,{children:I(bw,{children:I(yw,{width:"sm",children:I(Aw,{bankAccounts:[e]})})})})]})}const hO=e=>["accounting/manualJournalEntry",e.id],pO=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 Li(a)};function gO({id:e}){return wr({queryKey:hO({id:String(kl(e))}),queryFn:pO,enabled:Qn(e)})}const mO=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:Ca(n)};return await ba(r)})({data:e,accessToken:t,environment:n});const vO=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Ca(n)};return await ba(r)},bO=h.object({amount:h.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:h.string("Required")}),fO=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===kl(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},yO=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=gO({id:t??null}),r=function(){const{query:{data:e}}=Ry();return qy(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutate:a}=Eu({mutationFn:vO,onSuccess:async()=>{oa("beginning balance mutation successful, invalidating bank account queries");try{return xr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ia({error:e,severity:"error"})}}});const{mutate:o}=Eu({onSuccess:async()=>{oa("mutation successful, invalidating manual journal entry queries");try{return Promise.all([xr.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),xr.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&ia({error:e,severity:"error"})}},mutationFn:mO}),i=Es(),l=((e,t)=>{const n=fO(e,t);return{amount:Qn(e.beginningBalanceData.journalEntry?.id)?n:"",date:Qn(t?.date)?t.date:""}})(e,n);return qv({defaultValues:l,validators:{onBlur:bO},onSubmit:l=>{if(i.close(),Gn(t)||Gn(n))a({bankAccountId:kl(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(Gn(e.id))return null;const o={...e,id:e.id},i=a.map(e=>kl(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===kl(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),Gn(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=St(t)??o.date,o)})(n,At(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);Qn(t)&&o(t)}}})},xO=qn({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),TO=qn({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function CO({bankAccount:e}){const t=yO(e),n=Es(),r=()=>{n.close()};return D("form",{className:xO,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(ao,{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=>D("div",{className:TO,children:[I(Kv,{showIcon:!1,onClick:r}),I(Ku,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const wO=_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"}}}}),kO=qn({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function EO({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=jn(wO({layout:a}),di),i=jn(wO({layout:"right"}),di),l=r&&Pt(r);return D(ks,{placement:"right-start",children:[I(As,{children:e=>D("div",{className:kO,children:[D("button",{className:o,...e,type:"button",children:[I(io,{children:"Beginning Balance"}),I(ao,{children:Qn(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&D("button",{className:i,...e,type:"button",children:[I(io,{children:"Migration Date"}),I(ao,{children:l})]})]})}),I(Tm,{children:I(bw,{children:I(yw,{width:"sm",children:I(CO,{bankAccount:e})})})})]})}const AO=_n({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function SO({bankAccount:e,showStartDate:t}){const{query:{data:n}}=gO({id:e?.beginningBalanceData.journalEntry?.id??null});if(!e)return null;const r=fO(e,n),a=Qn(n?.date)?At(n?.date):null,o=Qn(e.tranStartDate)?At(e.tranStartDate):null,i=Qn(a)&&Qn(o)&&!xt(a,o),l=i?"left":t?"right":"left";return D("div",{className:AO({layout:i?"stacked":"inline"}),children:[t&&I(uO,{bankAccount:e}),I(EO,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const IO=qn({marginTop:"15px",marginBottom:"15px"}),NO={id:"",name:"",mask:"",type:void 0};const DO=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],RO=e=>{ph(e),gh(e)};function PO({bankAccountId:e}){const t=Qp(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:NO,[r,a]=y(n),o=function(e,t){const{mutate:n}=Ru(),{mutateAsync:r}=Du({mutationFn:Su}),a=mr(String(e.id));return qv({defaultValues:e,validators:{onBlur:YF},onSubmit:async e=>{if(a)n(Fu(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:wl({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||Lu(t.apiName),l=!!t&&Mu(t.apiName),s=du(r?.name??"",r?.mask??""),c=mr(s)?s:"New Bank Account",d=l&&Qn(t?.tranStartDate),u=Qn(t)&&(d||!0);return I(jN,{children:I(_N,{children:D("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:RO,children:[D(Sm,{children:[D(Nm,{children:[I(Jd,{Icon:ii}),I(ao,{children:c}),Qn(t)&&I(pw,{shouldUseButtonDiscreteStyles:!0,children:I(sO,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),D(aR,{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:DO,disabled:!i})}),u&&D(N,{children:[I("div",{className:IO,children:I(Gu,{alignment:"horizontal"})}),I(SO,{bankAccount:t,showStartDate:d})]})]})]})})})}function LO({popupTriggerProps:e,text:t}){return D(Jm,{popupTriggerChildrenProps:e,children:[I(bE,{children:I(cs,{wrap:"wrap",children:t})}),I(Ac,{Component:li})]})}function MO({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=dC(n,e.key),i=hC(e.name,o,1);return D(ks,{children:[I(As,{children:e=>I(LO,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>uC(n,e.key,t))},filters:a})]})}const FO=oi(Og,"Bank");function OO({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(yA,{isSelected:n}):I(Qm,{selected:n,showEmptyIndicator:!0});return D(Jm,{handleClick:t,selected:n,children:[D(bE,{children:[o&&I(wc,{imageUrl:e.iconUrl,Component:FO}),I(cs,{wrap:"wrap",children:e.name})]}),i]})}function BO({values:e,model:t,pendingFilters:n,onClick:r}){return D(_m,{children:[I(io,{children:"Filter by"}),I("div",{children:e.length>0?e.map((e,a)=>{const o=dC(n,t.key),l=(s=e,o.some(e=>i(e.value,s.value)));var s;return I(OO,{handleClick:()=>r(e),value:e,isActive:l,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(jm,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})]})}function UO({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:o}){const i=m(()=>new Ee(e,Up),[e]),l=m(()=>i.search(o).map(e=>e.item),[i,o]);return I(BO,{values:l,model:t,filters:n,pendingFilters:r,onClick:a})}function VO({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I(Wm,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:UO,DefaultList:BO,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}const WO=qn({padding:"16px",flex:"1 1 0",overflowY:"auto"});function HO({filters:e,filterModels:t,setFilters:n}){const r=ll().length>1,a=MT(),[o,i]=y(()=>function(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}(e,t));return I(jN,{children:D(_N,{children:[I(Sm,{children:D(Nm,{children:[I(Jd,r?{Icon:ii}:{}),I(cs,{children:"Back"})]})}),I("div",{className:WO,children:D(_m,{children:[I(io,{children:"Filter by"}),I("div",{children:t.filter(e=>{return n=a,(t=e)&&(n||!n&&!t.hideInFilterListOnDesktop);var t,n}).map(t=>{const r=t.possibleValues?t.possibleValues():null;return Gn(r)?I(MO,{model:t,setFilters:n,pendingFilters:o,setPendingFilters:i,filters:e},t.key):I(qO,{model:t,filters:e,pendingFilters:o,setPendingFilters:i,setFilters:n},t.key)})})]})}),I(OE,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),i(e)},onApply:()=>{const e=function(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}(o);n(e),il()}})]})})}function qO({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){if(void 0===e.possibleValues)return;const{values:o,isFilling:i}=e.possibleValues();if(Gn(o)||!Ge(o))return;const l=dC(n,e.key),s=hC(e.name,l);return i?I(tv,{}):D(ks,{children:[I(As,{children:e=>I(LO,{popupTriggerProps:e,text:s})}),I(zO,{values:o,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})]})}function zO({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o}){const l=Es(),s=e=>{a(n=>{const r=dC(n,t.key),a=t.singleSelect?(o=r,l=e,s=t.createFilter,o.some(e=>i(e.value,l.value))?o:[s(l)]):function(e,t,n){const r=e.findIndex(e=>i(e.value,t.value));return-1!==r?e.filter((e,t)=>t!==r):[...e,n(t)]}(r,e,t.createFilter);var o,l,s;return uC(n,t.key,a)})};return t.SimpleListComponent?I(Lm,{title:"Back",children:I(t.SimpleListComponent,{filters:n,pendingFilters:r,onToggle:s,model:t,setPendingFilters:a,setFilters:o})}):I(Lm,{title:"Back",Footer:I(OE,{onClearAll:()=>{a(e=>uC(e,t.key,[]))},onApply:()=>{const e=dC(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:s,model:t,setPendingFilters:a,setFilters:o}):I(VO,{values:e,model:t,filters:n,pendingFilters:r,onClick:s})})}function jO({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=qA(e);return I(HO,{filters:n,filterModels:t,setFilters:r})}function KO(){const e=cN();return I(jO,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function _O(){const e=SN();return I(jO,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function YO(){const e=KA();return I(jO,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function ZO(){return D(VN,{children:[I(HN,{name:"BankTransactionForm",Component:TF}),I(HN,{name:"Conversation",Component:NF}),I(HN,{name:"MobileConversation",Component:FF}),I(HN,{name:"FinancialSummary",Component:KF}),I(HN,{name:"BanksAndIntegrations",Component:_F}),I(HN,{name:"BankAccountForm",Component:PO}),I(HN,{name:"NewConnection",Component:OF}),I(HN,{name:"TransactionsFilterList",Component:YO}),I(HN,{name:"ExpensesFilterList",Component:KO}),I(HN,{name:"RevenueFilterList",Component:_O})]})}const GO=({environment:e,children:t})=>I(Tr.Provider,{value:e,children:t});function QO({children:e}){const{query:{data:t}}=Fx(),n={userId:t?.userId,userRole:t?.userRole||"OWNER",userEmail:t?.email,companyId:t?.companyId?wl({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};return I(Qs.Provider,{value:n,children:e})}const XO=e=>["whiteLabels",e??{}],JO=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await va(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function $O({children:e}){const t=Px(),{query:{data:n}}=Ni({queryKey:XO({filter:{name:{equal:t}}}),queryFn:JO}),r={icons:n?.data?.[0]?.icons};return I(ri.Provider,{value:r,children:e})}const eB=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const tB="SSE connection failed with status";function nB({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Cr();T(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Ta[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 Re(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${tB} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case eB.CONNECTED:return void oa("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case eB.ERROR:throw ia({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case eB.CACHE_BUST:return oa("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(()=>{xr.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>ia({error:e,severity:"error"}))},500*Math.random()),oa(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void ia({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 ia({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(tB))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>ia({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const rB=[eB.CACHE_BUST];function aB({children:e}){const{companyId:t,customerPartnerId:n}=b(Qs);return nB({companyId:t,customerPartnerId:n,sseTypes:rB}),e}const oB=v({dimensions:{width:null,height:null}}),iB="undefined"!=typeof window?k:T,lB="undefined"==typeof window;const sB=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;lB&&(t=!1);const[n,r]=y(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),a=ZT(r,e.debounceDelay,{leading:!0});function o(){(e.debounceDelay?a:r)({width:window.innerWidth,height:window.innerHeight})}return function(e,t,n,r){const a=g(t);iB(()=>{a.current=t},[t]),T(()=>{const t=window;if(!t||!t.addEventListener)return;const n=e=>{a.current(e)};return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}},[e,void 0,r])}("resize",o),iB(()=>{o()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I(oB.Provider,{value:r,children:e})},cB=({children:e})=>{const{dimensions:t}=b(oB),n=Qn(t.width)&&t.width<parseInt(uo("sizes.breakpoint-xl"));return I(LT.Provider,{value:n,children:e})};function dB({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return T(()=>{var e,r;e=n,r=t,ea.setProperties(ra),na=r,ta=e},[n,t]),I(GO,{environment:t,children:I(LN,{children:I(vr.Provider,{value:r,children:I(QO,{children:I($O,{children:I(aB,{children:I(sB,{children:D(cB,{children:[I(ye.ConfirmationRoot,{}),e,I(ZO,{})]})})})})})})})})}const uB=["BanksAndIntegrations"];function hB(e){return null!==e&&uB.includes(e)}const pB={FinancialOverviewDashboard:"/"};function gB({navState:e,onNavigate:t}){const n=Le(),r=Me(),a=pB[e.page]??"/";T(()=>{r.pathname!==a&&n(a)},[a,r.pathname,n]);const o=function(e){const t=g(e.anchor);return T(()=>{if(t.current=e.anchor,e.anchor){const n=document.getElementById(e.anchor);n&&(n.scrollIntoView({behavior:"smooth"}),t.current=void 0)}},[e.anchor,e.page]),x(e=>{t.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),t.current=void 0)},[])}(e),l=g(void 0);T(()=>{i(l.current,e.drawer)||(l.current=e.drawer,e.drawer&&ol(e.drawer.name,{replaceHistory:!0,routeProps:e.drawer.props}))},[e.drawer]);const s=g(e);s.current=e;const c=ll();T(()=>{const e=c.at(-1),n=e?function(e){const t=Object.keys(e)[0];if(t&&hB(t))switch(t){case"BankTransactionForm":case"NewConnection":case"BanksAndIntegrations":return{name:t};case"Conversation":{const n=e.Conversation;return n?{name:t,props:n.routeProps}:void 0}case"MobileConversation":{const n=e.MobileConversation;return n?{name:t,props:n.routeProps}:void 0}case"BankAccountForm":{const n=e.BankAccountForm;return n?{name:t,props:n.routeProps}:void 0}case"FinancialSummary":{const n=e.FinancialSummary;return n?{name:t,props:n.routeProps}:void 0}case"TransactionsFilterList":{const n=e.TransactionsFilterList;return n?{name:t,props:n.routeProps}:void 0}}}(e):void 0;i(s.current.drawer,n)||t({...s.current,drawer:n})},[c,t]);const d=x(e=>{n(pB[e.page]),t(e)},[t,n]),u=m(()=>({isApp:!0,navigate:d,registerAnchor:o}),[d,o]);return I(Rc.Provider,{value:u,children:D(Fe,{children:[I(Oe,{path:"/",element:I(rw,{})}),I(Oe,{path:"/transactions",element:I(iN,{})}),I(Oe,{path:"/banks",element:I(gE,{})}),I(Oe,{path:"/expense",element:I(kN,{})}),I(Oe,{path:"/income",element:I(DN,{})})]})})}function mB({accessToken:e,environment:t="PRODUCTION",navState:n,onNavigate:r}){return I(dB,{environment:t,accessToken:e,children:I(Pe,{initialEntries:[pB[n.page]??"/"],children:I(gB,{navState:n,onNavigate:r})})})}const vB={FinancialOverviewDashboard:!0},bB=new Set(Object.values(Go).flatMap(e=>Object.values(e)));function fB(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!vB[r])return;var r;const a=t.searchParams.get("bkDrawer");let o;if(hB(a)){const e=function(e){if("BanksAndIntegrations"===e)return{name:e}}(a);void 0!==e&&(o=e)}if("FinancialOverviewDashboard"===n){const e=t.searchParams.get("bkAnchor"),r=null!==(i=e)&&bB.has(i)?e:void 0;return void 0!==r&&void 0!==o?{page:n,anchor:r,drawer:o}:void 0!==r?{page:n,anchor:r}:void 0!==o?{page:n,drawer:o}:{page:n}}var i;return void 0!==o?{page:n,drawer:o}:{page:n}}export{gE as BanksAndIntegrations,rw as BusinessOwnerDashboard,kN as ExpenseDashboard,DN as IncomeDashboard,dB as Tight,mB as TightApp,iN as TransactionsDashboard,fB as parseNavUrl,hn as useOptions};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|