index.js.map 63 KB

1
  1. {"version":3,"sources":["../src/index.ts","../src/arrays.ts","../src/async.ts","../src/date.ts","../src/strings.ts","../src/devices.ts","../src/formatters.ts","../src/functions.ts","../src/misc.ts","../src/numbers.ts","../src/objects.ts","../src/statistics.ts","../src/validators.ts","../src/types.ts"],"sourcesContent":["export * from './arrays';\nexport * from './async';\nexport * from './date';\nexport * from './devices';\nexport * from './formatters';\nexport * from './functions';\nexport * from './misc';\nexport * from './numbers';\nexport * from './objects';\nexport * from './statistics';\nexport * from './strings';\nexport * from './validators';\n\nexport * as Types from './types';\n","import { PlainObject } from '@gilbarbara/types';\n\nimport { SortFunction } from './types';\n\n/**\n * Create a sequential array of numbers\n */\nexport function createArray(size: number, start = 1) {\n return Array.from({ length: size }, (_, index) => index + start);\n}\n\n/**\n * Get a random item from an array\n */\nexport function getRandomItem<T>(input: T[]) {\n return input[Math.floor(Math.random() * input.length)];\n}\n\n/**\n * Sort an array of numbers using a quick sort algorithm\n */\nexport function quickSort<T extends string | number>(input: T[], comparator = sortComparator): T[] {\n // Create a sortable array to return.\n const output = [...input];\n\n // Recursively sort sub-arrays.\n const recursiveSort = (start: number, end: number) => {\n // If this sub-array is empty, it's sorted.\n if (end - start < 1) {\n return;\n }\n\n const pivotValue = output[end];\n let splitIndex = start;\n\n for (let index = start; index < end; index++) {\n const sort = comparator(output[index], pivotValue);\n\n // This value is less than the pivot value.\n if (sort === -1) {\n // If the element just to the right of the split index,\n // isn't this element, swap them.\n if (splitIndex !== index) {\n const temp = output[splitIndex];\n\n output[splitIndex] = output[index];\n output[index] = temp;\n }\n\n // Move the split index to the right by one,\n // denoting an increase in the less-than sub-array size.\n splitIndex++;\n }\n\n // Leave values that are greater than or equal to\n // the pivot value where they are.\n }\n\n // Move the pivot value to between the split.\n output[end] = output[splitIndex];\n output[splitIndex] = pivotValue;\n\n // Recursively sort the less-than and greater-than arrays.\n recursiveSort(start, splitIndex - 1);\n recursiveSort(splitIndex + 1, end);\n };\n\n // Sort the entire array.\n recursiveSort(0, input.length - 1);\n\n return output;\n}\n\n/**\n * Remove duplicates from the array\n */\nexport function removeDuplicates<T = unknown>(input: T[]): T[] {\n return [...new Set(input)];\n}\n\n/**\n * Shuffle an array using the Fisher-Yates algorithm\n */\nexport function shuffle<T = unknown>(input: T[]) {\n let currentIndex = input.length;\n let randomIndex;\n let temporaryValue;\n const output = [...input];\n\n while (currentIndex) {\n randomIndex = Math.floor(Math.random() * currentIndex--);\n temporaryValue = output[currentIndex];\n output[currentIndex] = output[randomIndex];\n output[randomIndex] = temporaryValue;\n }\n\n return output;\n}\n\n/**\n * Sort an array with localeCompare\n */\nexport function sortByLocaleCompare(\n key?: string,\n options: Intl.CollatorOptions & { descending?: boolean } = {},\n): SortFunction {\n const { descending, ...compareOptions } = options;\n\n if (key) {\n if (descending) {\n return <T extends PlainObject<any>>(left: PlainObject<T>, right: PlainObject<T>) =>\n right[key].toLowerCase().localeCompare(left[key].toLowerCase(), undefined, compareOptions);\n }\n\n return <T extends PlainObject<any>>(left: PlainObject<T>, right: PlainObject<T>) =>\n left[key].toLowerCase().localeCompare(right[key].toLowerCase(), undefined, compareOptions);\n }\n\n if (descending) {\n return <T extends string>(left: T, right: T) =>\n right.toLowerCase().localeCompare(left.toLowerCase(), undefined, compareOptions);\n }\n\n return <T extends string>(left: T, right: T) =>\n left.toLowerCase().localeCompare(right.toLowerCase(), undefined, compareOptions);\n}\n\n/**\n * Sort an array by primitive values\n */\nexport function sortByPrimitive<T extends number | boolean>(\n key?: string,\n descending = false,\n): SortFunction {\n const firstComparator = descending ? 1 : -1;\n const secondComparator = descending ? -1 : 1;\n\n if (key) {\n return <P extends PlainObject<any>>(left: PlainObject<P>, right: PlainObject<P>) => {\n if (left[key] === right[key]) {\n return 0;\n }\n\n return left[key] < right[key] ? firstComparator : secondComparator;\n };\n }\n\n return <P extends T>(left: P, right: P) => {\n if (left === right) {\n return 0;\n }\n\n return left < right ? firstComparator : secondComparator;\n };\n}\n\n/**\n * Basic sort comparator\n */\nexport function sortComparator(left: string | number, right: string | number) {\n if (left < right) {\n return -1;\n }\n\n if (left > right) {\n return 1;\n }\n\n return 0;\n}\n\nexport function splitIntoChunks<T>(input: T[], chunkSize: number = 25): T[][] {\n if (!Array.isArray(input)) {\n throw new TypeError('expected an array for the first argument');\n }\n\n const chunks: T[][] = [];\n\n for (let index = 0; index < Math.ceil(input.length / chunkSize); index++) {\n chunks.push(input.slice(index * chunkSize, (index + 1) * chunkSize));\n }\n\n return chunks;\n}\n","import is from 'is-lite';\n\nimport { CorsOptions, PollOptions, RequestError, RequestOptions } from './types';\n\nexport const ASYNC_STATUS = {\n IDLE: 'IDLE',\n PENDING: 'PENDING',\n SUCCESS: 'SUCCESS',\n ERROR: 'ERROR',\n} as const;\n\n/**\n * Format a CORS response\n */\nexport function cors(data: any, statusCodeOrOptions: number | CorsOptions = 200) {\n const {\n allowCredentials = true,\n allowedHeaders = [],\n methods = ['GET'],\n origin = '*',\n responseHeaders = undefined,\n statusCode = 200,\n } = is.number(statusCodeOrOptions) ? { statusCode: statusCodeOrOptions } : statusCodeOrOptions;\n\n const allowMethods = [...methods, 'OPTIONS'];\n const allowHeaders = [\n ...new Set([\n 'Accept-Version',\n 'Accept',\n 'Authorization',\n 'Content-Length',\n 'Content-MD5',\n 'Content-Type',\n 'Date',\n 'x-amz-date',\n 'x-amz-security-token',\n 'X-Api-Version',\n 'X-CSRF-Token',\n 'X-Requested-With',\n ...allowedHeaders,\n ]),\n ];\n let exposedHeaders;\n\n if (responseHeaders) {\n exposedHeaders = {\n 'Access-Control-Expose-Headers': Object.keys(responseHeaders).join(','),\n ...responseHeaders,\n };\n }\n\n return {\n body: JSON.stringify(data),\n headers: {\n 'Access-Control-Allow-Origin': origin,\n 'Access-Control-Allow-Credentials': allowCredentials,\n 'Access-Control-Allow-Methods': allowMethods.join(','),\n 'Access-Control-Allow-Headers': allowHeaders.join(','),\n ...exposedHeaders,\n },\n statusCode,\n };\n}\n\n/**\n *\n * @param condition\n * @param options\n */\nexport async function poll(condition: () => boolean, options: PollOptions = {}): Promise<void> {\n const { delay = 1, maxRetries = 5 } = options;\n let retries = 0;\n\n while (!condition() && retries <= maxRetries) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(delay);\n retries++;\n }\n\n if (retries >= maxRetries) {\n throw new Error('Timeout');\n }\n}\n\n/**\n * Make async requests\n */\nexport async function request<D = any>(url: string, options: RequestOptions = {}): Promise<D> {\n const { body, headers, method = 'GET' }: RequestOptions = options;\n\n if (!url) {\n throw new Error('URL is required');\n }\n\n const params: RequestOptions = {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...headers,\n },\n method,\n };\n\n if (body) {\n params.body = is.plainObject(body) ? JSON.stringify(body) : body;\n }\n\n return fetch(url, params).then(async response => {\n const text = await response.text();\n let content: any;\n\n try {\n content = JSON.parse(text);\n } catch {\n content = text;\n }\n\n if (response.status > 299) {\n const error = new Error(response.statusText) as RequestError;\n\n error.status = response.status;\n error.response = content;\n\n throw error;\n } else {\n return content;\n }\n });\n}\n\n/**\n * Block execution\n */\nexport function sleep(seconds = 1) {\n return new Promise(resolve => {\n setTimeout(resolve, seconds * 1000);\n });\n}\n","import is from 'is-lite';\n\nimport { pluralize } from './strings';\nimport { TimeSinceOptions } from './types';\n\nexport const MINUTE = 60;\nexport const HOUR = MINUTE * 60;\nexport const DAY = HOUR * 24;\nexport const WEEK = DAY * 7;\nexport const MONTH = DAY * 30;\nexport const YEAR = 365 * DAY;\n\nexport function isIsoDate(input: string) {\n if (!/\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}.\\d{3}Z/.test(input)) {\n return false;\n }\n\n const date = new Date(input);\n\n return date.toISOString() === input;\n}\n\n/**\n * Check if the input is a valid date.\n */\nexport function isoDate(input?: string | number) {\n if (typeof input !== 'undefined') {\n return new Date(input).toISOString();\n }\n\n return new Date().toISOString();\n}\n\n/**\n * Check if the input is a valid date.\n */\nexport function isValidDate(input: string | number | Date) {\n const date = is.date(input) ? input : new Date(input);\n\n return !Number.isNaN(date.getTime());\n}\n\n/**\n * Returns the unixtime (in seconds).\n */\nexport function now() {\n return Math.floor(Date.now() / 1000);\n}\n\n/**\n * Returns how much time has passed since the input.\n */\nexport function timeSince(input: Date | string | number, options?: TimeSinceOptions) {\n const {\n day = 'day',\n days,\n hour = 'hour',\n hours,\n minute = 'minute',\n minutes,\n month = 'month',\n months,\n prefix,\n second = 'second',\n seconds,\n skipWeeks = false,\n suffix = 'ago',\n week = 'week',\n weeks,\n year = 'year',\n years,\n } = options || {};\n const date = typeof input === 'number' ? input : timestamp(input);\n const diff = now() - date;\n let quantity = Math.floor(diff / YEAR);\n\n const output = (value: number, caption: string) => {\n let result = `${value} ${caption}`;\n\n if (prefix) {\n result = `${prefix} ${result}`;\n }\n\n if (suffix) {\n result = `${result} ${suffix}`;\n }\n\n return result;\n };\n\n if (quantity >= 1) {\n return output(quantity, pluralize(quantity, year, years));\n }\n\n quantity = Math.floor(diff / MONTH);\n\n if (quantity > 1) {\n return output(quantity, pluralize(quantity, month, months));\n }\n\n if (!skipWeeks) {\n quantity = Math.floor(diff / WEEK);\n\n if (quantity > 1) {\n return output(quantity, pluralize(quantity, week, weeks));\n }\n }\n\n quantity = Math.floor(diff / DAY);\n\n if (quantity >= 1) {\n return output(quantity, pluralize(quantity, day, days));\n }\n\n quantity = Math.floor(diff / HOUR);\n\n if (quantity >= 1) {\n return output(quantity, pluralize(quantity, hour, hours));\n }\n\n quantity = Math.floor(diff / MINUTE);\n\n if (quantity > 1) {\n return output(quantity, pluralize(quantity, minute, minutes));\n }\n\n return output(Math.floor(diff), pluralize(diff, second, seconds));\n}\n\n/**\n * Get the timestamp (in seconds) for a date.\n */\nexport function timestamp(input?: Date | string) {\n if (!input) {\n return now();\n }\n\n const date = typeof input === 'string' ? new Date(input) : input;\n\n return Math.floor(date.getTime() / 1000);\n}\n","/**\n * Capitalize the first letter\n */\nexport function capitalize(input: string) {\n return input.charAt(0).toLocaleUpperCase() + input.slice(1).toLocaleLowerCase();\n}\n\n/**\n * Cleanup HTML content\n */\nexport function cleanupHTML(input: string) {\n return removeWhitespace(removeEmptyTags(input));\n}\n\n/**\n * Cleanup a numeric string\n */\nexport function cleanupNumericString(value = '') {\n return value.replace(/\\D+/g, '');\n}\n\n/**\n * Cleanup URI characters\n */\nexport function cleanupURI(input: string) {\n return input.replace(/[$&+,/:;=?@]/g, '');\n}\n\n/**\n * Get initials from name\n */\nexport function getInitials(input: string) {\n if (!input) {\n return '';\n }\n\n const names = input.trim().split(' ');\n\n if (names.length === 1) {\n return `${names[0].charAt(0)}`;\n }\n\n return `${names[0].charAt(0)}${names[names.length - 1].charAt(0)}`;\n}\n\n/**\n * Pluralize strings.\n *\n * If the plural form just adds an `s` to the end, you don't need to pass it.\n */\nexport function pluralize(quantity: number, singular: string, plural?: string) {\n if (quantity === 1) {\n return singular;\n }\n\n return plural || `${singular}s`;\n}\n\n/**\n * Remove accents\n */\nexport function removeAccents(input: string) {\n const removalMap = {\n A: /[AÀÁÂÃÄÅĀĂĄǍǞǠǺȀȂȦḀẠẢẤẦẨẪẬẮẰẲẴẶⒶA]/g,\n AA: /Ꜳ/g,\n AE: /[ÆǢǼ]/g,\n AO: /Ꜵ/g,\n AU: /Ꜷ/g,\n AV: /[ꜸꜺ]/g,\n AY: /Ꜽ/g,\n B: /[BƁƂɃḂḄḆⒷB]/g,\n C: /[CÇĆĈĊČƇȻḈⒸꜾC]/g,\n D: /[DĎĐƉƊƋḊḌḎḐḒⒹꝹD]/g,\n DZ: /[DŽDZ]/g,\n Dz: /[DžDz]/g,\n E: /[EÈÉÊËĒĔĖĘĚƎƐȄȆȨḔḖḘḚḜẸẺẼẾỀỂỄỆⒺE]/g,\n F: /[FƑḞⒻꝻF]/g,\n G: /[GĜĞĠĢƓǤǦǴḠⒼꝽꝾꞠG]/g,\n H: /[HĤĦȞḢḤḦḨḪⒽⱧⱵꞍH]/g,\n I: /[IÌÍÎÏĨĪĬĮİƗǏȈȊḬḮỈỊⒾI]/g,\n J: /[JĴɈⒿJ]/g,\n K: /[KĶƘǨḰḲḴⓀⱩꝀꝂꝄꞢK]/g,\n L: /[LĹĻĽĿŁȽḶḸḺḼⓁⱠⱢꝆꝈꞀL]/g,\n LJ: /LJ/g,\n Lj: /Lj/g,\n M: /[MƜḾṀṂⓂⱮM]/g,\n N: /[NÑŃŅŇƝǸȠṄṆṈṊⓃꞐꞤN]/g,\n NJ: /NJ/g,\n Nj: /Nj/g,\n O: /[OÒÓÔÕÖØŌŎŐƆƟƠǑǪǬǾȌȎȪȬȮȰṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢⓄꝊꝌO]/g,\n OI: /Ƣ/g,\n OO: /Ꝏ/g,\n OU: /Ȣ/g,\n P: /[PƤṔṖⓅⱣꝐꝒꝔP]/g,\n Q: /[QɊⓆꝖꝘQ]/g,\n R: /[RŔŖŘȐȒɌṘṚṜṞⓇⱤꝚꞂꞦR]/g,\n S: /[SŚŜŞŠȘṠṢṤṦṨẞⓈⱾꞄꞨS]/g,\n T: /[TŢŤŦƬƮȚȾṪṬṮṰⓉꞆT]/g,\n TZ: /Ꜩ/g,\n U: /[UÙÚÛÜŨŪŬŮŰŲƯǓǕǗǙǛȔȖɄṲṴṶṸṺỤỦỨỪỬỮỰⓊU]/g,\n V: /[VƲɅṼṾⓋꝞV]/g,\n VY: /Ꝡ/g,\n W: /[WŴẀẂẄẆẈⓌⱲW]/g,\n X: /[XẊẌⓍX]/g,\n Y: /[YÝŶŸƳȲɎẎỲỴỶỸỾⓎY]/g,\n Z: /[ZŹŻŽƵȤẐẒẔⓏⱫⱿꝢZ]/g,\n a: /[aàáâãäåāăąǎǟǡǻȁȃȧɐḁẚạảấầẩẫậắằẳẵặⓐⱥa]/g,\n aa: /ꜳ/g,\n ae: /[æǣǽ]/g,\n ao: /ꜵ/g,\n au: /ꜷ/g,\n av: /[ꜹꜻ]/g,\n ay: /ꜽ/g,\n b: /[bƀƃɓḃḅḇⓑb]/g,\n c: /[cçćĉċčƈȼḉↄⓒꜿc]/g,\n d: /[dďđƌɖɗḋḍḏḑḓⓓꝺd]/g,\n dz: /[dždz]/g,\n e: /[eèéêëēĕėęěǝȅȇȩɇɛḕḗḙḛḝẹẻẽếềểễệⓔe]/g,\n f: /[fƒḟⓕꝼf]/g,\n g: /[gĝğġģǥǧǵɠᵹḡⓖꝿꞡg]/g,\n h: /[hĥħȟɥḣḥḧḩḫẖⓗⱨⱶh]/g,\n hv: /ƕ/g,\n i: /[iìíîïĩīĭįıǐȉȋɨḭḯỉịⓘi]/g,\n j: /[jĵǰɉⓙj]/g,\n k: /[kķƙǩḱḳḵⓚⱪꝁꝃꝅꞣk]/g,\n l: /[lĺļľŀłſƚɫḷḹḻḽⓛⱡꝇꝉꞁl]/g,\n lj: /lj/g,\n m: /[mɯɱḿṁṃⓜm]/g,\n n: /[nñńņňʼnƞǹɲṅṇṉṋⓝꞑꞥn]/g,\n nj: /nj/g,\n o: /[oòóôõöøōŏőơǒǫǭǿȍȏȫȭȯȱɔɵṍṏṑṓọỏốồổỗộớờởỡợⓞꝋꝍo]/g,\n oi: /ƣ/g,\n ou: /ȣ/g,\n oo: /ꝏ/g,\n p: /[pƥᵽṕṗⓟꝑꝓꝕp]/g,\n q: /[qɋⓠꝗꝙq]/g,\n r: /[rŕŗřȑȓɍɽṙṛṝṟⓡꝛꞃꞧr]/g,\n s: /[sßśŝşšșȿṡṣṥṧṩẛⓢꞅꞩs]/g,\n t: /[tţťŧƭțʈṫṭṯṱẗⓣⱦꞇt]/g,\n tz: /ꜩ/g,\n u: /[uùúûüũūŭůűųưǔǖǘǚǜȕȗʉṳṵṷṹṻụủứừửữựⓤu]/g,\n v: /[vʋʌṽṿⓥꝟv]/g,\n vy: /ꝡ/g,\n w: /[wŵẁẃẅẇẉẘⓦⱳw]/g,\n x: /[xẋẍⓧx]/g,\n y: /[yýÿŷƴȳɏẏẙỳỵỷỹỿⓨy]/g,\n z: /[zźżžƶȥɀẑẓẕⓩⱬꝣz]/g,\n };\n let parsedString = input;\n\n Object.entries(removalMap).forEach(([key, value]) => {\n parsedString = parsedString.replace(value, key);\n });\n\n return parsedString;\n}\n\n/**\n * Remove emojis\n */\nexport function removeEmojis(input: string) {\n const baseEmojiRegex = /[\\u2700-\\u27bf]|\\ud83c[\\udde6-\\uddff]{2}|[\\ud800-\\udbff][\\udc00-\\udfff]/;\n const variationSelectorRegex = /[\\ufe0e\\ufe0f]?/;\n const modifierRegex = /[\\u0300-\\u036f\\u20d0-\\u20f0\\ufe20-\\ufe23]|\\ud83c[\\udffb-\\udfff]/;\n const zeroWidthJoinerRegex =\n /\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\u20d0-\\u20f0\\ufe20-\\ufe23]|\\ud83c[\\udffb-\\udfff])?/;\n const emojiRegex = new RegExp(\n `(?:${baseEmojiRegex.source})${variationSelectorRegex.source}(?:${modifierRegex.source})?(?:${zeroWidthJoinerRegex.source})*`,\n 'g',\n );\n\n return input.replace(emojiRegex, '').trim();\n}\n\n/**\n * Remove empty HTML Tags (including whitespace)\n */\nexport function removeEmptyTags(input: string) {\n return input.replace(/<[^/>][^>]*>\\s*<\\/[^>]+>/gi, '');\n}\n\n/**\n * Remove non-printable ASCII characters\n */\nexport function removeNonPrintableCharacters(input: string) {\n return input.replace(/[^\\x20-\\x7E´\\u00C0-\\u00FFˆ˜]+/g, '');\n}\n\n/**\n * Remove HTML tags\n */\nexport function removeTags(input: string) {\n return input.replace(/(<([^>]+)>)/gi, '');\n}\n\n/**\n * Remove whitespace\n */\nexport function removeWhitespace(input: string) {\n return input.replace(/\\r\\n|\\r|\\n|\\t/g, '').replace(/ +/g, ' ');\n}\n\n/**\n * Format string to slug\n */\nexport function slugify(input: string) {\n return removeAccents(input)\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[()]/g, '')\n .replace(/ /g, '-')\n .replace(/[\"%<>\\\\^`{|}]/g, '')\n .toLowerCase();\n}\n","/**\n * Detect if the device is in dark mode\n */\nexport function isDarkMode() {\n return !!window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;\n}\n\n/**\n * Detect if the device supports touch events\n */\nexport function isTouchDevice() {\n return !!window.matchMedia && window.matchMedia('(pointer: coarse)').matches;\n}\n\n/**\n * Detect if the user prefers reduced motion\n */\nexport function prefersReducedMotion() {\n return !!window.matchMedia && window.matchMedia('prefers-reduced-motion').matches;\n}\n","import { cleanupNumericString } from './strings';\nimport { FormatDateLocaleOptions, FormatMoneyOptions } from './types';\n\n/**\n * Format boolean into a Yes/No string\n */\nexport function formatBoolean(input: boolean) {\n return input ? 'Yes' : 'No';\n}\n\n/**\n * Format string into a CPF\n */\nexport function formatCPF(value: string) {\n const clearValue = cleanupNumericString(value);\n\n if (clearValue.length >= 10) {\n return `${clearValue.slice(0, 3)}.${clearValue.slice(3, 6)}.${clearValue.slice(\n 6,\n 9,\n )}-${clearValue.slice(9, 11)}`;\n } else if (clearValue.length >= 7) {\n return `${clearValue.slice(0, 3)}.${clearValue.slice(3, 6)}.${clearValue.slice(6, 9)}`;\n } else if (clearValue.length >= 4) {\n return `${clearValue.slice(0, 3)}.${clearValue.slice(3, 6)}`;\n }\n\n return clearValue;\n}\n\n/**\n * Format date ISO string using locale\n */\nexport function formatDateLocale(input: string, options: FormatDateLocaleOptions = {}) {\n const { locale = 'en-GB', showTime = false } = options;\n\n const formatOptions: Intl.DateTimeFormatOptions = {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n };\n\n if (showTime) {\n formatOptions.hour = '2-digit';\n formatOptions.minute = '2-digit';\n }\n\n return new Date(input).toLocaleDateString(locale, formatOptions);\n}\n\n/**\n * Format number into money string\n */\nexport function formatMoney(input: number, options: FormatMoneyOptions = {}) {\n const { decimalChar = '.', showCents = false, symbol = '$', thousandsChar = ',' } = options;\n\n const isNegative = input < 0;\n const value = Math.abs(input);\n const [amount, cents] = value.toFixed(2).split('.');\n const padStart = amount.length > 3 ? amount.length % 3 : 0;\n const initial = amount.slice(0, padStart);\n const remain = amount.slice(padStart).replace(/(\\d{3})(?=\\d)/g, `$1${thousandsChar}`);\n\n let formatted = `${remain}`;\n\n if (initial) {\n formatted = `${initial}${thousandsChar}${remain}`;\n }\n\n if (cents !== '00' || showCents) {\n formatted += `${decimalChar}${cents}`;\n }\n\n return `${isNegative ? '-' : ''}${symbol}${formatted}`;\n}\n\n/**\n * Format string into a brazilian phone\n */\nexport function formatPhoneBR(input: string) {\n const phone = input.replace(/\\D/g, '');\n\n if (phone.length === 8) {\n return phone.replace(/^(\\d{4})(\\d{4}).*/, '$1-$2');\n }\n\n if (phone.length === 9) {\n return phone.replace(/^(\\d{5})(\\d{4}).*/, '$1-$2');\n }\n\n if (phone.length === 10 || phone.length === 11) {\n return phone.replace(/^(\\d{2})(\\d{4,5})(\\d{4}).*/, '($1) $2-$3');\n }\n\n return phone;\n}\n\n/**\n * Format string into a US phone\n */\nexport function formatPhoneUS(input: string) {\n const phone = input.replace(/\\D/g, '');\n\n if (phone.length === 10) {\n return phone.replace(/^(\\d{3})(\\d{3})(\\d{4}).*/, '($1) $2-$3');\n }\n\n if (phone.length === 11 && phone.startsWith('1')) {\n return phone.replace(/^1(\\d{3})(\\d{3})(\\d{4}).*/, '+1 ($1) $2-$3');\n }\n\n return phone;\n}\n\n/**\n * Format string into a zip code\n */\nexport function formatPostalCodeBR(value: string) {\n const clearValue = cleanupNumericString(value);\n\n if (clearValue.length >= 6) {\n return `${clearValue.slice(0, 5)}-${clearValue.slice(5, 8)}`;\n }\n\n return clearValue;\n}\n","/**\n * Decouple methods from objects\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function demethodize(fn: Function) {\n return (parameter: any, ...rest: any[]) => fn.apply(parameter, rest);\n}\n\n/**\n * Measure function execution time\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport async function measureExecutionTime<T = any>(callback: Function): Promise<T> {\n const start = performance.now();\n\n const result = await callback();\n\n const end = performance.now();\n const total = end - start;\n\n // eslint-disable-next-line no-console\n console.log(`Completed in ${Math.ceil(total)} milliseconds`);\n\n return result as T;\n}\n\n/**\n * A function that does nothing.\n */\nexport function noop() {\n return undefined;\n}\n\n/**\n * Creates a function that will only be called once.\n * Repeat calls return the value of the first invocation.\n */\nexport function once<T extends (...arguments_: Array<any>) => any>(fn: T): T {\n let done = false;\n let result: ReturnType<T>;\n\n return function Fn(...arguments_: Parameters<T>): ReturnType<T> {\n if (!done) {\n done = true;\n result = fn(...arguments_);\n }\n\n return result as ReturnType<T>;\n } as T;\n}\n\n/**\n * Combine multiple functions into one.\n * The output of each function is passed as the input to the next.\n */\nexport function pipe<T>(...fns: Array<(argument: T) => T>) {\n return (input: T) => fns.reduce((previousValue, fn) => fn(previousValue), input);\n}\n","import { StringOrNumber } from '@gilbarbara/types';\nimport is from 'is-lite';\n\nimport { pad } from './numbers';\nimport { LoggerOptions, UniqueOptions } from './types';\n\ntype Case<T = void> = [boolean, () => T];\n\nexport function conditional<TReturn = void>(\n cases: Array<Case<TReturn>>,\n defaultCase?: () => TReturn,\n) {\n for (const [expression, callback] of cases) {\n if (expression) {\n return callback();\n }\n }\n\n return defaultCase?.();\n}\n\n/**\n * Copy a string to the clipboard\n */\nexport async function copyToClipboard(input: string) {\n try {\n await navigator.clipboard.writeText(input);\n } catch {\n return false;\n }\n\n return true;\n}\n\n/**\n * Get the data type of variable.\n */\nexport function getDataType(input: unknown, toLowerCase = false): string {\n const dataTypeName = Object.prototype.toString.call(input).slice(8, -1);\n let output = dataTypeName;\n\n if (/HTML\\w+Element/.test(dataTypeName)) {\n output = 'HTMLElement';\n }\n\n return toLowerCase ? output.toLowerCase() : output;\n}\n\nexport function invariant(condition: any, message: string | (() => string)): asserts condition {\n if (condition) {\n return;\n }\n\n const value = is.function(message) ? message() : message;\n\n throw new Error(value);\n}\n\n/**\n * Check if a string is a valid JSON\n */\nexport function isJSON(input: string) {\n try {\n JSON.parse(input);\n } catch {\n return false;\n }\n\n return true;\n}\n\n/**\n * Throw an error if the parameter isn't provided\n */\nexport function isRequired(input = 'parameter', Constructable = TypeError) {\n throw new Constructable(`\"${input}\" is required`);\n}\n\n/**\n * Log grouped messages to the console\n */\nexport function logger(type: string, title: string, data: any, options: LoggerOptions = {}) {\n /* eslint-disable no-console */\n const { collapsed = true, hideTimestamp = false, skip = false, typeColor = 'gray' } = options;\n const groupMethod = collapsed ? console.groupCollapsed : console.group;\n const date = new Date();\n const parts = [`%c ${type}`];\n const styles = [`color: ${typeColor}; font-weight: lighter;`, 'color: inherit;'];\n\n if (!hideTimestamp) {\n styles.push('color: gray; font-weight: lighter;');\n }\n\n const time = `${pad(date.getHours(), 2)}:${pad(date.getMinutes(), 2)}:${pad(\n date.getSeconds(),\n 2,\n )}`;\n\n parts.push(`%c${title}`);\n\n if (!hideTimestamp) {\n parts.push(`%c@ ${time}`);\n }\n\n /* istanbul ignore else */\n if (!skip) {\n groupMethod(parts.join(' '), ...styles);\n console.log(data);\n console.groupEnd();\n }\n /* eslint-enable */\n}\n\n/**\n * Returns the value or null\n */\nexport function nullify<T>(value: T) {\n return value ?? null;\n}\n\nexport function popupCenter(url: string, title: string, width: number, height: number) {\n const { screen, screenLeft, screenTop } = window;\n let screenWidth = window.innerWidth;\n let screenHeight = window.innerHeight;\n\n /* istanbul ignore next */\n if (!screenWidth) {\n screenWidth = document.documentElement.clientWidth\n ? document.documentElement.clientWidth\n : screen.width;\n }\n\n /* istanbul ignore next */\n if (!screenHeight) {\n screenHeight = document.documentElement.clientHeight\n ? document.documentElement.clientHeight\n : screen.height;\n }\n\n const left = screenWidth / 2 - width / 2 + screenLeft;\n const top = screenHeight / 2 - height / 2 + screenTop;\n\n const popup = window.open(\n url,\n title,\n `menubar=no,location=no,resizable=no,scrollbars=yees,status=no,width=${width},height=${height},top=${top}, left=${left}`,\n );\n\n /* istanbul ignore else */\n if (popup) {\n popup.focus();\n }\n\n return popup;\n}\n\nexport function px(value: undefined): undefined;\nexport function px(value: StringOrNumber): string;\nexport function px(value: StringOrNumber | undefined): string | undefined;\n\n/**\n * Convert a number or numeric value to px\n *\n * Otherwise, return the value.\n */\nexport function px(value: StringOrNumber | undefined): string | undefined {\n return is.number(value) || is.numericString(value) ? `${value}px` : value;\n}\n\n/**\n * Return a unique string\n */\nexport function unique(length = 8, options: UniqueOptions = {}): string {\n const {\n includeLowercase = true,\n includeNumbers = true,\n includeSymbols = false,\n includeUppercase = true,\n } = options;\n const lowercase = 'abcdefghijklmnopqrstuvwxyz';\n const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n const numbers = '0123456789';\n const symbols = '!?@#$%^&*+_-=:.~';\n\n let characters = '';\n\n if (includeLowercase) {\n characters += lowercase;\n }\n\n if (includeUppercase) {\n characters += uppercase;\n }\n\n if (includeNumbers) {\n characters += numbers;\n }\n\n if (includeSymbols) {\n characters += symbols;\n }\n\n let result = '';\n\n for (let index = length; index > 0; --index) {\n result += characters[Math.round(Math.random() * (characters.length - 1))];\n }\n\n return result;\n}\n\n/**\n * Returns an UUID v4 string.\n */\nexport function uuid() {\n /* eslint-disable no-bitwise */\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n\n return v.toString(16);\n });\n /* eslint-enable */\n}\n","/**\n * Ceil decimal numbers\n */\nexport function ceil(input: number, digits = 2) {\n const factor = 10 ** digits;\n\n return Math.ceil(input * factor) / factor;\n}\n\n/**\n * Limit number between range\n */\nexport function clamp(value: number, min = 0, max = 100) {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Floor decimal numbers\n */\nexport function floor(input: number, digits = 2) {\n const factor = 10 ** digits;\n\n return Math.floor(input * factor) / factor;\n}\n\n/**\n * Pad a number with zeros\n */\nexport function pad(input: number, length = 2) {\n return `${input}`.padStart(length, '0');\n}\n\n/**\n * Returns a random number\n */\nexport function randomNumber(min = 0, max = 10) {\n if (min >= max) {\n return max;\n }\n\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\n/**\n * Round decimal numbers\n */\nexport function round(input: number, digits = 2) {\n const factor = 10 ** digits;\n\n return Math.round(input * factor) / factor;\n}\n","import { NarrowPlainObject, PlainObject, RemoveType, Simplify } from '@gilbarbara/types';\nimport is from 'is-lite';\n\nimport { InvertKeyValue, QueryStringFormatOptions } from './types';\n\n/**\n * Remove properties with undefined value from an object\n */\nexport function cleanUpObject<T extends PlainObject>(input: T) {\n const output: Record<string, unknown> = {};\n\n for (const key in input) {\n if (input[key] !== undefined) {\n output[key] = input[key];\n }\n }\n\n return output as RemoveType<T>;\n}\n\n/**\n * Get a nested property inside an object or array\n */\nexport function getNestedProperty<T extends PlainObject<any>>(input: T, path: string): any {\n if ((!is.plainObject(input) && !is.array(input)) || !path) {\n return input;\n }\n\n const segments = path.split('.');\n const { length } = segments;\n let output = input;\n\n for (let index = 0; index < length; index++) {\n const currentSegment = segments[index];\n const remainingSegments = segments.slice(index + 1);\n\n if (currentSegment === '+' && is.array(output) && remainingSegments.length === 1) {\n return output.map(d => d[remainingSegments.join('.')]);\n }\n\n try {\n output = output[currentSegment];\n } catch {\n // skip\n }\n }\n\n return output;\n}\n\n/**\n * Invert object key and value\n */\nexport function invertKeys<const T extends PlainObject<PropertyKey>>(input: T) {\n if (!is.plainObject(input)) {\n throw new TypeError('Expected an object');\n }\n\n const result: Record<PropertyKey, PropertyKey> = {};\n\n for (const [key, value] of Object.entries(input)) {\n result[value] = key;\n }\n\n return result as InvertKeyValue<T>;\n}\n\n/**\n * Set the key as the value\n */\nexport function keyMirror<T extends PlainObject>(input: T): { [K in keyof T]: K } {\n if (!is.plainObject(input)) {\n throw new TypeError('Expected an object');\n }\n\n const output: any = {};\n\n for (const key in input) {\n /* istanbul ignore else */\n if (!Object.prototype.hasOwnProperty.call(output, key)) {\n output[key] = key;\n }\n }\n\n return output;\n}\n\n/**\n * Merges the defaultProps with literal values with the incoming props, removing undefined values from it that would override the defaultProps.\n * The result is a type-safe object with the defaultProps as required properties.\n */\nexport function mergeProps<TDefaultProps extends PlainObject<any>, TProps extends PlainObject<any>>(\n defaultProps: TDefaultProps,\n props: TProps,\n) {\n const cleanProps = cleanUpObject(props);\n\n return { ...defaultProps, ...cleanProps } as unknown as Simplify<\n TProps & Required<Pick<TProps, keyof TDefaultProps & string>>\n >;\n}\n\n/**\n * Type-safe Object.entries()\n */\nexport function objectEntries<T extends PlainObject<any>>(input: T) {\n return Object.entries(input) as Array<{ [K in keyof T]-?: [K, T[K]] }[keyof T]>;\n}\n\n/**\n * Type-safe Object.keys()\n */\nexport function objectKeys<T extends PlainObject<any>>(input: T) {\n return Object.keys(input) as Array<keyof T>;\n}\n\n/**\n * Convert an object to an array of objects\n */\nexport function objectToArray<T extends PlainObject>(input: T, includeOnly?: string) {\n if (!is.plainObject(input)) {\n throw new TypeError('Expected an object');\n }\n\n return Object.entries(input)\n .filter(([, value]) => (includeOnly ? typeof value === `${includeOnly}` : true)) // eslint-disable-line valid-typeof\n .map(([key, value]) => ({ [key]: value }));\n}\n\n/**\n * Remove properties from an object\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(\n input: NarrowPlainObject<T>,\n ...filter: K[]\n) {\n if (!is.plainObject(input)) {\n throw new TypeError('Expected an object');\n }\n\n const output: any = {};\n\n for (const key in input) {\n /* istanbul ignore else */\n if ({}.hasOwnProperty.call(input, key)) {\n if (!filter.includes(key as unknown as K)) {\n output[key] = input[key];\n }\n }\n }\n\n return output as Omit<T, K>;\n}\n\n/**\n * Select properties from an object\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(\n input: NarrowPlainObject<T>,\n ...filter: K[]\n) {\n if (!is.plainObject(input)) {\n throw new TypeError('Expected an object');\n }\n\n if (!filter.length) {\n return input;\n }\n\n const output: any = {};\n\n for (const key in input) {\n /* istanbul ignore else */\n if ({}.hasOwnProperty.call(input, key)) {\n if (filter.includes(key as unknown as K)) {\n output[key] = input[key];\n }\n }\n }\n\n return output as Pick<T, K>;\n}\n\n/**\n * Stringify a shallow object into a query string\n */\nexport function queryStringFormat<T extends PlainObject>(\n input: T,\n options: QueryStringFormatOptions = {},\n) {\n const { addPrefix = false, encoder = encodeURIComponent, encodeValuesOnly = true } = options;\n\n if (!is.plainObject(input)) {\n throw new TypeError(\"input type isn't supported\");\n }\n\n const isValidInput = Object.values(input).every(item => {\n if (is.array(item)) {\n return item.every(d => is.string(d) || is.number(d));\n }\n\n return is.string(item);\n });\n\n if (!isValidInput) {\n throw new TypeError(\"input format isn't supported\");\n }\n\n const output = Object.entries(input)\n .map(([key, value]) => {\n const nextKey = encodeValuesOnly ? key : encoder(key);\n const nextValue = is.array(value) ? value.map(encoder).join(',') : encoder(`${value}`);\n\n return `${nextKey}=${nextValue}`;\n })\n .join('&');\n\n return `${addPrefix ? '?' : ''}${output}`;\n}\n\n/**\n * Parse a query string\n */\nexport function queryStringParse(input: string): PlainObject<string> {\n let search = input;\n\n if (input.slice(0, 1) === '?') {\n search = input.slice(1);\n }\n\n return search.split('&').reduce<PlainObject<string>>((acc, d) => {\n const [key, value] = d.split('=');\n\n acc[decodeURIComponent(key)] = decodeURIComponent(value);\n\n return acc;\n }, {});\n}\n\n/**\n * Sort object keys\n */\nexport function sortObjectKeys<T extends PlainObject>(input: T) {\n return objectKeys(input)\n .sort()\n .reduce((acc, key) => {\n acc[key] = input[key];\n\n return acc;\n }, {} as T);\n}\n","import is from 'is-lite';\n\nimport { round } from './numbers';\n\n/**\n * Returns the average of two or more numbers\n */\nexport function mean(input: number[], precision?: number) {\n const output = input.reduce((sum, value) => sum + value, 0) / input.length;\n\n if (is.number(precision)) {\n return round(output, precision);\n }\n\n return output;\n}\n\n/**\n * Returns the median of two or more numbers\n */\nexport function median(input: number[]) {\n const sorted = [...input].sort((a, b) => a - b);\n const middle = Math.floor(sorted.length / 2);\n\n if (sorted.length % 2 === 0) {\n return (sorted[middle - 1] + sorted[middle]) / 2;\n }\n\n return sorted[middle];\n}\n\n/**\n * Returns the mode of two or more numbers\n */\nexport function mode(input: number[]) {\n const count = new Map<number, number>();\n\n for (const value of input) {\n const current = count.get(value) ?? 0;\n\n count.set(value, current + 1);\n }\n\n const sorted = [...count.entries()].sort((a, b) => b[1] - a[1]);\n\n return sorted[0][0];\n}\n","/**\n * Check if CPF is valid\n */\nimport { ValidatePasswordOptions } from './types';\n\nexport function isValidCPF(value: string) {\n if (!value) {\n return false;\n }\n\n const newValue = value.replace(/[.-]/g, '');\n let sum = 0;\n let rest: number;\n\n if (/^(\\d)\\1+$/.test(newValue)) {\n return false;\n }\n\n for (let index = 1; index <= 9; index++) {\n sum += parseInt(newValue.substring(index - 1, index), 10) * (11 - index);\n }\n\n rest = (sum * 10) % 11;\n\n if (rest === 10 || rest === 11) {\n rest = 0;\n }\n\n if (rest !== parseInt(newValue.substring(9, 10), 10)) {\n return false;\n }\n\n sum = 0;\n\n for (let index = 1; index <= 10; index++) {\n sum += parseInt(newValue.substring(index - 1, index), 10) * (12 - index);\n }\n\n rest = (sum * 10) % 11;\n\n if (rest === 10 || rest === 11) {\n rest = 0;\n }\n\n return rest === parseInt(newValue.substring(10, 11), 10);\n}\n\n/**\n * Check if email is valid\n */\nexport function isValidEmail(value: string) {\n return /^[\\w%+.-]+@[\\d.a-z-]+\\.[a-z]{2,}$/i.test(value);\n}\n\n/**\n * Validate password length and required characters\n * @throws\n */\nexport function validatePassword(password: string, options?: ValidatePasswordOptions) {\n const {\n maxLength = 64,\n maxLengthMessage = 'Password must be a maximum of 64 characters',\n minLength = 6,\n minLengthMessage = 'Password must be at least 6 characters long',\n regex = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[!#$%&*?@^]).*$/,\n requiredCharactersMessage = 'Password must have at least 1 number, 1 lowercase, 1 uppercase and 1 special character',\n } = options || {};\n\n if (password.length < minLength) {\n throw new Error(minLengthMessage);\n }\n\n if (password.length > maxLength) {\n throw new Error(maxLengthMessage);\n }\n\n if (!regex.test(password)) {\n throw new Error(requiredCharactersMessage);\n }\n\n return true;\n}\n","import { HttpMethods, PlainObject } from '@gilbarbara/types';\n\nexport interface CorsOptions {\n /** @default true */\n allowCredentials?: boolean;\n /** @default [] */\n allowedHeaders?: string[];\n /** @default ['GET'] */\n methods?: HttpMethods[];\n /** @default * */\n origin?: string;\n responseHeaders?: PlainObject<string>;\n /** @default 200 */\n statusCode?: number;\n}\n\nexport interface FormatDateLocaleOptions {\n locale?: string;\n showTime?: boolean;\n}\n\nexport interface FormatMoneyOptions {\n decimalChar?: ',' | '.';\n showCents?: boolean;\n symbol?: string;\n thousandsChar?: ',' | '.';\n}\n\nexport type InvertKeyValue<T extends Record<PropertyKey, PropertyKey>> = {\n [K in T[keyof T]]: { [P in keyof T]: T[P] extends K ? P : never }[keyof T];\n};\n\nexport interface LoggerOptions {\n collapsed?: boolean;\n hideTimestamp?: boolean;\n skip?: boolean;\n typeColor?: string;\n}\n\nexport interface PollOptions {\n delay?: number;\n maxRetries?: number;\n}\n\nexport interface QueryStringFormatOptions {\n addPrefix?: boolean;\n encodeValuesOnly?: boolean;\n encoder?: (uri: string) => string;\n}\n\nexport interface RequestOptions {\n body?: any;\n headers?: PlainObject<string>;\n method?: HttpMethods;\n}\n\nexport interface RequestError extends Error {\n response: any;\n status: number;\n}\n\nexport interface SortFunction {\n <T extends PlainObject = PlainObject>(left: PlainObject<T>, right: PlainObject<T>): number;\n <T = string>(left: T, right: T): number;\n}\n\nexport interface TimeSinceOptions {\n /**\n * @default \"day\"\n */\n day?: string;\n /**\n * @default \"days\"\n */\n days?: string;\n /**\n * @default \"hour\"\n */\n hour?: string;\n /**\n * @default \"hours\"\n */\n hours?: string;\n /**\n * @default \"minute\"\n */\n minute?: string;\n /**\n * @default \"minutes\"\n */\n minutes?: string;\n /**\n * @default \"month\"\n */\n month?: string;\n /**\n * @default \"months\"\n */\n months?: string;\n prefix?: string;\n /**\n * @default \"second\"\n */\n second?: string;\n /**\n * @default \"seconds\"\n */\n seconds?: string;\n /**\n * @default false\n */\n skipWeeks?: boolean;\n /**\n * @default \"ago\"\n */\n suffix?: string;\n /**\n * @default \"week\"\n */\n week?: string;\n /**\n * @default \"weeks\"\n */\n weeks?: string;\n /**\n * @default \"year\"\n */\n year?: string;\n /**\n * @default \"years\"\n */\n years?: string;\n}\n\nexport interface UniqueOptions {\n includeLowercase?: boolean;\n includeNumbers?: boolean;\n includeSymbols?: boolean;\n includeUppercase?: boolean;\n}\n\nexport interface ValidatePasswordOptions {\n maxLength?: number;\n maxLengthMessage?: string;\n minLength?: number;\n minLengthMessage?: string;\n regex?: RegExp;\n requiredCharactersMessage?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,SAAS,YAAY,MAAc,QAAQ,GAAG;AACnD,SAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC,GAAG,UAAU,QAAQ,KAAK;AACjE;AAKO,SAAS,cAAi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