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,EAAI,EACzD,sBAAyC,MAAlB,EAA8B,sBAAwB,GAErF,EACA,MAAO,SAAU,GACb,OAAO,EAAc,EACzB,GAER,CACA,QAAQ,QAAU,CACd,QAAS","file":"/npm/vue-ts-locale@1.0.2/lib/locale.directive.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/vue-ts-locale@1.0.2/lib/locale.directive.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar underscore_1 = require(\"underscore\");\nvar MessageFormat = require(\"intl-messageformat\");\nvar RelativeFormat = require(\"intl-relativeformat\");\nvar memoizeFormatConstructor = require(\"intl-format-cache\");\nvar isNode = Object.prototype.toString.call(typeof process !== \"undefined\" ? process : 0) === \"[object process]\";\nif (isNode) {\n    Intl.NumberFormat = IntlPolyfill.NumberFormat;\n    Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;\n}\nvar clamp = function (number, min, max) {\n    return Math.min(Math.max(number, min), max);\n};\nvar kebabCase = function (string) {\n    var result = string;\n    result = result.replace(/([a-z][A-Z])/g, function (match) {\n        return match.substr(0, 1) + '-' + match.substr(1, 1).toLowerCase();\n    });\n    result = result.toLowerCase();\n    result = result.replace(/[^-a-z0-9]+/g, '-');\n    result = result.replace(/^-+/, '').replace(/-$/, '');\n    return result;\n};\nvar formats = MessageFormat.formats;\nvar getCachedNumberFormat = memoizeFormatConstructor(Intl.NumberFormat);\nvar getCachedDateTimeFormat = memoizeFormatConstructor(Intl.DateTimeFormat);\nvar getCachedMessageFormat = memoizeFormatConstructor(MessageFormat);\nvar getCachedRelativeFormat = memoizeFormatConstructor(RelativeFormat);\nvar maximumFractionDigits = 18;\nfunction install(Vue, options) {\n    var language = options.language, currency = options.currency, messages = options.messages;\n    var locale = language;\n    exports.getLanguage = function () {\n        return { language: language, currency: currency, messages: messages };\n    };\n    exports.setLanguage = function (options, reloadLocation) {\n        language = options.language;\n        currency = options.currency;\n        messages = options.messages;\n        locale = language;\n        if (reloadLocation)\n            window.location.reload(true);\n    };\n    exports.formatDate = function (date, format) {\n        var parsedDate = new Date(date);\n        if (!underscore_1.isDate(parsedDate))\n            throw new TypeError(\"A date or timestamp must be provided to {{formatDate}}\");\n        if (underscore_1.isString(format) && format in formats.date)\n            format = formats.date[format];\n        return getCachedDateTimeFormat(locale, format).format(parsedDate);\n    };\n    exports.formatTime = function (date, format) {\n        var parsedDate = new Date(date);\n        if (!underscore_1.isDate(date))\n            throw new TypeError(\"A date or timestamp must be provided to {{formatTime}}\");\n        if (underscore_1.isString(format) && format in formats.time)\n            format = formats.time[format];\n        return getCachedDateTimeFormat(locale, format).format(parsedDate);\n    };\n    exports.formatNumber = function (num, format) {\n        if (!underscore_1.isNumber(num))\n            throw new TypeError(\"A number must be provided to {{formatNumber}}\");\n        if (underscore_1.isString(format)) {\n            if (format === \"currency\")\n                format = { style: \"currency\", currency: currency };\n            else if (format in formats.number)\n                format = formats.number[format];\n        }\n        return getCachedNumberFormat(locale, format).format(num);\n    };\n    exports.formatRelative = function (date, format, now) {\n        var parsedDate = new Date(date);\n        if (!underscore_1.isDate(parsedDate))\n            throw new TypeError(\"A date or timestamp must be provided to {{formatRelative}}\");\n        return getCachedRelativeFormat(locale, format).format(parsedDate, {\n            now: now || new Date()\n        });\n    };\n    exports.formatMessage = function (message) {\n        var formatOptions = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            formatOptions[_i - 1] = arguments[_i];\n        }\n        if (message in messages)\n            message = messages[message];\n        if (typeof message === \"string\")\n            message = getCachedMessageFormat(message, locale, {});\n        if (formatOptions.length === 1 && underscore_1.isObject(formatOptions[0]))\n            formatOptions = formatOptions[0];\n        return message.format(formatOptions);\n    };\n    var decimalTestNumber = 3.1;\n    var decimalSeparator = exports.formatNumber(decimalTestNumber).charAt(1);\n    function extractNumberParts(value) {\n        var parsed = parseInt(value.replace(/[^0-9]/g, \"\"), 0);\n        return isNaN(parsed) ? 0 : parsed;\n    }\n    function parseToNumber(value) {\n        if (value == undefined || value === \"\")\n            return 0;\n        var splits = value.split(decimalSeparator).map(extractNumberParts);\n        if (splits[1] > 0)\n            return parseFloat(splits[0] + \".\" + splits[1]);\n        return splits[0];\n    }\n    var helpers = {\n        formatDate: exports.formatDate,\n        formatTime: exports.formatTime,\n        formatRelative: exports.formatRelative,\n        formatNumber: exports.formatNumber,\n        formatMessage: exports.formatMessage\n    };\n    underscore_1.each(helpers, function (helper, name) {\n        Vue.filter(kebabCase(name), helper);\n        Vue.prototype[\"$\" + name] = helper;\n    });\n    Vue.filter(\"format-currency\", {\n        read: function (val) {\n            var numberOptions = {\n                style: \"currency\",\n                currency: currency,\n                minimumFractionDigits: 0,\n                maximumFractionDigits: 0\n            };\n            return exports.formatNumber(val == undefined || val === \"\" || isNaN(val) ? 0 : val, numberOptions);\n        },\n        write: function (val) {\n            return parseToNumber(val);\n        }\n    });\n    Vue.filter(\"format-currency-precise\", {\n        read: function (val) {\n            return exports.formatNumber(val == undefined || val === \"\" || isNaN(val) ? 0 : val, \"currency\");\n        },\n        write: function (val) {\n            return parseToNumber(val);\n        }\n    });\n    Vue.filter(\"format-percent\", {\n        read: function (val, fractionDigits) {\n            return exports.formatNumber(val == undefined || val === \"\" ? 0 : clamp(val / 100, 0, 1), {\n                style: \"percent\",\n                minimumFractionDigits: fractionDigits == undefined ? 0 : fractionDigits,\n                maximumFractionDigits: fractionDigits == undefined ? maximumFractionDigits : fractionDigits\n            });\n        },\n        write: function (val) {\n            return parseToNumber(val);\n        }\n    });\n    Vue.filter(\"format-number\", {\n        read: function (val, fractionDigits) {\n            return val == undefined || val === \"\" ? 0 : exports.formatNumber(val, {\n                minimumFractionDigits: fractionDigits == undefined ? 0 : fractionDigits,\n                maximumFractionDigits: fractionDigits == undefined ? maximumFractionDigits : fractionDigits\n            });\n        },\n        write: function (val) {\n            return parseToNumber(val);\n        }\n    });\n}\nexports.default = {\n    install: install\n};\n"]}