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X,EAAOH,eAAe,cAAe,KAAMU,GACzCI,EAAU,GACZX,EAAOH,eAAe,mBAAoB,EAAGU,GAE7CP,EAAOH,eAAe,WAAY,EAAGU,GAG9B,IAAZQ,EACKf,EAAOH,eAAe,mBAAoB,EAAGU,GAE7CP,EAAOH,eAAe,WAAYkB,EAASR,GAIjD,GAAIQ,EAAU,GACnB,OAAOf,EAAOH,eAAe,WAAYkB,EAASR,GAC7C,GAAIQ,EAAU,GACnB,OAAOf,EAAOH,eAAe,cAAe,EAAGU,GAC1C,GAAIQ,EAAUpB,EAAgB,CACnC,IAAIwB,EAAQH,KAAKC,MAAMF,EAAU,IACjC,OAAOf,EAAOH,eAAe,cAAesB,EAAOZ,GAC9C,GAAIQ,EAhLoB,KAiL7B,OAAOf,EAAOH,eAAe,QAAS,EAAGU,GACpC,GAAIQ,EAAUnB,EAAkB,CACrC,IAAIwB,EAAOJ,KAAKC,MAAMF,EAAUpB,GAChC,OAAOK,EAAOH,eAAe,QAASuB,EAAMb,GACvC,GAAIQ,EAnLe,MAqLxB,OADAL,EAASM,KAAKC,MAAMF,EAAUnB,GACvBI,EAAOH,eAAe,eAAgBa,EAAQH,GAKvD,IAFAG,GAAS,EAAAW,EAAA,GAAmBf,EAAWD,IAE1B,GAAI,CACf,IAAIiB,EAAeN,KAAKC,MAAMF,EAAUnB,GACxC,OAAOI,EAAOH,eAAe,UAAWyB,EAAcf,GAEtD,IAAIgB,EAAyBb,EAAS,GAClCc,EAAQR,KAAKS,MAAMf,EAAS,IAEhC,OAAIa,EAAyB,EACpBvB,EAAOH,eAAe,cAAe2B,EAAOjB,GAC1CgB,EAAyB,EAC3BvB,EAAOH,eAAe,aAAc2B,EAAOjB,GAE3CP,EAAOH,eAAe,eAAgB2B,EAAQ,EAAGjB","sources":["webpack://grafana/../../opt/drone/yarncache/date-fns-npm-2.28.0-c19c5add1b-a0516b2e4f.zip/node_modules/date-fns/esm/formatDistanceToNow/index.js","webpack://grafana/./public/app/core/components/AppNotifications/StoredNotificationItem.tsx","webpack://grafana/./public/app/features/notifications/StoredNotifications.tsx","webpack://grafana/./public/app/features/notifications/NotificationsPage.tsx","webpack://grafana/../../opt/drone/yarncache/date-fns-npm-2.28.0-c19c5add1b-a0516b2e4f.zip/node_modules/date-fns/esm/_lib/cloneObject/index.js","webpack://grafana/../../opt/drone/yarncache/date-fns-npm-2.28.0-c19c5add1b-a0516b2e4f.zip/node_modules/date-fns/esm/_lib/assign/index.js","webpack://grafana/../../opt/drone/yarncache/date-fns-npm-2.28.0-c19c5add1b-a0516b2e4f.zip/node_modules/date-fns/esm/formatDistance/index.js"],"sourcesContent":["import distanceInWords from \"../formatDistance/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * > ⚠️ Please note that this function is not present in the FP submodule as\n * > it uses `Date.now()` internally hence impure and can't be safely curried.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWordsToNow ` to `formatDistanceToNow`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsToNow(new Date(2014, 6, 2), { addSuffix: true })\n * //=> 'in 6 months'\n *\n * // v2.0.0 onward\n *\n * formatDistanceToNow(new Date(2014, 6, 2), { addSuffix: true })\n * //=> 'in 6 months'\n * ```\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - the object with options\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result specifies if now is earlier or later than the passed date\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * var result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * var result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * var result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * var eoLocale = require('date-fns/locale/eo')\n * var result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\n\nexport default function formatDistanceToNow(dirtyDate, dirtyOptions) {\n requiredArgs(1, arguments);\n return distanceInWords(dirtyDate, Date.now(), dirtyOptions);\n}","import { css } from '@emotion/css';\nimport { formatDistanceToNow } from 'date-fns';\nimport React, { ReactNode } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { Card, Checkbox, useTheme2 } from '@grafana/ui';\n\nexport type AlertVariant = 'success' | 'warning' | 'error' | 'info';\n\nexport interface Props {\n children?: ReactNode;\n className?: string;\n isSelected: boolean;\n onClick: () => void;\n severity?: AlertVariant;\n title: string;\n timestamp?: number;\n traceId?: string;\n}\n\nexport const StoredNotificationItem = ({\n children,\n className,\n isSelected,\n onClick,\n severity = 'error',\n title,\n traceId,\n timestamp,\n}: Props) => {\n const theme = useTheme2();\n const styles = getStyles(theme);\n const showTraceId = config.featureToggles.tracing && traceId;\n\n return (\n <Card className={className} onClick={onClick}>\n <Card.Heading>{title}</Card.Heading>\n <Card.Description>{children}</Card.Description>\n <Card.Figure>\n <Checkbox onChange={onClick} tabIndex={-1} value={isSelected} />\n </Card.Figure>\n <Card.Tags className={styles.trace}>\n {showTraceId && <span>{`Trace ID: ${traceId}`}</span>}\n {timestamp && formatDistanceToNow(timestamp, { addSuffix: true })}\n </Card.Tags>\n </Card>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n trace: css({\n alignItems: 'flex-end',\n alignSelf: 'flex-end',\n color: theme.colors.text.secondary,\n display: 'flex',\n flexDirection: 'column',\n fontSize: theme.typography.pxToRem(10),\n justifySelf: 'flex-end',\n }),\n };\n};\n","import { css, cx } from '@emotion/css';\nimport React, { useRef, useState } from 'react';\nimport { useEffectOnce } from 'react-use';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Alert, Button, Checkbox, Icon, useStyles2 } from '@grafana/ui';\nimport { StoredNotificationItem } from 'app/core/components/AppNotifications/StoredNotificationItem';\nimport {\n clearAllNotifications,\n clearNotification,\n readAllNotifications,\n selectWarningsAndErrors,\n selectLastReadTimestamp,\n} from 'app/core/reducers/appNotification';\nimport { useDispatch, useSelector } from 'app/types';\n\nexport function StoredNotifications() {\n const dispatch = useDispatch();\n const notifications = useSelector((state) => selectWarningsAndErrors(state.appNotifications));\n const [selectedNotificationIds, setSelectedNotificationIds] = useState<string[]>([]);\n const allNotificationsSelected = notifications.every((notification) =>\n selectedNotificationIds.includes(notification.id)\n );\n const lastReadTimestamp = useRef(useSelector((state) => selectLastReadTimestamp(state.appNotifications)));\n const styles = useStyles2(getStyles);\n\n useEffectOnce(() => {\n dispatch(readAllNotifications(Date.now()));\n });\n\n const clearSelectedNotifications = () => {\n if (allNotificationsSelected) {\n dispatch(clearAllNotifications());\n } else {\n selectedNotificationIds.forEach((id) => {\n dispatch(clearNotification(id));\n });\n }\n setSelectedNotificationIds([]);\n };\n\n const handleAllCheckboxToggle = (isChecked: boolean) => {\n setSelectedNotificationIds(isChecked ? notifications.map((n) => n.id) : []);\n };\n\n const handleCheckboxToggle = (id: string) => {\n setSelectedNotificationIds((prevState) => {\n if (!prevState.includes(id)) {\n return [...prevState, id];\n } else {\n return prevState.filter((notificationId) => notificationId !== id);\n }\n });\n };\n\n if (notifications.length === 0) {\n return (\n <div className={styles.noNotifsWrapper}>\n <Icon name=\"bell\" size=\"xxl\" />\n <span>Notifications you have received will appear here.</span>\n </div>\n );\n }\n\n return (\n <div className={styles.wrapper}>\n <Alert\n severity=\"info\"\n title=\"This page displays past errors and warnings. Once dismissed, they cannot be retrieved.\"\n />\n <div className={styles.topRow}>\n <Checkbox\n value={allNotificationsSelected}\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => handleAllCheckboxToggle(event.target.checked)}\n />\n <Button disabled={selectedNotificationIds.length === 0} onClick={clearSelectedNotifications}>\n Dismiss notifications\n </Button>\n </div>\n <ul className={styles.list}>\n {notifications.map((notif) => (\n <li key={notif.id} className={styles.listItem}>\n <StoredNotificationItem\n className={cx({ [styles.newItem]: notif.timestamp > lastReadTimestamp.current })}\n isSelected={selectedNotificationIds.includes(notif.id)}\n onClick={() => handleCheckboxToggle(notif.id)}\n severity={notif.severity}\n title={notif.title}\n timestamp={notif.timestamp}\n traceId={notif.traceId}\n >\n <span>{notif.text}</span>\n </StoredNotificationItem>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n topRow: css({\n alignItems: 'center',\n display: 'flex',\n gap: theme.spacing(2),\n }),\n list: css({\n display: 'flex',\n flexDirection: 'column',\n }),\n listItem: css({\n alignItems: 'center',\n display: 'flex',\n gap: theme.spacing(2),\n listStyle: 'none',\n position: 'relative',\n }),\n newItem: css({\n '&::before': {\n content: '\"\"',\n height: '100%',\n position: 'absolute',\n left: '-7px',\n top: 0,\n background: theme.colors.gradients.brandVertical,\n width: theme.spacing(0.5),\n borderRadius: theme.shape.borderRadius(1),\n },\n }),\n noNotifsWrapper: css({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n gap: theme.spacing(1),\n }),\n wrapper: css({\n display: 'flex',\n flexDirection: 'column',\n gap: theme.spacing(2),\n }),\n };\n}\n","import React from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\n\nimport Page from '../../core/components/Page/Page';\nimport { GrafanaRouteComponentProps } from '../../core/navigation/types';\nimport { getNavModel } from '../../core/selectors/navModel';\nimport { StoreState } from '../../types';\n\nimport { StoredNotifications } from './StoredNotifications';\n\nconst mapStateToProps = (state: StoreState) => ({\n navModel: getNavModel(state.navIndex, 'notifications'),\n});\n\nconst connector = connect(mapStateToProps, undefined);\n\ninterface OwnProps extends GrafanaRouteComponentProps {}\n\ntype Props = OwnProps & ConnectedProps<typeof connector>;\n\nexport const NotificationsPage = ({ navModel }: Props) => {\n return (\n <Page navModel={navModel}>\n <Page.Contents>\n <StoredNotifications />\n </Page.Contents>\n </Page>\n );\n};\n\nexport default connect(mapStateToProps)(NotificationsPage);\n","import assign from \"../assign/index.js\";\nexport default function cloneObject(dirtyObject) {\n return assign({}, dirtyObject);\n}","export default function assign(target, dirtyObject) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n\n dirtyObject = dirtyObject || {};\n\n for (var property in dirtyObject) {\n if (Object.prototype.hasOwnProperty.call(dirtyObject, property)) {\n target[property] = dirtyObject[property];\n }\n }\n\n return target;\n}","import compareAsc from \"../compareAsc/index.js\";\nimport differenceInMonths from \"../differenceInMonths/index.js\";\nimport differenceInSeconds from \"../differenceInSeconds/index.js\";\nimport defaultLocale from \"../locale/en-US/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport cloneObject from \"../_lib/cloneObject/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MINUTES_IN_DAY = 1440;\nvar MINUTES_IN_ALMOST_TWO_DAYS = 2520;\nvar MINUTES_IN_MONTH = 43200;\nvar MINUTES_IN_TWO_MONTHS = 86400;\n/**\n * @name formatDistance\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words.\n *\n * | Distance between dates | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance between dates | Result |\n * |------------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWords ` to `formatDistance`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWords(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 11, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n *\n * // v2.0.0 onward\n *\n * formatDistance(\n * new Date(1986, 3, 4, 11, 32, 0),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `baseDate` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00, including seconds?\n * const result = formatDistance(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0),\n * { includeSeconds: true }\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> 'about 1 year ago'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> 'pli ol 1 jaro'\n */\n\nexport default function formatDistance(dirtyDate, dirtyBaseDate) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n requiredArgs(2, arguments);\n var locale = options.locale || defaultLocale;\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain formatDistance property');\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate);\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value');\n }\n\n var localizeOptions = cloneObject(options);\n localizeOptions.addSuffix = Boolean(options.addSuffix);\n localizeOptions.comparison = comparison;\n var dateLeft;\n var dateRight;\n\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate);\n dateRight = toDate(dirtyDate);\n } else {\n dateLeft = toDate(dirtyDate);\n dateRight = toDate(dirtyBaseDate);\n }\n\n var seconds = differenceInSeconds(dateRight, dateLeft);\n var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1000;\n var minutes = Math.round((seconds - offsetInSeconds) / 60);\n var months; // 0 up to 2 mins\n\n if (minutes < 2) {\n if (options.includeSeconds) {\n if (seconds < 5) {\n return locale.formatDistance('lessThanXSeconds', 5, localizeOptions);\n } else if (seconds < 10) {\n return locale.formatDistance('lessThanXSeconds', 10, localizeOptions);\n } else if (seconds < 20) {\n return locale.formatDistance('lessThanXSeconds', 20, localizeOptions);\n } else if (seconds < 40) {\n return locale.formatDistance('halfAMinute', null, localizeOptions);\n } else if (seconds < 60) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);\n } else {\n return locale.formatDistance('xMinutes', 1, localizeOptions);\n }\n } else {\n if (minutes === 0) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions);\n } else {\n return locale.formatDistance('xMinutes', minutes, localizeOptions);\n }\n } // 2 mins up to 0.75 hrs\n\n } else if (minutes < 45) {\n return locale.formatDistance('xMinutes', minutes, localizeOptions); // 0.75 hrs up to 1.5 hrs\n } else if (minutes < 90) {\n return locale.formatDistance('aboutXHours', 1, localizeOptions); // 1.5 hrs up to 24 hrs\n } else if (minutes < MINUTES_IN_DAY) {\n var hours = Math.round(minutes / 60);\n return locale.formatDistance('aboutXHours', hours, localizeOptions); // 1 day up to 1.75 days\n } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {\n return locale.formatDistance('xDays', 1, localizeOptions); // 1.75 days up to 30 days\n } else if (minutes < MINUTES_IN_MONTH) {\n var days = Math.round(minutes / MINUTES_IN_DAY);\n return locale.formatDistance('xDays', days, localizeOptions); // 1 month up to 2 months\n } else if (minutes < MINUTES_IN_TWO_MONTHS) {\n months = Math.round(minutes / MINUTES_IN_MONTH);\n return locale.formatDistance('aboutXMonths', months, localizeOptions);\n }\n\n months = differenceInMonths(dateRight, dateLeft); // 2 months up to 12 months\n\n if (months < 12) {\n var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);\n return locale.formatDistance('xMonths', nearestMonth, localizeOptions); // 1 year up to max Date\n } else {\n var monthsSinceStartOfYear = months % 12;\n var years = Math.floor(months / 12); // N years up to 1 years 3 months\n\n if (monthsSinceStartOfYear < 3) {\n return locale.formatDistance('aboutXYears', years, localizeOptions); // N years 3 months up to N years 9 months\n } else if (monthsSinceStartOfYear < 9) {\n return locale.formatDistance('overXYears', years, localizeOptions); // N years 9 months up to N year 12 months\n } else {\n return locale.formatDistance('almostXYears', years + 1, localizeOptions);\n }\n }\n}"],"names":["formatDistanceToNow","dirtyDate","dirtyOptions","requiredArgs","arguments","Date","now","StoredNotificationItem","children","className","isSelected","onClick","severity","title","traceId","timestamp","theme","useTheme2","styles","getStyles","showTraceId","config","Card","Checkbox","onChange","tabIndex","value","trace","addSuffix","css","alignItems","alignSelf","color","colors","text","secondary","display","flexDirection","fontSize","typography","pxToRem","justifySelf","StoredNotifications","dispatch","useDispatch","notifications","useSelector","state","selectWarningsAndErrors","appNotifications","selectedNotificationIds","setSelectedNotificationIds","useState","allNotificationsSelected","every","notification","includes","id","lastReadTimestamp","useRef","selectLastReadTimestamp","useStyles2","useEffectOnce","readAllNotifications","length","noNotifsWrapper","Icon","name","size","wrapper","Alert","topRow","event","handleAllCheckboxToggle","isChecked","target","checked","map","n","Button","disabled","clearAllNotifications","forEach","clearNotification","list","notif","listItem","cx","newItem","current","handleCheckboxToggle","prevState","filter","notificationId","gap","spacing","listStyle","position","content","height","left","top","background","gradients","brandVertical","width","borderRadius","shape","mapStateToProps","navModel","getNavModel","navIndex","NotificationsPage","connect","undefined","Page","cloneObject","dirtyObject","TypeError","property","Object","prototype","hasOwnProperty","call","MINUTES_IN_DAY","MINUTES_IN_MONTH","formatDistance","dirtyBaseDate","options","locale","RangeError","comparison","compareAsc","isNaN","dateLeft","dateRight","localizeOptions","Boolean","toDate","months","seconds","differenceInSeconds","offsetInSeconds","getTimezoneOffsetInMilliseconds","minutes","Math","round","includeSeconds","hours","days","differenceInMonths","nearestMonth","monthsSinceStartOfYear","years","floor"],"sourceRoot":""}
|