{"version":3,"file":"asoftwareworld-charts-core.mjs","sources":["../../src/app/component/core/enum/currency-code.enum.ts","../../src/app/component/core/enum/grid-options.enum.ts","../../src/app/component/core/enum/legend-type.enum.ts","../../src/app/component/core/pipe/invalid-pipe-argument-error.ts","../../src/app/component/core/pipe/currency-pipe.ts","../../src/app/component/core/constant/chart-constants.ts","../../src/app/component/core/public_api.ts","../../src/app/component/core/asoftwareworld-charts-core.ts"],"sourcesContent":["/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\n export enum CurrencyCodeEnum {\r\n    ALL = 'Lek',\r\n    AFN = '؋',\r\n    ARS = '$',\r\n    AWG = 'ƒ',\r\n    AUD = '$',\r\n    AZN = '₼',\r\n    BSD = '$',\r\n    INR = 'INR',\r\n    USD = 'USD',\r\n    EUR = 'EUR',\r\n    JPY = 'JPY',\r\n    Test = 'PKR',\r\n    Blank = ''\r\n}\r\n","/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\n export enum GridOptionsEnum {\r\n    ExtraSmall = 'xs',\r\n    Small = 'sm',\r\n    Medium = 'md',\r\n    Large = 'lg',\r\n    ExtraLarge = 'xl',\r\n    ExtraExtraLarge = 'xxl'\r\n}\r\n","/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\nexport enum PieLegendTypeEnum {\r\n    Default = 'default',\r\n    Percentage = 'percentage',\r\n    Value = 'value',\r\n    Both = 'both'\r\n}\r\n\r\nexport enum LegendLayoutEnum {\r\n    Vertical = 'vertical',\r\n    Horizontal = 'horizontal',\r\n    Proximate = 'proximate'\r\n}\r\n\r\nexport enum LegendPositionEnum {\r\n    Left = 'left',\r\n    Right = 'right',\r\n    Bottom = 'bottom'\r\n}\r\n\r\nexport enum ChartLegendTypeEnum {\r\n    Default = 'default',\r\n    Both = 'both'\r\n}\r\n","/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\n\r\nimport { Type, ɵstringify as stringify } from '@angular/core';\r\n\r\nexport function invalidPipeArgumentError(type: Type<any>, value: any): any {\r\n    return Error(`InvalidPipeArgument: '${value}' for pipe '${stringify(type)}'`);\r\n}\r\n","/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\n\r\nimport { DEFAULT_CURRENCY_CODE, Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core';\r\nimport { formatCurrency, getCurrencySymbol } from '@angular/common';\r\nimport { invalidPipeArgumentError } from './invalid-pipe-argument-error';\r\n@Pipe({\r\n    name: 'aswCurrencyPipe',\r\n})\r\nexport class AswCurrencyPipe implements PipeTransform {\r\n    constructor(\r\n        @Inject(LOCALE_ID) private locale: string,\r\n        @Inject(DEFAULT_CURRENCY_CODE) private defaultCurrencyCode: string = 'USD') { }\r\n\r\n    transform(\r\n        value: number | string | null | undefined, currencyCode?: string,\r\n        display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string,\r\n        locale?: string): string | null;\r\n\r\n    transform(\r\n        value: number | string | null | undefined, currencyCode: string = this.defaultCurrencyCode,\r\n        display: 'code' | 'symbol' | 'symbol-narrow' | string | boolean = 'symbol', digitsInfo?: string,\r\n        locale?: string): string | null {\r\n        if (!isValue(value)) { return null; }\r\n\r\n        locale = locale || this.locale;\r\n\r\n        if (typeof display === 'boolean') {\r\n            display = display ? 'symbol' : 'code';\r\n        }\r\n\r\n        let currency: string = currencyCode || this.defaultCurrencyCode;\r\n        if (display !== 'code') {\r\n            if (display === 'symbol' || display === 'symbol-narrow') {\r\n                currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale);\r\n            } else {\r\n                currency = display;\r\n            }\r\n        }\r\n\r\n        try {\r\n            const num = strToNumber(value);\r\n            const formattedCurrency = formatCurrency(num, locale, currency, currencyCode, digitsInfo);\r\n            console.log(formattedCurrency);\r\n            return formattedCurrency;\r\n        } catch (error: any) {\r\n            throw invalidPipeArgumentError(AswCurrencyPipe, error.message);\r\n        }\r\n    }\r\n}\r\n\r\nfunction isValue(value: number | string | null | undefined): value is number | string {\r\n    return !(value == null || value === '' || value !== value);\r\n}\r\n\r\n/**\r\n * Transforms a string into a number (if needed).\r\n */\r\nfunction strToNumber(value: number | string): number {\r\n    // Convert strings to numbers\r\n    if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) {\r\n        return Number(value);\r\n    }\r\n    if (typeof value !== 'number') {\r\n        throw new Error(`${value} is not a number`);\r\n    }\r\n    return value;\r\n}\r\n\r\n\r\n// transform(value: any, args?: any): any {\r\n    //     return value.charAt(0) === '-' ?\r\n    //        '(' + value.substring(1, value.length) + ')' :\r\n    //        value;\r\n    // }\r\n    // transform(value: number | null | undefined): any {\r\n    //     if (value === null) { return null; }\r\n    //     if (isNaN(Number(value))) { return null; } // will only work value is a number\r\n    //     if (value === 0) { return null; }\r\n    //     let abs = Math.abs(Number(value));\r\n    //     const rounder = Math.pow(10, 1);\r\n    //     const isNegative = Number(value) < 0; // will also work for Negetive numbers\r\n    //     let key = '';\r\n\r\n    //     const powers = [\r\n    //         { key: 'Q', value: Math.pow(10, 15) },\r\n    //         { key: 'T', value: Math.pow(10, 12) },\r\n    //         { key: 'B', value: Math.pow(10, 9) },\r\n    //         { key: 'M', value: Math.pow(10, 6) },\r\n    //         { key: 'K', value: 1000 }\r\n    //     ];\r\n\r\n    //     powers.forEach(power => {\r\n    //         let reduced = abs / power.value;\r\n    //         reduced = Math.round(reduced * rounder) / rounder;\r\n    //         if (reduced >= 1) {\r\n    //             abs = reduced;\r\n    //             key = power.key;\r\n    //             return;\r\n    //         }\r\n    //     });\r\n\r\n    //     // for (let i = 0; i < powers.length; i++) {\r\n    //     //     let reduced = abs / powers[i].value;\r\n    //     //     reduced = Math.round(reduced * rounder) / rounder;\r\n    //     //     if (reduced >= 1) {\r\n    //     //         abs = reduced;\r\n    //     //         key = powers[i].key;\r\n    //     //         break;\r\n    //     //     }\r\n    //     // }\r\n    //     return (isNegative ? '(' + abs + ')' : abs) + key;\r\n    // }\r\n","/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\nexport class AswChartConstants {\r\n    public static readonly whiteColor: string = '#ffffff';\r\n    public static readonly blackColor: string = '#000000';\r\n    public static readonly fontWeight: string = 'normal';\r\n    public static readonly fontSize12: string = '12px';\r\n    public static readonly fontSize14: string = '14px';\r\n    public static readonly fontSize16: string = '16px';\r\n    public static readonly innerSize: string = '75%';\r\n    public static readonly pointer: string = 'pointer';\r\n    public static readonly centerAlign: string = 'center';\r\n}\r\n","/**\r\n * @license\r\n * Copyright ASW (A Software World) All Rights Reserved.\r\n *\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file\r\n */\r\n\r\nexport * from './enum/currency-code.enum';\r\nexport * from './enum/grid-options.enum';\r\nexport * from './enum/legend-type.enum';\r\nexport * from './interface/point-click-event';\r\nexport * from './pipe/currency-pipe';\r\nexport * from './constant/chart-constants';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["stringify"],"mappings":";;;;AAAA;;;;;;;IAOa;AAAZ,WAAY,gBAAgB;IACzB,+BAAW,CAAA;IACX,kCAAS,CAAA;IACT,6BAAS,CAAA;IACT,kCAAS,CAAA;IACT,6BAAS,CAAA;IACT,kCAAS,CAAA;IACT,6BAAS,CAAA;IACT,+BAAW,CAAA;IACX,+BAAW,CAAA;IACX,+BAAW,CAAA;IACX,+BAAW,CAAA;IACX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