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E/./src/api/client/portfolio-chart.api.types.ts","webpack://_N_E/./src/components/pages/detail/portfolio-chart/configs.ts","webpack://_N_E/./src/api/client/portfolio-chart.api.ts","webpack://_N_E/./src/components/pages/detail/portfolio-chart/calc-percentage-with-others.ts","webpack://_N_E/./src/components/pages/detail/portfolio-chart/chart-utils.tsx","webpack://_N_E/./src/components/pages/detail/portfolio-chart/use-portfolio-chart.ts","webpack://_N_E/./src/components/pages/detail/portfolio-chart/portfolio-chart.tsx","webpack://_N_E/./src/hooks/portfolio/use-asset-color.ts","webpack://_N_E/./src/hooks/portfolio/use-weightage-formatter.ts","webpack://_N_E/"],"sourcesContent":["export enum EnumAssetType {\n Stock = \"Stock\",\n ETF = \"ETF\",\n Derivatives = \"Derivatives\",\n Wikifolios = \"Wikifolios\",\n Cash = \"Cash\",\n}\n\ninterface IAsset {\n assetType: EnumAssetType;\n name: string;\n amount: number;\n}\n\nexport interface IPortfolioChartResponse {\n portfolio: {\n isSuperWikifolio: boolean;\n hasWeighting: boolean;\n underlyings: IAsset[];\n };\n}\n","import { Options, Point, SeriesBarOptions, SeriesOptionsType, TooltipPositionerPointObject } from \"highcharts/highstock\";\nimport { IAsset } from \"./chart-utils\";\n\ninterface IAssetTooltipData {\n color: string;\n name: string;\n percentageFormatted: string;\n}\nexport const getAssetSeries = (underlying: IAsset, color: string, percentageFormatted: string): SeriesBarOptions & { custom: IAssetTooltipData } => ({\n type: \"bar\",\n name: underlying.name,\n data: [underlying.allocPercentage],\n color,\n custom: {\n color,\n name: underlying.name,\n percentageFormatted,\n },\n});\n\nconst CLASS_PORTFOLIO_CHART_TOOLTIP = \"portfolio-chart-tooltip\";\nexport const PORTFOLIO_CHART_TOOLTIP_SX = {\n [\".\" + CLASS_PORTFOLIO_CHART_TOOLTIP]: {\n h: 4,\n display: \"flex\",\n alignItems: \"center\",\n color: \"white\",\n px: 1,\n bg: \"gray.800\",\n rounded: \"8px\",\n fontSize: \"xs\",\n \"> span:nth-of-type(1)\": {\n flexShrink: 0,\n mr: 0.5,\n },\n \"> span:nth-of-type(2)\": {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n fontWeight: 600,\n },\n \"> span:nth-of-type(3)\": {\n flexShrink: 0,\n ml: 2,\n },\n },\n};\nconst getTooltipHtml = (point: Point) => {\n const underlying = point.series.options.custom as IAssetTooltipData;\n\n return `
\n \n ${underlying.name}\n ${underlying.percentageFormatted}\n
`;\n};\n\ninterface IExtendedTooltipPositionerPointObject extends TooltipPositionerPointObject {\n h: number;\n}\n\nexport const PORTFOLIO_CHART_HEIGHT = 74;\nexport const getPortfolioChartConfig = (series: SeriesOptionsType[]): Options => ({\n chart: {\n type: \"bar\",\n spacing: [27, 0, 0, 0],\n height: PORTFOLIO_CHART_HEIGHT,\n backgroundColor: \"transparent\",\n },\n accessibility: {\n point: {\n descriptionFormatter: point => `${point.series.name} ${point.percentage?.toFixed(2)}%`,\n },\n },\n plotOptions: {\n bar: {\n borderWidth: 2,\n },\n series: {\n stacking: \"percent\",\n accessibility: {\n descriptionFormat: \"\",\n },\n },\n },\n // Disable Title, Credits, Legends, RangeSelector and Exporting\n title: { text: undefined },\n credits: { enabled: false },\n legend: { enabled: false },\n exporting: { buttons: { contextButton: { enabled: false } } },\n // Define Axis\n xAxis: {\n tickLength: 0,\n lineWidth: 0,\n labels: {\n enabled: false,\n },\n },\n yAxis: {\n title: { text: null },\n gridLineWidth: 0,\n labels: {\n enabled: false,\n },\n },\n tooltip: {\n useHTML: true,\n borderWidth: 0,\n padding: 2,\n distance: 14,\n shadow: false,\n headerFormat: \"\",\n shape: \"square\",\n positioner: function (w, _, point) {\n const chartW = this.chart.chartWidth;\n // Center tooltip\n let x = point.plotX - (point as IExtendedTooltipPositionerPointObject).h / 2 - w / 2;\n\n // Ensure the tooltip is not overflowing the chart\n if (x < 0) {\n x = 0;\n } else if (chartW < x + w) {\n x = chartW - w;\n }\n\n return { x, y: 0 };\n },\n pointFormatter: function () {\n return getTooltipHtml(this);\n },\n },\n series,\n});\n","import { createApiPortfolioChartDataUrl } from \"src/consts/urls\";\nimport { useQuery } from \"src/hooks/react-query/use-query\";\nimport { IPortfolioChartResponse } from \"./portfolio-chart.api.types\";\n\nexport function usePortfolioChartQuery(wikifolioId: string, retry = 0) {\n return useQuery(createApiPortfolioChartDataUrl(wikifolioId), {\n queryParams: new URLSearchParams({ includePortfolio: \"true\" }),\n retry: retry,\n });\n}\n","/*\n * This algorithm takes an array of IValuePercentagesItem and mutates\n * the array updating the realPercentage and allocPercentage.\n *\n * The realPercentage is the actual percent of item in the given percentageBase (default is 100%).\n * and the allocPercentage is the allocation percentage for this item for the charts.\n * The allocPercentage is bigger or equal to minPercentage.\n *\n * If at the end, there is no space in the percentageBase for all items, a new item is created as first one.\n * This is the \"Others\" item where aggregates all the items where cannot fit.\n *\n * The algorithm is not \"detecting\" the assets for the \"Others\" but is pushing\n * the assets to the \"Others\" if they don't fit in the chart.\n *\n * This is how it works:\n * - if the percentage of an asset is <1% then make it 1%\n * - this is increasing the amount of percentage to be more that 100%\n * - the algorithm takes all these assets (above the 100%) and adds it in the \"others\"\n *\n * There is a tolerance (of 5%) where when the sum of the percentages is up to 105%,\n * it doesn't create the \"Others\" slice but it shrinks all the assets.\n * Thanks to this we don't see the \"others\" slice when small changes made only.\n */\n\nexport interface IValuePercentagesItem {\n amount: number;\n realPercentage: number; // the actual percentage of an item\n allocPercentage: number; // the allocation percentage of an item for the chart\n}\n\ninterface IArgs {\n items: IValuePercentagesItem[];\n /** The minimum allocation percentage */\n minPercentage?: number;\n /**\n * Valid values: 1-100. Default is 100.\n * How much allocation percentage the items should cover.\n * In case to calculate partial items of a bigger collection of items,\n * define here the desired partial percent that allocation percentage should cover.\n */\n percentageBase?: number;\n /**\n * After the apply of the minPercentage,\n * do not create the \"Others\" slice if the difference of the new total percentage\n * it up to this percentage. i.e. 5% means if the new percentage is up to 105% do\n * not create the \"Others\" but shrink them all.\n */\n othersTolerancePercentage?: number;\n skipSort?: boolean;\n}\n\n/**\n * Calculate the allocation percentage (the optical percentage) applying min\n * percentage and aggregate the items that don't fit.\n * If the \"Others\" item is created, will be placed as first.\n * @returns {IValuePercentagesItem[]} - The items (with the same references) with\n * the allocPercentage property updated\n */\nexport const calcPercentagesWithOthers = (args: IArgs) => {\n const { items: _items, minPercentage = 1, percentageBase = 100, othersTolerancePercentage = 5, skipSort = false } = args;\n let items = _items;\n\n const amountSum = items.reduce((acc: number, item: IValuePercentagesItem) => acc + item.amount, 0);\n\n // Calculate the percentages\n items.forEach((item: IValuePercentagesItem) => {\n item.realPercentage = (item.amount * percentageBase) / amountSum;\n item.allocPercentage = item.realPercentage;\n });\n\n // Sort them\n if (!skipSort) {\n items = items.sort((itemA: IValuePercentagesItem, itemB: IValuePercentagesItem) => itemA.realPercentage - itemB.realPercentage);\n }\n\n // Exit if all items have same or equal to percentage, no need for aggregation\n if (!items.find(item => item.allocPercentage < minPercentage)) {\n return items;\n }\n\n // Apply the minPercentage to allocPercentage if it is lower\n items.forEach((item: IValuePercentagesItem) => {\n if (item.allocPercentage < minPercentage) {\n item.allocPercentage = minPercentage;\n }\n });\n\n // If the allocPercentage exceeds the tolerance\n if (getAllocPercentageSum(items) - percentageBase > othersTolerancePercentage) {\n // Create the \"Others\" item, for the items that doesn't fit\n createOthers(items, minPercentage, percentageBase);\n } else {\n // Otherwise fit all items in the given space without reducing the items with percentage === minPercentage\n\n let sumOfMinPercentage = 0;\n let sumOfBigEnoughPercentage = 0;\n let countItemBiggerThanMin = 0;\n\n items.forEach(item => {\n if (item.allocPercentage <= minPercentage) {\n sumOfMinPercentage += item.allocPercentage;\n } else {\n sumOfBigEnoughPercentage += item.allocPercentage;\n countItemBiggerThanMin++;\n }\n });\n\n if (percentageBase - sumOfMinPercentage - countItemBiggerThanMin * minPercentage < 0) {\n createOthers(items, minPercentage, percentageBase);\n return;\n }\n\n const availableSpaceForCompressableItems = percentageBase - sumOfMinPercentage;\n\n items.forEach((item: IValuePercentagesItem) => {\n if (item.allocPercentage > minPercentage) {\n item.allocPercentage = (item.allocPercentage * availableSpaceForCompressableItems) / sumOfBigEnoughPercentage;\n }\n });\n\n // If again cannot fit, because there wasn't enough space from the compressables, create the \"Others\" item\n if (round(getAllocPercentageSum(items)) > round(percentageBase)) {\n createOthers(items, minPercentage, percentageBase);\n }\n }\n};\n\n/**\n * Create the \"Others\" item adding anything that doesn't fit as first new item\n * @param {IValuePercentagesItem[]} items - The items that will be proceeded\n * @param {number} minPercentage - The minimum allocation percentage\n * @param {number} percentageBase - How much allocation percentage the items should cover.\n */\nexport const createOthers = (items: IValuePercentagesItem[], minPercentage: number, percentageBase: number): void => {\n let othersValue = 0;\n let othersRealPercentage = 0;\n let allocPercentageSum = getAllocPercentageSum(items);\n\n // Add to \"Others\" items that doesn't fit\n const roundedPercentageBase = round(percentageBase);\n while (items.length && round(othersRealPercentage + allocPercentageSum) > roundedPercentageBase) {\n const itemForTheOthers = items.shift()!;\n othersValue += itemForTheOthers.amount;\n othersRealPercentage += itemForTheOthers.realPercentage;\n allocPercentageSum -= itemForTheOthers.allocPercentage;\n }\n\n // Calculate the alloc percentage\n let othersAllocPercentage = percentageBase - allocPercentageSum;\n\n // If the othersAllocPercentage is too small, make it minPercentage and subtract from the other items proportional\n if (othersAllocPercentage < minPercentage) {\n const differ = minPercentage - othersAllocPercentage;\n othersAllocPercentage = minPercentage;\n\n if (items.length > 0) {\n const subtractPortionForEvery = differ / items.length;\n items.forEach((item: IValuePercentagesItem) => {\n item.allocPercentage = item.allocPercentage - subtractPortionForEvery;\n });\n }\n }\n\n // Add the new \"Others\" item as the first one\n items.unshift({\n amount: othersValue,\n allocPercentage: othersAllocPercentage,\n realPercentage: othersRealPercentage,\n });\n};\n\nconst getAllocPercentageSum = (items: IValuePercentagesItem[]): number => {\n return items.reduce((acc: number, item: IValuePercentagesItem) => acc + item.allocPercentage, 0);\n};\n\nconst round = (value: number, digits = 5): number => {\n return Math.round(value * Math.pow(10, digits)) / Math.pow(10, digits);\n};\n","import { EnumAssetType, IPortfolioChartResponse } from \"src/api/client/portfolio-chart.api.types\";\nimport { calcPercentagesWithOthers } from \"./calc-percentage-with-others\";\n\nexport interface IAsset {\n assetType: EnumAssetType;\n name: string;\n amount: number;\n allocPercentage: number;\n realPercentage: number;\n}\n\ninterface IAssetGroup {\n assetType: EnumAssetType;\n totalUnderlyings: number;\n underlyings: IAsset[];\n amount: number;\n allocPercentage: number;\n realPercentage: number;\n}\n\ninterface IArgs {\n data: IPortfolioChartResponse;\n othersLabel: string;\n /** The minimum optical percentage */\n minPercentage?: number;\n /** After the apply of the minPercentage,\n * do not create the \"Others\" slice if the difference of the new total percentage\n * it up to this percentage. i.e. 5% means if the new percentage is up to 105% do\n * not create the \"Others\" but shrink them all.\n */\n othersTolerancePercentage?: number;\n}\n\n/**\n * Group the underlyings by their asset type.\n * Each underlying will have a minPercentage for the optical representation.\n * For the underlyings of each one asset type, create the \"Others\" slice aggregating the underlyings that don't fit.\n * Note: if an underlying has negative value, this value is changed to 0.00001 by default, in order to be shown in the chart as <1.0%.\n * @returns {IAssetGroup[]} - Return the AssetGroup for the chart.\n */\nexport const convertUnderlyingsToAssetGroupsWithOthers = (args: IArgs): IAssetGroup[] => {\n const { data, othersLabel, minPercentage = 1, othersTolerancePercentage = 5 } = args;\n\n const assetGroups = createAssetGroups(data);\n calcAllocPercentages(assetGroups, othersLabel, minPercentage, othersTolerancePercentage);\n return assetGroups;\n};\n\n/**\n * Group the underlyings by their asset to asset groups.\n * @param {IAsset[]} underlyings - The underlying to be grouped.\n * @returns {IAssetGroup[]} - The underlyings grouped.\n */\nconst createAssetGroups = (data: IPortfolioChartResponse): IAssetGroup[] => {\n const assetGroupMap = new Map();\n\n // Create the asset groups dictionary\n data.portfolio.underlyings.forEach(underlying => {\n // Skip if the underlying has negative value\n if (underlying.amount < 0) {\n return;\n }\n\n const groupUnderlying: IAsset = { ...underlying, allocPercentage: 0, realPercentage: 0 };\n const assetGroup = assetGroupMap.get(underlying.assetType);\n if (!assetGroup) {\n // create the group if it doesn't exist\n assetGroupMap.set(groupUnderlying.assetType, {\n assetType: groupUnderlying.assetType,\n totalUnderlyings: 1,\n underlyings: [groupUnderlying],\n amount: groupUnderlying.amount,\n allocPercentage: 0,\n realPercentage: 0,\n });\n } else {\n // update it\n assetGroup.underlyings.push(groupUnderlying);\n assetGroup.amount += groupUnderlying.amount;\n assetGroup.totalUnderlyings++;\n }\n });\n\n const result: (IAssetGroup | undefined)[] = [];\n // schedule the order of the asset-group within the bar chart\n if (data.portfolio.isSuperWikifolio) {\n result.push(assetGroupMap.get(EnumAssetType.Wikifolios));\n } else {\n result.push(assetGroupMap.get(EnumAssetType.Stock));\n result.push(assetGroupMap.get(EnumAssetType.ETF));\n result.push(assetGroupMap.get(EnumAssetType.Derivatives));\n }\n result.push(assetGroupMap.get(EnumAssetType.Cash));\n\n return result.filter(Boolean) as IAssetGroup[]; // :-(\n};\n\n/**\n * Calculate the allocation percentage (the optical percentage), applying min percentage for each one and aggregate the underlyings that don't fit.\n * @param {IAssetGroup[]} assetGroups - The grouped underlyings to asset groups\n * @param {string} othersLabel - Label of the \"Others\" slice\n * @param {number} minPercentage - Minimum optical percentage for each underlying.\n * @param {number} othersTolerancePercentage - After the apply of the minPercentage,\n * do not create the \"Others\" slice if the difference of the new total percentage\n * it up to this percentage. i.e. 5% means if the new percentage is up to 105% do\n * not create the \"Others\" but shrink them all.\n */\nconst calcAllocPercentages = (assetGroups: IAssetGroup[], othersLabel: string, minPercentage: number, othersTolerancePercentage: number): void => {\n const underlyingCountMap = new Map();\n\n // Get the underlying counts\n assetGroups.forEach(assetGroup => underlyingCountMap.set(assetGroup.assetType, assetGroup.underlyings.length));\n\n // Calculate the percentages for each asset group\n calcPercentagesWithOthers({\n items: assetGroups,\n minPercentage,\n percentageBase: 100,\n othersTolerancePercentage,\n skipSort: true,\n });\n\n // Calculate the percentages for the underlyings of each one asset group\n assetGroups.forEach((assetGroup: IAssetGroup) => {\n // The percentage base is the assetGroup.allocPercentage!\n calcPercentagesWithOthers({\n items: assetGroup.underlyings,\n minPercentage,\n percentageBase: assetGroup.allocPercentage,\n othersTolerancePercentage,\n skipSort: false,\n });\n\n // Add asset type and name for the others asset\n if (!assetGroup.underlyings[0].assetType) {\n const othersCount: number = underlyingCountMap.get(assetGroup.assetType)! - (assetGroup.underlyings.length - 1);\n assetGroup.underlyings[0].assetType = assetGroup.assetType;\n assetGroup.underlyings[0].name = `${othersLabel} (${othersCount})`;\n }\n\n // Reverse the assetGroup.underlyings, since the calc function returns the smallers first\n assetGroup.underlyings.reverse();\n });\n};\n","import { useMemo } from \"react\";\nimport { useTranslation } from \"next-i18next\";\nimport { usePortfolioChartQuery } from \"src/api/client/portfolio-chart.api\";\nimport { useAssetColor } from \"src/hooks/portfolio/use-asset-color\";\nimport { useWeightageFormatter } from \"src/hooks/portfolio/use-weightage-formatter\";\nimport { convertUnderlyingsToAssetGroupsWithOthers } from \"./chart-utils\";\nimport { getAssetSeries, getPortfolioChartConfig } from \"./configs\";\n\nexport const usePortfolioChart = (wikifolioId: string) => {\n const colorMap = useAssetColor();\n const formatWeightage = useWeightageFormatter();\n const { t } = useTranslation(\"wf-detail\");\n const { isLoading, isError, data } = usePortfolioChartQuery(wikifolioId);\n\n const computedData = useMemo(() => {\n if (!data?.portfolio.hasWeighting) {\n return null;\n }\n\n const assetGroups = convertUnderlyingsToAssetGroupsWithOthers({ data, othersLabel: t(\"others\") });\n const amountSum = assetGroups.reduce((acc, assetGroup) => acc + assetGroup.amount, 0);\n\n const series = assetGroups\n .flatMap(assetGroup => assetGroup.underlyings)\n .reverse()\n .map(asset => getAssetSeries(asset, colorMap[asset.assetType], formatWeightage(asset.amount / amountSum, 1)));\n const config = getPortfolioChartConfig(series);\n\n return { assetGroups, config, amountSum };\n }, [colorMap, data, formatWeightage, t]);\n\n return {\n isLoading,\n isError: isError,\n hasWeighting: Boolean(data?.portfolio.hasWeighting),\n ...(computedData ?? {}),\n };\n};\n","import { useRef } from \"react\";\nimport { Box, BoxProps, Flex, Grid, SimpleGrid, Text } from \"@chakra-ui/react\";\nimport Highstock from \"highcharts/highstock\";\nimport HighchartsAccessibility from \"highcharts/modules/accessibility\";\nimport { useTranslation } from \"next-i18next\";\nimport { EnumAssetType } from \"src/api/client/portfolio-chart.api.types\";\nimport { IPortfolioChartDict } from \"src/api/server/wf-detail.types\";\nimport { FullSizeFlexCentered } from \"src/components/base\";\nimport { IconHidden } from \"src/components/icons\";\nimport { useAssetColor } from \"src/hooks/portfolio/use-asset-color\";\nimport { useWeightageFormatter } from \"src/hooks/portfolio/use-weightage-formatter\";\nimport { useIsomorphicLayoutEffect } from \"src/utils/common-util\";\nimport { logger } from \"src/utils/logger-util\";\nimport { PORTFOLIO_CHART_HEIGHT, PORTFOLIO_CHART_TOOLTIP_SX } from \"./configs\";\nimport { LoadingState } from \"./loading-state\";\nimport { usePortfolioChart } from \"./use-portfolio-chart\";\n\nconst UNKNOWN_ASSET_TYPE_ERROR_MESSAGE = \"Unknown asset type:\";\n\nconst getAssetGroupLabel = (type: EnumAssetType, dict: IPortfolioChartDict) => {\n switch (type) {\n case EnumAssetType.Stock:\n return dict.stock;\n case EnumAssetType.ETF:\n return dict.etf;\n case EnumAssetType.Derivatives:\n return dict.derivatives;\n case EnumAssetType.Wikifolios:\n return dict.wikifolios;\n case EnumAssetType.Cash:\n return dict.cash;\n default:\n logger.error({ message: UNKNOWN_ASSET_TYPE_ERROR_MESSAGE, type });\n return \"\";\n }\n};\n\nconst getColumnsXs = (assetGroupsLength: number) => (assetGroupsLength === 1 ? 1 : 2);\n\nconst EmptyState = () => {\n const { t } = useTranslation(\"common\");\n\n return (\n \n \n \n {[1, 2, 3, 4].map(key => (\n \n ))}\n \n \n \n \n {t(\"no-data\")}\n \n \n \n );\n};\n\nconst CHART_SX = {\n mt: -1,\n [\"& *\"]: {\n fontFamily: \"body\",\n },\n ...PORTFOLIO_CHART_TOOLTIP_SX,\n};\n\ninterface IAssetGroupProps {\n value: string;\n color: string;\n label: string;\n count?: number;\n}\nconst AssetGroup = ({ value, color, label, count }: IAssetGroupProps) => (\n \n \n {value}\n \n \n \n ●\n \n \n {label}\n {count && <> ({count})}\n \n \n \n);\n\nexport interface IPortfolioChartProps extends BoxProps {\n wikifolioId: string;\n dict: IPortfolioChartDict;\n}\n\nexport const PortfolioChart = ({ wikifolioId, dict }: IPortfolioChartProps) => {\n const { t } = useTranslation([\"common\", \"wf-detail\"]);\n const formatWeightage = useWeightageFormatter();\n const colorMap = useAssetColor();\n const ref = useRef(null);\n const { isLoading, isError, hasWeighting, config, assetGroups, amountSum } = usePortfolioChart(wikifolioId);\n\n useIsomorphicLayoutEffect(() => {\n HighchartsAccessibility(Highstock);\n\n if (!ref.current || !config) {\n return;\n }\n\n Highstock.setOptions({\n lang: {\n accessibility: {\n svgContainerLabel: t(\"labels.portfolio-chart-aria-label\", { ns: \"wf-detail\" }),\n },\n },\n });\n Highstock.chart(ref.current, config);\n });\n\n const columnXs = assetGroups ? getColumnsXs(assetGroups.length) : undefined;\n\n return (\n <>\n {isLoading && }\n {!isLoading && (isError || !hasWeighting) && }\n {config && assetGroups && amountSum && (\n <>\n \n \n {assetGroups.map((group, i) => (\n \n ))}\n \n \n )}\n \n );\n};\n","import { useMemo } from \"react\";\nimport { useToken } from \"@chakra-ui/react\";\nimport { EnumAssetType } from \"src/api/client/portfolio-chart.api.types\";\nimport { EnumAssetType as EnumAssetType2 } from \"src/api/client/portfolio-table.api\";\n\nexport const useAssetColor = () => {\n const [green600, lilac600, orange600, yellow600, blue600] = useToken(\"colors\", [\n \"green.600\",\n \"lilac.600\",\n \"orange.600\",\n \"yellow.600\",\n \"blue.600\",\n ]) as string[];\n\n return useMemo(\n () => ({\n [EnumAssetType.Stock]: green600,\n [EnumAssetType.ETF]: lilac600,\n [EnumAssetType.Derivatives]: orange600,\n [EnumAssetType.Wikifolios]: yellow600,\n [EnumAssetType.Cash]: blue600,\n // number based\n [EnumAssetType2.Stocks]: green600,\n [EnumAssetType2.ETFs]: lilac600,\n [EnumAssetType2.Derivatives]: orange600,\n [EnumAssetType2.Wikifolios]: yellow600,\n [EnumAssetType2.Cash]: blue600,\n }),\n [blue600, green600, lilac600, orange600, yellow600]\n );\n};\n","import { useCallback } from \"react\";\nimport { IFractionDigits } from \"../formatters/number-formatter\";\nimport { useNumberFormatter } from \"../formatters/use-number-formatter\";\n\nexport const useWeightageFormatter = () => {\n const { formatPercent } = useNumberFormatter();\n\n return useCallback(\n (weightPercent: number, fractionDigits?: IFractionDigits) => {\n if (weightPercent <= 0.01) {\n return \"<\" + formatPercent(0.01, fractionDigits);\n } else if (0.999 < weightPercent && weightPercent < 1) {\n return formatPercent(0.999, fractionDigits);\n } else {\n return formatPercent(weightPercent, fractionDigits);\n }\n },\n [formatPercent]\n );\n};\n"],"names":["EnumAssetType","Stock","ETF","Derivatives","Wikifolios","Cash","getAssetSeries","underlying","color","percentageFormatted","type","name","data","allocPercentage","custom","CLASS_PORTFOLIO_CHART_TOOLTIP","getTooltipHtml","point","series","options","concat","getPortfolioChartConfig","chart","spacing","height","backgroundColor","accessibility","descriptionFormatter","percentage","toFixed","plotOptions","bar","borderWidth","stacking","descriptionFormat","title","text","undefined","credits","enabled","legend","exporting","buttons","contextButton","xAxis","tickLength","lineWidth","labels","yAxis","gridLineWidth","tooltip","useHTML","padding","distance","shadow","headerFormat","shape","positioner","w","_","chartW","chartWidth","x","plotX","h","y","pointFormatter","calcPercentagesWithOthers","items","_items","minPercentage","percentageBase","othersTolerancePercentage","skipSort","args","amountSum","reduce","acc","item","amount","forEach","realPercentage","sort","itemA","itemB","find","getAllocPercentageSum","createOthers","sumOfMinPercentage","sumOfBigEnoughPercentage","countItemBiggerThanMin","availableSpaceForCompressableItems","round","othersValue","othersRealPercentage","allocPercentageSum","roundedPercentageBase","length","itemForTheOthers","shift","othersAllocPercentage","differ","subtractPortionForEvery","unshift","value","digits","Math","pow","convertUnderlyingsToAssetGroupsWithOthers","othersLabel","assetGroups","createAssetGroups","calcAllocPercentages","assetGroupMap","Map","portfolio","underlyings","groupUnderlying","assetGroup","get","assetType","push","totalUnderlyings","set","result","isSuperWikifolio","filter","Boolean","underlyingCountMap","othersCount","reverse","usePortfolioChart","colorMap","useAssetColor","formatWeightage","useWeightageFormatter","t","useTranslation","isLoading","isError","usePortfolioChartQuery","wikifolioId","retry","useQuery","createApiPortfolioChartDataUrl","queryParams","URLSearchParams","includePortfolio","computedData","useMemo","hasWeighting","flatMap","map","asset","config","getAssetGroupLabel","dict","stock","etf","derivatives","wikifolios","cash","logger","message","getColumnsXs","assetGroupsLength","EmptyState","jsx_runtime","jsxs","Box","pb","pointerEvents","jsx","mt","rounded","bg","SimpleGrid","columns","key","mx","FullSizeFlexCentered","direction","top","IconHidden","boxSize","Text","fontSize","fontWeight","CHART_SX","fontFamily","display","alignItems","px","flexShrink","mr","overflow","textOverflow","whiteSpace","ml","AssetGroup","label","count","param","Flex","align","Fragment","PortfolioChart","ref","useRef","useIsomorphicLayoutEffect","HighchartsAccessibility","Highstock","current","lang","svgContainerLabel","ns","columnXs","LoadingState","PORTFOLIO_CHART_HEIGHT","sx","Grid","templateColumns","rowGap","group","i","green600","lilac600","orange600","yellow600","blue600","useToken","EnumAssetType2","formatPercent","useNumberFormatter","useCallback","weightPercent","fractionDigits"],"sourceRoot":""}