@cranberry-money/shared-utils 8.19.7 → 8.19.10
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/allocations.d.ts +0 -15
- package/dist/allocations.d.ts.map +1 -1
- package/dist/allocations.js +0 -16
- package/dist/allocations.js.map +1 -1
- package/dist/badge-status.d.ts +0 -58
- package/dist/badge-status.d.ts.map +1 -1
- package/dist/badge-status.js +0 -60
- package/dist/badge-status.js.map +1 -1
- package/dist/badge.d.ts +0 -36
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +0 -46
- package/dist/badge.js.map +1 -1
- package/dist/cash-account.d.ts +0 -36
- package/dist/cash-account.d.ts.map +1 -1
- package/dist/cash-account.js +0 -33
- package/dist/cash-account.js.map +1 -1
- package/dist/currency.d.ts +0 -82
- package/dist/currency.d.ts.map +1 -1
- package/dist/currency.js +0 -82
- package/dist/currency.js.map +1 -1
- package/dist/dashboard.d.ts +0 -48
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +2 -52
- package/dist/dashboard.js.map +1 -1
- package/dist/date.d.ts +0 -59
- package/dist/date.d.ts.map +1 -1
- package/dist/date.js +0 -59
- package/dist/date.js.map +1 -1
- package/dist/downloads.d.ts +0 -10
- package/dist/downloads.d.ts.map +1 -1
- package/dist/downloads.js +0 -10
- package/dist/downloads.js.map +1 -1
- package/dist/filters.d.ts +0 -74
- package/dist/filters.d.ts.map +1 -1
- package/dist/filters.js +0 -74
- package/dist/filters.js.map +1 -1
- package/dist/holdings.d.ts +0 -13
- package/dist/holdings.d.ts.map +1 -1
- package/dist/holdings.js +0 -13
- package/dist/holdings.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/instruments.d.ts +0 -14
- package/dist/instruments.d.ts.map +1 -1
- package/dist/instruments.js +1 -15
- package/dist/instruments.js.map +1 -1
- package/dist/numbers.d.ts +0 -14
- package/dist/numbers.d.ts.map +1 -1
- package/dist/numbers.js +0 -14
- package/dist/numbers.js.map +1 -1
- package/dist/portfolio-template.d.ts +0 -50
- package/dist/portfolio-template.d.ts.map +1 -1
- package/dist/portfolio-template.js +0 -47
- package/dist/portfolio-template.js.map +1 -1
- package/dist/portfolio-validation.d.ts +0 -28
- package/dist/portfolio-validation.d.ts.map +1 -1
- package/dist/portfolio-validation.js +0 -25
- package/dist/portfolio-validation.js.map +1 -1
- package/dist/portfolio.d.ts +0 -63
- package/dist/portfolio.d.ts.map +1 -1
- package/dist/portfolio.js +0 -63
- package/dist/portfolio.js.map +1 -1
- package/dist/text.d.ts +0 -20
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +0 -20
- package/dist/text.js.map +1 -1
- package/dist/user-profile-validation.d.ts +32 -0
- package/dist/user-profile-validation.d.ts.map +1 -0
- package/dist/user-profile-validation.js +179 -0
- package/dist/user-profile-validation.js.map +1 -0
- package/dist/validation.d.ts +0 -79
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +0 -82
- package/dist/validation.js.map +1 -1
- package/dist/withdrawal-status.d.ts +0 -60
- package/dist/withdrawal-status.d.ts.map +1 -1
- package/dist/withdrawal-status.js +11 -71
- package/dist/withdrawal-status.js.map +1 -1
- package/dist/withdrawal.d.ts +0 -40
- package/dist/withdrawal.d.ts.map +1 -1
- package/dist/withdrawal.js +0 -40
- package/dist/withdrawal.js.map +1 -1
- package/package.json +1 -1
package/dist/currency.js
CHANGED
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Currency formatting utility functions and constants
|
|
3
|
-
*
|
|
4
|
-
* This module provides pure functions for formatting currency values,
|
|
5
|
-
* parsing currency inputs, and working with different currency formats.
|
|
6
|
-
*/
|
|
7
1
|
import { DEFAULT_CURRENCY, DECIMAL_PLACES } from '@cranberry-money/shared-constants';
|
|
8
|
-
/**
|
|
9
|
-
* Number formatting options for currency display
|
|
10
|
-
*/
|
|
11
2
|
export const NUMBER_FORMAT_OPTIONS_CURRENCY = {
|
|
12
3
|
style: 'currency',
|
|
13
4
|
minimumFractionDigits: DECIMAL_PLACES,
|
|
14
5
|
maximumFractionDigits: DECIMAL_PLACES,
|
|
15
6
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Number formatting options for currency with explicit sign display
|
|
18
|
-
*/
|
|
19
7
|
export const NUMBER_FORMAT_OPTIONS_CURRENCY_SIGNED = {
|
|
20
8
|
...NUMBER_FORMAT_OPTIONS_CURRENCY,
|
|
21
9
|
signDisplay: 'always',
|
|
22
10
|
};
|
|
23
|
-
/**
|
|
24
|
-
* Formats a number as currency with commas and 2 decimal places
|
|
25
|
-
*
|
|
26
|
-
* @param value - Number or string value to format
|
|
27
|
-
* @returns Formatted currency string without currency symbol
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* formatCurrency(1234.5) // '1,234.50'
|
|
32
|
-
* formatCurrency('1234.5') // '1,234.50'
|
|
33
|
-
* formatCurrency(0) // '0.00'
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
11
|
export function formatCurrency(value) {
|
|
37
12
|
if (!value && value !== 0)
|
|
38
13
|
return '';
|
|
@@ -44,42 +19,12 @@ export function formatCurrency(value) {
|
|
|
44
19
|
maximumFractionDigits: 2,
|
|
45
20
|
});
|
|
46
21
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Parses a currency string input into a number
|
|
49
|
-
*
|
|
50
|
-
* @param value - Currency string to parse
|
|
51
|
-
* @returns Parsed number value (or 0 if invalid)
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* parseCurrencyInput('$1,234.56') // 1234.56
|
|
56
|
-
* parseCurrencyInput('1234.567') // 1234.56
|
|
57
|
-
* parseCurrencyInput('abc') // 0
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
22
|
export function parseCurrencyInput(value) {
|
|
61
23
|
const cleanValue = value.replace(/[^0-9.]/g, '');
|
|
62
24
|
const parts = cleanValue.split('.');
|
|
63
25
|
const formattedValue = parts[0] + (parts.length > 1 && parts[1] ? '.' + parts[1].slice(0, 2) : '');
|
|
64
26
|
return parseFloat(formattedValue) || 0;
|
|
65
27
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Formats a number as currency with specific currency code and locale
|
|
68
|
-
*
|
|
69
|
-
* @param value - Number to format
|
|
70
|
-
* @param currencyCode - ISO 4217 currency code (default: DEFAULT_CURRENCY)
|
|
71
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
72
|
-
* @param minimumFractionDigits - Minimum decimal places (default: 0)
|
|
73
|
-
* @param maximumFractionDigits - Maximum decimal places (default: 0)
|
|
74
|
-
* @returns Formatted currency string
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* formatCurrencyWithCode(1234.5) // 'A$1,235'
|
|
79
|
-
* formatCurrencyWithCode(1234.5, 'USD', 'en-US') // '$1,235'
|
|
80
|
-
* formatCurrencyWithCode(1234.56, 'AUD', 'en-AU', 2, 2) // 'A$1,234.56'
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
28
|
export function formatCurrencyWithCode(value, currencyCode = DEFAULT_CURRENCY, locale = 'en-AU', minimumFractionDigits = 0, maximumFractionDigits = 0) {
|
|
84
29
|
if (value == null || isNaN(value))
|
|
85
30
|
return '';
|
|
@@ -90,36 +35,9 @@ export function formatCurrencyWithCode(value, currencyCode = DEFAULT_CURRENCY, l
|
|
|
90
35
|
maximumFractionDigits,
|
|
91
36
|
}).format(value);
|
|
92
37
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Convenience function to format currency with the default currency (AUD)
|
|
95
|
-
*
|
|
96
|
-
* @param value - Number to format
|
|
97
|
-
* @param minimumFractionDigits - Minimum decimal places (default: 0)
|
|
98
|
-
* @param maximumFractionDigits - Maximum decimal places (default: 0)
|
|
99
|
-
* @returns Formatted currency string with default currency
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* formatDefaultCurrency(1234.5) // 'A$1,235'
|
|
104
|
-
* formatDefaultCurrency(1234.56, 2, 2) // 'A$1,234.56'
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
38
|
export function formatDefaultCurrency(value, minimumFractionDigits = 0, maximumFractionDigits = 0) {
|
|
108
39
|
return formatCurrencyWithCode(value, DEFAULT_CURRENCY, 'en-AU', minimumFractionDigits, maximumFractionDigits);
|
|
109
40
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Formats a number for displaying share quantities (no decimals)
|
|
112
|
-
*
|
|
113
|
-
* @param shares - Number of shares to format
|
|
114
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
115
|
-
* @returns Formatted shares string with commas as thousands separators
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```typescript
|
|
119
|
-
* formatShares(1234) // '1,234'
|
|
120
|
-
* formatShares(1234567) // '1,234,567'
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
41
|
export function formatShares(shares, locale = 'en-AU') {
|
|
124
42
|
return new Intl.NumberFormat(locale, {
|
|
125
43
|
minimumFractionDigits: 0,
|
package/dist/currency.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../src/currency.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../src/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAErF,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,KAAK,EAAE,UAAU;IACjB,qBAAqB,EAAE,cAAc;IACrC,qBAAqB,EAAE,cAAc;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,8BAA8B;IACjC,WAAW,E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UAAU;QACjB,QAAQ,EAAE,YAAY;QACtB,qBAAqB;QACrB,qBAAqB;KACtB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,wBAAgC,CAAC,EACjC,wBAAgC,CAAC;IAEjC,OAAO,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;AAChH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,SAAiB,OAAO;IACnE,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACnC,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,EAAE,CAAC;KACzB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/dashboard.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { AssetAllocation, AssetHolding } from '@cranberry-money/shared-types';
|
|
2
|
-
/**
|
|
3
|
-
* Display item interface for allocation data
|
|
4
|
-
*/
|
|
5
2
|
export interface AllocationDisplayItem {
|
|
6
3
|
readonly instrumentUuid: string;
|
|
7
4
|
readonly symbol: string;
|
|
@@ -15,58 +12,13 @@ export interface AllocationDisplayItem {
|
|
|
15
12
|
readonly hasTarget: boolean;
|
|
16
13
|
readonly hasActual: boolean;
|
|
17
14
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Processes allocation and holding data for dashboard display
|
|
20
|
-
* Merges target allocations with actual holdings data
|
|
21
|
-
*
|
|
22
|
-
* @param allocations - Target asset allocations
|
|
23
|
-
* @param holdings - Actual asset holdings
|
|
24
|
-
* @returns Array of display items sorted by target/actual percentage
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* const allocations = [{ instrument: '123', percentage: '50.00', ... }];
|
|
28
|
-
* const holdings = [{ instrument: { uuid: '123' }, quantity: 100, ... }];
|
|
29
|
-
* processAllocationData(allocations, holdings);
|
|
30
|
-
*/
|
|
31
15
|
export declare const processAllocationData: (allocations: readonly AssetAllocation[], holdings: readonly AssetHolding[]) => AllocationDisplayItem[];
|
|
32
|
-
/**
|
|
33
|
-
* Calculates totals from allocation display items
|
|
34
|
-
*
|
|
35
|
-
* @param items - Array of allocation display items
|
|
36
|
-
* @returns Object with total calculations
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* const items = [{ targetPercentage: 50, actualPercentage: 45, value: 1000, quantity: 10 }];
|
|
40
|
-
* calculateTotals(items);
|
|
41
|
-
* // returns { totalTarget: 50, totalActual: 45, totalValue: 1000, totalQuantity: 10 }
|
|
42
|
-
*/
|
|
43
16
|
export declare const calculateTotals: (items: readonly AllocationDisplayItem[]) => {
|
|
44
17
|
totalTarget: number;
|
|
45
18
|
totalActual: number;
|
|
46
19
|
totalValue: number;
|
|
47
20
|
totalQuantity: number;
|
|
48
21
|
};
|
|
49
|
-
/**
|
|
50
|
-
* Formats a percentage value for display
|
|
51
|
-
*
|
|
52
|
-
* @param value - The percentage value to format
|
|
53
|
-
* @returns Formatted percentage string
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* formatPercentage(45.678); // returns "45.7%"
|
|
57
|
-
* formatPercentage(undefined); // returns "0.0%"
|
|
58
|
-
*/
|
|
59
22
|
export declare const formatPercentage: (value?: number) => string;
|
|
60
|
-
/**
|
|
61
|
-
* Formats currency value for dashboard display
|
|
62
|
-
*
|
|
63
|
-
* @param value - The numeric value to format
|
|
64
|
-
* @param currency - Currency code (defaults to DEFAULT_CURRENCY)
|
|
65
|
-
* @returns Formatted currency string or "—" for undefined values
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* formatDashboardCurrency(1234.56); // returns "$1,234.56"
|
|
69
|
-
* formatDashboardCurrency(undefined); // returns "—"
|
|
70
|
-
*/
|
|
71
23
|
export declare const formatDashboardCurrency: (value?: number, currency?: string) => string;
|
|
72
24
|
//# sourceMappingURL=dashboard.d.ts.map
|
package/dist/dashboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAKnF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,qBAAqB,GAChC,aAAa,SAAS,eAAe,EAAE,EACvC,UAAU,SAAS,YAAY,EAAE,KAChC,qBAAqB,EAoEvB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,qBAAqB,EAAE;;;;;CAOtE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAGjD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,QAAQ,MAAM,EAAE,WAAU,MAAyB,KAAG,MAG7F,CAAC"}
|
package/dist/dashboard.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
import { DEFAULT_CURRENCY } from '@cranberry-money/shared-constants';
|
|
2
|
-
import { getChartColor } from '@cranberry-money/shared-constants';
|
|
1
|
+
import { DEFAULT_CURRENCY, DESIGN_TOKENS } from '@cranberry-money/shared-constants';
|
|
3
2
|
import { formatCurrencyWithCode } from './currency';
|
|
4
3
|
import { calculateHoldingAllocations } from './holdings';
|
|
5
|
-
/**
|
|
6
|
-
* Processes allocation and holding data for dashboard display
|
|
7
|
-
* Merges target allocations with actual holdings data
|
|
8
|
-
*
|
|
9
|
-
* @param allocations - Target asset allocations
|
|
10
|
-
* @param holdings - Actual asset holdings
|
|
11
|
-
* @returns Array of display items sorted by target/actual percentage
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* const allocations = [{ instrument: '123', percentage: '50.00', ... }];
|
|
15
|
-
* const holdings = [{ instrument: { uuid: '123' }, quantity: 100, ... }];
|
|
16
|
-
* processAllocationData(allocations, holdings);
|
|
17
|
-
*/
|
|
18
4
|
export const processAllocationData = (allocations, holdings) => {
|
|
19
5
|
const actualAllocations = calculateHoldingAllocations(holdings);
|
|
20
6
|
const instrumentMap = new Map();
|
|
21
|
-
// Process target allocations
|
|
22
7
|
allocations.forEach(allocation => {
|
|
23
8
|
instrumentMap.set(allocation.instrument, {
|
|
24
9
|
symbol: allocation.instrumentSymbol,
|
|
@@ -26,7 +11,6 @@ export const processAllocationData = (allocations, holdings) => {
|
|
|
26
11
|
targetPercentage: parseFloat(allocation.percentage),
|
|
27
12
|
});
|
|
28
13
|
});
|
|
29
|
-
// Process actual holdings
|
|
30
14
|
holdings.forEach(holding => {
|
|
31
15
|
const existing = instrumentMap.get(holding.instrument.uuid);
|
|
32
16
|
const currentPrice = parseFloat(holding.instrument.currentPrice || '0');
|
|
@@ -41,7 +25,6 @@ export const processAllocationData = (allocations, holdings) => {
|
|
|
41
25
|
value,
|
|
42
26
|
});
|
|
43
27
|
});
|
|
44
|
-
// Convert to display items
|
|
45
28
|
const items = [];
|
|
46
29
|
let colorIndex = 0;
|
|
47
30
|
instrumentMap.forEach((data, instrumentUuid) => {
|
|
@@ -54,12 +37,11 @@ export const processAllocationData = (allocations, holdings) => {
|
|
|
54
37
|
quantity: data.quantity,
|
|
55
38
|
currentPrice: data.currentPrice,
|
|
56
39
|
value: data.value,
|
|
57
|
-
color:
|
|
40
|
+
color: DESIGN_TOKENS.colors.chart[colorIndex++ % DESIGN_TOKENS.colors.chart.length],
|
|
58
41
|
hasTarget: data.targetPercentage !== undefined,
|
|
59
42
|
hasActual: data.actualPercentage !== undefined && data.actualPercentage > 0,
|
|
60
43
|
});
|
|
61
44
|
});
|
|
62
|
-
// Sort by target percentage (highest first), then by actual percentage
|
|
63
45
|
return items.sort((a, b) => {
|
|
64
46
|
const aTarget = a.targetPercentage || 0;
|
|
65
47
|
const bTarget = b.targetPercentage || 0;
|
|
@@ -70,17 +52,6 @@ export const processAllocationData = (allocations, holdings) => {
|
|
|
70
52
|
return bActual - aActual;
|
|
71
53
|
});
|
|
72
54
|
};
|
|
73
|
-
/**
|
|
74
|
-
* Calculates totals from allocation display items
|
|
75
|
-
*
|
|
76
|
-
* @param items - Array of allocation display items
|
|
77
|
-
* @returns Object with total calculations
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* const items = [{ targetPercentage: 50, actualPercentage: 45, value: 1000, quantity: 10 }];
|
|
81
|
-
* calculateTotals(items);
|
|
82
|
-
* // returns { totalTarget: 50, totalActual: 45, totalValue: 1000, totalQuantity: 10 }
|
|
83
|
-
*/
|
|
84
55
|
export const calculateTotals = (items) => {
|
|
85
56
|
const totalTarget = items.reduce((sum, item) => sum + (item.targetPercentage || 0), 0);
|
|
86
57
|
const totalActual = items.reduce((sum, item) => sum + (item.actualPercentage || 0), 0);
|
|
@@ -88,32 +59,11 @@ export const calculateTotals = (items) => {
|
|
|
88
59
|
const totalQuantity = items.reduce((sum, item) => sum + (item.quantity || 0), 0);
|
|
89
60
|
return { totalTarget, totalActual, totalValue, totalQuantity };
|
|
90
61
|
};
|
|
91
|
-
/**
|
|
92
|
-
* Formats a percentage value for display
|
|
93
|
-
*
|
|
94
|
-
* @param value - The percentage value to format
|
|
95
|
-
* @returns Formatted percentage string
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* formatPercentage(45.678); // returns "45.7%"
|
|
99
|
-
* formatPercentage(undefined); // returns "0.0%"
|
|
100
|
-
*/
|
|
101
62
|
export const formatPercentage = (value) => {
|
|
102
63
|
if (value === undefined)
|
|
103
64
|
return '0.0%';
|
|
104
65
|
return `${value.toFixed(1)}%`;
|
|
105
66
|
};
|
|
106
|
-
/**
|
|
107
|
-
* Formats currency value for dashboard display
|
|
108
|
-
*
|
|
109
|
-
* @param value - The numeric value to format
|
|
110
|
-
* @param currency - Currency code (defaults to DEFAULT_CURRENCY)
|
|
111
|
-
* @returns Formatted currency string or "—" for undefined values
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* formatDashboardCurrency(1234.56); // returns "$1,234.56"
|
|
115
|
-
* formatDashboardCurrency(undefined); // returns "—"
|
|
116
|
-
*/
|
|
117
67
|
export const formatDashboardCurrency = (value, currency = DEFAULT_CURRENCY) => {
|
|
118
68
|
if (value === undefined || value === null)
|
|
119
69
|
return '—';
|
package/dist/dashboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,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
|
package/dist/date.d.ts
CHANGED
|
@@ -1,64 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date and time formatting utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides pure functions for formatting dates and times
|
|
5
|
-
* in various formats suitable for display in the application.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Formats a date string to a localized date
|
|
9
|
-
*
|
|
10
|
-
* @param dateString - ISO date string or null
|
|
11
|
-
* @param fallback - Fallback text when date is null (default: 'No expiry')
|
|
12
|
-
* @returns Formatted date string
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* formatDate('2024-03-15') // '3/15/2024' (in en-US)
|
|
17
|
-
* formatDate(null) // 'No expiry'
|
|
18
|
-
* formatDate(null, 'Not set') // 'Not set'
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
export declare function formatDate(dateString: string | null, fallback?: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Formats a date string to a short date format (e.g., "Jan 15")
|
|
24
|
-
*
|
|
25
|
-
* @param dateString - ISO date string
|
|
26
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
27
|
-
* @returns Formatted short date string
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* formatShortDate('2024-01-15') // 'Jan 15'
|
|
32
|
-
* formatShortDate('2024-12-25', 'en-US') // 'Dec 25'
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
2
|
export declare function formatShortDate(dateString: string, locale?: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Formats a date string to a time format (24-hour)
|
|
38
|
-
*
|
|
39
|
-
* @param dateString - ISO date string
|
|
40
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
41
|
-
* @returns Formatted time string in 24-hour format
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* formatTime('2024-01-15T14:30:00') // '14:30'
|
|
46
|
-
* formatTime('2024-01-15T09:05:00') // '09:05'
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
3
|
export declare function formatTime(dateString: string, locale?: string): string;
|
|
50
|
-
/**
|
|
51
|
-
* Formats a date string to a combined short date and time format
|
|
52
|
-
*
|
|
53
|
-
* @param dateString - ISO date string
|
|
54
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
55
|
-
* @returns Formatted string like "Jan 15 14:30"
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* formatDateTime('2024-01-15T14:30:00') // 'Jan 15 14:30'
|
|
60
|
-
* formatDateTime('2024-12-25T09:00:00', 'en-US') // 'Dec 25 09:00'
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
4
|
export declare function formatDateTime(dateString: string, locale?: string): string;
|
|
64
5
|
//# sourceMappingURL=date.d.ts.map
|
package/dist/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,GAAE,MAAoB,GAAG,MAAM,CAG5F;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAMpF;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAM/E;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAYnF"}
|
package/dist/date.js
CHANGED
|
@@ -1,41 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date and time formatting utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides pure functions for formatting dates and times
|
|
5
|
-
* in various formats suitable for display in the application.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Formats a date string to a localized date
|
|
9
|
-
*
|
|
10
|
-
* @param dateString - ISO date string or null
|
|
11
|
-
* @param fallback - Fallback text when date is null (default: 'No expiry')
|
|
12
|
-
* @returns Formatted date string
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* formatDate('2024-03-15') // '3/15/2024' (in en-US)
|
|
17
|
-
* formatDate(null) // 'No expiry'
|
|
18
|
-
* formatDate(null, 'Not set') // 'Not set'
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
export function formatDate(dateString, fallback = 'No expiry') {
|
|
22
2
|
if (!dateString)
|
|
23
3
|
return fallback;
|
|
24
4
|
return new Date(dateString).toLocaleDateString();
|
|
25
5
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Formats a date string to a short date format (e.g., "Jan 15")
|
|
28
|
-
*
|
|
29
|
-
* @param dateString - ISO date string
|
|
30
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
31
|
-
* @returns Formatted short date string
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* formatShortDate('2024-01-15') // 'Jan 15'
|
|
36
|
-
* formatShortDate('2024-12-25', 'en-US') // 'Dec 25'
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
6
|
export function formatShortDate(dateString, locale = 'en-AU') {
|
|
40
7
|
const date = new Date(dateString);
|
|
41
8
|
return date.toLocaleDateString(locale, {
|
|
@@ -43,19 +10,6 @@ export function formatShortDate(dateString, locale = 'en-AU') {
|
|
|
43
10
|
day: 'numeric',
|
|
44
11
|
});
|
|
45
12
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Formats a date string to a time format (24-hour)
|
|
48
|
-
*
|
|
49
|
-
* @param dateString - ISO date string
|
|
50
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
51
|
-
* @returns Formatted time string in 24-hour format
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* formatTime('2024-01-15T14:30:00') // '14:30'
|
|
56
|
-
* formatTime('2024-01-15T09:05:00') // '09:05'
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
13
|
export function formatTime(dateString, locale = 'en-AU') {
|
|
60
14
|
return new Date(dateString).toLocaleTimeString(locale, {
|
|
61
15
|
hour: '2-digit',
|
|
@@ -63,19 +17,6 @@ export function formatTime(dateString, locale = 'en-AU') {
|
|
|
63
17
|
hour12: false,
|
|
64
18
|
});
|
|
65
19
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Formats a date string to a combined short date and time format
|
|
68
|
-
*
|
|
69
|
-
* @param dateString - ISO date string
|
|
70
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
71
|
-
* @returns Formatted string like "Jan 15 14:30"
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* formatDateTime('2024-01-15T14:30:00') // 'Jan 15 14:30'
|
|
76
|
-
* formatDateTime('2024-12-25T09:00:00', 'en-US') // 'Dec 25 09:00'
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
20
|
export function formatDateTime(dateString, locale = 'en-AU') {
|
|
80
21
|
const date = new Date(dateString);
|
|
81
22
|
const shortDate = date.toLocaleDateString(locale, {
|
package/dist/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,UAAyB,EAAE,WAAmB,WAAW;IAClF,IAAI,CAAC,UAAU;QAAE,OAAO,QAAQ,CAAC;IACjC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,SAAiB,OAAO;IAC1E,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACrC,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,UAAkB,EAAE,SAAiB,OAAO;IACrE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACrD,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,SAAiB,OAAO;IACzE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAChD,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAC3C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IACH,OAAO,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;AAChC,CAAC"}
|
package/dist/downloads.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File download utilities
|
|
3
|
-
* Browser-based file download functionality
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Download a blob as a file
|
|
7
|
-
* Creates a temporary download link and triggers the download
|
|
8
|
-
* @param blob - The blob to download
|
|
9
|
-
* @param filename - The filename for the downloaded file
|
|
10
|
-
*/
|
|
11
1
|
export declare function downloadBlob(blob: Blob, filename: string): void;
|
|
12
2
|
//# sourceMappingURL=downloads.d.ts.map
|
package/dist/downloads.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloads.d.ts","sourceRoot":"","sources":["../src/downloads.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"downloads.d.ts","sourceRoot":"","sources":["../src/downloads.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS/D"}
|
package/dist/downloads.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File download utilities
|
|
3
|
-
* Browser-based file download functionality
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Download a blob as a file
|
|
7
|
-
* Creates a temporary download link and triggers the download
|
|
8
|
-
* @param blob - The blob to download
|
|
9
|
-
* @param filename - The filename for the downloaded file
|
|
10
|
-
*/
|
|
11
1
|
export function downloadBlob(blob, filename) {
|
|
12
2
|
const url = window.URL.createObjectURL(blob);
|
|
13
3
|
const link = document.createElement('a');
|
package/dist/downloads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloads.js","sourceRoot":"","sources":["../src/downloads.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"downloads.js","sourceRoot":"","sources":["../src/downloads.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,IAAU,EAAE,QAAgB;IACvD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAChB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/filters.d.ts
CHANGED
|
@@ -1,86 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utility functions for filter operations
|
|
3
|
-
* Generic, reusable filter functions for managing filter states
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Checks if any filters are active
|
|
7
|
-
* @param filters - The filter object to check
|
|
8
|
-
* @param excludeFields - Fields to exclude from the active check (default: ['searchQuery'])
|
|
9
|
-
* @returns true if any filters are active, false otherwise
|
|
10
|
-
*/
|
|
11
1
|
export declare function hasActiveFilters<T extends Record<string, unknown>>(filters: T, excludeFields?: (keyof T)[]): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Counts the number of active filters
|
|
14
|
-
* @param filters - The filter object to count
|
|
15
|
-
* @param excludeFields - Fields to exclude from the count (default: ['searchQuery'])
|
|
16
|
-
* @returns The number of active filters
|
|
17
|
-
*/
|
|
18
2
|
export declare function countActiveFilters<T extends Record<string, unknown>>(filters: T, excludeFields?: (keyof T)[]): number;
|
|
19
|
-
/**
|
|
20
|
-
* Type-safe filter update helper
|
|
21
|
-
* @param currentFilters - The current filter state
|
|
22
|
-
* @param updates - The updates to apply
|
|
23
|
-
* @returns A new filter object with updates applied
|
|
24
|
-
*/
|
|
25
3
|
export declare function updateFilters<T extends Record<string, unknown>>(currentFilters: T, updates: Partial<T>): T;
|
|
26
|
-
/**
|
|
27
|
-
* Common Filter Patterns
|
|
28
|
-
* Pre-configured utilities for common filter use cases
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Check if any instrument filters are active (excluding searchQuery)
|
|
32
|
-
* Common pattern for instrument filter checking across applications
|
|
33
|
-
* @param filters - The instrument filter object to check
|
|
34
|
-
* @returns true if any non-search filters are active
|
|
35
|
-
*/
|
|
36
4
|
export declare function hasActiveInstrumentFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Count active instrument filters (excluding searchQuery)
|
|
39
|
-
* Common pattern for instrument filter counting across applications
|
|
40
|
-
* @param filters - The instrument filter object to count
|
|
41
|
-
* @returns number of active non-search filters
|
|
42
|
-
*/
|
|
43
5
|
export declare function countActiveInstrumentFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
44
|
-
/**
|
|
45
|
-
* Check if any trade filters are active (excluding searchQuery)
|
|
46
|
-
* Common pattern for trade filter checking across applications
|
|
47
|
-
* @param filters - The trade filter object to check
|
|
48
|
-
* @returns true if any non-search filters are active
|
|
49
|
-
*/
|
|
50
6
|
export declare function hasActiveTradeFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Count active trade filters (excluding searchQuery)
|
|
53
|
-
* Common pattern for trade filter counting across applications
|
|
54
|
-
* @param filters - The trade filter object to count
|
|
55
|
-
* @returns number of active non-search filters
|
|
56
|
-
*/
|
|
57
7
|
export declare function countActiveTradeFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
58
|
-
/**
|
|
59
|
-
* Check if any transaction filters are active (excluding searchQuery)
|
|
60
|
-
* Common pattern for transaction filter checking across applications
|
|
61
|
-
* @param filters - The transaction filter object to check
|
|
62
|
-
* @returns true if any non-search filters are active
|
|
63
|
-
*/
|
|
64
8
|
export declare function hasActiveTransactionFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Count active transaction filters (excluding searchQuery)
|
|
67
|
-
* Common pattern for transaction filter counting across applications
|
|
68
|
-
* @param filters - The transaction filter object to count
|
|
69
|
-
* @returns number of active non-search filters
|
|
70
|
-
*/
|
|
71
9
|
export declare function countActiveTransactionFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
72
|
-
/**
|
|
73
|
-
* Check if any target trade filters are active (excluding searchQuery)
|
|
74
|
-
* Common pattern for target trade filter checking across applications
|
|
75
|
-
* @param filters - The target trade filter object to check
|
|
76
|
-
* @returns true if any non-search filters are active
|
|
77
|
-
*/
|
|
78
10
|
export declare function hasActiveTargetTradeFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Count active target trade filters (excluding searchQuery)
|
|
81
|
-
* Common pattern for target trade filter counting across applications
|
|
82
|
-
* @param filters - The target trade filter object to count
|
|
83
|
-
* @returns number of active non-search filters
|
|
84
|
-
*/
|
|
85
11
|
export declare function countActiveTargetTradeFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
86
12
|
//# sourceMappingURL=filters.d.ts.map
|
package/dist/filters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,OAAO,EAAE,CAAC,EACV,aAAa,GAAE,CAAC,MAAM,CAAC,CAAC,EAA+B,GACtD,OAAO,CAOT;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,OAAO,EAAE,CAAC,EACV,aAAa,GAAE,CAAC,MAAM,CAAC,CAAC,EAA+B,GACtD,MAAM,CAOR;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,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