M /sublimated/undefined +0 -0
? /sublimated/undefined
binary file or content unavailable
A /sublimated/undefined +135 -0
1import { configFromISO, configFromRFC2822 } from './from-string';2import { configFromArray } from './from-array';3import { getParseRegexForToken } from '../parse/regex';4import { addTimeToArrayFromToken } from '../parse/token';5import {6 expandFormat,7 formatTokenFunctions,8 formattingTokens,9} from '../format/format';10import checkOverflow from './check-overflow';11import { YEAR, HOUR } from '../units/constants';12import { hooks } from '../utils/hooks';13import getParsingFlags from './parsing-flags';14
15// constant that refers to the ISO standard16hooks.ISO_8601 = function () {};17
18// constant that refers to the RFC 2822 form19hooks.RFC_2822 = function () {};20
21// date from string and format string22export function configFromStringAndFormat(config) {23 // TODO: Move this to another part of the creation flow to prevent circular deps24 if (config._f === hooks.ISO_8601) {25 configFromISO(config);26 return;27 }28 if (config._f === hooks.RFC_2822) {29 configFromRFC2822(config);30 return;31 }32 config._a = [];33 getParsingFlags(config).empty = true;34
35 // This array is used to make a Date, either with `new Date` or `Date.UTC`36 var string = '' + config._i,37 i,38 parsedInput,39 tokens,40 token,41 skipped,42 stringLength = string.length,43 totalParsedInputLength = 0,44 era,45 tokenLen;46
47 tokens =48 expandFormat(config._f, config._locale).match(formattingTokens) || [];49 tokenLen = tokens.length;50 for (i = 0; i < tokenLen; i++) {51 token = tokens[i];52 parsedInput = (string.match(getParseRegexForToken(token, config)) ||53 [])[0];54 if (parsedInput) {55 skipped = string.substr(0, string.indexOf(parsedInput));56 if (skipped.length > 0) {57 getParsingFlags(config).unusedInput.push(skipped);58 }59 string = string.slice(60 string.indexOf(parsedInput) + parsedInput.length61 );62 totalParsedInputLength += parsedInput.length;63 }64 // don't parse if it's not a known token65 if (formatTokenFunctions[token]) {66 if (parsedInput) {67 getParsingFlags(config).empty = false;68 } else {69 getParsingFlags(config).unusedTokens.push(token);70 }71 addTimeToArrayFromToken(token, parsedInput, config);72 } else if (config._strict && !parsedInput) {73 getParsingFlags(config).unusedTokens.push(token);74 }75 }76
77 // add remaining unparsed input length to the string78 getParsingFlags(config).charsLeftOver =79 stringLength - totalParsedInputLength;80 if (string.length > 0) {81 getParsingFlags(config).unusedInput.push(string);82 }83
84 // clear _12h flag if hour is <= 1285 if (86 config._a[HOUR] <= 12 &&87 getParsingFlags(config).bigHour === true &&88 config._a[HOUR] > 089 ) {90 getParsingFlags(config).bigHour = undefined;91 }92
93 getParsingFlags(config).parsedDateParts = config._a.slice(0);94 getParsingFlags(config).meridiem = config._meridiem;95 // handle meridiem96 config._a[HOUR] = meridiemFixWrap(97 config._locale,98 config._a[HOUR],99 config._meridiem100 );101
102 // handle era103 era = getParsingFlags(config).era;104 if (era !== null) {105 config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);106 }107
108 configFromArray(config);109 checkOverflow(config);110}111
112function meridiemFixWrap(locale, hour, meridiem) {113 var isPm;114
115 if (meridiem == null) {116 // nothing to do117 return hour;118 }119 if (locale.meridiemHour != null) {120 return locale.meridiemHour(hour, meridiem);121 } else if (locale.isPM != null) {122 // Fallback123 isPm = locale.isPM(meridiem);124 if (isPm && hour < 12) {125 hour += 12;126 }127 if (!isPm && hour === 12) {128 hour = 0;129 }130 return hour;131 } else {132 // this is not supposed to happen133 return hour;134 }135}M /sublimated/undefined +0 -0
M /sublimated/undefined +0 -0
M /sublimated/undefined +0 -0
M /sublimated/undefined +0 -0
A /sublimated/undefined +258 -0
1import { configFromStringAndFormat } from './from-string-and-format';2import { createUTCDate } from './date-from-array';3import { hooks } from '../utils/hooks';4import { deprecate } from '../utils/deprecate';5import getParsingFlags from './parsing-flags';6import { defaultLocaleMonthsShort } from '../units/month';7import { defaultLocaleWeekdaysShort } from '../units/day-of-week';8
9// iso 8601 regex10// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)11var extendedIsoRegex =12 /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,13 basicIsoRegex =14 /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,15 tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,16 isoDates = [17 ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],18 ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],19 ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],20 ['GGGG-[W]WW', /\d{4}-W\d\d/, false],21 ['YYYY-DDD', /\d{4}-\d{3}/],22 ['YYYY-MM', /\d{4}-\d\d/, false],23 ['YYYYYYMMDD', /[+-]\d{10}/],24 ['YYYYMMDD', /\d{8}/],25 ['GGGG[W]WWE', /\d{4}W\d{3}/],26 ['GGGG[W]WW', /\d{4}W\d{2}/, false],27 ['YYYYDDD', /\d{7}/],28 ['YYYYMM', /\d{6}/, false],29 ['YYYY', /\d{4}/, false],30 ],31 // iso time formats and regexes32 isoTimes = [33 ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],34 ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],35 ['HH:mm:ss', /\d\d:\d\d:\d\d/],36 ['HH:mm', /\d\d:\d\d/],37 ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],38 ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],39 ['HHmmss', /\d\d\d\d\d\d/],40 ['HHmm', /\d\d\d\d/],41 ['HH', /\d\d/],42 ],43 aspNetJsonRegex = /^\/?Date\((-?\d+)/i,44 // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.345 rfc2822 =46 /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,47 obsOffsets = {48 UT: 0,49 GMT: 0,50 EDT: -4 * 60,51 EST: -5 * 60,52 CDT: -5 * 60,53 CST: -6 * 60,54 MDT: -6 * 60,55 MST: -7 * 60,56 PDT: -7 * 60,57 PST: -8 * 60,58 };59
60// date from iso format61export function configFromISO(config) {62 var i,63 l,64 string = config._i,65 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),66 allowTime,67 dateFormat,68 timeFormat,69 tzFormat,70 isoDatesLen = isoDates.length,71 isoTimesLen = isoTimes.length;72
73 if (match) {74 getParsingFlags(config).iso = true;75 for (i = 0, l = isoDatesLen; i < l; i++) {76 if (isoDates[i][1].exec(match[1])) {77 dateFormat = isoDates[i][0];78 allowTime = isoDates[i][2] !== false;79 break;80 }81 }82 if (dateFormat == null) {83 config._isValid = false;84 return;85 }86 if (match[3]) {87 for (i = 0, l = isoTimesLen; i < l; i++) {88 if (isoTimes[i][1].exec(match[3])) {89 // match[2] should be 'T' or space90 timeFormat = (match[2] || ' ') + isoTimes[i][0];91 break;92 }93 }94 if (timeFormat == null) {95 config._isValid = false;96 return;97 }98 }99 if (!allowTime && timeFormat != null) {100 config._isValid = false;101 return;102 }103 if (match[4]) {104 if (tzRegex.exec(match[4])) {105 tzFormat = 'Z';106 } else {107 config._isValid = false;108 return;109 }110 }111 config._f = dateFormat + (timeFormat || '') + (tzFormat || '');112 configFromStringAndFormat(config);113 } else {114 config._isValid = false;115 }116}117
118function extractFromRFC2822Strings(119 yearStr,120 monthStr,121 dayStr,122 hourStr,123 minuteStr,124 secondStr125) {126 var result = [127 untruncateYear(yearStr),128 defaultLocaleMonthsShort.indexOf(monthStr),129 parseInt(dayStr, 10),130 parseInt(hourStr, 10),131 parseInt(minuteStr, 10),132 ];133
134 if (secondStr) {135 result.push(parseInt(secondStr, 10));136 }137
138 return result;139}140
141function untruncateYear(yearStr) {142 var year = parseInt(yearStr, 10);143 if (year <= 49) {144 return 2000 + year;145 } else if (year <= 999) {146 return 1900 + year;147 }148 return year;149}150
151function preprocessRFC2822(s) {152 // Remove comments and folding whitespace and replace multiple-spaces with a single space153 return s154 .replace(/\([^()]*\)|[\n\t]/g, ' ')155 .replace(/(\s\s+)/g, ' ')156 .replace(/^\s\s*/, '')157 .replace(/\s\s*$/, '');158}159
160function checkWeekday(weekdayStr, parsedInput, config) {161 if (weekdayStr) {162 // TODO: Replace the vanilla JS Date object with an independent day-of-week check.163 var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),164 weekdayActual = new Date(165 parsedInput[0],166 parsedInput[1],167 parsedInput[2]168 ).getDay();169 if (weekdayProvided !== weekdayActual) {170 getParsingFlags(config).weekdayMismatch = true;171 config._isValid = false;172 return false;173 }174 }175 return true;176}177
178function calculateOffset(obsOffset, militaryOffset, numOffset) {179 if (obsOffset) {180 return obsOffsets[obsOffset];181 } else if (militaryOffset) {182 // the only allowed military tz is Z183 return 0;184 } else {185 var hm = parseInt(numOffset, 10),186 m = hm % 100,187 h = (hm - m) / 100;188 return h * 60 + m;189 }190}191
192// date and time from ref 2822 format193export function configFromRFC2822(config) {194 var match = rfc2822.exec(preprocessRFC2822(config._i)),195 parsedArray;196 if (match) {197 parsedArray = extractFromRFC2822Strings(198 match[4],199 match[3],200 match[2],201 match[5],202 match[6],203 match[7]204 );205 if (!checkWeekday(match[1], parsedArray, config)) {206 return;207 }208
209 config._a = parsedArray;210 config._tzm = calculateOffset(match[8], match[9], match[10]);211
212 config._d = createUTCDate.apply(null, config._a);213 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);214
215 getParsingFlags(config).rfc2822 = true;216 } else {217 config._isValid = false;218 }219}220
221// date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict222export function configFromString(config) {223 var matched = aspNetJsonRegex.exec(config._i);224 if (matched !== null) {225 config._d = new Date(+matched[1]);226 return;227 }228
229 configFromISO(config);230 if (config._isValid === false) {231 delete config._isValid;232 } else {233 return;234 }235
236 configFromRFC2822(config);237 if (config._isValid === false) {238 delete config._isValid;239 } else {240 return;241 }242
243 if (config._strict) {244 config._isValid = false;245 } else {246 // Final attempt, use Input Fallback247 hooks.createFromInputFallback(config);248 }249}250
251hooks.createFromInputFallback = deprecate(252 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +253 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +254 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',255 function (config) {256 config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));257 }258);A /sublimated/undefined +36 -0
1import hasOwnProp from '../utils/has-own-prop';2import isNumber from '../utils/is-number';3import toInt from '../utils/to-int';4
5var tokens = {};6
7export function addParseToken(token, callback) {8 var i,9 func = callback,10 tokenLen;11 if (typeof token === 'string') {12 token = [token];13 }14 if (isNumber(callback)) {15 func = function (input, array) {16 array[callback] = toInt(input);17 };18 }19 tokenLen = token.length;20 for (i = 0; i < tokenLen; i++) {21 tokens[token[i]] = func;22 }23}24
25export function addWeekParseToken(token, callback) {26 addParseToken(token, function (input, array, config, token) {27 config._w = config._w || {};28 callback(input, config._w, config, token);29 });30}31
32export function addTimeToArrayFromToken(token, input, config) {33 if (input != null && hasOwnProp(tokens, token)) {34 tokens[token](input, config._a, config, token);35 }36}A /sublimated/undefined +117 -0
1import isArray from '../utils/is-array';2import isObject from '../utils/is-object';3import isObjectEmpty from '../utils/is-object-empty';4import isUndefined from '../utils/is-undefined';5import isNumber from '../utils/is-number';6import isDate from '../utils/is-date';7import map from '../utils/map';8import { createInvalid } from './valid';9import { Moment, isMoment } from '../moment/constructor';10import { getLocale } from '../locale/locales';11import { hooks } from '../utils/hooks';12import checkOverflow from './check-overflow';13import { isValid } from './valid';14
15import { configFromStringAndArray } from './from-string-and-array';16import { configFromStringAndFormat } from './from-string-and-format';17import { configFromString } from './from-string';18import { configFromArray } from './from-array';19import { configFromObject } from './from-object';20
21function createFromConfig(config) {22 var res = new Moment(checkOverflow(prepareConfig(config)));23 if (res._nextDay) {24 // Adding is smart enough around DST25 res.add(1, 'd');26 res._nextDay = undefined;27 }28
29 return res;30}31
32export function prepareConfig(config) {33 var input = config._i,34 format = config._f;35
36 config._locale = config._locale || getLocale(config._l);37
38 if (input === null || (format === undefined && input === '')) {39 return createInvalid({ nullInput: true });40 }41
42 if (typeof input === 'string') {43 config._i = input = config._locale.preparse(input);44 }45
46 if (isMoment(input)) {47 return new Moment(checkOverflow(input));48 } else if (isDate(input)) {49 config._d = input;50 } else if (isArray(format)) {51 configFromStringAndArray(config);52 } else if (format) {53 configFromStringAndFormat(config);54 } else {55 configFromInput(config);56 }57
58 if (!isValid(config)) {59 config._d = null;60 }61
62 return config;63}64
65function configFromInput(config) {66 var input = config._i;67 if (isUndefined(input)) {68 config._d = new Date(hooks.now());69 } else if (isDate(input)) {70 config._d = new Date(input.valueOf());71 } else if (typeof input === 'string') {72 configFromString(config);73 } else if (isArray(input)) {74 config._a = map(input.slice(0), function (obj) {75 return parseInt(obj, 10);76 });77 configFromArray(config);78 } else if (isObject(input)) {79 configFromObject(config);80 } else if (isNumber(input)) {81 // from milliseconds82 config._d = new Date(input);83 } else {84 hooks.createFromInputFallback(config);85 }86}87
88export function createLocalOrUTC(input, format, locale, strict, isUTC) {89 var c = {};90
91 if (format === true || format === false) {92 strict = format;93 format = undefined;94 }95
96 if (locale === true || locale === false) {97 strict = locale;98 locale = undefined;99 }100
101 if (102 (isObject(input) && isObjectEmpty(input)) ||103 (isArray(input) && input.length === 0)104 ) {105 input = undefined;106 }107 // object construction must be done this way.108 // https://github.com/moment/moment/issues/1423109 c._isAMomentObject = true;110 c._useUTC = c._isUTC = isUTC;111 c._l = locale;112 c._i = input;113 c._f = format;114 c._strict = strict;115
116 return createFromConfig(c);117}M /sublimated/undefined +0 -0
A /sublimated/undefined +3 -0
1# esbuild2
3This is the macOS ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.A /sublimated/undefined +20 -0
1{2 "name": "@esbuild/darwin-arm64",3 "version": "0.25.12",4 "description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.",5 "repository": {6 "type": "git",7 "url": "git+https://github.com/evanw/esbuild.git"8 },9 "license": "MIT",10 "preferUnplugged": true,11 "engines": {12 "node": ">=18"13 },14 "os": [15 "darwin"16 ],17 "cpu": [18 "arm64"19 ]20}M /sublimated/undefined +0 -0
A /sublimated/undefined +80 -0
1var match1 = /\d/, // 0 - 92 match2 = /\d\d/, // 00 - 993 match3 = /\d{3}/, // 000 - 9994 match4 = /\d{4}/, // 0000 - 99995 match6 = /[+-]?\d{6}/, // -999999 - 9999996 match1to2 = /\d\d?/, // 0 - 997 match3to4 = /\d\d\d\d?/, // 999 - 99998 match5to6 = /\d\d\d\d\d\d?/, // 99999 - 9999999 match1to3 = /\d{1,3}/, // 0 - 99910 match1to4 = /\d{1,4}/, // 0 - 999911 match1to6 = /[+-]?\d{1,6}/, // -999999 - 99999912 matchUnsigned = /\d+/, // 0 - inf13 matchSigned = /[+-]?\d+/, // -inf - inf14 matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z15 matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z16 matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.12317 // any word (or two) characters or numbers including two/three word month in arabic.18 // includes scottish gaelic two word and hyphenated months19 matchWord =20 /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,21 regexes;22
23export {24 match1,25 match2,26 match3,27 match4,28 match6,29 match1to2,30 match3to4,31 match5to6,32 match1to3,33 match1to4,34 match1to6,35 matchUnsigned,36 matchSigned,37 matchOffset,38 matchShortOffset,39 matchTimestamp,40 matchWord,41};42
43import hasOwnProp from '../utils/has-own-prop';44import isFunction from '../utils/is-function';45
46regexes = {};47
48export function addRegexToken(token, regex, strictRegex) {49 regexes[token] = isFunction(regex)50 ? regex51 : function (isStrict, localeData) {52 return isStrict && strictRegex ? strictRegex : regex;53 };54}55
56export function getParseRegexForToken(token, config) {57 if (!hasOwnProp(regexes, token)) {58 return new RegExp(unescapeFormat(token));59 }60
61 return regexes[token](config._strict, config._locale);62}63
64// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript65function unescapeFormat(s) {66 return regexEscape(67 s68 .replace('\\', '')69 .replace(70 /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,71 function (matched, p1, p2, p3, p4) {72 return p1 || p2 || p3 || p4;73 }74 )75 );76}77
78export function regexEscape(s) {79 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');80}