{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Moment } from 'moment';\nimport momentLib from 'moment';\nimport 'moment-timezone/moment-timezone.js';\nimport 'moment-timezone/moment-timezone-utils.js';\nimport deprecated from '@wordpress/deprecated';\nimport type { DateSettings } from './types';\n\nexport type * from './types';\n\nconst WP_ZONE = 'WP';\n\n// This regular expression tests positive for UTC offsets as described in ISO 8601.\n// See: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\nconst VALID_UTC_OFFSET = /^[+-][0-1][0-9](:?[0-9][0-9])?$/;\n\n// Changes made here will likely need to be synced with Core in the file\n// src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`.\nlet settings: DateSettings = {\n\tl10n: {\n\t\tlocale: 'en',\n\t\tmonths: [\n\t\t\t'January',\n\t\t\t'February',\n\t\t\t'March',\n\t\t\t'April',\n\t\t\t'May',\n\t\t\t'June',\n\t\t\t'July',\n\t\t\t'August',\n\t\t\t'September',\n\t\t\t'October',\n\t\t\t'November',\n\t\t\t'December',\n\t\t],\n\t\tmonthsShort: [\n\t\t\t'Jan',\n\t\t\t'Feb',\n\t\t\t'Mar',\n\t\t\t'Apr',\n\t\t\t'May',\n\t\t\t'Jun',\n\t\t\t'Jul',\n\t\t\t'Aug',\n\t\t\t'Sep',\n\t\t\t'Oct',\n\t\t\t'Nov',\n\t\t\t'Dec',\n\t\t],\n\t\tweekdays: [\n\t\t\t'Sunday',\n\t\t\t'Monday',\n\t\t\t'Tuesday',\n\t\t\t'Wednesday',\n\t\t\t'Thursday',\n\t\t\t'Friday',\n\t\t\t'Saturday',\n\t\t],\n\t\tweekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],\n\t\tmeridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' },\n\t\trelative: {\n\t\t\tfuture: '%s from now',\n\t\t\tpast: '%s ago',\n\t\t\ts: 'a few seconds',\n\t\t\tss: '%d seconds',\n\t\t\tm: 'a minute',\n\t\t\tmm: '%d minutes',\n\t\t\th: 'an hour',\n\t\t\thh: '%d hours',\n\t\t\td: 'a day',\n\t\t\tdd: '%d days',\n\t\t\tM: 'a month',\n\t\t\tMM: '%d months',\n\t\t\ty: 'a year',\n\t\t\tyy: '%d years',\n\t\t},\n\t\tstartOfWeek: 0,\n\t},\n\tformats: {\n\t\ttime: 'g:i a',\n\t\tdate: 'F j, Y',\n\t\tdatetime: 'F j, Y g:i a',\n\t\tdatetimeAbbreviated: 'M j, Y g:i a',\n\t},\n\ttimezone: { offset: 0, offsetFormatted: '0', string: '', abbr: '' },\n};\n\n/**\n * Adds a locale to moment, using the format supplied by `wp_localize_script()`.\n *\n * @param dateSettings Settings, including locale data.\n */\nexport function setSettings( dateSettings: DateSettings ) {\n\tsettings = dateSettings;\n\n\tsetupWPTimezone();\n\n\t// Does moment already have a locale with the right name?\n\tif ( momentLib.locales().includes( dateSettings.l10n.locale ) ) {\n\t\t// Is that locale misconfigured, e.g. because we are on a site running\n\t\t// WordPress < 6.0?\n\t\tif (\n\t\t\tmomentLib\n\t\t\t\t.localeData( dateSettings.l10n.locale )\n\t\t\t\t.longDateFormat( 'LTS' ) === null\n\t\t) {\n\t\t\t// Delete the misconfigured locale.\n\t\t\tmomentLib.defineLocale( dateSettings.l10n.locale, null );\n\t\t} else {\n\t\t\t// We have a properly configured locale, so no need to create one.\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// defineLocale() will modify the current locale, so back it up.\n\tconst currentLocale = momentLib.locale();\n\n\t// Create locale.\n\tmomentLib.defineLocale( dateSettings.l10n.locale, {\n\t\t// Inherit anything missing from English. We don't load\n\t\t// moment-with-locales.js so English is all there is.\n\t\tparentLocale: 'en',\n\t\tmonths: dateSettings.l10n.months,\n\t\tmonthsShort: dateSettings.l10n.monthsShort,\n\t\tweekdays: dateSettings.l10n.weekdays,\n\t\tweekdaysShort: dateSettings.l10n.weekdaysShort,\n\t\tmeridiem( hour, minute, isLowercase ) {\n\t\t\tif ( hour < 12 ) {\n\t\t\t\treturn isLowercase\n\t\t\t\t\t? dateSettings.l10n.meridiem.am\n\t\t\t\t\t: dateSettings.l10n.meridiem.AM;\n\t\t\t}\n\t\t\treturn isLowercase\n\t\t\t\t? dateSettings.l10n.meridiem.pm\n\t\t\t\t: dateSettings.l10n.meridiem.PM;\n\t\t},\n\t\tlongDateFormat: {\n\t\t\tLT: dateSettings.formats.time,\n\t\t\tLTS: momentLib.localeData( 'en' ).longDateFormat( 'LTS' ),\n\t\t\tL: momentLib.localeData( 'en' ).longDateFormat( 'L' ),\n\t\t\tLL: dateSettings.formats.date,\n\t\t\tLLL: dateSettings.formats.datetime,\n\t\t\tLLLL: momentLib.localeData( 'en' ).longDateFormat( 'LLLL' ),\n\t\t},\n\t\t// From human_time_diff?\n\t\t// Set to `(number, withoutSuffix, key, isFuture) => {}` instead.\n\t\trelativeTime: dateSettings.l10n.relative,\n\t} );\n\n\t// Restore the locale to what it was.\n\tmomentLib.locale( currentLocale );\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @return {DateSettings} Settings, including locale data.\n */\nexport function getSettings() {\n\treturn settings;\n}\n\n/**\n * Returns the currently defined date settings.\n *\n * @deprecated\n * @return {DateSettings} Settings, including locale data.\n */\nexport function __experimentalGetSettings() {\n\tdeprecated( 'wp.date.__experimentalGetSettings', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.date.getSettings',\n\t} );\n\treturn getSettings();\n}\n\n// Cached packed zone string, used to re-add the WP zone without requiring\n// moment-timezone-utils (which provides .pack()) after a third-party plugin\n// reloads moment-timezone and destroys both the zone and the utils.\nlet wpZonePacked: string | undefined;\n\n/**\n * Ensures the custom WP timezone zone exists in moment-timezone's registry.\n *\n * Third-party plugins (e.g. WooCommerce) may load their own copy of\n * moment-timezone, which reinitializes the internal zone storage and\n * destroys the custom 'WP' zone. This function checks for the zone's\n * existence and re-creates it if necessary.\n */\nfunction ensureWPTimezone() {\n\tif ( ! momentLib.tz.zone( WP_ZONE ) ) {\n\t\tif ( wpZonePacked ) {\n\t\t\tmomentLib.tz.add( wpZonePacked );\n\t\t} else {\n\t\t\tsetupWPTimezone();\n\t\t}\n\t}\n}\n\nfunction setupWPTimezone() {\n\t// Get the current timezone settings from the WP timezone string.\n\tconst currentTimezone = momentLib.tz.zone( settings.timezone.string );\n\n\tlet packed;\n\t// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset.\n\tif ( currentTimezone ) {\n\t\t// Create WP timezone based off settings.timezone.string.  We need to include the additional data so that we\n\t\t// don't lose information about daylight savings time and other items.\n\t\t// See https://github.com/WordPress/gutenberg/pull/48083\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: currentTimezone.abbrs,\n\t\t\tuntils: currentTimezone.untils,\n\t\t\toffsets: currentTimezone.offsets,\n\t\t} );\n\t} else {\n\t\t// Create WP timezone based off dateSettings.\n\t\tpacked = momentLib.tz.pack( {\n\t\t\tname: WP_ZONE,\n\t\t\tabbrs: [ WP_ZONE ],\n\t\t\tuntils: [ Infinity ],\n\t\t\toffsets: [ -settings.timezone.offset * 60 || 0 ],\n\t\t} );\n\t}\n\n\twpZonePacked = packed;\n\tmomentLib.tz.add( packed );\n}\n\n// Date constants.\n/**\n * Number of seconds in one minute.\n */\nconst MINUTE_IN_SECONDS = 60;\n/**\n * Number of minutes in one hour.\n */\nconst HOUR_IN_MINUTES = 60;\n/**\n * Number of seconds in one hour.\n */\nconst HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;\n\n/**\n * Map of PHP formats to Moment.js formats.\n *\n * These are used internally by {@link format}, and are either\n * a string representing the corresponding Moment.js format code, or a\n * function which returns the formatted string.\n *\n * This should only be used through {@link format}, not\n * directly.\n */\nconst formatMap = {\n\t// Day.\n\td: 'DD',\n\tD: 'ddd',\n\tj: 'D',\n\tl: 'dddd',\n\tN: 'E',\n\n\t/**\n\t * Gets the ordinal suffix.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tS( momentDate: Moment ) {\n\t\t// Do - D.\n\t\tconst num = momentDate.format( 'D' );\n\t\tconst withOrdinal = momentDate.format( 'Do' );\n\t\treturn withOrdinal.replace( num, '' );\n\t},\n\n\tw: 'd',\n\t/**\n\t * Gets the day of the year (zero-indexed).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tz( momentDate: Moment ) {\n\t\t// DDD - 1.\n\t\treturn ( parseInt( momentDate.format( 'DDD' ), 10 ) - 1 ).toString();\n\t},\n\n\t// Week.\n\tW: 'W',\n\n\t// Month.\n\tF: 'MMMM',\n\tm: 'MM',\n\tM: 'MMM',\n\tn: 'M',\n\t/**\n\t * Gets the days in the month.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tt( momentDate: Moment ) {\n\t\treturn momentDate.daysInMonth();\n\t},\n\n\t// Year.\n\t/**\n\t * Gets whether the current year is a leap year.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tL( momentDate: Moment ) {\n\t\treturn momentDate.isLeapYear() ? '1' : '0';\n\t},\n\to: 'GGGG',\n\tY: 'YYYY',\n\ty: 'YY',\n\n\t// Time.\n\ta: 'a',\n\tA: 'A',\n\t/**\n\t * Gets the current time in Swatch Internet Time (.beats).\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tB( momentDate: Moment ) {\n\t\tconst timezoned = momentLib( momentDate ).utcOffset( 60 );\n\t\tconst seconds = parseInt( timezoned.format( 's' ), 10 ),\n\t\t\tminutes = parseInt( timezoned.format( 'm' ), 10 ),\n\t\t\thours = parseInt( timezoned.format( 'H' ), 10 );\n\t\treturn parseInt(\n\t\t\t(\n\t\t\t\t( seconds +\n\t\t\t\t\tminutes * MINUTE_IN_SECONDS +\n\t\t\t\t\thours * HOUR_IN_SECONDS ) /\n\t\t\t\t86.4\n\t\t\t).toString(),\n\t\t\t10\n\t\t);\n\t},\n\tg: 'h',\n\tG: 'H',\n\th: 'hh',\n\tH: 'HH',\n\ti: 'mm',\n\ts: 'ss',\n\tu: 'SSSSSS',\n\tv: 'SSS',\n\t// Timezone.\n\te: 'zz',\n\t/**\n\t * Gets whether the timezone is in DST currently.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tI( momentDate: Moment ) {\n\t\treturn momentDate.isDST() ? '1' : '0';\n\t},\n\tO: 'ZZ',\n\tP: 'Z',\n\tT: 'z',\n\t/**\n\t * Gets the timezone offset in seconds.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tZ( momentDate: Moment ) {\n\t\t// Timezone offset in seconds.\n\t\tconst offset = momentDate.format( 'Z' );\n\t\tconst sign = offset[ 0 ] === '-' ? -1 : 1;\n\t\tconst parts = offset\n\t\t\t.substring( 1 )\n\t\t\t.split( ':' )\n\t\t\t.map( ( n ) => parseInt( n, 10 ) );\n\t\treturn (\n\t\t\tsign *\n\t\t\t( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) *\n\t\t\tMINUTE_IN_SECONDS\n\t\t);\n\t},\n\t// Full date/time.\n\tc: 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString.\n\t/**\n\t * Formats the date as RFC2822.\n\t *\n\t * @param momentDate Moment instance.\n\t *\n\t * @return Formatted date.\n\t */\n\tr( momentDate: Moment ) {\n\t\treturn momentDate\n\t\t\t.locale( 'en' )\n\t\t\t.format( 'ddd, DD MMM YYYY HH:mm:ss ZZ' );\n\t},\n\tU: 'X',\n};\n\n/**\n * Formats a date. Does not alter the date's timezone.\n *\n * @param dateFormat PHP-style formatting string.\n *                   See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue  Date object or string,\n *                   parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function format(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tlet i, char;\n\tconst newFormat = [];\n\tconst momentDate = momentLib( dateValue );\n\tfor ( i = 0; i < dateFormat.length; i++ ) {\n\t\tchar = dateFormat[ i ];\n\t\t// Is this an escape?\n\t\tif ( '\\\\' === char ) {\n\t\t\t// Add next character, then move on. A final backslash is\n\t\t\t// ignored to align with PHP:\n\t\t\t// `var_dump( date( 'Y\\\\', 0 ) );` prints `string(5) \"1970\"`\n\t\t\ti++;\n\t\t\tif ( i < dateFormat.length ) {\n\t\t\t\tnewFormat.push( '[' + dateFormat[ i ] + ']' );\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif ( char in formatMap ) {\n\t\t\tconst formatter = formatMap[ char as keyof typeof formatMap ];\n\t\t\tif ( typeof formatter !== 'string' ) {\n\t\t\t\t// If the format is a function, call it.\n\t\t\t\tnewFormat.push( '[' + formatter( momentDate ) + ']' );\n\t\t\t} else {\n\t\t\t\t// Otherwise, add as a formatting string.\n\t\t\t\tnewFormat.push( formatter );\n\t\t\t}\n\t\t} else {\n\t\t\tnewFormat.push( '[' + char + ']' );\n\t\t}\n\t}\n\t// Join with [] between to separate characters, and replace\n\t// unneeded separators with static text.\n\treturn momentDate.format( newFormat.join( '[]' ) );\n}\n\n/**\n * Formats a date (like `date()` in PHP).\n *\n * @param  dateFormat PHP-style formatting string.\n *                    See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param  dateValue  Date object or string, parsable\n *                    by moment.js.\n * @param  timezone   Timezone to output result in or a\n *                    UTC offset. Defaults to timezone from\n *                    site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return {string} Formatted date in English.\n */\nexport function date(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string\n) {\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `date()` in PHP), in the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n *                   See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue  Date object or string,\n *                   parsable by moment.js.\n *\n * @return Formatted date in English.\n */\nexport function gmdate(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale.\n *\n * Backward Compatibility Notice: if `timezone` is set to `true`, the function\n * behaves like `gmdateI18n`.\n *\n * @param dateFormat PHP-style formatting string.\n *                   See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue  Date object or string, parsable by\n *                   moment.js.\n * @param timezone   Timezone to output result in or a\n *                   UTC offset. Defaults to timezone from\n *                   site. Notice: `boolean` is effectively\n *                   deprecated, but still supported for\n *                   backward compatibility reasons.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return  Formatted date.\n */\nexport function dateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date(),\n\ttimezone?: string | number | boolean\n) {\n\tif ( true === timezone ) {\n\t\treturn gmdateI18n( dateFormat, dateValue );\n\t}\n\n\tif ( false === timezone ) {\n\t\ttimezone = undefined;\n\t}\n\n\tconst dateMoment = buildMoment( dateValue, timezone );\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Formats a date (like `wp_date()` in PHP), translating it into site's locale\n * and using the UTC timezone.\n *\n * @param dateFormat PHP-style formatting string.\n *                   See [php.net/date](https://www.php.net/manual/en/function.date.php).\n * @param dateValue  Date object or string,\n *                   parsable by moment.js.\n *\n * @return Formatted date.\n */\nexport function gmdateI18n(\n\tdateFormat: string,\n\tdateValue: Moment | Date | string | number = new Date()\n) {\n\tconst dateMoment = momentLib( dateValue ).utc();\n\tdateMoment.locale( settings.l10n.locale );\n\treturn format( dateFormat, dateMoment );\n}\n\n/**\n * Check whether a date is considered in the future according to the WordPress settings.\n *\n * @param dateValue Date String or Date object in the Defined WP Timezone.\n *\n * @return Is in the future.\n */\nexport function isInTheFuture( dateValue: Date | string | number ) {\n\tensureWPTimezone();\n\tconst now = momentLib.tz( WP_ZONE );\n\tconst momentObject = momentLib.tz( dateValue, WP_ZONE );\n\n\treturn momentObject.isAfter( now );\n}\n\n/**\n * Create and return a JavaScript Date Object from a date string in the WP timezone.\n *\n * @param dateString Date formatted in the WP timezone.\n *\n * @return  Date\n */\nexport function getDate( dateString?: string | null ) {\n\tensureWPTimezone();\n\tif ( ! dateString ) {\n\t\treturn momentLib.tz( WP_ZONE ).toDate();\n\t}\n\n\treturn momentLib.tz( dateString, WP_ZONE ).toDate();\n}\n\n/**\n * Returns a human-readable time difference between two dates, like human_time_diff() in PHP.\n *\n * @param from From date, in the WP timezone.\n * @param to   To date, formatted in the WP timezone.\n *\n * @return Human-readable time difference.\n */\nexport function humanTimeDiff(\n\tfrom: Moment | Date | string | number,\n\tto?: Moment | Date | string | number\n) {\n\tensureWPTimezone();\n\tconst fromMoment = momentLib.tz( from, WP_ZONE );\n\tconst toMoment = to ? momentLib.tz( to, WP_ZONE ) : momentLib.tz( WP_ZONE );\n\treturn fromMoment.from( toMoment );\n}\n\n/**\n * Creates a moment instance using the given timezone or, if none is provided, using global settings.\n *\n * @param dateValue Date object or string, parsable\n *                  by moment.js.\n * @param timezone  Timezone to output result in or a\n *                  UTC offset. Defaults to timezone from\n *                  site.\n *\n * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC\n *\n * @return A moment instance.\n */\nfunction buildMoment(\n\tdateValue: Moment | Date | string | number,\n\ttimezone: string | number = ''\n) {\n\tconst dateMoment = momentLib( dateValue );\n\n\tif ( timezone !== '' ) {\n\t\treturn isUTCOffset( timezone )\n\t\t\t? dateMoment.utcOffset( timezone )\n\t\t\t: // A false isUTCOffset() guarantees that timezone is a string.\n\t\t\t\tdateMoment.tz( timezone as string );\n\t}\n\n\tif ( settings.timezone.string ) {\n\t\treturn dateMoment.tz( settings.timezone.string );\n\t}\n\n\treturn dateMoment.utcOffset( +settings.timezone.offset );\n}\n\n/**\n * Returns whether a certain UTC offset is valid or not.\n *\n * @param offset a UTC offset.\n *\n * @return  whether a certain UTC offset is valid or not.\n */\nfunction isUTCOffset( offset: number | string ) {\n\tif ( 'number' === typeof offset ) {\n\t\treturn true;\n\t}\n\n\treturn VALID_UTC_OFFSET.test( offset );\n}\n\nsetupWPTimezone();\n"],"mappings":";;;;;AASA,MAAM,UAAU;AAIhB,MAAM,mBAAmB;AAIzB,IAAI,WAAyB;CAC5B,MAAM;EACL,QAAQ;EACR,QAAQ;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACA,aAAa;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACA,UAAU;GACT;GACA;GACA;GACA;GACA;GACA;GACA;EACD;EACA,eAAe;GAAE;GAAO;GAAO;GAAO;GAAO;GAAO;GAAO;EAAM;EACjE,UAAU;GAAE,IAAI;GAAM,IAAI;GAAM,IAAI;GAAM,IAAI;EAAK;EACnD,UAAU;GACT,QAAQ;GACR,MAAM;GACN,GAAG;GACH,IAAI;GACJ,GAAG;GACH,IAAI;GACJ,GAAG;GACH,IAAI;GACJ,GAAG;GACH,IAAI;GACJ,GAAG;GACH,IAAI;GACJ,GAAG;GACH,IAAI;EACL;EACA,aAAa;CACd;CACA,SAAS;EACR,MAAM;EACN,MAAM;EACN,UAAU;EACV,qBAAqB;CACtB;CACA,UAAU;EAAE,QAAQ;EAAG,iBAAiB;EAAK,QAAQ;EAAI,MAAM;CAAG;AACnE;;;;;;AAOA,SAAgB,YAAa,cAA6B;CACzD,WAAW;CA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