cdn.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. (() => {
  2. var _window$dateFns;function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);}function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _defineProperty(obj, key, value) {key = _toPropertyKey(key);if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == _typeof(i) ? i : String(i);}function _toPrimitive(t, r) {if ("object" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != _typeof(i)) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}var __defProp = Object.defineProperty;
  3. var __export = function __export(target, all) {
  4. for (var name in all)
  5. __defProp(target, name, {
  6. get: all[name],
  7. enumerable: true,
  8. configurable: true,
  9. set: function set(newValue) {return all[name] = function () {return newValue;};}
  10. });
  11. };
  12. // lib/locale/en-US/_lib/formatRelative.js
  13. var formatRelativeLocale = {
  14. lastWeek: "'last' eeee 'at' p",
  15. yesterday: "'yesterday at' p",
  16. today: "'today at' p",
  17. tomorrow: "'tomorrow at' p",
  18. nextWeek: "eeee 'at' p",
  19. other: "P"
  20. };
  21. var formatRelative = function formatRelative(token, _date, _baseDate, _options) {return formatRelativeLocale[token];};
  22. // lib/locale/_lib/buildLocalizeFn.js
  23. function buildLocalizeFn(args) {
  24. return function (value, options) {
  25. var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
  26. var valuesArray;
  27. if (context === "formatting" && args.formattingValues) {
  28. var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
  29. var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
  30. valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
  31. } else {
  32. var _defaultWidth = args.defaultWidth;
  33. var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
  34. valuesArray = args.values[_width] || args.values[_defaultWidth];
  35. }
  36. var index = args.argumentCallback ? args.argumentCallback(value) : value;
  37. return valuesArray[index];
  38. };
  39. }
  40. // lib/locale/en-US/_lib/localize.js
  41. var eraValues = {
  42. narrow: ["B", "A"],
  43. abbreviated: ["BC", "AD"],
  44. wide: ["Before Christ", "Anno Domini"]
  45. };
  46. var quarterValues = {
  47. narrow: ["1", "2", "3", "4"],
  48. abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  49. wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
  50. };
  51. var monthValues = {
  52. narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
  53. abbreviated: [
  54. "Jan",
  55. "Feb",
  56. "Mar",
  57. "Apr",
  58. "May",
  59. "Jun",
  60. "Jul",
  61. "Aug",
  62. "Sep",
  63. "Oct",
  64. "Nov",
  65. "Dec"],
  66. wide: [
  67. "January",
  68. "February",
  69. "March",
  70. "April",
  71. "May",
  72. "June",
  73. "July",
  74. "August",
  75. "September",
  76. "October",
  77. "November",
  78. "December"]
  79. };
  80. var dayValues = {
  81. narrow: ["S", "M", "T", "W", "T", "F", "S"],
  82. short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  83. abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  84. wide: [
  85. "Sunday",
  86. "Monday",
  87. "Tuesday",
  88. "Wednesday",
  89. "Thursday",
  90. "Friday",
  91. "Saturday"]
  92. };
  93. var dayPeriodValues = {
  94. narrow: {
  95. am: "a",
  96. pm: "p",
  97. midnight: "mi",
  98. noon: "n",
  99. morning: "morning",
  100. afternoon: "afternoon",
  101. evening: "evening",
  102. night: "night"
  103. },
  104. abbreviated: {
  105. am: "AM",
  106. pm: "PM",
  107. midnight: "midnight",
  108. noon: "noon",
  109. morning: "morning",
  110. afternoon: "afternoon",
  111. evening: "evening",
  112. night: "night"
  113. },
  114. wide: {
  115. am: "a.m.",
  116. pm: "p.m.",
  117. midnight: "midnight",
  118. noon: "noon",
  119. morning: "morning",
  120. afternoon: "afternoon",
  121. evening: "evening",
  122. night: "night"
  123. }
  124. };
  125. var formattingDayPeriodValues = {
  126. narrow: {
  127. am: "a",
  128. pm: "p",
  129. midnight: "mi",
  130. noon: "n",
  131. morning: "in the morning",
  132. afternoon: "in the afternoon",
  133. evening: "in the evening",
  134. night: "at night"
  135. },
  136. abbreviated: {
  137. am: "AM",
  138. pm: "PM",
  139. midnight: "midnight",
  140. noon: "noon",
  141. morning: "in the morning",
  142. afternoon: "in the afternoon",
  143. evening: "in the evening",
  144. night: "at night"
  145. },
  146. wide: {
  147. am: "a.m.",
  148. pm: "p.m.",
  149. midnight: "midnight",
  150. noon: "noon",
  151. morning: "in the morning",
  152. afternoon: "in the afternoon",
  153. evening: "in the evening",
  154. night: "at night"
  155. }
  156. };
  157. var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
  158. var number = Number(dirtyNumber);
  159. var rem100 = number % 100;
  160. if (rem100 > 20 || rem100 < 10) {
  161. switch (rem100 % 10) {
  162. case 1:
  163. return number + "st";
  164. case 2:
  165. return number + "nd";
  166. case 3:
  167. return number + "rd";
  168. }
  169. }
  170. return number + "th";
  171. };
  172. var localize = {
  173. ordinalNumber: ordinalNumber,
  174. era: buildLocalizeFn({
  175. values: eraValues,
  176. defaultWidth: "wide"
  177. }),
  178. quarter: buildLocalizeFn({
  179. values: quarterValues,
  180. defaultWidth: "wide",
  181. argumentCallback: function argumentCallback(quarter) {return quarter - 1;}
  182. }),
  183. month: buildLocalizeFn({
  184. values: monthValues,
  185. defaultWidth: "wide"
  186. }),
  187. day: buildLocalizeFn({
  188. values: dayValues,
  189. defaultWidth: "wide"
  190. }),
  191. dayPeriod: buildLocalizeFn({
  192. values: dayPeriodValues,
  193. defaultWidth: "wide",
  194. formattingValues: formattingDayPeriodValues,
  195. defaultFormattingWidth: "wide"
  196. })
  197. };
  198. // lib/locale/_lib/buildMatchFn.js
  199. function buildMatchFn(args) {
  200. return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  201. var width = options.width;
  202. var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
  203. var matchResult = string.match(matchPattern);
  204. if (!matchResult) {
  205. return null;
  206. }
  207. var matchedString = matchResult[0];
  208. var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
  209. var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {return pattern.test(matchedString);}) : findKey(parsePatterns, function (pattern) {return pattern.test(matchedString);});
  210. var value;
  211. value = args.valueCallback ? args.valueCallback(key) : key;
  212. value = options.valueCallback ? options.valueCallback(value) : value;
  213. var rest = string.slice(matchedString.length);
  214. return { value: value, rest: rest };
  215. };
  216. }
  217. function findKey(object, predicate) {
  218. for (var key in object) {
  219. if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
  220. return key;
  221. }
  222. }
  223. return;
  224. }
  225. function findIndex(array, predicate) {
  226. for (var key = 0; key < array.length; key++) {
  227. if (predicate(array[key])) {
  228. return key;
  229. }
  230. }
  231. return;
  232. }
  233. // lib/locale/_lib/buildMatchPatternFn.js
  234. function buildMatchPatternFn(args) {
  235. return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  236. var matchResult = string.match(args.matchPattern);
  237. if (!matchResult)
  238. return null;
  239. var matchedString = matchResult[0];
  240. var parseResult = string.match(args.parsePattern);
  241. if (!parseResult)
  242. return null;
  243. var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
  244. value = options.valueCallback ? options.valueCallback(value) : value;
  245. var rest = string.slice(matchedString.length);
  246. return { value: value, rest: rest };
  247. };
  248. }
  249. // lib/locale/en-US/_lib/match.js
  250. var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
  251. var parseOrdinalNumberPattern = /\d+/i;
  252. var matchEraPatterns = {
  253. narrow: /^(b|a)/i,
  254. abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  255. wide: /^(before christ|before common era|anno domini|common era)/i
  256. };
  257. var parseEraPatterns = {
  258. any: [/^b/i, /^(a|c)/i]
  259. };
  260. var matchQuarterPatterns = {
  261. narrow: /^[1234]/i,
  262. abbreviated: /^q[1234]/i,
  263. wide: /^[1234](th|st|nd|rd)? quarter/i
  264. };
  265. var parseQuarterPatterns = {
  266. any: [/1/i, /2/i, /3/i, /4/i]
  267. };
  268. var matchMonthPatterns = {
  269. narrow: /^[jfmasond]/i,
  270. abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  271. wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
  272. };
  273. var parseMonthPatterns = {
  274. narrow: [
  275. /^j/i,
  276. /^f/i,
  277. /^m/i,
  278. /^a/i,
  279. /^m/i,
  280. /^j/i,
  281. /^j/i,
  282. /^a/i,
  283. /^s/i,
  284. /^o/i,
  285. /^n/i,
  286. /^d/i],
  287. any: [
  288. /^ja/i,
  289. /^f/i,
  290. /^mar/i,
  291. /^ap/i,
  292. /^may/i,
  293. /^jun/i,
  294. /^jul/i,
  295. /^au/i,
  296. /^s/i,
  297. /^o/i,
  298. /^n/i,
  299. /^d/i]
  300. };
  301. var matchDayPatterns = {
  302. narrow: /^[smtwf]/i,
  303. short: /^(su|mo|tu|we|th|fr|sa)/i,
  304. abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  305. wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
  306. };
  307. var parseDayPatterns = {
  308. narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
  309. any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
  310. };
  311. var matchDayPeriodPatterns = {
  312. narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  313. any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
  314. };
  315. var parseDayPeriodPatterns = {
  316. any: {
  317. am: /^a/i,
  318. pm: /^p/i,
  319. midnight: /^mi/i,
  320. noon: /^no/i,
  321. morning: /morning/i,
  322. afternoon: /afternoon/i,
  323. evening: /evening/i,
  324. night: /night/i
  325. }
  326. };
  327. var match = {
  328. ordinalNumber: buildMatchPatternFn({
  329. matchPattern: matchOrdinalNumberPattern,
  330. parsePattern: parseOrdinalNumberPattern,
  331. valueCallback: function valueCallback(value) {return parseInt(value, 10);}
  332. }),
  333. era: buildMatchFn({
  334. matchPatterns: matchEraPatterns,
  335. defaultMatchWidth: "wide",
  336. parsePatterns: parseEraPatterns,
  337. defaultParseWidth: "any"
  338. }),
  339. quarter: buildMatchFn({
  340. matchPatterns: matchQuarterPatterns,
  341. defaultMatchWidth: "wide",
  342. parsePatterns: parseQuarterPatterns,
  343. defaultParseWidth: "any",
  344. valueCallback: function valueCallback(index) {return index + 1;}
  345. }),
  346. month: buildMatchFn({
  347. matchPatterns: matchMonthPatterns,
  348. defaultMatchWidth: "wide",
  349. parsePatterns: parseMonthPatterns,
  350. defaultParseWidth: "any"
  351. }),
  352. day: buildMatchFn({
  353. matchPatterns: matchDayPatterns,
  354. defaultMatchWidth: "wide",
  355. parsePatterns: parseDayPatterns,
  356. defaultParseWidth: "any"
  357. }),
  358. dayPeriod: buildMatchFn({
  359. matchPatterns: matchDayPeriodPatterns,
  360. defaultMatchWidth: "any",
  361. parsePatterns: parseDayPeriodPatterns,
  362. defaultParseWidth: "any"
  363. })
  364. };
  365. // lib/locale/en-CA/_lib/formatDistance.js
  366. var formatDistanceLocale = {
  367. lessThanXSeconds: {
  368. one: "less than a second",
  369. other: "less than {{count}} seconds"
  370. },
  371. xSeconds: {
  372. one: "a second",
  373. other: "{{count}} seconds"
  374. },
  375. halfAMinute: "half a minute",
  376. lessThanXMinutes: {
  377. one: "less than a minute",
  378. other: "less than {{count}} minutes"
  379. },
  380. xMinutes: {
  381. one: "a minute",
  382. other: "{{count}} minutes"
  383. },
  384. aboutXHours: {
  385. one: "about an hour",
  386. other: "about {{count}} hours"
  387. },
  388. xHours: {
  389. one: "an hour",
  390. other: "{{count}} hours"
  391. },
  392. xDays: {
  393. one: "a day",
  394. other: "{{count}} days"
  395. },
  396. aboutXWeeks: {
  397. one: "about a week",
  398. other: "about {{count}} weeks"
  399. },
  400. xWeeks: {
  401. one: "a week",
  402. other: "{{count}} weeks"
  403. },
  404. aboutXMonths: {
  405. one: "about a month",
  406. other: "about {{count}} months"
  407. },
  408. xMonths: {
  409. one: "a month",
  410. other: "{{count}} months"
  411. },
  412. aboutXYears: {
  413. one: "about a year",
  414. other: "about {{count}} years"
  415. },
  416. xYears: {
  417. one: "a year",
  418. other: "{{count}} years"
  419. },
  420. overXYears: {
  421. one: "over a year",
  422. other: "over {{count}} years"
  423. },
  424. almostXYears: {
  425. one: "almost a year",
  426. other: "almost {{count}} years"
  427. }
  428. };
  429. var formatDistance = function formatDistance(token, count, options) {
  430. var result;
  431. var tokenValue = formatDistanceLocale[token];
  432. if (typeof tokenValue === "string") {
  433. result = tokenValue;
  434. } else if (count === 1) {
  435. result = tokenValue.one;
  436. } else {
  437. result = tokenValue.other.replace("{{count}}", count.toString());
  438. }
  439. if (options !== null && options !== void 0 && options.addSuffix) {
  440. if (options.comparison && options.comparison > 0) {
  441. return "in " + result;
  442. } else {
  443. return result + " ago";
  444. }
  445. }
  446. return result;
  447. };
  448. // lib/locale/_lib/buildFormatLongFn.js
  449. function buildFormatLongFn(args) {
  450. return function () {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  451. var width = options.width ? String(options.width) : args.defaultWidth;
  452. var format = args.formats[width] || args.formats[args.defaultWidth];
  453. return format;
  454. };
  455. }
  456. // lib/locale/en-CA/_lib/formatLong.js
  457. var dateFormats = {
  458. full: "EEEE, MMMM do, yyyy",
  459. long: "MMMM do, yyyy",
  460. medium: "MMM d, yyyy",
  461. short: "yyyy-MM-dd"
  462. };
  463. var timeFormats = {
  464. full: "h:mm:ss a zzzz",
  465. long: "h:mm:ss a z",
  466. medium: "h:mm:ss a",
  467. short: "h:mm a"
  468. };
  469. var dateTimeFormats = {
  470. full: "{{date}} 'at' {{time}}",
  471. long: "{{date}} 'at' {{time}}",
  472. medium: "{{date}}, {{time}}",
  473. short: "{{date}}, {{time}}"
  474. };
  475. var formatLong = {
  476. date: buildFormatLongFn({
  477. formats: dateFormats,
  478. defaultWidth: "full"
  479. }),
  480. time: buildFormatLongFn({
  481. formats: timeFormats,
  482. defaultWidth: "full"
  483. }),
  484. dateTime: buildFormatLongFn({
  485. formats: dateTimeFormats,
  486. defaultWidth: "full"
  487. })
  488. };
  489. // lib/locale/en-CA.js
  490. var enCA = {
  491. code: "en-CA",
  492. formatDistance: formatDistance,
  493. formatLong: formatLong,
  494. formatRelative: formatRelative,
  495. localize: localize,
  496. match: match,
  497. options: {
  498. weekStartsOn: 0,
  499. firstWeekContainsDate: 1
  500. }
  501. };
  502. // lib/locale/en-CA/cdn.js
  503. window.dateFns = _objectSpread(_objectSpread({},
  504. window.dateFns), {}, {
  505. locale: _objectSpread(_objectSpread({}, (_window$dateFns =
  506. window.dateFns) === null || _window$dateFns === void 0 ? void 0 : _window$dateFns.locale), {}, {
  507. enCA: enCA }) });
  508. //# debugId=B9A68712FFB8E78764756E2164756E21
  509. //# sourceMappingURL=cdn.js.map
  510. })();