1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[973],{46220:function(e,t,a){a.d(t,{V:function(){return n}});let n=(e,t)=>{let a=Number(e);switch(t){case"NumberNoDecimals":return a.toLocaleString("en-US",{maximumFractionDigits:0});case"NumberDecimals":return a.toLocaleString("en-US",{maximumFractionDigits:2});case"NumberOneDecimal":return a.toLocaleString("en-US",{maximumFractionDigits:1});case"DollarsNoDecimals":return a.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0});case"DollarsDecimals":return a.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2});case"PercentNoDecimals":return a.toLocaleString("en-US",{style:"percent",maximumFractionDigits:0});case"PercentDecimals":return a.toLocaleString("en-US",{style:"percent",maximumFractionDigits:2});case"PercentOneDecimal":return a.toLocaleString("en-US",{style:"percent",maximumFractionDigits:1});default:return e}}},55148:function(e,t,a){a.d(t,{_:function(){return s}});var n=a(85893);a(67294);var r=a(32186);let s=e=>{let{title:t,children:a,placement:s,delay:i}=e;return(0,n.jsx)(r.Z,{PopperProps:{sx:{zIndex:999999}},arrow:!0,placement:s||"top",enterDelay:i||0,enterTouchDelay:i||0,enterNextDelay:i||0,title:t,children:a})}},31177:function(e,t,a){a.d(t,{m:function(){return _},v:function(){return ee}});var n=a(85893),r=a(47286),s=a(6433),i=a(16143),l=a(27484),o=a.n(l),c=a(70178),d=a.n(c),u=a(96671),h=a.n(u),m=a(79212),f=a.n(m),p=a(37412),y=a.n(p);o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let g=(e,t)=>{null==t||t.sort((e,t)=>e.date-t.date);let a=!t||0===t.length,n=e.map(e=>{if(a)return 0;let n=t.find(t=>o().unix(t.date).isSameOrAfter(o()(e).startOf("month"))&&o().unix(t.date).isSameOrBefore(o()(e).endOf("month")));return n&&n.amount||0});return{cumulArray:n.reduce((e,t,a)=>[...e,t+(e[a-1]||0)],[]),fundArray:n}};var x=a(48936);o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let b=e=>{let{lastAssetIndex:t,rows:a,assetTotals:n,lastLiabIndex:s,liabTotals:i}=e;if(-1!==t){let e=["Total assets",...n];a.splice(t+1,0,e)}if(-1!==s){let e=["Total liabilities",...i];a.push(e)}let l=Array.from({length:n.length},(e,t)=>n[t]-i[t]),o=[r.A4,...l];a.push(o);let c=Array.from({length:i.length},(e,t)=>l[t]+i[t]);return a.push(["Total liabilities and equity",...c]),o};class D{processHistoricalsAndSetCashBalanceToUse(e){if(this.historicals=(0,x.lD)({companies:this.companies,companyId:this.companyId}),this.lengthOfHistoricals&&this.historicals.newBsItems){let e=(0,x.lz)({newBsItems:this.historicals.newBsItems,newBsSignFlip:this.historicals.newBsSignFlip,qbBsData:this.historicals.qbBsData,qbBsExtendedData:this.historicals.qbBsExtendedData,newBsCategoriesObj:this.historicals.newBsCategoriesObj});this.cashBalanceToUse=(0,x.qG)({qbBsExtendedData:this.historicals.qbBsExtendedData}),e.forEach(e=>{var t;let{friendlyName:a,category:n,data:r}=e,s=null===(t=(0,i.Zw)(n))||void 0===t?void 0:t.balSheetCat;(0,x.iJ)({name:a,category:n,bsCat:s,bsNormalizedDataList:this.normalizedData,historical:r,lengthOfProjections:this.lengthOfProjections})})}else this.cashBalanceToUse=e}sumAssetAndLiabArrays(e,t){let a=this.getEmptyArrayOfHistoricalsAndProjections(),n=this.getEmptyArrayOfHistoricalsAndProjections();return e.forEach(e=>{e.forEach((e,t)=>{a[t]+=e})}),t.forEach(e=>{e.forEach((e,t)=>{n[t]+=e})}),{assetTotals:a,liabTotals:n}}getAssetAndLiabTotalsFromNormalizedData(){let e=this.normalizedData.filter(e=>"assets"===e.bsCat).map(e=>[...e.historical,...e.projections]),t=this.normalizedData.filter(e=>"liabilities"===e.bsCat).map(e=>[...e.historical,...e.projections]);return 0===e.length&&(e=[this.getEmptyArrayOfHistoricalsAndProjections()]),0===t.length&&(t=[this.getEmptyArrayOfHistoricalsAndProjections()]),this.sumAssetAndLiabArrays(e,t)}getAssetAndLiabTotalsFromNormalizedDataExcludingHistoricalCash(){let e;let t=this.normalizedData.filter(e=>"assets"===e.bsCat).map(e=>[...e.historical,...e.projections]),a=this.normalizedData.filter(e=>"liabilities"===e.bsCat).map(e=>[...e.historical,...e.projections]);return e=0===t.length?[this.getEmptyArrayOfHistoricalsAndProjections()]:this.normalizedData.filter(e=>"assets"===e.bsCat&&e.lineItem!==r.Td).map(e=>[...e.historical,...e.projections]),0===a.length&&(a=[this.getEmptyArrayOfHistoricalsAndProjections()]),this.sumAssetAndLiabArrays(e,a)}calculateFutureCash(){let e,t;
1this.cashBalanceToUse||(this.cashBalanceToUse=0);let a=this.breakEvenChartData.revenue.slice(this.lengthOfHistoricals),n=this.breakEvenChartData.cost.slice(this.lengthOfHistoricals),s=a.map((e,t)=>e-n[t]),{fundArray:i}=g(this.breakEvenChartData.labels.slice(this.lengthOfHistoricals),this.cashRaises),{assetTotals:l,liabTotals:o}=this.getAssetAndLiabTotalsFromNormalizedDataExcludingHistoricalCash(),c=0;if(this.lengthOfHistoricals){let a=l.slice(this.lengthOfHistoricals+1);e=a.map((e,t)=>0===t?e-l.slice(this.lengthOfHistoricals)[0]:e-a[t-1]);let n=o.slice(this.lengthOfHistoricals+1);t=n.map((e,t)=>0===t?e-o.slice(this.lengthOfHistoricals)[0]:e-n[t-1])}else c=this.totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth,e=l.map((e,t)=>0===t?0:e-l[t-1]),t=o.map((e,t)=>0===t?0:e-o[t-1]);let d=[];for(let a=0;a<this.lengthOfProjections;a++){let n=0===a,r=(n?this.cashBalanceToUse:d[a-1])+s[a]+i[a]-e[a]+t[a]+(n?c:0);d.push(r)}return d.unshift(r.Td),d}addProjectionsToNormalizedDataList(e){let{name:t,category:a,bsCatId:n,thisNodeProjections:r}=e,s=this.normalizedData.find(e=>e.lineItem===t&&e.bsCat===n);s?s.projections=s.projections.map((e,t)=>e+r[t]):this.normalizedData.push({lineItem:t,bsCat:n,category:a,historical:this.lengthOfHistoricals?(0,i.il)(this.lengthOfHistoricals+1):[],projections:r})}addAccumDeprIfNeeded(e){if(e){let t=this.normalizedData.find(e=>e.lineItem===r.Pc);if(t){let e=t.historical[t.historical.length-1]||0;t.projections=t.projections.map(t=>t+e)}this.addProjectionsToNormalizedDataList({name:r.Pc,bsCatId:"assets",category:"otherAssets",thisNodeProjections:e})}}calcProjectionsForBsExcludingCashAndAddToNormalizedDataList(){this.simplifiedNodesAll.forEach(e=>{let{name:t,category:a,projections:n}=e,r=(0,i.Zw)(a);if(r){let e=r.balSheetCat;this.addProjectionsToNormalizedDataList({name:t,category:a,bsCatId:e,thisNodeProjections:n})}})}calcProjectionsForBsIncludingCashAndAddToNormalizedDataList(){this.calcProjectionsForBsExcludingCashAndAddToNormalizedDataList();let e=this.calculateFutureCash(),t={lineItem:r.Td,bsCat:"assets",category:"otherAssets",projections:e.slice(1),historical:this.lengthOfHistoricals?(0,i.il)(this.lengthOfHistoricals+1):[]};this.addProjectionsToNormalizedDataList({name:t.lineItem,category:t.category,bsCatId:t.bsCat,thisNodeProjections:t.projections})}sortNormalizedBasedOnCategoryThenSize(){this.normalizedData.sort((e,t)=>{if("assets"===e.bsCat&&"liabilities"===t.bsCat)return -1;if("liabilities"===e.bsCat&&"assets"===t.bsCat)return 1;if(e.lineItem===r.Td)return -1;if(t.lineItem===r.Td||e.lineItem===r.Pc)return 1;if(t.lineItem===r.Pc)return -1;if("fixedAssets"===e.category)return 1;if("fixedAssets"===t.category)return -1;let a=r.dQ[e.category],n=r.dQ[t.category];if("currentAsset"===a&&"nonCurrentAsset"===n)return -1;if("nonCurrentAsset"===a&&"currentAsset"===n)return 1;if("currentLiability"===a&&"nonCurrentLiability"===n)return -1;if("nonCurrentLiability"===a&&"currentLiability"===n||"otherAssets"===e.category)return 1;if("otherAssets"===t.category)return -1;if("otherLiabilities"===e.category)return 1;if("otherLiabilities"===t.category)return -1;let s=e.projections.slice(0,12),i=t.projections.slice(0,12),l=s.reduce((e,t)=>e+t,0);return Math.abs(i.reduce((e,t)=>e+t,0))-Math.abs(l)})}flattenNormalizedDataForBs(){let e=[],t=-1,a=-1,n=[];return this.normalizedData.forEach((r,s)=>{let{category:i,bsCat:l,lineItem:o,historical:c,projections:d}=r,u=[o,...c,...d];"assets"===l?t=s:"liabilities"===l&&(a=s),e.push(u),n.push({lineItem:o,category:i,bsCat:l,row:u})}),{lastAssetIndex:t,rows:e,lastLiabIndex:a,listOfBsObjWithRawRowsAndCategories:n}}getTotalsAndLastIndicesForBs(){let{listOfBsObjWithRawRowsAndCategories:e,lastAssetIndex:t,lastLiabIndex:a,rows:n}=this.flattenNormalizedDataForBs(),{assetTotals:r,liabTotals:s}=this.getAssetAndLiabTotalsFromNormalizedData();return{listOfBsObjWithRawRowsAndCategories:e,assetTotals:r,liabTotals:s,rows:n,lastAssetIndex:t,lastLiabIndex:a}}calculate(){this.sortNormalizedBasedOnCategoryThenSize();let{assetTotals:e,liabTotals:t,rows:a,lastAssetIndex:n,lastLiabIndex:r,listOfBsObjWithRawRowsAndCategories:i}=this.getTotalsAndLastIndicesForBs(),l=b({lastAssetIndex:n,rows:a,assetTotals:e,lastLiabIndex:r,liabTotals:t});
1return{newRowsToUse:(0,s.QI)(a),rawRowsForChart:a,listOfBsObjWithRawRowsAndCategories:i,equityRow:l,colCountIncludingRowHeader:a[0].length,bsNormalizedDataList:this.normalizedData}}constructor(e){this.getEmptyArrayOfHistoricalsAndProjections=()=>(0,i.il)((this.lengthOfHistoricals?this.lengthOfHistoricals+1:0)+this.lengthOfProjections);let{companies:t,companyId:a,cashBalance:n,lengthOfHistoricals:r,lengthOfProjections:s,cashRaises:l,breakEvenChartData:o,simplifiedNodesAll:c,edges:d,accumDeprArray:u,totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth:h}=e;this.lengthOfHistoricals=r,this.lengthOfProjections=s,this.cashRaises=l,this.breakEvenChartData=o,this.simplifiedNodesAll=c,this.edges=d,this.normalizedData=[],this.companies=t,this.companyId=a,this.processHistoricalsAndSetCashBalanceToUse(n),this.totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth=h,this.addAccumDeprIfNeeded(u),this.calcProjectionsForBsIncludingCashAndAddToNormalizedDataList()}}let v=e=>new D(e).calculate();var j=a(23744);o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let C=e=>{let{rows:t,lastOpActivitiesIndex:a,lastInvActivitiesIndex:n,opActivitiesTotals:r,invActivitiesTotals:s,finActivitiesTotals:i,finalCashArray:l}=e;-1!==a&&t.splice(a+1,0,r),-1!==n&&t.splice(n+1,0,s),t.push(i);let o=l.slice(0,l.length-1),c=l.slice(1,l.length),d=Array.from({length:r.length-1},(e,t)=>c[t]-o[t]),u=["Cash beginning balance",...o],h=["Cash ending balance",...c],m=["Change in cash",...d];return t.push(u),t.push(h),t.push(m),m},A=e=>{let t,{lengthOfHistoricals:a,lengthOfProjections:n,rows:r,listOfBsObjWithRawRowsAndCategoriesAndFlippedSigns:s,rawRowsForChartFromPandLCalc:l}=e;t=a?["Cash flow from operating activities",...(0,i.il)(a+n)]:["Cash flow from operating activities",...(0,i.il)(n-1)];let o=l.find(e=>e[0]===j.nM),c=a?o:[o[0],...o.slice(2)];return r.push(c),t.forEach((e,a)=>{0!==a&&(t[a]+=c[a])}),s.sort((e,t)=>"Depreciation"===e.lineItem?-1:"Depreciation"===t.lineItem?1:0),s.forEach(e=>{let{category:a}=e;["fixedAssets","loanPay","startupCosts"].includes(a)||(e.row.forEach((e,a)=>{0!==a&&(t[a]+=e)}),r.push(e.row))}),t},w=e=>{let t,a,n,{rows:r,lengthOfHistoricals:s,lengthOfProjections:l,listOfBsObjWithRawRowsAndCategoriesAndFlippedSigns:o}=e;return s?(t=["Cash flow from investing activities",...(0,i.il)(s+l)],a=["Startup costs",...(0,i.il)(s+l)],n=["Capital expenditures",...(0,i.il)(s+l)]):(t=["Cash flow from investing activities",...(0,i.il)(l-1)],a=["Startup costs",...(0,i.il)(l-1)],n=["Capital expenditures",...(0,i.il)(l-1)]),o.forEach(e=>{let{category:r,row:s}=e;"startupCosts"===r&&t.forEach((e,n)=>{0!==n&&(a[n]+=s[n],t[n]+=s[n])}),"fixedAssets"===r&&t.forEach((e,a)=>{0!==a&&(n[a]+=s[a],t[a]+=s[a])})}),a.slice(1).some(e=>0!==e)&&r.push(a),r.push(n),t},N=e=>{let t,a,{rows:n,lengthOfHistoricals:r,lengthOfProjections:s,listOfBsObjWithRawRowsAndCategoriesAndFlippedSigns:l,equityRowOnBs:o}=e;r?(t=["Cash flow from financing activities",...(0,i.il)(r+s)],a=["Loan principal proceeds (payments)",...(0,i.il)(r+s)]):(t=["Cash flow from financing activities",...(0,i.il)(s-1)],a=["Loan principal proceeds (payments)",...(0,i.il)(s-1)]),l.forEach(e=>{let{category:n,row:r}=e;"loanPay"===n&&t.forEach((e,n)=>{0!==n&&(a[n]+=r[n],t[n]+=r[n])})});let c=n[0].slice(1),d=[],u=o.slice(1);u.forEach((e,t)=>{if(0===t)return;let a=u[t-1];d.push(e-a)});let h=["Fundraising event",...d.map((e,t)=>Math.round(e-c[t]))];return h.forEach((e,a)=>{0!==a&&(t[a]+=e)}),n.push(h),a.slice(1).some(e=>0!==e)&&n.push(a),t},O=e=>JSON.parse(JSON.stringify(e)).map(e=>{let t=e.row.slice(1);"assets"===e.bsCat&&(t=t.map(e=>-e));let a=[];return t.forEach((e,n)=>{if(0===n)return;let r=t[n-1];a.push(e-r)}),"Accumulated Depreciation"===e.lineItem?e.lineItem="Depreciation":e.lineItem="".concat("Change in ").concat(e.lineItem),e.row=[e.lineItem,...a],e}),R=e=>{let{lengthOfHistoricals:t,lengthOfProjections:a,equityRowOnBs:n,listOfBsObjWithRawRowsAndCategoriesWithoutCash:r,rawRowsForChartFromPandLCalc:s}=e,i=[],l=O(r),o=A({rows:i,lengthOfHistoricals:t,lengthOfProjections:a,listOfBsObjWithRawRowsAndCategoriesAndFlippedSigns:l,rawRowsForChartFromPandLCalc:s}),c=i.length-1,d=w({rows:i,lengthOfHistoricals:t,lengthOfProjections:a,listOfBsObjWithRawRowsAndCategoriesAndFlippedSigns:l}),u=i.length-1+1,h=N({rows:i,lengthOfHistoricals:t,lengthOfProjections:a,listOfBsObjWithRawRowsAndCategoriesAndFlippedSigns:l,equityRowOnBs:n});return{rows:i,lastOpActivitiesIndex:c,lastInvActivitiesIndex:u,opActivitiesTotals:o,invActivitiesTotals:d,finActivitiesTotals:h}},M=e=>{let{opActivitiesTotals:t,invActivitiesTotals:a,finActivitiesTotals:n,cashChangeRow:r}=e,s=t.slice(1),i=a.slice(1),l=n.slice(1),o=r.slice(1);return!s.map((e,t)=>e+i[t]+l[t]).every((e,t)=>10>Math.abs(e-o[t]))},S=e=>{var t;let{lengthOfProjections:a,lengthOfHistoricals:n,equityRowOnBs:i,listOfBsObjWithRawRowsAndCategories:l,rawRowsForChartFromPandLCalc:o}=e,c=null===(t=l.find(e=>e.lineItem===r.Td))||void 0===t?void 0:t.row.slice(1),{rows:d,lastOpActivitiesIndex:u,lastInvActivitiesIndex:h,opActivitiesTotals:m,invActivitiesTotals:f,finActivitiesTotals:p}=R({lengthOfProjections:a,lengthOfHistoricals:n,listOfBsObjWithRawRowsAndCategoriesWithoutCash:l.filter(e=>e.lineItem!==r.Td),equityRowOnBs:i,rawRowsForChartFromPandLCalc:o}),y=C({rows:d,lastOpActivitiesIndex:u,lastInvActivitiesIndex:h,opActivitiesTotals:m,invActivitiesTotals:f,finActivitiesTotals:p,finalCashArray:c}),g=d[0].length,x=M({opActivitiesTotals:m,invActivitiesTotals:f,finActivitiesTotals:p,cashChangeRow:y});return{newRowsToUse:(0,s.QI)(d),rawRowsForChart:d,colCountIncludingRowHeader:g,cashDoesNotFoot:x}};o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let E=e=>{let t;let a=[[]],n={},s={},i=o()().subtract(1,"year").startOf("year"),l=null==e?void 0:e.filter(e=>o().unix(e.date)>=i);if(0===l.length)return{qbData:a,plCategoriesObj:n,plItems:s};
1l.forEach(e=>{(!t||o().unix(e.date)<t)&&(t=o().unix(e.date))});let c=0;for(let e=t;e<=o()().subtract(1,"month").endOf("month");e=e.add(1,"month"))c++;let d=Array.from({length:c},(e,a)=>t.add(a,"month").endOf("month"));a[0]=["QB account name",d.map(e=>e.format("YYYY-MM-DD"))];let u=Array.from(new Set(l.map(e=>e.type))),h=u.map(e=>r.n8.find(t=>t.typeShortName===e).friendlyName),m=u.map(e=>r.n8.find(t=>t.typeShortName===e).categoryName),f=u.map(e=>r.n8.find(t=>t.typeShortName===e).friendlyNameWithId);return f.forEach((e,t)=>{n[e]=m[t],s[e]=h[t]}),a.push(...f.map(e=>[e,...Array.from({length:c},()=>0)])),d.forEach((e,t)=>{let n=e.startOf("month"),r=l.filter(t=>{let a=o().unix(t.date);return a>=n&&a<=e});0!==r.length&&u.map(e=>r.filter(t=>t.type===e).reduce((e,t)=>e+t.amount,0)).forEach((e,n)=>{let r=a.find(e=>e[0]===f[n]);r[t+1]+=e})}),{qbData:a,plCategoriesObj:n,plItems:s}};var T=a(28815),I=a(37193),P=a(73339),L=a(83797),F=a(3570),z=a(59625);o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let V=e=>{let{assetBalances:t,percentOf:a}=e,n=a?Math.round((0,i.yC)(100,a)):0,r=(0,i.yC)(1,n),s=Array(t.length).fill(0),l=Array(t.length).fill(0),o=0;for(let e=0;e<t.length;e++){let a=t[e]*r;e>0&&t[e]<t[e-1]&&(o*=1-(1-(0,i.yC)(t[e],t[e-1]))),(o+=a)>t[e]&&(a-=o-t[e],o=t[e]),s[e]=a,l[e]=o}return{deprExpArray:s,accumDeprArray:l}},B=e=>{let{node:t,lengthOfProjections:a,nodes:n,edges:r,fixedAssetsTotalArray:s}=e,l=(0,i.il)(a),o=(0,i.il)(a),{dependentOnDriverBlockStartupCosts:c,lineItems:d}=t.data;if(c){let e=(0,i.Td)({nodes:n,edges:r,node:t}).data.driversObj.startupCosts.startupCostList,{cumulAmortArray:s}=(0,L.tS)({lengthOfProjections:a,startupCosts:e});o.forEach((e,t)=>{o[t]+=s[t]})}else d.forEach(e=>{let{percentOf:t}=e,{deprExpArray:a,accumDeprArray:n}=V({assetBalances:s,percentOf:t});l.forEach((e,t)=>{l[t]+=a[t]}),o.forEach((e,t)=>{o[t]+=n[t]})});return o.forEach((e,t)=>{o[t]*=-1}),{newDeprExp:l,newAccumDepr:o}},q=e=>{let{allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:t,edges:a,lengthOfProjections:n,fixedAssetsTotalArray:r}=e,s=(0,i.il)(n);return t.filter(e=>"depreciation"===e.data.category).forEach(e=>{let{newAccumDepr:i}=B({node:e,nodes:t,edges:a,lengthOfProjections:n,fixedAssetsTotalArray:r});i.forEach((e,t)=>{s[t]+=e})}),s.some(e=>0!==e)?s:null};o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let k=e=>{let{lineItem:t,lengthOfProjections:a}=e,{startDate:n,endDate:r,endDisabled:s,value:l,growthRate:c,bsCat:d,seasonality:u}=t,h=o().utc().endOf("month"),m=(0,i.il)(a),f=(0,i.il)(a),p=o().unix(n).utc().endOf("month"),y=s?h.add(10,"years"):o().unix(r).utc().endOf("month");return"assets"===d?m=m.map((e,t)=>{let a=o().utc().add(t,"month").endOf("month");if(a.isSameOrAfter(p)&&a.isSameOrBefore(y)){let t=a.diff(p,"month");return e+(0,i.qu)({val:l,growthRate:c,monthStr:a.format("MMM"),seasonality:u,monthsCount:t,startMonthStr:p.format("MMM")})}return e}):"liabilities"===d&&(f=f.map((e,t)=>{let a=o().utc().add(t,"month").endOf("month");if(a.isSameOrAfter(p)&&a.isSameOrBefore(y)){let t=a.diff(p,"month");return e+(0,i.qu)({val:l,growthRate:c,monthStr:a.format("MMM"),seasonality:u,monthsCount:t,startMonthStr:p.format("MMM")})}return e})),{newAssets:m,newLiabs:f}},Y=e=>{let{lineItem:t,lengthOfProjections:a}=e,n=(0,i.il)(a),r=(0,i.il)(a),{startDate:s,endDate:l,endDisabled:c,value:d,growthRate:u,pAndLCat:h,seasonality:m}=t,f=o().utc().endOf("month"),p=o().unix(s).utc().endOf("month"),y=c?f.add(10,"years"):o().unix(l).utc().endOf("month");return"revenue"===h?n=n.map((e,t)=>{let a=o().utc().add(t,"month").endOf("month");if(a.isSameOrAfter(p)&&a.isSameOrBefore(y)){let t=a.diff(p,"month");return e+(0,i.qu)({val:d,growthRate:u,monthStr:a.format("MMM"),seasonality:m,monthsCount:t,startMonthStr:p.format("MMM")})}return e}):r=r.map((e,t)=>{let a=o().utc().add(t,"month").endOf("month");if(a.isSameOrAfter(p)&&a.isSameOrBefore(y)){let t=a.diff(p,"month");return e+(0,i.qu)({val:d,growthRate:u,monthStr:a.format("MMM"),seasonality:m,monthsCount:t,startMonthStr:p.format("MMM")})}return e}),{newRevenue:n,newExpenses:r}};o().extend(d()),o().extend(h()),o().extend(f()),o().extend(y());let Z=e=>{let{node:t,projections:a}=e;return{id:t.id,...t.data,projections:a}},H=e=>{let{lengthOfProjections:t,nodes:a,products:n,edges:r}=e,s=a.filter(e=>"revenue"===e.data.pAndLCat&&!e.data.isDriverBlock),l=(0,i.il)(t);return s.map(e=>{let s=(0,i.il)(t);if(e.data.dependentOnDriverBlock){let l=(0,i.Td)({nodes:a,edges:r,node:e}).data;s=(0,L.fY)({driverNodeData:l,node:e,products:n,lengthOfProjections:t})}else{let{lineItems:a}=e.data;
1a.forEach(e=>{let{newRevenue:a}=Y({lineItem:e,lengthOfProjections:t});s=s.map((e,t)=>e+a[t])})}return l=l.map((e,t)=>e+s[t]),Z({node:e,projections:s})})},U=e=>{let{nodes:t,lengthOfProjections:a}=e,n=t.filter(e=>"fixedAssets"===e.data.category&&!e.data.isDriverBlock),r=[];return{allFixedAssetProjections:n.map(e=>{let t=(0,i.il)(a),{lineItems:n}=e.data;return n.forEach(e=>{let{newAssets:n}=k({lineItem:e,lengthOfProjections:a});t=t.map((e,t)=>e+n[t])}),r.push(t),Z({node:e,projections:t})}),fixedAssetsTotalArray:(0,i.JN)(r,a)}},W=e=>{let{nodes:t,edges:a,lengthOfProjections:n,revTotalArray:r,expTotalArray:s,cogsTotalArray:l,historicalRevTotalArray:o,historicalExpTotalArray:c,historicalCogsTotalArray:d}=e;return t.filter(e=>(0,i.Zw)(e.data.category)&&"fixedAssets"!==e.data.category&&!e.data.isDriverBlock).map(e=>{let{category:u,dependentOnDriverBlock:h,lineItems:m}=e.data,f=(0,i.il)(n),{calcIsNumberOfDays:p}=(0,F.uN)(u);if(h){if("loanPay"===u){let{driversObj:{loan:r}}=(0,i.Td)({nodes:t,edges:a,node:e}).data,{monthlyLoanBalArray:s}=(0,z.mI)({lengthOfProjections:n,loan:r});f=s}else if("startupCosts"===u){let{driversObj:{startupCosts:{startupCostList:r}}}=(0,i.Td)({nodes:t,edges:a,node:e}).data,{grossTotalArray:s}=(0,L.tS)({startupCosts:r,lengthOfProjections:n});f=s}}else if(p){let{newAssetOrLiab:t}=(0,F.Q3)({node:e,lengthOfProjections:n,revTotalArray:r,expTotalArray:s,cogsTotalArray:l,historicalRevTotalArray:o,historicalExpTotalArray:c,historicalCogsTotalArray:d});(0,i.Nf)(u),f=t}else m.forEach(e=>{let{newAssets:t,newLiabs:a}=k({lineItem:e,lengthOfProjections:n});f=(0,i.Nf)(u)?f.map((e,a)=>e+t[a]):f.map((e,t)=>e+a[t])});return Z({node:e,projections:f})})},J=e=>{let{nodes:t,edges:a,lengthOfProjections:n,products:r,revTotalArray:s,fixedAssetsTotalArray:l}=e,o=t.filter(e=>"expenses"===e.data.pAndLCat&&!e.data.isDriverBlock),c=[];return{allExpenseNodesProjections:o.map(e=>{let{category:o,dependentOnDriverBlock:d,lineItems:u}=e.data,h=(0,i.il)(n);if(d){let s=(0,i.Td)({nodes:t,edges:a,node:e}).data;h=(0,L.XJ)({driverNodeData:s,node:e,products:r,lengthOfProjections:n})}else if("depreciation"===o){var m;let{deprExpArray:e}=V({assetBalances:l,percentOf:(null==u?void 0:null===(m=u[0])||void 0===m?void 0:m.percentOf)||0});h=e}else{let{calcIsPercentOf:t,dependentWord:a}=(0,i.Ro)(o);t&&"revenue"===a?h=(0,F.WQ)({node:e,lengthOfProjections:n,revTotalArray:s}):u.forEach(e=>{let{newExpenses:t}=Y({lineItem:e,lengthOfProjections:n});h=h.map((e,a)=>e+t[a])})}return"cogs"===o&&c.push(h),Z({node:e,projections:h})}),cogsTotalArray:(0,i.JN)(c,n)}},G=e=>{let{nodes:t,edges:a,lengthOfProjections:n,products:r,lengthOfHistoricals:s,historicals:l}=e;if(!(null==t?void 0:t.length))return{simplifiedNodesAll:[],simplifiedBsNodes:[],simplifiedPAndLNodes:[],fixedAssetsTotalArray:[]};let o=[],c=[],d=[];if(s){let{newPlCategoriesObj:e,qbData:t,newPlItems:a,newSignFlip:n}=l,r=(0,x.oL)({newPlItems:a,newSignFlip:n,qbData:t,newPlCategoriesObj:e}),u=r.filter(e=>{var t;return(null===(t=(0,i.kJ)(e.category))||void 0===t?void 0:t.pAndLCat)==="revenue"});o=(0,i.JN)(u.map(e=>e.data),s);let h=r.filter(e=>{var t;return(null===(t=(0,i.kJ)(e.category))||void 0===t?void 0:t.pAndLCat)==="expenses"});c=(0,i.JN)(h.map(e=>e.data),s);let m=r.filter(e=>"cogs"===e.category);d=(0,i.JN)(m.map(e=>e.data),s)}let u=H({nodes:t,edges:a,lengthOfProjections:n,products:r}),h=(0,i.JN)(u.map(e=>e.projections),n),{allFixedAssetProjections:m,fixedAssetsTotalArray:f}=U({nodes:t,lengthOfProjections:n}),{allExpenseNodesProjections:p,cogsTotalArray:y}=J({nodes:t,edges:a,lengthOfProjections:n,products:r,revTotalArray:h,fixedAssetsTotalArray:f}),g=(0,i.JN)(p.map(e=>e.projections),n),b=[...W({nodes:t,edges:a,lengthOfProjections:n,revTotalArray:h,expTotalArray:g,cogsTotalArray:y,historicalRevTotalArray:o,historicalExpTotalArray:c,historicalCogsTotalArray:d}),...m],D=[...u,...p];return{simplifiedNodesAll:[...b,...D],simplifiedBsNodes:b,simplifiedPAndLNodes:D,fixedAssetsTotalArray:f}};a(67294);let _=e=>{let{cashDoesNotFoot:t}=e;return t?(0,n.jsx)(I.Z,{sx:{display:"flex",margin:"auto",mt:3,mb:3,justifyContent:"center",maxWidth:"60%"},children:(0,n.jsxs)(P.Z,{severity:"warning",variant:"filled",children:["The cash flow statement is not balanced. This could be due to incorrectly mapped historical data.",(0,n.jsx)("br",{}),"If those are correct, please contact support."]}
1)}):null},Q=e=>{let{colCountIncludingRowHeader:t,lengthOfHistoricals:a,rawRowsForChart:n}=e,r=(0,s.h7)(t,a),i=(0,j.yW)(n,r);return{hasRevenue:null==i?void 0:i.revenue.some(e=>0!==e),hasCost:null==i?void 0:i.cost.some(e=>0!==e),breakEvenChartData:i,fsColumns:r}},X=e=>{var t;let{companies:a,companyId:n,lengthOfProjections:i,lengthOfHistoricals:l,cashBalance:o,breakEvenChartData:c,cashRaises:d,simplifiedNodesAll:u,edges:h,allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:m,fixedAssetsTotalArray:f,rawRowsForChartFromPandLCalc:p}=e,y=q({allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:m,edges:h,lengthOfProjections:i,fixedAssetsTotalArray:f}),{totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth:g}=(0,z.Sj)({allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:m,edges:h,lengthOfProjections:i}),{newRowsToUse:x,colCountIncludingRowHeader:b,listOfBsObjWithRawRowsAndCategories:D,equityRow:j,bsNormalizedDataList:C}=v({companies:a,companyId:n,lengthOfProjections:i,lengthOfHistoricals:l,cashBalance:o,breakEvenChartData:c,cashRaises:d,simplifiedNodesAll:u,edges:h,accumDeprArray:y,totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth:g}),A=null===(t=D.find(e=>e.lineItem===r.Td))||void 0===t?void 0:t.row.slice(1),w=(0,s.hU)({colCountExcludingRowHeader:b,lengthOfHistoricals:l}),{newRowsToUse:N,colCountIncludingRowHeader:O,cashDoesNotFoot:R}=S({lengthOfProjections:i,lengthOfHistoricals:l,equityRowOnBs:j,listOfBsObjWithRawRowsAndCategories:D,rawRowsForChartFromPandLCalc:p});return{bsNewRowsToUse:x,bsFsColumns:w,finalCashArray:A,cfNewRowsToUse:N,cfFsColumns:(0,s.$n)({cfColCountIncludingRowHeader:O,lengthOfHistoricals:l}),cashDoesNotFoot:R,bsNormalizedDataList:C}},K=e=>{let{companies:t,currentModelCompanyId:a,transactions:n,lengthOfHistoricals:r,lengthOfProjections:s,simplifiedPAndLNodes:i,secondarySimplifiedPAndLNodes:l}=e,o=(0,x.lD)({companies:t,companyId:a}),{newPlCategoriesObj:c,qbData:d,newPlItems:u}=o,h=o.newSignFlip;if(!d){if(n&&0!==n.length){console.log("\uD83D\uDE80 ~ file: calculateMemoizedData.tsx:103 ~ transactions:",n,typeof n);let e=E(n);d=e.qbData,c=e.plCategoriesObj,u=e.plItems}else d=[[]]}let m={newPlCategoriesObj:c||{},qbData:d,newPlItems:u||{},newSignFlip:h||{}},f=(0,j.me)({lengthOfHistoricals:r,lengthOfProjections:s,qbData:m.qbData,newPlItems:m.newPlItems,newSignFlip:m.newSignFlip,newPlCategoriesObj:m.newPlCategoriesObj,simplifiedPAndLNodes:i}),p={newRowsToUse:[],rawRowsForChart:[],colCountIncludingRowHeader:0,lengthOfHistoricals:0,normalizedDataList:[]};return l&&(p=(0,j.me)({lengthOfHistoricals:r,lengthOfProjections:s,qbData:m.qbData,newPlItems:m.newPlItems,newSignFlip:m.newSignFlip,newPlCategoriesObj:m.newPlCategoriesObj,simplifiedPAndLNodes:l})),{historicalData:m,pAndLResults:f,secondaryPLResults:p}},$=e=>{let{mySecondaryModel:t,lengthOfProjections:a,colCountIncludingRowHeader:n,secondaryPLResults:r,companies:s,companyId:i,cashBalance:l,lengthOfHistoricals:o,secondarySimplifiedNodesAll:c,secondaryFixedAssetsTotalArray:d}=e;if(!t)return{secondaryCashRaises:[],secondaryBsNewRowsToUse:[],secondaryBsFsColumns:[],secondaryFinalCashArray:[],secondaryCfNewRowsToUse:[],secondaryCfFsColumns:[],secondaryCashDoesNotFoot:!1,secondaryBreakEvenAndCols:{hasRevenue:!1,hasCost:!1,breakEvenChartData:{cost:[],revenue:[],labels:[]},fsColumns:[]}};let u=(0,j.a7)(t),h=Q({colCountIncludingRowHeader:n,lengthOfHistoricals:o,rawRowsForChart:r.rawRowsForChart}),{bsNewRowsToUse:m,bsFsColumns:f,finalCashArray:p,cfNewRowsToUse:y,cfFsColumns:g,cashDoesNotFoot:x}=X({companies:s,companyId:i,lengthOfProjections:a,lengthOfHistoricals:o,cashBalance:l,breakEvenChartData:h.breakEvenChartData,cashRaises:u,simplifiedNodesAll:c,edges:Object.values(t.edges),fixedAssetsTotalArray:d,allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:Object.values(t.nodes),rawRowsForChartFromPandLCalc:r.rawRowsForChart});return{secondaryCashRaises:u,secondaryBsNewRowsToUse:m,secondaryBs
1FsColumns:f,secondaryFinalCashArray:p,secondaryCfNewRowsToUse:y,secondaryCfFsColumns:g,secondaryCashDoesNotFoot:x,secondaryBreakEvenAndCols:h}},ee=e=>{let{myModel:t,nodes:a,edges:n,mySecondaryModel:r,lengthOfHistoricals:s,products:l,lengthOfProjections:o,companies:c,companyId:d,secondaryProducts:u,transactions:h}=e;if(!t.id||!t)return{hasRevenue:!1,hasCost:!1,noRevOrNoCost:!1,breakEvenChartData:{cost:[],revenue:[],labels:[]},fsColumns:[],secondaryBreakEvenAndCols:{hasRevenue:!1,hasCost:!1,breakEvenChartData:{cost:[],revenue:[],labels:[]},fsColumns:[]},bsNewRowsToUse:[],bsFsColumns:[],finalCashArray:[],cashBalance:0,cashRaises:[],secondaryCashRaises:[],cfNewRowsToUse:[],cfFsColumns:[],cashDoesNotFoot:!1,secondaryBsNewRowsToUse:[],secondaryBsFsColumns:[],secondaryFinalCashArray:[],secondaryCfNewRowsToUse:[],secondaryCfFsColumns:[],singleMonthCalculations:{keyRatios:[],grossMarginDetails:[],debtToEquityRatioDetails:[],currentRatioDetails:[],debtServiceCoverageRatioDetails:[],workingCapitalRatiosDetails:[]},singleMonthCalculationsColumns:[],fsPortionOfPrompt:"",keyRatiosPortionOfPrompt:"",productListPortionOfPrompt:"",pAndLResults:{newRowsToUse:[],rawRowsForChart:[],colCountIncludingRowHeader:0,lengthOfHistoricals:0,normalizedDataList:[]},secondaryPLResults:{newRowsToUse:[],rawRowsForChart:[],colCountIncludingRowHeader:0,lengthOfHistoricals:0,normalizedDataList:[]},newRowsToUse:[],secondaryNewRowsToUse:[],simplifiedPAndLNodes:[],simplifiedBsNodes:[],simplifiedReactFlowNodesBothPandLAndBs:[],secondarysimplifiedReactFlowNodesBothPandLAndBs:[]};let m="calculateMemoizedData".concat(Date.now());console.time(m);let f=c.find(e=>e.id===d),p=null==f?void 0:f.cashBalance,y=(0,j.a7)(t),g=(0,x.lD)({companies:c,companyId:d}),{simplifiedNodesAll:b,simplifiedPAndLNodes:D,simplifiedBsNodes:v,fixedAssetsTotalArray:C}=G({nodes:a,edges:n,lengthOfProjections:o,products:l,lengthOfHistoricals:s,historicals:g}),{simplifiedNodesAll:A,simplifiedPAndLNodes:w,fixedAssetsTotalArray:N}=G({nodes:(null==r?void 0:r.nodes)||[],edges:(null==r?void 0:r.edges)||[],lengthOfProjections:o,products:u,lengthOfHistoricals:s,historicals:g}),{pAndLResults:O,secondaryPLResults:R}=K({companies:c,currentModelCompanyId:d,transactions:h,lengthOfHistoricals:s,lengthOfProjections:o,simplifiedPAndLNodes:D,secondarySimplifiedPAndLNodes:w}),{newRowsToUse:M,rawRowsForChart:S,colCountIncludingRowHeader:E}=O,{hasRevenue:I,hasCost:P,breakEvenChartData:L,fsColumns:F}=Q({colCountIncludingRowHeader:E,lengthOfHistoricals:s,rawRowsForChart:S}),{bsNewRowsToUse:V,bsFsColumns:B,finalCashArray:q,cfNewRowsToUse:k,cfFsColumns:Y,cashDoesNotFoot:Z,bsNormalizedDataList:H}=X({companies:c,companyId:d,lengthOfProjections:o,lengthOfHistoricals:s,cashBalance:p,breakEvenChartData:L,cashRaises:y,simplifiedNodesAll:b,edges:n,allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:a,fixedAssetsTotalArray:C,rawRowsForChartFromPandLCalc:S}
1),{secondaryCashRaises:U,secondaryBsNewRowsToUse:W,secondaryBsFsColumns:J,secondaryFinalCashArray:_,secondaryCfNewRowsToUse:ee,secondaryCfFsColumns:et,secondaryCashDoesNotFoot:ea,secondaryBreakEvenAndCols:en}=$({mySecondaryModel:r,lengthOfProjections:o,colCountIncludingRowHeader:E,lengthOfHistoricals:s,secondaryPLResults:R,companies:c,companyId:d,cashBalance:p,secondarySimplifiedNodesAll:A,secondaryFixedAssetsTotalArray:N}),{totalMonthlyIntExpArray:er,totalMonthlyPrincRepayArray:es,loanNodesWithDetails:ei}=(0,z.Sj)({allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:a,edges:n,lengthOfProjections:o}),{singleMonthCalculations:el,singleMonthCalculationsColumns:eo}=(0,T.FB)({newRowsToUse:M,bsNewRowsToUse:V,lengthOfProjections:o,lengthOfHistoricals:s,colCountIncludingRowHeader:E,simplifiedNodesAll:b,totalMonthlyIntExpArray:er,totalMonthlyPrincRepayArray:es,normalizedDataList:O.normalizedDataList,bsNormalizedDataList:H,loanNodesWithDetails:ei}),ec=(0,i.gC)({newRowsToUse:M,fsColumns:F,bsNewRowsToUse:V,bsFsColumns:B,cfNewRowsToUse:k,cfFsColumns:Y}),ed=(0,i.EB)({singleMonthCalculations:el,singleMonthCalculationsColumns:eo}),eu=(0,i.St)({products:l});return console.timeEnd(m),{hasRevenue:I,hasCost:P,noRevOrNoCost:!I||!P,breakEvenChartData:L,fsColumns:F,secondaryBreakEvenAndCols:en,bsNewRowsToUse:V,bsFsColumns:B,finalCashArray:q,cashBalance:p,cashRaises:y,secondaryCashRaises:U,cfNewRowsToUse:k,cfFsColumns:Y,cashDoesNotFoot:Z||ea,secondaryBsNewRowsToUse:W,secondaryBs
1FsColumns:J,secondaryFinalCashArray:_,secondaryCfNewRowsToUse:ee,secondaryCfFsColumns:et,singleMonthCalculations:el,singleMonthCalculationsColumns:eo,fsPortionOfPrompt:ec,keyRatiosPortionOfPrompt:ed,productListPortionOfPrompt:eu,pAndLResults:O,secondaryPLResults:R,newRowsToUse:O.newRowsToUse,secondaryNewRowsToUse:R.newRowsToUse,simplifiedPAndLNodes:D,simplifiedBsNodes:v,simplifiedReactFlowNodesBothPandLAndBs:b,secondarysimplifiedReactFlowNodesBothPandLAndBs:A}}},38050:function(e,t,a){a.d(t,{I:function(){return l}});var n=a(85893),r=a(37193),s=a(9304);a(67294);var i=a(64681);let l=e=>{let{chartWidth:t,handleDownload:a}=e;return(0,n.jsx)(r.Z,{sx:{justifyContent:"left",alignItems:"left",display:"flex",margin:"auto"},children:(0,n.jsx)(s.Z,{onClick:a,sx:{mt:t<400?"-35px !important":null,ml:"5px !important",p:"2px !important"},children:(0,n.jsx)(i.Z,{color:"action",sx:{p:0}})})})}},36225:function(e,t,a){a.d(t,{Qm:function(){return y},x3:function(){return p}});var n=a(85893),r=a(37193),s=a(67294),i=a(5152),l=a.n(i),o=a(80224),c=a(46220),d=a(65988),u=a(93281),h=a(38050),m=a(80830);let f=l()(()=>Promise.all([a.e(2196),a.e(9676),a.e(6495)]).then(a.bind(a,26495)).then(e=>e.Line),{loadableGenerated:{webpack:()=>[null]},ssr:!1}),p=e=>{let t;let{fractionDigits:a,value:n,percent:r,notDollars:s}=e;switch(a){case 0:default:t="NoDecimals";break;case 1:t="OneDecimal";break;case 2:t="Decimals"}return r?(0,c.V)(n,"Percent".concat(t)):s?(0,c.V)(n,"Number".concat(t)):(0,c.V)(n,"Dollars".concat(t))},y=e=>{let t,{nodePopupChartTitle:i,nodePopupChartId:l,chartId:c,width:y=315,height:g=170,chartData:x,gradientFactor:b=.85,percent:D,fractionDigits:v,notDollars:j,handleDownload:C}=e,A=(0,o.Z)(),[w]=(0,d.eJ)("chartColor",A.palette.primary.main);t=i||(0,m.IE)(c);let[N,O]=s.useState(!1),R=e=>0===e.index?"dark"===A.palette.mode?"#3b3b3b":"#fcfcfc":"transparent";if(s.useEffect(()=>{(async()=>{if(N)return;let{Chart:e,CategoryScale:t,LinearScale:n,PointElement:r,LineElement:s,Title:i,Tooltip:l,Legend:o,Filler:c}=await Promise.all([a.e(2196),a.e(9676)]).then(a.bind(a,23148));e.register(t,n,r,s,i,l,o,c),O(!0)})()},[]),!N)return null;let M={labels:x.map(e=>e[0]).slice(1),datasets:[{fill:!0,label:t,data:x.map(e=>e[1]).slice(1),pointHitRadius:20,pointRadius:y<400?2:3,pointHoverRadius:7,borderColor:w,borderWidth:y<400?1.5:3,pointBackgroun
1dColor:w,backgroundColor:e=>{let t=e.chart.ctx.createLinearGradient(0,0,0,g*b);return t.addColorStop(0,(0,u.s5)(w,.75)),t.addColorStop(1,(0,u.s5)(w,0)),t}}]},S={responsive:!1,maintainAspectRatio:!1,scales:{x:{grid:{display:!0,color:R,tickWidth:0},ticks:{color:A.palette.text.secondary,font:{family:A.typography.fontFamily,size:A.typography.fontSize},maxTicksLimit:y<400?3:6}},y:{beginAtZero:!0,grid:{display:!0,color:R,tickWidth:0},ticks:{color:A.palette.text.secondary,font:{family:A.typography.fontFamily,size:A.typography.fontSize},maxTicksLimit:5,callback:e=>p({value:e,percent:D,fractionDigits:v,notDollars:j})}}},plugins:{tooltip:{bodyFont:{family:A.typography.fontFamily,size:A.typography.fontSize},callbacks:{label(e){let t=e.raw;return" ".concat(p({value:t,percent:D,fractionDigits:v,notDollars:j}))}}},legend:{display:!1},title:{display:y<400,text:t,font:{family:A.typography.fontFamily,size:A.typography.fontSize},position:"bottom"}}};return y?(0,n.jsxs)(r.Z,{children:[(0,n.jsx)(r.Z,{sx:{display:"flex"},children:(0,n.jsx)(f,{style:{maxWidth:"99%"},id:c||l,height:g,width:y,data:M,options:S})}),(0,n.jsx)(h.I,{chartWidth:y,handleDownload:C})]}):(0,n.jsxs)(r.Z,{sx:{display:"flex"},children:[(0,n.jsx)(f,{id:c||l,height:g,width:y,data:M,options:S}),(0,n.jsx)(h.I,{chartWidth:y,handleDownload:C})]})}},59625:function(e,t,a){a.d(t,{DQ:function(){return b},Sj:function(){return g},Xr:function(){return D},mI:function(){return y}});var n=a(27484),r=a.n(n),s=a(70178),i=a.n(s),l=a(96671),o=a.n(l),c=a(79212),d=a.n(c),u=a(37412),h=a.n(u),m=a(76991),f=a(16143);r().extend(i()),r().extend(o()),r().extend(d()),r().extend(h());let p=e=>e.map((t,a)=>{if(0===t){if(0===a)return 0;for(let t=a-1;t>=0;t--)if(0!==e[t])return e[t];return 0}return t}),y=e=>{let{lengthOfProjections:t,loan:a}=e,{principalAmount:n,monthsToRepay:s,annualInterestRate:i,dateFirstMonthLoanRepayment:l,dateLoanProceedsReceived:o}=a,c=r().unix(l).endOf("month"),d=r().unix(o).endOf("month"),u=d.format("YYYY-MM-DD")===r().utc().endOf("month").format("YYYY-MM-DD"),h=(0,f.il)(t),p=(0,f.il)(t),y=(0,f.il)(t),g=[];try{let{installments:e}=(0,m.Loan)(n||1e-5,s||1,i||1e-5,"annuity");g=e.map((e,t)=>{let a=c.add(t,"month").endOf("month").format("YYYY-MM-DD");return{...e,date:a}})}catch(e){console.log(e)}return h=h.map((e,t)=>{let a=r().utc().add(t,"month").endOf("month").format("YYYY-MM-DD"),n=g.find(e=>e.date===a);return n?(p[t]=n.capital,y[t]=n.remain,n.interest):0}),y.forEach((e,t)=>{let a=r()().add(t,"month").endOf("month");d<=a&&c>a&&(y[t]=n)}),{monthlyIntExpArray:h,monthlyPrincRepayArray:p,monthlyLoanBalArray:y,loanProceedsReceivedInFirstProjectedMonth:u}},g=e=>{let{allFullNodesJustForPurposesOfAccumDeprAndLoanRepaymentCalcs:t,edges:a,lengthOfProjections:n}=e,r=t.filter(e=>e.data.dependentOnDriverBlockLoan&&(0,f.Zw)(e.data.category)),s=Array(n).fill(0),i=Array(n).fill(0),l=Array(n).fill(0),o=0;return 0===r.length?{totalMonthlyIntExpArray:s,totalMonthlyPrincRepayArray:i,totalMonthlyLoanBalArray:l,totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth:o,loanNodesWithDetails:[]}:{loanNodesWithDetails:r.map(e=>{let{driversObj:{loan:r}}=(0,f.Td)({nodes:t,edges:a,node:e}).data,{monthlyIntExpArray:c,monthlyPrincRepayArray:d,monthlyLoanBalArray:u,loanProceedsReceivedInFirstProjectedMonth:h}=y({lengthOfProjections:n,loan:r});return h&&(o+=u[0]),s=s.map((e,t)=>e+c[t]),i=i.map((e,t)=>e+d[t]),l=l.map((e,t)=>e+u[t]),{node:e,monthlyIntExpArray:c,monthlyPrincRepayArray:d,monthlyLoanBalArray:u,loanProceedsReceivedInFirstProjectedMonth:h}}),totalMonthlyIntExpArray:s,totalMonthlyPrincRepayArray:i,totalMonthlyLoanBalArray:l,totalRemainingPrincipalFromLoansStartedInFirstProjectedMonth:o}},x=e=>{let{calcArray:t,lengthOfProjections:a}=e,n=(0,f.il)(a),s=(0,f.il)(a),i=(0,f.il)(a),l=(0,f.il)(a),o=r().utc().endOf("month");for(let e=0;e<a;e++){let c=r().utc().add(e,"month").endOf("month"),d=c.format("YYYY-MM-DD"),u=t[0].date,h=t[0].grossTotal;u<=c&&(l[e]+=h);let m=t[t.length-1].date,f=t[t.length-1].grossTotal;m<o&&(i[e]+=f);let y=t.find(e=>e.date.format("YYYY-MM-DD")===d);if(y)n[e]+=y.amortThisMonth,s[e]+=y.remainingBalance,i[e]+=y.cumulativeAmort;else if(c>m){i=p(i);for(let t=e;t<a;t++)l[t]=h;break}}return{amortizationExpArray:n,startupCostBalArray:s,cumulAmortArray:i,grossTotalArray:l}},b=e=>{let{lengthOfProjections:t,calculationArrays:a}=e,n=(0,f.il)(t),r=(0,f.il)(t),s=(0,f.il)(t),i=(0,f.il)(t);
1return a.forEach(e=>{let{amortizationExpArray:a,startupCostBalArray:l,cumulAmortArray:o,grossTotalArray:c}=x({calcArray:e,lengthOfProjections:t});a.forEach((e,t)=>{n[t]+=e}),l.forEach((e,t)=>{r[t]+=e}),o.forEach((e,t)=>{s[t]+=e}),c.forEach((e,t)=>{i[t]+=e})}),{amortizationExpArray:n,startupCostBalArray:r,cumulAmortArray:s,grossTotalArray:i}},D=e=>{let t=[];return e.map(e=>({...e,grossTotal:e.amount,monthlyAmortizationExp:(0,f.yC)(e.amount,e.monthsToAmortize)})).forEach(e=>{let a=Array.from({length:e.monthsToAmortize+1},(t,a)=>{let n=e.monthlyAmortizationExp*a;return 0===a?{date:r().unix(e.expenseDate).utc().add(a,"month").endOf("month"),amortThisMonth:0,cumulativeAmort:n,remainingBalance:e.amount,grossTotal:e.amount}:{date:r().unix(e.expenseDate).utc().add(a,"month").endOf("month"),amortThisMonth:e.monthlyAmortizationExp,cumulativeAmort:n,remainingBalance:e.amount-e.monthlyAmortizationExp*a,grossTotal:e.amount}});t.push(a)}),t}},6433:function(e,t,a){a.d(t,{$n:function(){return O},QI:function(){return p},Rh:function(){return y},T6:function(){return x},Z8:function(){return g},h7:function(){return v},hU:function(){return A}});var n=a(85893);a(67294);var r=a(37193),s=a(27484),i=a.n(s),l=a(70178),o=a.n(l),c=a(96671),d=a.n(c),u=a(79212),h=a.n(u),m=a(37412),f=a.n(m);i().extend(o()),i().extend(d()),i().extend(h()),i().extend(f());let p=e=>{let t=[];return e.forEach((e,a)=>{let n={};e.forEach((e,t)=>{n["id-".concat(t)]=e}),n.id=a,t.push(n)}),t},y=e=>{let t={};Object.keys(e).forEach(a=>{"id"!==a&&"id-0"!==a&&(t[a]=e[a])});let a=[];return Object.keys(t).forEach(e=>{a[Number(e.split("-")[1])]=t[e]}),a.shift(),a},g=e=>{let{name:t,dataRow:a,lengthOfHistoricals:n}=e;return[["",t],...Array.from({length:a.length},(e,t)=>i().utc().add(t-n,"month").format("MMM-YYYY")).map((e,t)=>[e,a[t]])]},x=e=>0===e.index?"#fcfcfc":"transparent",b=e=>{let t=Number(e.value),a=Number(e.value),s=Math.abs(Number(e.value));"Gross margin"===e.row["id-0"]?(t=100*e.value,t="".concat(t.toFixed(0),"%")):Number.isNaN(parseFloat(e.value))?t="":(t=s.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}),t=a<0?"(".concat(t,")"):t);let i=["Total expenses","Net income","Total revenue"].includes(e.row["id-0"]);return(0,n.jsx)(r.Z,{sx:i?{fontWeight:"bold"}:{},children:t})},D={renderCell:e=>{let t=["Total expenses","Net income","Total revenue"].includes(e.row["id-0"]);return(0,n.jsx)(r.Z,{sx:{display:"contents",whiteSpace:"normal",textAlign:"left",...t?{fontWeight:"bold"}:{}},children:e.value})}},v=(e,t)=>Array.from({length:e},(e,a)=>{let n;n=0===t?1:t+1;let r=i().utc().add(a-n,"month").format("MMM-YYYY");return{field:"id-".concat(a),headerName:0===a?"P&L":"".concat(r),type:"number",editable:!1,minWidth:0===a?210:120,flex:1,sortable:!1,renderCell:0===a?D.renderCell:b}}),j=e=>{let t=Number(e.value),a=Number(e.value);t=Math.abs(Number(e.value)).toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}),t=a<0?"(".concat(t,")"):t;let s=["Total assets","Total liabilities","Total liabilities and equity"].includes(e.row["id-0"]);return(0,n.jsx)(r.Z,{sx:s?{fontWeight:"bold"}:{},children:t})},C={renderCell:e=>{let t=["Total assets","Total liabilities","Total liabilities and equity"].includes(e.row["id-0"]);return(0,n.jsx)(r.Z,{sx:{display:"contents",whiteSpace:"normal",textAlign:"left",...t?{fontWeight:"bold"}:{}},children:e.value})}},A=e=>{let{colCountExcludingRowHeader:t,lengthOfHistoricals:a}=e;return Array.from({length:t},(e,t)=>{let n;n=0===a?1:a+1+1;let r=i().utc().add(t-n,"month").format("MMM-YYYY");return{field:"id-".concat(t),headerName:0===t?"Balance Sheet":"".concat(r),type:"number",editable:!1,minWidth:0===t?210:120,flex:1,sortable:!1,renderCell:0===t?C.renderCell:j}})},w=e=>{let t=Number(e.value),a=Number(e.value);t=Math.abs(Number(e.value)).toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}),t=a<0?"(".concat(t,")"):t;let s=["Cash flow from operating activities","Cash flow from investing activities","Cash flow from financing activities","Cash beginning balance","Cash ending balance","Change in cash"].includes(e.row["id-0"]);return(0,n.jsx)(r.Z,{sx:s?{fontWeight:"bold"}:{},children:t})},N={renderCell:e=>{let t=["Cash flow from operating activities","Cash flow from investing activities","Cash flow from financing activities","Cash beginning balance","Cash ending balance","Change in cash"].includes(e.row["id-0"]);return(0,n.jsx)(r.Z,{sx:{display:"contents",whiteSpace:"normal",textAlign:"left",...t?{fontWeight:"bold"}:{}},children:e.value})}},O=e=>{let{cfColCountIncludingRowHeader:t,lengthOfHistoricals:a}=e;return Array.from({length:t},(e,t)=>{let n;n=0===a?0:a+1;let r=i().utc().add(t-n,"month").format("MMM-YYYY");return{field:"id-".concat(t),headerName:0===t?"Cash flow statement":"".concat(r),type:"number",editable:!1,minWidth:0===t?210:120,flex:1,sortable:!1,renderCell:0===t?N.renderCell:w}})}},83797:function(e,t,a){a.d(t,{Rt:function(){return y},XJ:function(){return D},fY:function(){return b},gP:function(){return g},tS:function(){return p}});var n=a(27484),r=a.n(n),s=a(70178),i=a.n(s),l=a(96671),o=a.n(l),c=a(79212),d=a.n(c),u=a(37412),h=a.n(u),m=a(59625),f=a(16143);r().extend(i()),r().extend(o()),r().extend(d()),r().extend(h());let p=e=>{let{lengthOfProjections:t,startupCosts:a}=e,n=(0,m.Xr)(a);
1return(0,m.DQ)({lengthOfProjections:t,calculationArrays:n})},y=e=>{let{lengthOfProjections:t,products:a,drivesRevenue:n,drivesExpenses:s,leads:i}=e,{growthRate:l,seasonality:o,monthlyLeads:c,costPerLead:d,conversionRate:u,listOfProductIdAndUnits:h,endDisabled:m,startDate:p,endDate:y}=i,g=r().utc().endOf("month"),x=m?g.add(10,"years"):r().unix(y).endOf("month"),b=r().unix(p).startOf("month"),D=(0,f.il)(t).map((e,t)=>{let a=r().utc().add(t,"month").endOf("month");if(a.isSameOrAfter(b)&&a.isSameOrBefore(x)){let t=a.diff(b,"month");return e+(0,f.qu)({val:c,growthRate:l,monthStr:a.format("MMM"),seasonality:o,monthsCount:t,startMonthStr:b.format("MMM")})}return e}),v=D.map(e=>e*d),j=D.map(e=>Math.round(e*u/100)),C=j.map(e=>e*(0,f.J4)(h,a)),A=j.map(e=>e*(0,f.f5)(h,a));return n||(C.fill(0),A.fill(0),j.fill(0)),s||v.fill(0),{monthlyCogsExpArray:A,monthlyMktgExpArray:v,monthlyRevArray:C,monthlyCustsArray:j,monthlyLeadsArray:D}},g=e=>{let{lengthOfProjections:t,products:a,driverNodeData:n}=e,{customerGrowthRate:s,monthlyCustomers:i,listOfProductIdAndUnits:l,endDisabled:o,startDate:c,endDate:d,seasonality:u}=n.driversObj.productSales,h=r().utc().endOf("month"),m=o?h.add(10,"years"):r().unix(d).endOf("month"),p=r().unix(c).startOf("month"),y=(0,f.il)(t).map((e,t)=>{let a=r().utc().add(t,"month").endOf("month");if(a.isSameOrAfter(p)&&a.isSameOrBefore(m)){let t=a.diff(p,"month");return Math.round(e+(0,f.qu)({val:i,growthRate:s,monthStr:a.format("MMM"),seasonality:u,monthsCount:t,startMonthStr:p.format("MMM")}))}return e}),g=y.map(e=>e*(0,f.J4)(l,a));return{monthlyCogsExpArray:y.map(e=>e*(0,f.f5)(l,a)),monthlyRevArray:g,monthlyCustsArray:y}},x=e=>{let{lengthOfProjections:t,products:a,driverNodeData:n,node:r}=e,s=(0,f.il)(t),{driversObj:{leads:i},drivesRevenue:l,drivesExpenses:o}=n,c=y({leads:i,lengthOfProjections:t,products:a,drivesRevenue:l,drivesExpenses:o});s=c.monthlyRevArray;let{monthlyCogsExpArray:d,monthlyMktgExpArray:u}=c,{dependentOnDriverBlockCogs:h,dependentOnDriverBlockMarketingExp:m}=r.data;return{monthlyRevArray:s,monthlyExpArray:h?d:u}},b=e=>{let{driverNodeData:t,products:a,lengthOfProjections:n,node:r}=e,s=[],{dependentOnDriverBlockProductSales:i}=r.data;if(i){let{monthlyRevArray:e}=g({lengthOfProjections:n,products:a,driverNodeData:t});s=e}else{let{monthlyRevArray:e}=x({lengthOfProjections:n,products:a,driverNodeData:t,node:r});s=e}return s},D=e=>{let{driverNodeData:t,node:a,products:n,lengthOfProjections:r}=e,{dependentOnDriverBlockLoan:s,dependentOnDriverBlockStartupCosts:i,dependentOnDriverBlockProductSales:l}=a.data,o=(0,f.il)(r);if(s){let{driversObj:{loan:e}}=t,{monthlyIntExpArray:a}=(0,m.mI)({lengthOfProjections:r,loan:e});o=a}else if(i){let{driversObj:{startupCosts:{startupCostList:e}}}=t,{amortizationExpArray:a}=p({lengthOfProjections:r,startupCosts:e});o=a}else if(l){let{monthlyCogsExpArray:e}=g({lengthOfProjections:r,products:n,driverNodeData:t});o=e}else{let{monthlyExpArray:e}=x({lengthOfProjections:r,products:n,driverNodeData:t,node:a});o=e}return o}},3570:function(e,t,a){a.d(t,{Q3:function(){return c},WQ:function(){return s},uN:function(){return r}});var n=a(16143);let r=e=>{let t,a,n;let r=!1;switch(e){case"inventory":t="Driven by cost of goods sold. 30 days means the business always needs to hold a full month's worth of volume sold (since it sells all of it every 30 days). 60 days means the business always holds 2 months worth of inventory (1 for the current month and 1 for next month's sales).",n="cogs",a=30,r=!0;break;case"prepaidExp":t="Driven by total expenses. 30 days means that the business pays 30 days worth of expenses in advance. 15 days means the business pays, in advance, half of monthly expenses. 60 days means the business pays this month and next month's entire expenses in advance.",n="expenses",a=30,r=!0;break;case"accountsRec":t="Driven by total revenue. 30 days means the business collects all of its revenue after 30 days. 60 days means that 2 months worth of revenue is still uncollected at any given time.",n="revenue",a=30,r=!0;break;case"accountsPay":t="Driven by total expenses. 60 days means the business doesn't have cash outflows related to expenses until 60 days after that expense is incurred on the P&L. 30 days means the cash outflow related to expenses is paid on a 1 month lag.",n="expenses",a=60,r=!0}return{word:t,dependentWord:n,calcIsNumberOfDays:r,numberOfDays:a}},s=e=>{let{node:t,lengthOfProjections:a,revTotalArray:r}=e,{lineItems:s}=t.data,{percentOf:i}=s[0];return(0,n.il)(a).map((e,t)=>e+i/100*r[t])},i=e=>{let{numberOfDays:t}=e,a=t%30;return{totalIndicesNeeded:Math.floor(t/30)+(a>0?1:0),partialMonthMultiplier:0===a?1:a/30,remainingDays:a}},l=e=>{let{relevantArrayOfOnlyNumbers:t,numberOfDays:a,projectedIndex:n}=e,{totalIndicesNeeded:r,partialMonthMultiplier:s}=i({numberOfDays:a}),l=t.slice(Math.max(0,n-r+1),n+1);return Math.round(100*Array(r-l.length).fill(t[0]).concat(l).map((e,t)=>0===t?e*s:e).reduce((e,t)=>
1e+t,0))/100},o=e=>{let{relevantArrayOfOnlyNumbers:t,numberOfDays:a,projectedIndex:n}=e,{totalIndicesNeeded:r,partialMonthMultiplier:s}=i({numberOfDays:a}),l=Math.min(t.length,n+r),o=t.slice(n,l),c=[...o,...Array(r-o.length).fill(o[o.length-1])];return Math.round(100*c.map((e,t)=>t===c.length-1?e*s:e).reduce((e,t)=>e+t,0))/100},c=e=>{let t,{node:a,lengthOfProjections:s,revTotalArray:i,expTotalArray:c,cogsTotalArray:d,historicalRevTotalArray:u,historicalExpTotalArray:h,historicalCogsTotalArray:m}=e,f=(0,n.il)(s),p=[...u,...i],y=[...h,...c],g=[...m,...d],x=a.data.lineItems[0].numberOfDays,b=a.data.category,{dependentWord:D,numberOfDays:v}=r(b),j=0===x?0:x||v;"revenue"===D?t=p:"cogs"===D?t=g:"expenses"===D&&(t=y);let C=u.length;return"inventory"===b||"prepaidExp"===b?f.forEach((e,a)=>{let n=o({relevantArrayOfOnlyNumbers:t,numberOfDays:j,projectedIndex:C+a});f[a]=n}):f.forEach((e,a)=>{let n=l({relevantArrayOfOnlyNumbers:t,numberOfDays:j,projectedIndex:C+a});f[a]=n}),{newAssetOrLiab:f}}},23744:function(e,t,a){a.d(t,{a7:function(){return d},me:function(){return o},nM:function(){return i},yW:function(){return c}});var n=a(16143),r=a(6433),s=a(48936);let i="Net income";class l{sortNormalizedBasedOnCategoryThenSize(){this.normalizedDataList.sort((e,t)=>{if("revenue"===e.pAndLCat&&"expenses"===t.pAndLCat)return -1;if("expenses"===e.pAndLCat&&"revenue"===t.pAndLCat)return 1;if("cogs"===e.category&&"cogs"!==t.category)return -1;if("cogs"!==e.category&&"cogs"===t.category)return 1;let a=e.historical,n=t.historical,r=e.projections.slice(0,a.length),s=t.projections.slice(0,n.length),i=a.reduce((e,t)=>e+t,0),l=n.reduce((e,t)=>e+t,0),o=r.reduce((e,t)=>e+t,0);return Math.max(Math.abs(l),Math.abs(s.reduce((e,t)=>e+t,0)))-Math.max(Math.abs(i),Math.abs(o))})}flattenNormalizedData(){let e=this.normalizedDataList,t=(0,n.il)(this.colCountIncludingRowHeader);t[0]="Total revenue";let a=(0,n.il)(this.colCountIncludingRowHeader);a[0]="Total expenses";let r=[],s=-1;e.forEach((e,n)=>{let{pAndLCat:i}=e,l=[e.lineItem,...e.historical,...e.projections];l.forEach((e,r)=>{if(0!==r){if("revenue"===i){let a=t[r];t[r]=a+e,s=n}else if("expenses"===i){let t=a[r];a[r]=t+e}}}),r.push(l)}),this.revTotals=t,this.expTotals=a,this.lastRevIndex=s,this.rows=r}insertTotalsRows(){let{lastRevIndex:e,rows:t,revTotals:a,expTotals:r}=this;t.splice(e+1,0,a),t.push(r);let s=(0,n.il)(this.colCountIncludingRowHeader);s[0]=i,s.forEach((e,t)=>{if(0===t)return;let n=a[t],i=r[t];s[t]=n-i}),t.push(s)}addProjectionsToCategoryTotals(e){let{nodeCategory:t,pAndLCat:a,thisNodeProjections:n}=e,r=this.categoryTotals.find(e=>e.category===t);r?r.projections=r.projections.map((e,t)=>e+n[t]):this.categoryTotals.push({category:t,pAndLCat:a,projections:n})}addProjectionsToNormalizedDataList(e){let{name:t,category:a,pAndLCat:r,thisNodeProjections:s}=e,i=this.normalizedDataList.find(e=>e.lineItem===t&&e.pAndLCat===r);i?i.projections=i.projections.map((e,t)=>e+s[t]):this.normalizedDataList.push({lineItem:t,category:a,pAndLCat:r,historical:(0,n.il)(this.lengthOfHistoricals),projections:s})}calcProjectionsForOnlyPAndL(){this.simplifiedPAndLNodes.forEach(e=>{let{name:t,category:a,pAndLCat:n,projections:r}=e;this.addProjectionsToNormalizedDataList({name:t,category:a,pAndLCat:n,thisNodeProjections:r}),this.addProjectionsToCategoryTotals({nodeCategory:a,pAndLCat:n,thisNodeProjections:r})})}calculate(){return this.lengthOfHistoricals&&(0,s.oL)({newPlItems:this.newPlItems,newSignFlip:this.newSignFlip,qbData:this.qbData,newPlCategoriesObj:this.newPlCategoriesObj}).forEach(e=>{var t;let{friendlyName:a,category:r,data:i}=e,l=null===(t=(0,n.kJ)(r))||void 0===t?void 0:t.pAndLCat;(0,s.y)({name:a,category:r,pAndLCat:l,normalizedDataList:this.normalizedDataList,historical:i,lengthOfProjections:this.lengthOfProjections})}),this.calcProjectionsForOnlyPAndL(),this.sortNormalizedBasedOnCategoryThenSize(),this.flattenNormalizedData(),this.insertTotalsRows(),{newRowsToUse:(0,r.QI)(this.rows),rawRowsForChart:this.rows,lengthOfHistoricals:this.lengthOfHistoricals,colCountIncludingRowHeader:this.colCountIncludingRowHeader,normalizedDataList:this.normalizedDataList}}constructor(e){let{lengthOfHistoricals:t,lengthOfProjections:a,qbData:n,newPlCategoriesObj:r,newPlItems:s,newSignFlip:i,simplifiedPAndLNodes:l}=e;this.lengthOfHistoricals=t,this.lengthOfProjections=a,this.colCountIncludingRowHeader=t+a+1,this.qbData=n,this.newPlCategoriesObj=r,this.newPlItems=s,this.newSignFlip=i,this.simplifiedPAndLNodes=l,this.normalizedDataList=[],this.categoryTotals=[],this.revTotals=[],this.expTotals=[],this.lastRevIndex=-1,this.rows=[]}}let o=e=>new l(e).calculate(),c=(e,t)=>{try{let a=t.map(e=>e.headerName).slice(1),n=e.find(e=>"Total expenses"===e[0]).slice(1),r=e.find(e=>"Total revenue"===e[0]).slice(1);return{cost:n,labels:a,revenue:r}}catch(e){return null}},d=e=>(null==e?void 0:e.cashRaises)&&(null==e?void 0:e.cashRaises)!=="[]"?"string"==typeof e.cashRaises?JSON.parse(e.cashRaises):e.cashRaises:[]},30973:function(e,t,a){a.r(t),a.d(t,{OutcomesDataContext:function(){return p},OutcomesDataProvider:function(){return g},useOutcomesData:function(){return x}});var n=a(85893),r=a(67294),s=a(18446),i=a.n(s),l=a(55971),o=a(31224),c=a(80830),d=a(31177),u=a(92659),h=a(51394),m=a(40705),f=a.n(m);let p=(0,r.createContext)(null),y=e=>{let{children:t}=e,a=(0,o.useAuth)().user,s=a.uid,m=(0,c.Xs)(a),{models:y,model:g,company:x,companies:b,activeCompanyId:D}=(0,u.useModelsAndCompanies)(),{nodesDataHash:v,getNodes:j,getEdges:C}=(0,h.xV)(e=>({getNodes:e.getNodes,getEdges:e.getEdges,nodesDataHash:f()(e.nodes.map(e=>e.data))})),A=null==g?void 0:g.promptState,w=null==g?void 0:g.plainEnglishState,N=null==g?void 0:g.id,O=a.secondaryModel,R=null==y?void 0:y.find(e=>e.id===O),M=(0,r.useMemo)(()=>(null==g?void 0:g.productList)||[],[g]),S=(0,r.useMemo)(()=>(null==R?void 0:R.productList)||[],[R]),E=(0,c.EI)({companies:b,companyId:D}),T=(0,l.Gh)(D);r.useEffect(()=>(console.log("Component mounted"),()=>{console.log("Component unmounted (will remount if mounted again)")}),[]);let I=(0,r.useRef)({modelId:N,secondaryModelId:O,model:g,secondaryModel:R,memoizedData:null}),P=(0,r.useMemo)(()=>{let e={modelId:N,secondaryModelId:O,model:g,secondaryModel:R},t={modelId:I.current.modelId,secondaryModelId:I.current.secondaryModelId,model:I.current.model,secondaryModel:I.current.secondaryModel},a=!i()(e,t);return a&&(I.current={...e,memoizedData:null}),a},[N,O,g,R]),L=(0,r.useMemo)(()=>
1{if(!P&&I.current.memoizedData)return I.current.memoizedData;let e=(0,d.v)({nodes:j(),edges:C(),lengthOfHistoricals:E,myModel:g,mySecondaryModel:R,products:M,secondaryProducts:S,transactions:T,lengthOfProjections:m,companies:b,companyId:D});return I.current.memoizedData=e,e},[v,P,j,C,E,g,R,M,S,T,m,b,D]),F=(0,r.useMemo)(()=>({...L,company:x,companies:b,transactions:T,companyId:D,products:M,secondaryProducts:S,model:g,secondaryModel:R,models:y,uid:s,plainEnglishState:w,promptState:A,lengthOfProjections:m,lengthOfHistoricals:E,modelId:g.id,secondaryModelId:O}),[L,x,b,T,D,M,S,g,R,y,s,w,A,m,E,O]);return(0,n.jsx)(p.Provider,{value:F,children:t})},g=e=>{let{children:t}=e;return(0,o.useAuth)().user?(0,n.jsx)(y,{children:t}):t},x=()=>{let e=(0,r.useContext)(p);if(!e)throw Error("useOutcomesData must be used within a OutcomesDataProvider");return e};t.default={}},28815:function(e,t,a){a.d(t,{RX:function(){return $},J:function(){return ee},Nr:function(){return K},FB:function(){return Q}});var n=a(47286),r=a(16143),s=a(6433);let i=e=>{let{normalizedDataList:t,lengthOfHistoricals:a}=e,n=(0,r.eM)({dataList:t.filter(e=>"revenue"===e.pAndLCat),isBsLineItem:!1,lengthOfHistoricals:a});if(0===n.length)return{grossMargin:[],details:[]};let s=n[0].amounts.length,i=(0,r.JN)(n.map(e=>e.amounts),s),l=(0,r.eM)({dataList:t.filter(e=>"cogs"===e.category),isBsLineItem:!1,lengthOfHistoricals:a}),o=(0,r.JN)(l.map(e=>e.amounts),s),c=[],d=[];return Array.from({length:s}).forEach((e,t)=>{let a=o[t],s=i[t],u=(0,r.Wn)(s-a,s);c.push(u),d.push({revenue:s,cogs:a,revenueBreakdown:Object.fromEntries(n.map(e=>[e.name,e.amounts[t]])),cogsBreakdown:Object.fromEntries(l.map(e=>[e.name,e.amounts[t]])),revenueNodes:n.map(e=>({name:e.name,amount:e.amounts[t]})),cogsNodes:l.map(e=>({name:e.name,amount:e.amounts[t]}))})}),{grossMargin:c,details:d}},l=e=>{let{plRows:t,lengthOfHistoricals:a,totalMonthlyIntExpArray:n,totalMonthlyPrincRepayArray:i}=e,l=t.find(e=>"Net income"===e["id-0"])||{},o=t.find(e=>"Depreciation"===e["id-0"])||{},c=t.find(e=>"Tax"===e["id-0"])||{};if(0===Object.keys(l).length){let e=Object.keys(t[0]).length;return{debtServiceCoverageRatio:Array(e).fill(null),details:Array(e).fill({ebitda:null,debtService:null,netIncome:null,depreciation:null,tax:null,interest:null,principalPayment:null})}}let d=(0,s.Rh)(l).slice(a),u=(0,s.Rh)(o).slice(a),h=(0,s.Rh)(c).slice(a),m=Array(a).fill(null),f=Array(a).fill(null);return d.forEach((e,t)=>{let a=u[t]||0,s=h[t]||0,l=n[t],o=e+a+s+l,c=i[t],d=l+c,p=(0,r.Wn)(o,d);m.push(p),f.push({ebitda:o,debtService:d,netIncome:e,depreciation:a,tax:s,interest:l,principalPayment:c})}),{debtServiceCoverageRatio:m,details:f}},o=e=>{let{bsRows:t,bsNormalizedDataList:a,lengthOfHistoricals:i}=e,l=t.find(e=>e["id-0"]===n.A4)||{},o=Object.keys(l).length;if(0===o)return{debtToEquityRatio:Array(Object.keys(t[0]).length).fill(null),details:Array(Object.keys(t[0]).length).fill({totalLiabilities:null,totalEquity:null,liabilityNodes:[]})};let c=(0,s.Rh)(l).slice(i>0?1:0),d=a.filter(e=>(0,r.Lt)(e.category)&&(e.lineItem.toLowerCase().includes("loan")||e.lineItem.toLowerCase().includes("note")||e.lineItem.toLowerCase().includes("debt")||e.lineItem.toLowerCase().includes("mortgage")||e.lineItem.toLowerCase().includes("financing")||e.lineItem.toLowerCase().includes("installment"))||"loanPay"===e.category),u=(0,r.eM)({dataList:d,isBsLineItem:!0,lengthOfHistoricals:i}),h=(0,r.JN)(u.map(e=>e.amounts),o),m=[],f=[];return Array.from({length:o}).forEach((e,t)=>{let a=c[t],n=h[t],s=(0,r.Wn)(n,a);m.push(s),f.push({debt:n,totalEquity:a,debtNodes:u.map(e=>({name:e.name,amount:e.amounts[t]}))})}),{debtToEquityRatio:m,details:f}},c=e=>{let{nodes:t,lengthOfProjections:a,lengthOfHistoricals:i,bsRows:l,loanNodesWithDetails:o}=e,c=t.filter(e=>(0,r.Zw)(e.category)),d=i?i+1:0,u=Array(a).fill(0),h=Array(a).fill(0),m=l.find(e=>"Cash"===e["id-0"])||{},f=(0,s.Rh)(m).slice(d);u=u.map((e,t)=>e+f[t]);let p=[],y=[];c.forEach(e=>{let t=e.category,a=e.name,r=e.projections;"currentAsset"===n.dQ[t]?(u=u.map((e,t)=>e+r[t]),p.push({name:a,projections:r})):"currentLiability"===n.dQ[t]&&"loanPay"!==t&&(h=h.map((e,t)=>e+r[t]),y.push({name:a,projections:r}))}
1),o.forEach(e=>{let t=(0,r.il)(a),{monthlyPrincRepayArray:n}=e;c.find(t=>t.id===e.node.id).projections.forEach((e,a)=>{if(0!==e){let e=n.slice(a+1,a+1+12).reduce((e,t)=>e+t,0);t[a]+=e,h[a]+=e}}),y.push({name:"".concat(e.node.data.name," [Current portion]"),projections:t})});let g=u,x=h,b=Array(i).fill(null),D=Array(i).fill(null);return g.forEach((e,t)=>{let a=(0,r.Wn)(e,x[t]);b.push(a),D.push({currentAssets:e,currentLiabilities:x[t],cash:f[t],currentAssetNodes:p.map(e=>({name:e.name,amount:e.projections[t]})),currentLiabilityNodes:y.map(e=>({name:e.name,amount:e.projections[t]}))})}),{currentRatio:b,details:D}},d=e=>{let{bsRows:t,plRows:a,normalizedDataList:i,bsNormalizedDataList:l,lengthOfHistoricals:o}=e,c=(0,r.eM)({dataList:l.filter(e=>"inventory"===e.category),isBsLineItem:!0,lengthOfHistoricals:o}),d=(0,r.eM)({dataList:i.filter(e=>"cogs"===e.category),isBsLineItem:!1,lengthOfHistoricals:o}),u=(0,r.eM)({dataList:l.filter(e=>"accountsRec"===e.category),isBsLineItem:!0,lengthOfHistoricals:o}),h=(0,r.eM)({dataList:l.filter(e=>"accountsPay"===e.category),isBsLineItem:!0,lengthOfHistoricals:o}),m=(0,r.eM)({dataList:i.filter(e=>"revenue"===e.pAndLCat),isBsLineItem:!1,lengthOfHistoricals:o}),f=t.find(e=>"Total assets"===e["id-0"])||{},p=o>0?1:0,y=(0,s.Rh)(f).slice(p),g=a.find(e=>"Net income"===e["id-0"])||{},x=(0,s.Rh)(g),b=x.map(e=>12*e),D=x.length,v=t.find(e=>e["id-0"]===n.A4)||{},j=(0,s.Rh)(v).slice(p),C=(0,r.JN)(c.map(e=>e.amounts),D),A=(0,r.JN)(d.map(e=>e.amounts),D),w=(0,r.JN)(u.map(e=>e.amounts),D),N=(0,r.JN)(h.map(e=>e.amounts),D),O=(0,r.JN)(m.map(e=>e.amounts),D),R=A.map(e=>12*e),M=O.map(e=>12*e),S=C.map((e,t)=>360*(0,r.Wn)(e,R[t])),E=w.map((e,t)=>360*(0,r.Wn)(e,M[t])),T=N.map((e,t)=>360*(0,r.Wn)(e,R[t])),I=S.map((e,t)=>e+E[t]-T[t]),P=b.map((e,t)=>j[t]>0?(0,r.Wn)(e,j[t]):null),L=b.map((e,t)=>(0,r.Wn)(e,M[t])),F=M.map((e,t)=>(0,r.Wn)(e,y[t])),z=y.map((e,t)=>j[t]<0?null:(0,r.Wn)(e,j[t])),V=L.map((e,t)=>null===e||null===F[t]||null===z[t]?null:e*F[t]*z[t]),B=Array(D).fill({}).map((e,t)=>({dio:{inventoryValue:C[t],cogsValue:R[t]},arDays:{arValue:w[t],revenueValue:M[t]},apDays:{apValue:N[t],cogsValue:R[t]},ccc:{dioValue:S[t],arDaysValue:E[t],apDaysValue:T[t]},roe:{annualizedNetIncomeValue:b[t],equityValue:j[t]},netProfitMargin:{annualizedNetIncomeValue:b[t],annualizedRevenueValue:M[t]},assetTurnover:{annualizedRevenueValue:M[t],totalAssetsValue:y[t]},equityMultiplier:{totalAssetsValue:y[t],equityValue:j[t]},dupontRoe:{netProfitMarginValue:L[t],assetTurnoverValue:F[t],equityMultiplierValue:z[t]}}));return{dio:S,arDays:E,apDays:T,ccc:I,roe:P,netProfitMargin:L,assetTurnover:F,equityMultiplier:z,dupontRoe:V,details:B}},u=e=>{let{plRows:t,bsRows:a,lengthOfProjections:n,lengthOfHistoricals:r,simplifiedNodes:u,totalMonthlyIntExpArray:h,totalMonthlyPrincRepayArray:m,normalizedDataList:f,bsNormalizedDataList:p,loanNodesWithDetails:y}=e,{grossMargin:g,details:x}=i({normalizedDataList:f,lengthOfHistoricals:r}),{debtServiceCoverageRatio:b,details:D}=l({plRows:t,lengthOfHistoricals:r,totalMonthlyIntExpArray:h,totalMonthlyPrincRepayArray:m}),{debtToEquityRatio:v,details:j}=o({bsRows:a,bsNormalizedDataList:p,lengthOfHistoricals:r}),{currentRatio:C,details:A}=c({nodes:u,lengthOfProjections:n,lengthOfHistoricals:r,bsRows:a,loanNodesWithDetails:y}),{dio:w,arDays:N,apDays:O,ccc:R,roe:M,netProfitMargin:S,assetTurnover:E,equityMultiplier:T,dupontRoe:I,details:P}=d({bsRows:a,plRows:t,normalizedDataList:f,bsNormalizedDataList:p,lengthOfHistoricals:r});return{keyRatios:(0,s.QI)([["Gross Margin",...g],["Net Profit Margin",...S],["Debt-to-Equity Ratio",...v],["Current Ratio",...C],["Debt Service Coverage Ratio",...b],["Days Inventory Outstanding",...w],["Days Sales Outstanding",...N],["Days Payable Outstanding",...O],["Cash Conversion Cycle",...R],["Return on Equity",...M],["Asset Turnover",...E],["Equity Multiplier",...T],["DuPont ROE",...I]]),grossMarginDetails:x,debtToEquityRatioDetails:j,currentRatioDetails:A,debtServiceCoverageRatioDetails:D,workingCapitalRatiosDetails:P}};var h=a(85893);a(67294);var m=a(18587),f=a(55148),p=a(69320),y=a(46220);let g={"Gross Margin":(0,h.jsxs)(p.Z,{children:["Gross Margin is the percent of revenue that remains after cost of goods sold.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: (Revenue - Cost of Goods Sold) / Revenue"]}),"Net Profit Margin":(0,h.jsxs)(p.Z,{children:["Net Profit Margin shows the percentage of annualized revenue that translates into profit after all expenses.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Annualized Net Income / Annualized Revenue"]}),"Debt-to-Equity Ratio":(0,h.jsxs)(p.Z,{children:["Debt-to-Equity Ratio compares total Debt to shareholders' equity, indicating financial leverage.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Debt / Shareholders' Equity"]}),"Current Ratio":(0,h.jsxs)(p.Z,{children:["Current Ratio measures a company's ability to pay short-term obligations with its short-term assets.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Current Assets / Current Liabilities"]}),"Debt Service Coverage Ratio":(0,h.jsxs)(p.Z,{children:["Note: If you have historical loans in your accounting data that are imported, for each loan:",(0,h.jsxs)("ul",{children:[(0,h.jsx)("li",{children:"please add a term loan driver block to the canvas and set its attributes"}),(0,h.jsx)("li",{children:"remove the existing interest expense and loan payable blocks added by the AI import."})]}),"This will ensure accurate DSCR calculations.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Debt Service Coverage Ratio measures the cash flow available to pay current debt obligations.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Net Operating Income / Total Debt Service"]}),"Days Inventory Outstanding":(0,h.jsxs)(p.Z,{children:["Days Inventory Outstanding measures the average number of days inventory is held before it is sold.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: (Average Inventory / Annualized Cost of Goods Sold) * 360"]}),"Days Sales Outstanding":(0,h.jsxs)(p.Z,{children:["Days Sales Outstanding measures the average number of days it takes to collect accounts receivable.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: (Average Accounts Receivable / Annualized Revenue) * 360"]}),"Days Payable Outstanding":(0,h.jsxs)(p.Z,{children:["Days Payable Outstanding measures the average number of days it takes to pay accounts payable.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: (Average Accounts Payable / Annualized Cost of Goods Sold) * 360"]}),"Cash Conversion Cycle":(0,h.jsxs)(p.Z,{children:["Cash Conversion Cycle is the sum of Days Inventory Outstanding (DIO), Days Sales Outstanding (DSO), and the negative of Days Payable Outstanding (DPO).",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: DIO + DSO - DPO"]}),"Return on Equity":(0,h.jsxs)(p.Z,{children:["Return on Equity (ROE) measures the annualized profitability of a company in relation to its shareholders' equity.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Annualized Net Income / Shareholders' Equity"]}),"Asset Turnover":(0,h.jsxs)(p.Z,{children:["Asset Turnover measures how efficie
1ntly a company uses its assets to generate annualized sales.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Annualized Revenue / Average Total Assets"]}),"Equity Multiplier":(0,h.jsxs)(p.Z,{children:["Equity Multiplier shows the extent to which a company uses debt financing.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: Total Assets / Shareholders' Equity"]}),"DuPont ROE":(0,h.jsxs)(p.Z,{children:["DuPont ROE decomposes ROE into three components: annualized profit margin, asset turnover, and equity multiplier.",(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Formula: (Annualized Net Income / Annualized Revenue) * (Annualized Revenue / Total Assets) * (Total Assets / Shareholders' Equity)"]})},x=e=>{let t=e.row["id-0"],a=e.value,n="".concat(t," for ").concat(e.colDef.headerName,": ").concat(a);return(0,h.jsx)(f._,{title:(0,h.jsx)(p.Z,{children:n}),delay:500,children:(0,h.jsx)("span",{children:a})})},b=e=>{let t=e.row["id-0"],a=g[t]||"No description available";return(0,h.jsx)(f._,{title:(0,h.jsx)(p.Z,{children:a}),delay:500,children:(0,h.jsxs)("span",{children:[t,(0,h.jsx)(m.Z,{sx:{fontSize:16,color:"action.active"}})]})})},D=e=>null==e,v={"Gross Margin":e=>D(e)?"":"".concat((100*e).toFixed(0),"%"),"Net Profit Margin":e=>D(e)?"":"".concat((100*e).toFixed(1),"%"),"Debt-to-Equity Ratio":e=>D(e)?"":e.toFixed(1),"Current Ratio":e=>D(e)?"":e.toFixed(1),"Debt Service Coverage Ratio":e=>D(e)?"":e.toFixed(2),"Days Inventory Outstanding":e=>D(e)?"":e.toFixed(1),"Days Sales Outstanding":e=>D(e)?"":e.toFixed(1),"Days Payable Outstanding":e=>D(e)?"":e.toFixed(1),"Cash Conversion Cycle":e=>D(e)?"":e.toFixed(1),"Return on Equity":e=>D(e)?"":"".concat((100*e).toFixed(1),"%"),"Asset Turnover":e=>D(e)?"":e.toFixed(1),"Equity Multiplier":e=>D(e)?"":e.toFixed(1),"DuPont ROE":e=>D(e)?"":"".concat((100*e).toFixed(1),"%")},j=(e,t,a)=>{let n=a(e.value);if(!t)return(0,h.jsx)("span",{children:n});let r=t.revenueNodes.map(e=>"".concat(e.name,": ").concat((0,y.V)(e.amount,"DollarsNoDecimals"))).join("\n"),s=t.cogsNodes.map(e=>"".concat(e.name,": ").concat((0,y.V)(e.amount,"DollarsNoDecimals"))).join("\n"),i=t.revenue,l=t.cogs;return(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:[(0,h.jsx)("u",{children:"Revenue"}),(0,h.jsx)("br",{}),r,(0,h.jsx)("br",{}),"Total Revenue:"," ",(0,y.V)(i,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),(0,h.jsx)("u",{children:"COGS"}),(0,h.jsx)("br",{}),s,(0,h.jsx)("br",{}),"Total COGS:"," ",(0,y.V)(l,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Gross Margin: (",(0,y.V)(i,"DollarsNoDecimals")," ","-"," ",(0,y.V)(l,"DollarsNoDecimals"),") /"," ",(0,y.V)(i,"DollarsNoDecimals")," ","="," ",n]}),delay:500,children:(0,h.jsx)("span",{children:n})})},C=(e,t,a)=>{let n=a(e.value);if(!t)return(0,h.jsx)("span",{children:n});let r=t.annualizedRevenueValue,s=t.annualizedNetIncomeValue;return(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Annualized Net Income:"," ",(0,y.V)(s,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Annualized Revenue:"," ",(0,y.V)(r,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Net Profit Margin:"," ",(0,y.V)(s,"DollarsNoDecimals")," ","/"," ",(0,y.V)(r,"DollarsNoDecimals")," ","="," ",n]}),delay:500,children:(0,h.jsx)("span",{children:n})})},A=(e,t,a)=>{let n=a(e.value);if(!t)return(0,h.jsx)("span",{children:n});let r=t.debtNodes.map(e=>"".concat(e.name,": ").concat((0,y.V)(e.amount,"DollarsNoDecimals"))).join("\n"),s=t.debt,i=t.totalEquity;return(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:[(0,h.jsx)("u",{children:"Debt"}),(0,h.jsx)("br",{}),r,(0,h.jsx)("br",{}),"Total Debt:"," ",(0,y.V)(s,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Total Equity:"," ",(0,y.V)(i,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Debt-to-Equity Ratio:"," ",(0,y.V)(s,"DollarsNoDecimals")," ","/"," ",(0,y.V)(i,"DollarsNoDecimals")," ","="," ",n]}),delay:500,children:(0,h.jsx)("span",{children:n})})},w=(e,t,a)=>{let n=a(e.value);if(!t)return(0,h.jsx)("span",{children:n});let r=t.currentAssetNodes.map(e=>"".concat(e.name,": ").concat((0,y.V)(e.amount,"DollarsNoDecimals"))).join("\n"),s=t.currentLiabilityNodes.map(e=>"".concat(e.name,": ").concat((0,y.V)(e.amount,"DollarsNoDecimals"))).join("\n"),i=t.currentAssets,l=t.currentLiabilities;return(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:[(0,h.jsx)("u",{children:"Current Assets"}),(0,h.jsx)("br",{}),"Cash:"," ",(0,y.V)(t.cash,"DollarsNoDecimals"),(0,h.jsx)("br",{}),r,(0,h.jsx)("br",{}),"Total Current Assets:"," ",(0,y.V)(i,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),(0,h.jsx)("u",{children:"Current Liabilities"}),(0,h.jsx)("br",{}),s,(0,h.jsx)("br",{}),"Total Current Liabilities:"," ",(0,y.V)(l,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Current Ratio:"," ",(0,y.V)(i,"DollarsNoDecimals")," ","/"," ",(0,y.V)(l,"DollarsNoDecimals")," ","="," ",n]}),delay:500,children:(0,h.jsx)("span",{children:n})})},N=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Net Income:"," ",(0,y.V)(t.netIncome,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Interest:"," ",(0,y.V)(t.interest,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Tax:"," ",(0,y.V)(t.tax,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Depreciation:"," ",(0,y.V)(t.depreciation,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"EBITDA:"," ",(0,y.V)(t.ebitda,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Interest:"," ",(0,y.V)(t.interest,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Principal Payment:"," ",(0,y.V)(t.principalPayment,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Debt Service:"," ",(0,y.V)(t.debtService,"DollarsNoDecimals"),(0,h.jsx)("br",{}),(0,h.jsx)("br",{}),"Debt Service Coverage Ratio:"," ",n,(0,h.jsx)("br",{}),"(",(0,y.V)(t.ebitda,"DollarsNoDecimals")," ","/"," ",(0,y.V)(t.debtService,"DollarsNoDecimals"),")"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},O=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Inventory Value:"," ",(0,y.V)(t.inventoryValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Annualized COGS Value:"," ",(0,y.V)(t.cogsValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Days Inventory Outstanding:"," ",n,(0,h.jsx)("br",{}),"(Inventory Value / Annualized COGS Value) * 360"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},R=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Accounts Receivable Value:"," ",(0,y.V)(t.arValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}
1),"Annualized Revenue Value:"," ",(0,y.V)(t.revenueValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Days Sales Outstanding:"," ",n,(0,h.jsx)("br",{}),"(Accounts Receivable Value / Annualized Revenue Value) * 360"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},M=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Accounts Payable Value:"," ",(0,y.V)(t.apValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Annualized COGS Value:"," ",(0,y.V)(t.cogsValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Days Payable Outstanding:"," ",n,(0,h.jsx)("br",{}),"(Accounts Payable Value / Annualized COGS Value) * 360"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},S=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Days Inventory Outstanding:"," ",a(t.dioValue),(0,h.jsx)("br",{}),"Days Sales Outstanding:"," ",a(t.arDaysValue),(0,h.jsx)("br",{}),"Days Payable Outstanding:"," ",a(t.apDaysValue),(0,h.jsx)("br",{}),"Cash Conversion Cycle:"," ",n,(0,h.jsx)("br",{}),"DIO + DSO - DPO"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},E=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Annualized Revenue:"," ",(0,y.V)(t.annualizedRevenueValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Total Assets:"," ",(0,y.V)(t.totalAssetsValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Asset Turnover:"," ",n,(0,h.jsx)("br",{}),"(Annualized Revenue / Total Assets)"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},T=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Total Assets:"," ",(0,y.V)(t.totalAssetsValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Equity:"," ",(0,y.V)(t.equityValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Equity Multiplier:"," ",n,(0,h.jsx)("br",{}),"(Total Assets / Equity)"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},I=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Annualized Net Income:"," ",(0,y.V)(t.annualizedNetIncomeValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Equity:"," ",(0,y.V)(t.equityValue,"DollarsNoDecimals"),(0,h.jsx)("br",{}),"Return on Equity:"," ",n,(0,h.jsx)("br",{}),"(Annualized Net Income / Equity)"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})},P=(e,t,a)=>{let n=a(e.value);return t?(0,h.jsx)(f._,{title:(0,h.jsxs)(p.Z,{style:{whiteSpace:"pre-line"},children:["Net Profit Margin:"," ",a(t.netProfitMarginValue),(0,h.jsx)("br",{}),"Asset Turnover:"," ",(0,y.V)(t.assetTurnoverValue,"NumberOneDecimal"),(0,h.jsx)("br",{}),"Equity Multiplier:"," ",(0,y.V)(t.equityMultiplierValue,"NumberOneDecimal"),(0,h.jsx)("br",{}),"DuPont ROE:"," ",n,(0,h.jsx)("br",{}),"Net Profit Margin * Asset Turnover * Equity Multiplier"]}),delay:500,children:(0,h.jsx)("span",{children:n})}):(0,h.jsx)("span",{children:n})};var L=a(27484),F=a.n(L),z=a(70178),V=a.n(z),B=a(96671),q=a.n(B),k=a(79212),Y=a.n(k),Z=a(37412),H=a.n(Z),U=a(36225);F().extend(V()),F().extend(q()),F().extend(Y()),F().extend(H());let W=e=>{let{params:t,index:a,calculations:n}=e;if(0===a)return b(t);if(null===t.value)return null;let r=v[t.row["id-0"]],{grossMarginDetails:s,debtToEquityRatioDetails:i,currentRatioDetails:l,debtServiceCoverageRatioDetails:o,workingCapitalRatiosDetails:c}=n,d={"Gross Margin":()=>j(t,s[a-1],r),"Net Profit Margin":()=>{var e;return C(t,null===(e=c[a-1])||void 0===e?void 0:e.netProfitMargin,r)},"Debt-to-Equity Ratio":()=>A(t,i[a-1],r),"Current Ratio":()=>w(t,l[a-1],r),"Debt Service Coverage Ratio":()=>N(t,o[a-1],r),"Days Inventory Outstanding":()=>{var e;return O(t,null===(e=c[a-1])||void 0===e?void 0:e.dio,r)},"Days Sales Outstanding":()=>{var e;return R(t,null===(e=c[a-1])||void 0===e?void 0:e.arDays,r)},"Days Payable Outstanding":()=>{var e;return M(t,null===(e=c[a-1])||void 0===e?void 0:e.apDays,r)},"Cash Conversion Cycle":()=>{var e;return S(t,null===(e=c[a-1])||void 0===e?void 0:e.ccc,r)},"Return on Equity":()=>{var e;return I(t,null===(e=c[a-1])||void 0===e?void 0:e.roe,r)},"Equity Multiplier":()=>{var e;return T(t,null===(e=c[a-1])||void 0===e?void 0:e.equityMultiplier,r)},"Asset Turnover":()=>{var e;return E(t,null===(e=c[a-1])||void 0===e?void 0:e.assetTurnover,r)},"DuPont ROE":()=>{var e;return P(t,null===(e=c[a-1])||void 0===e?void 0:e.dupontRoe,r)}}[t.row["id-0"]];if(d)return d();let u=r?r(t.value):t.value;return x({...t,value:u})},J=e=>{let{calculations:t,fsColumns:a,lengthOfHistoricals:n}=e;return a.map((e,a)=>({...e,headerName:0===a?"Key Ratios":"".concat(F().utc().subtract(n+1-a,"month").format("MMM-YYYY")),minWidth:0===a?210:95,renderCell:e=>W({params:e,index:a,calculations:t})}))},G={"Gross Margin":e=>null===e?"":(0,y.V)(e,"PercentNoDecimals"),"Net Profit Margin":e=>null===e?"":(0,y.V)(e,"PercentOneDecimal"),"Debt-to-Equity Ratio":e=>null===e?"":(0,y.V)(e,"NumberOneDecimal"),"Current Ratio":e=>null===e?"":(0,y.V)(e,"NumberOneDecimal"),"Debt Service Coverage Ratio":e=>null===e?"":(0,y.V)(e,"NumberDecimals")},_=e=>{let{colCountIncludingRowHeader:t,lengthOfHistoricals:a}=e;return Array.from({length:t}).map((e,t)=>{let n=0===t?"Key Ratios":"".concat(F().utc().subtract(a+1-t,"month").format("MMM-YYYY"));return{field:"id-".concat(t),headerName:n,type:"number",editable:!1,minWidth:0===t?210:120,flex:1,sortable:!1,renderCell:e=>{if(0===t)return e.value;let a=G[e.row["id-0"]];return a?a(e.value):e.value}}})},Q=e=>{let{newRowsToUse:t,bsNewRowsToUse:a,lengthOfProjections:n,lengthOfHistoricals:r,colCountIncludingRowHeader:s,simplifiedNodesAll:i,totalMonthlyIntExpArray:l,totalMonthlyPrincRepayArray:o,normalizedDataList:c,bsNormalizedDataList:d,loanNodesWithDetails:h}=e,m=_({colCountIncludingRowHeader:s,lengthOfHistoricals:r}),f=u({plRows:t,bsRows:a,lengthOfProjections:n,lengthOfHistoricals:r,simplifiedNodes:i,totalMonthlyIntExpArray:l,totalMonthlyPrincRepayArray:o,normalizedDataList:c,bsNormalizedDataList:d,loanNodesWithDetails:h}),p=J({calculations:f,fsColumns:m,lengthOfHistoricals:r});return{singleMonthCalculations:f,singleMonthCalculationsColumns:p}},X=e=>{let{projectionsIndex:t,lineItems:a}=e,n=F().utc().add(t,"month").endOf("month"),r=F().utc().endOf("month"),s=0;
1return a.forEach(e=>{let t=F().unix(e.startDate).startOf("month"),a=e.endDisabled?r.add(10,"years"):F().unix(e.endDate).endOf("month");n.isSameOrAfter(t)&&n.isSameOrBefore(a)&&(s+=1)}),s},K=e=>{let{lengthOfProjections:t,simplifiedNodesAll:a}=e,n=a.filter(e=>"payroll"===e.category).map(e=>e.lineItems).flat();return Array(t).fill(0).map((e,t)=>X({projectionsIndex:t,lineItems:n}))},$=e=>{let t,{cashBalance:a,lengthOfHistoricals:n,lengthOfProjections:r,finalCashArray:s}=e;if(0===n)t=Array.from({length:r+1},(e,t)=>F().utc().add(t-1,"month").format("MMM-YYYY"));else{let e=n+1;t=Array.from({length:e+r},(t,a)=>F().utc().add(a-e,"month").format("MMM-YYYY"))}let i=s;return 0===n&&(i=[a,...s]),[["","Cash Balance"],...t.map((e,t)=>[e,i[t]])]},ee=e=>t=>{let{percent:a,fractionDigits:n,notDollars:r}=t;return{responsive:!1,maintainAspectRatio:!1,scales:{x:{grid:{display:!0,color:s.T6,tickWidth:0},ticks:{color:e.palette.text.secondary,font:{family:e.typography.fontFamily,size:e.typography.fontSize},maxTicksLimit:6}},y:{beginAtZero:!0,grid:{display:!0,color:s.T6,tickWidth:0},ticks:{color:e.palette.text.secondary,font:{family:e.typography.fontFamily,size:e.typography.fontSize},maxTicksLimit:6,callback:e=>(0,U.x3)({value:e,percent:a,fractionDigits:n,notDollars:r})}}},plugins:{tooltip:{bodyFont:{family:e.typography.fontFamily,size:e.typography.fontSize},displayColors:!1,callbacks:{label(e){let t=e.raw;if(["Revenue","Cost"].includes(e.dataset.label)){let t=e.chart.data.datasets[0],s=e.chart.data.datasets[1],i=t.data[e.dataIndex],l=s.data[e.dataIndex];return" Rev: ".concat((0,U.x3)({value:i,percent:a,fractionDigits:n,notDollars:r}),"\n Cost: ").concat((0,U.x3)({value:l,percent:a,fractionDigits:n,notDollars:r}),"\n Profit: ").concat((0,U.x3)({value:i-l,percent:a,fractionDigits:n,notDollars:r}))}return" ".concat(e.dataset.label,": ").concat((0,U.x3)({value:t,percent:a,fractionDigits:n,notDollars:r}))}}},legend:{display:!1},title:{display:!1}}}}},65988:function(e,t,a){a.d(t,{TK:function(){return s},eJ:function(){return r}});var n=a(73545);let r=(e,t)=>(0,n.Z)(e,{defaultValue:t}),s={formSubmitted:!1,chartColor:"#6e9ecf"}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.