moment.js 120 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070
  1. import {
  2. __require
  3. } from "./chunk-WFTEJBJX.js";
  4. // node_modules/moment/dist/moment.js
  5. var hookCallback;
  6. function hooks() {
  7. return hookCallback.apply(null, arguments);
  8. }
  9. function setHookCallback(callback) {
  10. hookCallback = callback;
  11. }
  12. function isArray(input) {
  13. return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]";
  14. }
  15. function isObject(input) {
  16. return input != null && Object.prototype.toString.call(input) === "[object Object]";
  17. }
  18. function hasOwnProp(a, b) {
  19. return Object.prototype.hasOwnProperty.call(a, b);
  20. }
  21. function isObjectEmpty(obj) {
  22. if (Object.getOwnPropertyNames) {
  23. return Object.getOwnPropertyNames(obj).length === 0;
  24. } else {
  25. var k;
  26. for (k in obj) {
  27. if (hasOwnProp(obj, k)) {
  28. return false;
  29. }
  30. }
  31. return true;
  32. }
  33. }
  34. function isUndefined(input) {
  35. return input === void 0;
  36. }
  37. function isNumber(input) {
  38. return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]";
  39. }
  40. function isDate(input) {
  41. return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
  42. }
  43. function map(arr, fn) {
  44. var res = [], i, arrLen = arr.length;
  45. for (i = 0; i < arrLen; ++i) {
  46. res.push(fn(arr[i], i));
  47. }
  48. return res;
  49. }
  50. function extend(a, b) {
  51. for (var i in b) {
  52. if (hasOwnProp(b, i)) {
  53. a[i] = b[i];
  54. }
  55. }
  56. if (hasOwnProp(b, "toString")) {
  57. a.toString = b.toString;
  58. }
  59. if (hasOwnProp(b, "valueOf")) {
  60. a.valueOf = b.valueOf;
  61. }
  62. return a;
  63. }
  64. function createUTC(input, format2, locale2, strict) {
  65. return createLocalOrUTC(input, format2, locale2, strict, true).utc();
  66. }
  67. function defaultParsingFlags() {
  68. return {
  69. empty: false,
  70. unusedTokens: [],
  71. unusedInput: [],
  72. overflow: -2,
  73. charsLeftOver: 0,
  74. nullInput: false,
  75. invalidEra: null,
  76. invalidMonth: null,
  77. invalidFormat: false,
  78. userInvalidated: false,
  79. iso: false,
  80. parsedDateParts: [],
  81. era: null,
  82. meridiem: null,
  83. rfc2822: false,
  84. weekdayMismatch: false
  85. };
  86. }
  87. function getParsingFlags(m) {
  88. if (m._pf == null) {
  89. m._pf = defaultParsingFlags();
  90. }
  91. return m._pf;
  92. }
  93. var some;
  94. if (Array.prototype.some) {
  95. some = Array.prototype.some;
  96. } else {
  97. some = function(fun) {
  98. var t = Object(this), len = t.length >>> 0, i;
  99. for (i = 0; i < len; i++) {
  100. if (i in t && fun.call(this, t[i], i, t)) {
  101. return true;
  102. }
  103. }
  104. return false;
  105. };
  106. }
  107. function isValid(m) {
  108. var flags = null, parsedParts = false, isNowValid = m._d && !isNaN(m._d.getTime());
  109. if (isNowValid) {
  110. flags = getParsingFlags(m);
  111. parsedParts = some.call(flags.parsedDateParts, function(i) {
  112. return i != null;
  113. });
  114. isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
  115. if (m._strict) {
  116. isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
  117. }
  118. }
  119. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  120. m._isValid = isNowValid;
  121. } else {
  122. return isNowValid;
  123. }
  124. return m._isValid;
  125. }
  126. function createInvalid(flags) {
  127. var m = createUTC(NaN);
  128. if (flags != null) {
  129. extend(getParsingFlags(m), flags);
  130. } else {
  131. getParsingFlags(m).userInvalidated = true;
  132. }
  133. return m;
  134. }
  135. var momentProperties = hooks.momentProperties = [];
  136. var updateInProgress = false;
  137. function copyConfig(to2, from2) {
  138. var i, prop, val, momentPropertiesLen = momentProperties.length;
  139. if (!isUndefined(from2._isAMomentObject)) {
  140. to2._isAMomentObject = from2._isAMomentObject;
  141. }
  142. if (!isUndefined(from2._i)) {
  143. to2._i = from2._i;
  144. }
  145. if (!isUndefined(from2._f)) {
  146. to2._f = from2._f;
  147. }
  148. if (!isUndefined(from2._l)) {
  149. to2._l = from2._l;
  150. }
  151. if (!isUndefined(from2._strict)) {
  152. to2._strict = from2._strict;
  153. }
  154. if (!isUndefined(from2._tzm)) {
  155. to2._tzm = from2._tzm;
  156. }
  157. if (!isUndefined(from2._isUTC)) {
  158. to2._isUTC = from2._isUTC;
  159. }
  160. if (!isUndefined(from2._offset)) {
  161. to2._offset = from2._offset;
  162. }
  163. if (!isUndefined(from2._pf)) {
  164. to2._pf = getParsingFlags(from2);
  165. }
  166. if (!isUndefined(from2._locale)) {
  167. to2._locale = from2._locale;
  168. }
  169. if (momentPropertiesLen > 0) {
  170. for (i = 0; i < momentPropertiesLen; i++) {
  171. prop = momentProperties[i];
  172. val = from2[prop];
  173. if (!isUndefined(val)) {
  174. to2[prop] = val;
  175. }
  176. }
  177. }
  178. return to2;
  179. }
  180. function Moment(config) {
  181. copyConfig(this, config);
  182. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  183. if (!this.isValid()) {
  184. this._d = /* @__PURE__ */ new Date(NaN);
  185. }
  186. if (updateInProgress === false) {
  187. updateInProgress = true;
  188. hooks.updateOffset(this);
  189. updateInProgress = false;
  190. }
  191. }
  192. function isMoment(obj) {
  193. return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
  194. }
  195. function warn(msg) {
  196. if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
  197. console.warn("Deprecation warning: " + msg);
  198. }
  199. }
  200. function deprecate(msg, fn) {
  201. var firstTime = true;
  202. return extend(function() {
  203. if (hooks.deprecationHandler != null) {
  204. hooks.deprecationHandler(null, msg);
  205. }
  206. if (firstTime) {
  207. var args = [], arg, i, key, argLen = arguments.length;
  208. for (i = 0; i < argLen; i++) {
  209. arg = "";
  210. if (typeof arguments[i] === "object") {
  211. arg += "\n[" + i + "] ";
  212. for (key in arguments[0]) {
  213. if (hasOwnProp(arguments[0], key)) {
  214. arg += key + ": " + arguments[0][key] + ", ";
  215. }
  216. }
  217. arg = arg.slice(0, -2);
  218. } else {
  219. arg = arguments[i];
  220. }
  221. args.push(arg);
  222. }
  223. warn(
  224. msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack
  225. );
  226. firstTime = false;
  227. }
  228. return fn.apply(this, arguments);
  229. }, fn);
  230. }
  231. var deprecations = {};
  232. function deprecateSimple(name, msg) {
  233. if (hooks.deprecationHandler != null) {
  234. hooks.deprecationHandler(name, msg);
  235. }
  236. if (!deprecations[name]) {
  237. warn(msg);
  238. deprecations[name] = true;
  239. }
  240. }
  241. hooks.suppressDeprecationWarnings = false;
  242. hooks.deprecationHandler = null;
  243. function isFunction(input) {
  244. return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]";
  245. }
  246. function set(config) {
  247. var prop, i;
  248. for (i in config) {
  249. if (hasOwnProp(config, i)) {
  250. prop = config[i];
  251. if (isFunction(prop)) {
  252. this[i] = prop;
  253. } else {
  254. this["_" + i] = prop;
  255. }
  256. }
  257. }
  258. this._config = config;
  259. this._dayOfMonthOrdinalParseLenient = new RegExp(
  260. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
  261. );
  262. }
  263. function mergeConfigs(parentConfig, childConfig) {
  264. var res = extend({}, parentConfig), prop;
  265. for (prop in childConfig) {
  266. if (hasOwnProp(childConfig, prop)) {
  267. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  268. res[prop] = {};
  269. extend(res[prop], parentConfig[prop]);
  270. extend(res[prop], childConfig[prop]);
  271. } else if (childConfig[prop] != null) {
  272. res[prop] = childConfig[prop];
  273. } else {
  274. delete res[prop];
  275. }
  276. }
  277. }
  278. for (prop in parentConfig) {
  279. if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
  280. res[prop] = extend({}, res[prop]);
  281. }
  282. }
  283. return res;
  284. }
  285. function Locale(config) {
  286. if (config != null) {
  287. this.set(config);
  288. }
  289. }
  290. var keys;
  291. if (Object.keys) {
  292. keys = Object.keys;
  293. } else {
  294. keys = function(obj) {
  295. var i, res = [];
  296. for (i in obj) {
  297. if (hasOwnProp(obj, i)) {
  298. res.push(i);
  299. }
  300. }
  301. return res;
  302. };
  303. }
  304. var defaultCalendar = {
  305. sameDay: "[Today at] LT",
  306. nextDay: "[Tomorrow at] LT",
  307. nextWeek: "dddd [at] LT",
  308. lastDay: "[Yesterday at] LT",
  309. lastWeek: "[Last] dddd [at] LT",
  310. sameElse: "L"
  311. };
  312. function calendar(key, mom, now2) {
  313. var output = this._calendar[key] || this._calendar["sameElse"];
  314. return isFunction(output) ? output.call(mom, now2) : output;
  315. }
  316. function zeroFill(number, targetLength, forceSign) {
  317. var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign2 = number >= 0;
  318. return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  319. }
  320. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
  321. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  322. var formatFunctions = {};
  323. var formatTokenFunctions = {};
  324. function addFormatToken(token2, padded, ordinal2, callback) {
  325. var func = callback;
  326. if (typeof callback === "string") {
  327. func = function() {
  328. return this[callback]();
  329. };
  330. }
  331. if (token2) {
  332. formatTokenFunctions[token2] = func;
  333. }
  334. if (padded) {
  335. formatTokenFunctions[padded[0]] = function() {
  336. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  337. };
  338. }
  339. if (ordinal2) {
  340. formatTokenFunctions[ordinal2] = function() {
  341. return this.localeData().ordinal(
  342. func.apply(this, arguments),
  343. token2
  344. );
  345. };
  346. }
  347. }
  348. function removeFormattingTokens(input) {
  349. if (input.match(/\[[\s\S]/)) {
  350. return input.replace(/^\[|\]$/g, "");
  351. }
  352. return input.replace(/\\/g, "");
  353. }
  354. function makeFormatFunction(format2) {
  355. var array = format2.match(formattingTokens), i, length;
  356. for (i = 0, length = array.length; i < length; i++) {
  357. if (formatTokenFunctions[array[i]]) {
  358. array[i] = formatTokenFunctions[array[i]];
  359. } else {
  360. array[i] = removeFormattingTokens(array[i]);
  361. }
  362. }
  363. return function(mom) {
  364. var output = "", i2;
  365. for (i2 = 0; i2 < length; i2++) {
  366. output += isFunction(array[i2]) ? array[i2].call(mom, format2) : array[i2];
  367. }
  368. return output;
  369. };
  370. }
  371. function formatMoment(m, format2) {
  372. if (!m.isValid()) {
  373. return m.localeData().invalidDate();
  374. }
  375. format2 = expandFormat(format2, m.localeData());
  376. formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2);
  377. return formatFunctions[format2](m);
  378. }
  379. function expandFormat(format2, locale2) {
  380. var i = 5;
  381. function replaceLongDateFormatTokens(input) {
  382. return locale2.longDateFormat(input) || input;
  383. }
  384. localFormattingTokens.lastIndex = 0;
  385. while (i >= 0 && localFormattingTokens.test(format2)) {
  386. format2 = format2.replace(
  387. localFormattingTokens,
  388. replaceLongDateFormatTokens
  389. );
  390. localFormattingTokens.lastIndex = 0;
  391. i -= 1;
  392. }
  393. return format2;
  394. }
  395. var defaultLongDateFormat = {
  396. LTS: "h:mm:ss A",
  397. LT: "h:mm A",
  398. L: "MM/DD/YYYY",
  399. LL: "MMMM D, YYYY",
  400. LLL: "MMMM D, YYYY h:mm A",
  401. LLLL: "dddd, MMMM D, YYYY h:mm A"
  402. };
  403. function longDateFormat(key) {
  404. var format2 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
  405. if (format2 || !formatUpper) {
  406. return format2;
  407. }
  408. this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function(tok) {
  409. if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
  410. return tok.slice(1);
  411. }
  412. return tok;
  413. }).join("");
  414. return this._longDateFormat[key];
  415. }
  416. var defaultInvalidDate = "Invalid date";
  417. function invalidDate() {
  418. return this._invalidDate;
  419. }
  420. var defaultOrdinal = "%d";
  421. var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  422. function ordinal(number) {
  423. return this._ordinal.replace("%d", number);
  424. }
  425. var defaultRelativeTime = {
  426. future: "in %s",
  427. past: "%s ago",
  428. s: "a few seconds",
  429. ss: "%d seconds",
  430. m: "a minute",
  431. mm: "%d minutes",
  432. h: "an hour",
  433. hh: "%d hours",
  434. d: "a day",
  435. dd: "%d days",
  436. w: "a week",
  437. ww: "%d weeks",
  438. M: "a month",
  439. MM: "%d months",
  440. y: "a year",
  441. yy: "%d years"
  442. };
  443. function relativeTime(number, withoutSuffix, string, isFuture) {
  444. var output = this._relativeTime[string];
  445. return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
  446. }
  447. function pastFuture(diff2, output) {
  448. var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
  449. return isFunction(format2) ? format2(output) : format2.replace(/%s/i, output);
  450. }
  451. var aliases = {
  452. D: "date",
  453. dates: "date",
  454. date: "date",
  455. d: "day",
  456. days: "day",
  457. day: "day",
  458. e: "weekday",
  459. weekdays: "weekday",
  460. weekday: "weekday",
  461. E: "isoWeekday",
  462. isoweekdays: "isoWeekday",
  463. isoweekday: "isoWeekday",
  464. DDD: "dayOfYear",
  465. dayofyears: "dayOfYear",
  466. dayofyear: "dayOfYear",
  467. h: "hour",
  468. hours: "hour",
  469. hour: "hour",
  470. ms: "millisecond",
  471. milliseconds: "millisecond",
  472. millisecond: "millisecond",
  473. m: "minute",
  474. minutes: "minute",
  475. minute: "minute",
  476. M: "month",
  477. months: "month",
  478. month: "month",
  479. Q: "quarter",
  480. quarters: "quarter",
  481. quarter: "quarter",
  482. s: "second",
  483. seconds: "second",
  484. second: "second",
  485. gg: "weekYear",
  486. weekyears: "weekYear",
  487. weekyear: "weekYear",
  488. GG: "isoWeekYear",
  489. isoweekyears: "isoWeekYear",
  490. isoweekyear: "isoWeekYear",
  491. w: "week",
  492. weeks: "week",
  493. week: "week",
  494. W: "isoWeek",
  495. isoweeks: "isoWeek",
  496. isoweek: "isoWeek",
  497. y: "year",
  498. years: "year",
  499. year: "year"
  500. };
  501. function normalizeUnits(units) {
  502. return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
  503. }
  504. function normalizeObjectUnits(inputObject) {
  505. var normalizedInput = {}, normalizedProp, prop;
  506. for (prop in inputObject) {
  507. if (hasOwnProp(inputObject, prop)) {
  508. normalizedProp = normalizeUnits(prop);
  509. if (normalizedProp) {
  510. normalizedInput[normalizedProp] = inputObject[prop];
  511. }
  512. }
  513. }
  514. return normalizedInput;
  515. }
  516. var priorities = {
  517. date: 9,
  518. day: 11,
  519. weekday: 11,
  520. isoWeekday: 11,
  521. dayOfYear: 4,
  522. hour: 13,
  523. millisecond: 16,
  524. minute: 14,
  525. month: 8,
  526. quarter: 7,
  527. second: 15,
  528. weekYear: 1,
  529. isoWeekYear: 1,
  530. week: 5,
  531. isoWeek: 5,
  532. year: 1
  533. };
  534. function getPrioritizedUnits(unitsObj) {
  535. var units = [], u;
  536. for (u in unitsObj) {
  537. if (hasOwnProp(unitsObj, u)) {
  538. units.push({ unit: u, priority: priorities[u] });
  539. }
  540. }
  541. units.sort(function(a, b) {
  542. return a.priority - b.priority;
  543. });
  544. return units;
  545. }
  546. var match1 = /\d/;
  547. var match2 = /\d\d/;
  548. var match3 = /\d{3}/;
  549. var match4 = /\d{4}/;
  550. var match6 = /[+-]?\d{6}/;
  551. var match1to2 = /\d\d?/;
  552. var match3to4 = /\d\d\d\d?/;
  553. var match5to6 = /\d\d\d\d\d\d?/;
  554. var match1to3 = /\d{1,3}/;
  555. var match1to4 = /\d{1,4}/;
  556. var match1to6 = /[+-]?\d{1,6}/;
  557. var matchUnsigned = /\d+/;
  558. var matchSigned = /[+-]?\d+/;
  559. var matchOffset = /Z|[+-]\d\d:?\d\d/gi;
  560. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi;
  561. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/;
  562. var matchWord = /[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;
  563. var match1to2NoLeadingZero = /^[1-9]\d?/;
  564. var match1to2HasZero = /^([1-9]\d|\d)/;
  565. var regexes;
  566. regexes = {};
  567. function addRegexToken(token2, regex, strictRegex) {
  568. regexes[token2] = isFunction(regex) ? regex : function(isStrict, localeData2) {
  569. return isStrict && strictRegex ? strictRegex : regex;
  570. };
  571. }
  572. function getParseRegexForToken(token2, config) {
  573. if (!hasOwnProp(regexes, token2)) {
  574. return new RegExp(unescapeFormat(token2));
  575. }
  576. return regexes[token2](config._strict, config._locale);
  577. }
  578. function unescapeFormat(s) {
  579. return regexEscape(
  580. s.replace("\\", "").replace(
  581. /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
  582. function(matched, p1, p2, p3, p4) {
  583. return p1 || p2 || p3 || p4;
  584. }
  585. )
  586. );
  587. }
  588. function regexEscape(s) {
  589. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
  590. }
  591. function absFloor(number) {
  592. if (number < 0) {
  593. return Math.ceil(number) || 0;
  594. } else {
  595. return Math.floor(number);
  596. }
  597. }
  598. function toInt(argumentForCoercion) {
  599. var coercedNumber = +argumentForCoercion, value = 0;
  600. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  601. value = absFloor(coercedNumber);
  602. }
  603. return value;
  604. }
  605. var tokens = {};
  606. function addParseToken(token2, callback) {
  607. var i, func = callback, tokenLen;
  608. if (typeof token2 === "string") {
  609. token2 = [token2];
  610. }
  611. if (isNumber(callback)) {
  612. func = function(input, array) {
  613. array[callback] = toInt(input);
  614. };
  615. }
  616. tokenLen = token2.length;
  617. for (i = 0; i < tokenLen; i++) {
  618. tokens[token2[i]] = func;
  619. }
  620. }
  621. function addWeekParseToken(token2, callback) {
  622. addParseToken(token2, function(input, array, config, token3) {
  623. config._w = config._w || {};
  624. callback(input, config._w, config, token3);
  625. });
  626. }
  627. function addTimeToArrayFromToken(token2, input, config) {
  628. if (input != null && hasOwnProp(tokens, token2)) {
  629. tokens[token2](input, config._a, config, token2);
  630. }
  631. }
  632. function isLeapYear(year) {
  633. return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
  634. }
  635. var YEAR = 0;
  636. var MONTH = 1;
  637. var DATE = 2;
  638. var HOUR = 3;
  639. var MINUTE = 4;
  640. var SECOND = 5;
  641. var MILLISECOND = 6;
  642. var WEEK = 7;
  643. var WEEKDAY = 8;
  644. addFormatToken("Y", 0, 0, function() {
  645. var y = this.year();
  646. return y <= 9999 ? zeroFill(y, 4) : "+" + y;
  647. });
  648. addFormatToken(0, ["YY", 2], 0, function() {
  649. return this.year() % 100;
  650. });
  651. addFormatToken(0, ["YYYY", 4], 0, "year");
  652. addFormatToken(0, ["YYYYY", 5], 0, "year");
  653. addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
  654. addRegexToken("Y", matchSigned);
  655. addRegexToken("YY", match1to2, match2);
  656. addRegexToken("YYYY", match1to4, match4);
  657. addRegexToken("YYYYY", match1to6, match6);
  658. addRegexToken("YYYYYY", match1to6, match6);
  659. addParseToken(["YYYYY", "YYYYYY"], YEAR);
  660. addParseToken("YYYY", function(input, array) {
  661. array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  662. });
  663. addParseToken("YY", function(input, array) {
  664. array[YEAR] = hooks.parseTwoDigitYear(input);
  665. });
  666. addParseToken("Y", function(input, array) {
  667. array[YEAR] = parseInt(input, 10);
  668. });
  669. function daysInYear(year) {
  670. return isLeapYear(year) ? 366 : 365;
  671. }
  672. hooks.parseTwoDigitYear = function(input) {
  673. return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
  674. };
  675. var getSetYear = makeGetSet("FullYear", true);
  676. function getIsLeapYear() {
  677. return isLeapYear(this.year());
  678. }
  679. function makeGetSet(unit, keepTime) {
  680. return function(value) {
  681. if (value != null) {
  682. set$1(this, unit, value);
  683. hooks.updateOffset(this, keepTime);
  684. return this;
  685. } else {
  686. return get(this, unit);
  687. }
  688. };
  689. }
  690. function get(mom, unit) {
  691. if (!mom.isValid()) {
  692. return NaN;
  693. }
  694. var d = mom._d, isUTC = mom._isUTC;
  695. switch (unit) {
  696. case "Milliseconds":
  697. return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
  698. case "Seconds":
  699. return isUTC ? d.getUTCSeconds() : d.getSeconds();
  700. case "Minutes":
  701. return isUTC ? d.getUTCMinutes() : d.getMinutes();
  702. case "Hours":
  703. return isUTC ? d.getUTCHours() : d.getHours();
  704. case "Date":
  705. return isUTC ? d.getUTCDate() : d.getDate();
  706. case "Day":
  707. return isUTC ? d.getUTCDay() : d.getDay();
  708. case "Month":
  709. return isUTC ? d.getUTCMonth() : d.getMonth();
  710. case "FullYear":
  711. return isUTC ? d.getUTCFullYear() : d.getFullYear();
  712. default:
  713. return NaN;
  714. }
  715. }
  716. function set$1(mom, unit, value) {
  717. var d, isUTC, year, month, date;
  718. if (!mom.isValid() || isNaN(value)) {
  719. return;
  720. }
  721. d = mom._d;
  722. isUTC = mom._isUTC;
  723. switch (unit) {
  724. case "Milliseconds":
  725. return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value));
  726. case "Seconds":
  727. return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
  728. case "Minutes":
  729. return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
  730. case "Hours":
  731. return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
  732. case "Date":
  733. return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
  734. case "FullYear":
  735. break;
  736. default:
  737. return;
  738. }
  739. year = value;
  740. month = mom.month();
  741. date = mom.date();
  742. date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
  743. void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
  744. }
  745. function stringGet(units) {
  746. units = normalizeUnits(units);
  747. if (isFunction(this[units])) {
  748. return this[units]();
  749. }
  750. return this;
  751. }
  752. function stringSet(units, value) {
  753. if (typeof units === "object") {
  754. units = normalizeObjectUnits(units);
  755. var prioritized = getPrioritizedUnits(units), i, prioritizedLen = prioritized.length;
  756. for (i = 0; i < prioritizedLen; i++) {
  757. this[prioritized[i].unit](units[prioritized[i].unit]);
  758. }
  759. } else {
  760. units = normalizeUnits(units);
  761. if (isFunction(this[units])) {
  762. return this[units](value);
  763. }
  764. }
  765. return this;
  766. }
  767. function mod(n, x) {
  768. return (n % x + x) % x;
  769. }
  770. var indexOf;
  771. if (Array.prototype.indexOf) {
  772. indexOf = Array.prototype.indexOf;
  773. } else {
  774. indexOf = function(o) {
  775. var i;
  776. for (i = 0; i < this.length; ++i) {
  777. if (this[i] === o) {
  778. return i;
  779. }
  780. }
  781. return -1;
  782. };
  783. }
  784. function daysInMonth(year, month) {
  785. if (isNaN(year) || isNaN(month)) {
  786. return NaN;
  787. }
  788. var modMonth = mod(month, 12);
  789. year += (month - modMonth) / 12;
  790. return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
  791. }
  792. addFormatToken("M", ["MM", 2], "Mo", function() {
  793. return this.month() + 1;
  794. });
  795. addFormatToken("MMM", 0, 0, function(format2) {
  796. return this.localeData().monthsShort(this, format2);
  797. });
  798. addFormatToken("MMMM", 0, 0, function(format2) {
  799. return this.localeData().months(this, format2);
  800. });
  801. addRegexToken("M", match1to2, match1to2NoLeadingZero);
  802. addRegexToken("MM", match1to2, match2);
  803. addRegexToken("MMM", function(isStrict, locale2) {
  804. return locale2.monthsShortRegex(isStrict);
  805. });
  806. addRegexToken("MMMM", function(isStrict, locale2) {
  807. return locale2.monthsRegex(isStrict);
  808. });
  809. addParseToken(["M", "MM"], function(input, array) {
  810. array[MONTH] = toInt(input) - 1;
  811. });
  812. addParseToken(["MMM", "MMMM"], function(input, array, config, token2) {
  813. var month = config._locale.monthsParse(input, token2, config._strict);
  814. if (month != null) {
  815. array[MONTH] = month;
  816. } else {
  817. getParsingFlags(config).invalidMonth = input;
  818. }
  819. });
  820. var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split(
  821. "_"
  822. );
  823. var defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");
  824. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  825. var defaultMonthsShortRegex = matchWord;
  826. var defaultMonthsRegex = matchWord;
  827. function localeMonths(m, format2) {
  828. if (!m) {
  829. return isArray(this._months) ? this._months : this._months["standalone"];
  830. }
  831. return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format2) ? "format" : "standalone"][m.month()];
  832. }
  833. function localeMonthsShort(m, format2) {
  834. if (!m) {
  835. return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"];
  836. }
  837. return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m.month()];
  838. }
  839. function handleStrictParse(monthName, format2, strict) {
  840. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  841. if (!this._monthsParse) {
  842. this._monthsParse = [];
  843. this._longMonthsParse = [];
  844. this._shortMonthsParse = [];
  845. for (i = 0; i < 12; ++i) {
  846. mom = createUTC([2e3, i]);
  847. this._shortMonthsParse[i] = this.monthsShort(
  848. mom,
  849. ""
  850. ).toLocaleLowerCase();
  851. this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase();
  852. }
  853. }
  854. if (strict) {
  855. if (format2 === "MMM") {
  856. ii = indexOf.call(this._shortMonthsParse, llc);
  857. return ii !== -1 ? ii : null;
  858. } else {
  859. ii = indexOf.call(this._longMonthsParse, llc);
  860. return ii !== -1 ? ii : null;
  861. }
  862. } else {
  863. if (format2 === "MMM") {
  864. ii = indexOf.call(this._shortMonthsParse, llc);
  865. if (ii !== -1) {
  866. return ii;
  867. }
  868. ii = indexOf.call(this._longMonthsParse, llc);
  869. return ii !== -1 ? ii : null;
  870. } else {
  871. ii = indexOf.call(this._longMonthsParse, llc);
  872. if (ii !== -1) {
  873. return ii;
  874. }
  875. ii = indexOf.call(this._shortMonthsParse, llc);
  876. return ii !== -1 ? ii : null;
  877. }
  878. }
  879. }
  880. function localeMonthsParse(monthName, format2, strict) {
  881. var i, mom, regex;
  882. if (this._monthsParseExact) {
  883. return handleStrictParse.call(this, monthName, format2, strict);
  884. }
  885. if (!this._monthsParse) {
  886. this._monthsParse = [];
  887. this._longMonthsParse = [];
  888. this._shortMonthsParse = [];
  889. }
  890. for (i = 0; i < 12; i++) {
  891. mom = createUTC([2e3, i]);
  892. if (strict && !this._longMonthsParse[i]) {
  893. this._longMonthsParse[i] = new RegExp(
  894. "^" + this.months(mom, "").replace(".", "") + "$",
  895. "i"
  896. );
  897. this._shortMonthsParse[i] = new RegExp(
  898. "^" + this.monthsShort(mom, "").replace(".", "") + "$",
  899. "i"
  900. );
  901. }
  902. if (!strict && !this._monthsParse[i]) {
  903. regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
  904. this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i");
  905. }
  906. if (strict && format2 === "MMMM" && this._longMonthsParse[i].test(monthName)) {
  907. return i;
  908. } else if (strict && format2 === "MMM" && this._shortMonthsParse[i].test(monthName)) {
  909. return i;
  910. } else if (!strict && this._monthsParse[i].test(monthName)) {
  911. return i;
  912. }
  913. }
  914. }
  915. function setMonth(mom, value) {
  916. if (!mom.isValid()) {
  917. return mom;
  918. }
  919. if (typeof value === "string") {
  920. if (/^\d+$/.test(value)) {
  921. value = toInt(value);
  922. } else {
  923. value = mom.localeData().monthsParse(value);
  924. if (!isNumber(value)) {
  925. return mom;
  926. }
  927. }
  928. }
  929. var month = value, date = mom.date();
  930. date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
  931. void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
  932. return mom;
  933. }
  934. function getSetMonth(value) {
  935. if (value != null) {
  936. setMonth(this, value);
  937. hooks.updateOffset(this, true);
  938. return this;
  939. } else {
  940. return get(this, "Month");
  941. }
  942. }
  943. function getDaysInMonth() {
  944. return daysInMonth(this.year(), this.month());
  945. }
  946. function monthsShortRegex(isStrict) {
  947. if (this._monthsParseExact) {
  948. if (!hasOwnProp(this, "_monthsRegex")) {
  949. computeMonthsParse.call(this);
  950. }
  951. if (isStrict) {
  952. return this._monthsShortStrictRegex;
  953. } else {
  954. return this._monthsShortRegex;
  955. }
  956. } else {
  957. if (!hasOwnProp(this, "_monthsShortRegex")) {
  958. this._monthsShortRegex = defaultMonthsShortRegex;
  959. }
  960. return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
  961. }
  962. }
  963. function monthsRegex(isStrict) {
  964. if (this._monthsParseExact) {
  965. if (!hasOwnProp(this, "_monthsRegex")) {
  966. computeMonthsParse.call(this);
  967. }
  968. if (isStrict) {
  969. return this._monthsStrictRegex;
  970. } else {
  971. return this._monthsRegex;
  972. }
  973. } else {
  974. if (!hasOwnProp(this, "_monthsRegex")) {
  975. this._monthsRegex = defaultMonthsRegex;
  976. }
  977. return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
  978. }
  979. }
  980. function computeMonthsParse() {
  981. function cmpLenRev(a, b) {
  982. return b.length - a.length;
  983. }
  984. var shortPieces = [], longPieces = [], mixedPieces = [], i, mom, shortP, longP;
  985. for (i = 0; i < 12; i++) {
  986. mom = createUTC([2e3, i]);
  987. shortP = regexEscape(this.monthsShort(mom, ""));
  988. longP = regexEscape(this.months(mom, ""));
  989. shortPieces.push(shortP);
  990. longPieces.push(longP);
  991. mixedPieces.push(longP);
  992. mixedPieces.push(shortP);
  993. }
  994. shortPieces.sort(cmpLenRev);
  995. longPieces.sort(cmpLenRev);
  996. mixedPieces.sort(cmpLenRev);
  997. this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  998. this._monthsShortRegex = this._monthsRegex;
  999. this._monthsStrictRegex = new RegExp(
  1000. "^(" + longPieces.join("|") + ")",
  1001. "i"
  1002. );
  1003. this._monthsShortStrictRegex = new RegExp(
  1004. "^(" + shortPieces.join("|") + ")",
  1005. "i"
  1006. );
  1007. }
  1008. function createDate(y, m, d, h, M, s, ms) {
  1009. var date;
  1010. if (y < 100 && y >= 0) {
  1011. date = new Date(y + 400, m, d, h, M, s, ms);
  1012. if (isFinite(date.getFullYear())) {
  1013. date.setFullYear(y);
  1014. }
  1015. } else {
  1016. date = new Date(y, m, d, h, M, s, ms);
  1017. }
  1018. return date;
  1019. }
  1020. function createUTCDate(y) {
  1021. var date, args;
  1022. if (y < 100 && y >= 0) {
  1023. args = Array.prototype.slice.call(arguments);
  1024. args[0] = y + 400;
  1025. date = new Date(Date.UTC.apply(null, args));
  1026. if (isFinite(date.getUTCFullYear())) {
  1027. date.setUTCFullYear(y);
  1028. }
  1029. } else {
  1030. date = new Date(Date.UTC.apply(null, arguments));
  1031. }
  1032. return date;
  1033. }
  1034. function firstWeekOffset(year, dow, doy) {
  1035. var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  1036. return -fwdlw + fwd - 1;
  1037. }
  1038. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  1039. var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
  1040. if (dayOfYear <= 0) {
  1041. resYear = year - 1;
  1042. resDayOfYear = daysInYear(resYear) + dayOfYear;
  1043. } else if (dayOfYear > daysInYear(year)) {
  1044. resYear = year + 1;
  1045. resDayOfYear = dayOfYear - daysInYear(year);
  1046. } else {
  1047. resYear = year;
  1048. resDayOfYear = dayOfYear;
  1049. }
  1050. return {
  1051. year: resYear,
  1052. dayOfYear: resDayOfYear
  1053. };
  1054. }
  1055. function weekOfYear(mom, dow, doy) {
  1056. var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
  1057. if (week < 1) {
  1058. resYear = mom.year() - 1;
  1059. resWeek = week + weeksInYear(resYear, dow, doy);
  1060. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  1061. resWeek = week - weeksInYear(mom.year(), dow, doy);
  1062. resYear = mom.year() + 1;
  1063. } else {
  1064. resYear = mom.year();
  1065. resWeek = week;
  1066. }
  1067. return {
  1068. week: resWeek,
  1069. year: resYear
  1070. };
  1071. }
  1072. function weeksInYear(year, dow, doy) {
  1073. var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  1074. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  1075. }
  1076. addFormatToken("w", ["ww", 2], "wo", "week");
  1077. addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
  1078. addRegexToken("w", match1to2, match1to2NoLeadingZero);
  1079. addRegexToken("ww", match1to2, match2);
  1080. addRegexToken("W", match1to2, match1to2NoLeadingZero);
  1081. addRegexToken("WW", match1to2, match2);
  1082. addWeekParseToken(
  1083. ["w", "ww", "W", "WW"],
  1084. function(input, week, config, token2) {
  1085. week[token2.substr(0, 1)] = toInt(input);
  1086. }
  1087. );
  1088. function localeWeek(mom) {
  1089. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  1090. }
  1091. var defaultLocaleWeek = {
  1092. dow: 0,
  1093. // Sunday is the first day of the week.
  1094. doy: 6
  1095. // The week that contains Jan 6th is the first week of the year.
  1096. };
  1097. function localeFirstDayOfWeek() {
  1098. return this._week.dow;
  1099. }
  1100. function localeFirstDayOfYear() {
  1101. return this._week.doy;
  1102. }
  1103. function getSetWeek(input) {
  1104. var week = this.localeData().week(this);
  1105. return input == null ? week : this.add((input - week) * 7, "d");
  1106. }
  1107. function getSetISOWeek(input) {
  1108. var week = weekOfYear(this, 1, 4).week;
  1109. return input == null ? week : this.add((input - week) * 7, "d");
  1110. }
  1111. addFormatToken("d", 0, "do", "day");
  1112. addFormatToken("dd", 0, 0, function(format2) {
  1113. return this.localeData().weekdaysMin(this, format2);
  1114. });
  1115. addFormatToken("ddd", 0, 0, function(format2) {
  1116. return this.localeData().weekdaysShort(this, format2);
  1117. });
  1118. addFormatToken("dddd", 0, 0, function(format2) {
  1119. return this.localeData().weekdays(this, format2);
  1120. });
  1121. addFormatToken("e", 0, 0, "weekday");
  1122. addFormatToken("E", 0, 0, "isoWeekday");
  1123. addRegexToken("d", match1to2);
  1124. addRegexToken("e", match1to2);
  1125. addRegexToken("E", match1to2);
  1126. addRegexToken("dd", function(isStrict, locale2) {
  1127. return locale2.weekdaysMinRegex(isStrict);
  1128. });
  1129. addRegexToken("ddd", function(isStrict, locale2) {
  1130. return locale2.weekdaysShortRegex(isStrict);
  1131. });
  1132. addRegexToken("dddd", function(isStrict, locale2) {
  1133. return locale2.weekdaysRegex(isStrict);
  1134. });
  1135. addWeekParseToken(["dd", "ddd", "dddd"], function(input, week, config, token2) {
  1136. var weekday = config._locale.weekdaysParse(input, token2, config._strict);
  1137. if (weekday != null) {
  1138. week.d = weekday;
  1139. } else {
  1140. getParsingFlags(config).invalidWeekday = input;
  1141. }
  1142. });
  1143. addWeekParseToken(["d", "e", "E"], function(input, week, config, token2) {
  1144. week[token2] = toInt(input);
  1145. });
  1146. function parseWeekday(input, locale2) {
  1147. if (typeof input !== "string") {
  1148. return input;
  1149. }
  1150. if (!isNaN(input)) {
  1151. return parseInt(input, 10);
  1152. }
  1153. input = locale2.weekdaysParse(input);
  1154. if (typeof input === "number") {
  1155. return input;
  1156. }
  1157. return null;
  1158. }
  1159. function parseIsoWeekday(input, locale2) {
  1160. if (typeof input === "string") {
  1161. return locale2.weekdaysParse(input) % 7 || 7;
  1162. }
  1163. return isNaN(input) ? null : input;
  1164. }
  1165. function shiftWeekdays(ws, n) {
  1166. return ws.slice(n, 7).concat(ws.slice(0, n));
  1167. }
  1168. var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");
  1169. var defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");
  1170. var defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_");
  1171. var defaultWeekdaysRegex = matchWord;
  1172. var defaultWeekdaysShortRegex = matchWord;
  1173. var defaultWeekdaysMinRegex = matchWord;
  1174. function localeWeekdays(m, format2) {
  1175. var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"];
  1176. return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
  1177. }
  1178. function localeWeekdaysShort(m) {
  1179. return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  1180. }
  1181. function localeWeekdaysMin(m) {
  1182. return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  1183. }
  1184. function handleStrictParse$1(weekdayName, format2, strict) {
  1185. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  1186. if (!this._weekdaysParse) {
  1187. this._weekdaysParse = [];
  1188. this._shortWeekdaysParse = [];
  1189. this._minWeekdaysParse = [];
  1190. for (i = 0; i < 7; ++i) {
  1191. mom = createUTC([2e3, 1]).day(i);
  1192. this._minWeekdaysParse[i] = this.weekdaysMin(
  1193. mom,
  1194. ""
  1195. ).toLocaleLowerCase();
  1196. this._shortWeekdaysParse[i] = this.weekdaysShort(
  1197. mom,
  1198. ""
  1199. ).toLocaleLowerCase();
  1200. this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase();
  1201. }
  1202. }
  1203. if (strict) {
  1204. if (format2 === "dddd") {
  1205. ii = indexOf.call(this._weekdaysParse, llc);
  1206. return ii !== -1 ? ii : null;
  1207. } else if (format2 === "ddd") {
  1208. ii = indexOf.call(this._shortWeekdaysParse, llc);
  1209. return ii !== -1 ? ii : null;
  1210. } else {
  1211. ii = indexOf.call(this._minWeekdaysParse, llc);
  1212. return ii !== -1 ? ii : null;
  1213. }
  1214. } else {
  1215. if (format2 === "dddd") {
  1216. ii = indexOf.call(this._weekdaysParse, llc);
  1217. if (ii !== -1) {
  1218. return ii;
  1219. }
  1220. ii = indexOf.call(this._shortWeekdaysParse, llc);
  1221. if (ii !== -1) {
  1222. return ii;
  1223. }
  1224. ii = indexOf.call(this._minWeekdaysParse, llc);
  1225. return ii !== -1 ? ii : null;
  1226. } else if (format2 === "ddd") {
  1227. ii = indexOf.call(this._shortWeekdaysParse, llc);
  1228. if (ii !== -1) {
  1229. return ii;
  1230. }
  1231. ii = indexOf.call(this._weekdaysParse, llc);
  1232. if (ii !== -1) {
  1233. return ii;
  1234. }
  1235. ii = indexOf.call(this._minWeekdaysParse, llc);
  1236. return ii !== -1 ? ii : null;
  1237. } else {
  1238. ii = indexOf.call(this._minWeekdaysParse, llc);
  1239. if (ii !== -1) {
  1240. return ii;
  1241. }
  1242. ii = indexOf.call(this._weekdaysParse, llc);
  1243. if (ii !== -1) {
  1244. return ii;
  1245. }
  1246. ii = indexOf.call(this._shortWeekdaysParse, llc);
  1247. return ii !== -1 ? ii : null;
  1248. }
  1249. }
  1250. }
  1251. function localeWeekdaysParse(weekdayName, format2, strict) {
  1252. var i, mom, regex;
  1253. if (this._weekdaysParseExact) {
  1254. return handleStrictParse$1.call(this, weekdayName, format2, strict);
  1255. }
  1256. if (!this._weekdaysParse) {
  1257. this._weekdaysParse = [];
  1258. this._minWeekdaysParse = [];
  1259. this._shortWeekdaysParse = [];
  1260. this._fullWeekdaysParse = [];
  1261. }
  1262. for (i = 0; i < 7; i++) {
  1263. mom = createUTC([2e3, 1]).day(i);
  1264. if (strict && !this._fullWeekdaysParse[i]) {
  1265. this._fullWeekdaysParse[i] = new RegExp(
  1266. "^" + this.weekdays(mom, "").replace(".", "\\.?") + "$",
  1267. "i"
  1268. );
  1269. this._shortWeekdaysParse[i] = new RegExp(
  1270. "^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$",
  1271. "i"
  1272. );
  1273. this._minWeekdaysParse[i] = new RegExp(
  1274. "^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$",
  1275. "i"
  1276. );
  1277. }
  1278. if (!this._weekdaysParse[i]) {
  1279. regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
  1280. this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i");
  1281. }
  1282. if (strict && format2 === "dddd" && this._fullWeekdaysParse[i].test(weekdayName)) {
  1283. return i;
  1284. } else if (strict && format2 === "ddd" && this._shortWeekdaysParse[i].test(weekdayName)) {
  1285. return i;
  1286. } else if (strict && format2 === "dd" && this._minWeekdaysParse[i].test(weekdayName)) {
  1287. return i;
  1288. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  1289. return i;
  1290. }
  1291. }
  1292. }
  1293. function getSetDayOfWeek(input) {
  1294. if (!this.isValid()) {
  1295. return input != null ? this : NaN;
  1296. }
  1297. var day = get(this, "Day");
  1298. if (input != null) {
  1299. input = parseWeekday(input, this.localeData());
  1300. return this.add(input - day, "d");
  1301. } else {
  1302. return day;
  1303. }
  1304. }
  1305. function getSetLocaleDayOfWeek(input) {
  1306. if (!this.isValid()) {
  1307. return input != null ? this : NaN;
  1308. }
  1309. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  1310. return input == null ? weekday : this.add(input - weekday, "d");
  1311. }
  1312. function getSetISODayOfWeek(input) {
  1313. if (!this.isValid()) {
  1314. return input != null ? this : NaN;
  1315. }
  1316. if (input != null) {
  1317. var weekday = parseIsoWeekday(input, this.localeData());
  1318. return this.day(this.day() % 7 ? weekday : weekday - 7);
  1319. } else {
  1320. return this.day() || 7;
  1321. }
  1322. }
  1323. function weekdaysRegex(isStrict) {
  1324. if (this._weekdaysParseExact) {
  1325. if (!hasOwnProp(this, "_weekdaysRegex")) {
  1326. computeWeekdaysParse.call(this);
  1327. }
  1328. if (isStrict) {
  1329. return this._weekdaysStrictRegex;
  1330. } else {
  1331. return this._weekdaysRegex;
  1332. }
  1333. } else {
  1334. if (!hasOwnProp(this, "_weekdaysRegex")) {
  1335. this._weekdaysRegex = defaultWeekdaysRegex;
  1336. }
  1337. return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
  1338. }
  1339. }
  1340. function weekdaysShortRegex(isStrict) {
  1341. if (this._weekdaysParseExact) {
  1342. if (!hasOwnProp(this, "_weekdaysRegex")) {
  1343. computeWeekdaysParse.call(this);
  1344. }
  1345. if (isStrict) {
  1346. return this._weekdaysShortStrictRegex;
  1347. } else {
  1348. return this._weekdaysShortRegex;
  1349. }
  1350. } else {
  1351. if (!hasOwnProp(this, "_weekdaysShortRegex")) {
  1352. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  1353. }
  1354. return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  1355. }
  1356. }
  1357. function weekdaysMinRegex(isStrict) {
  1358. if (this._weekdaysParseExact) {
  1359. if (!hasOwnProp(this, "_weekdaysRegex")) {
  1360. computeWeekdaysParse.call(this);
  1361. }
  1362. if (isStrict) {
  1363. return this._weekdaysMinStrictRegex;
  1364. } else {
  1365. return this._weekdaysMinRegex;
  1366. }
  1367. } else {
  1368. if (!hasOwnProp(this, "_weekdaysMinRegex")) {
  1369. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  1370. }
  1371. return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  1372. }
  1373. }
  1374. function computeWeekdaysParse() {
  1375. function cmpLenRev(a, b) {
  1376. return b.length - a.length;
  1377. }
  1378. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp;
  1379. for (i = 0; i < 7; i++) {
  1380. mom = createUTC([2e3, 1]).day(i);
  1381. minp = regexEscape(this.weekdaysMin(mom, ""));
  1382. shortp = regexEscape(this.weekdaysShort(mom, ""));
  1383. longp = regexEscape(this.weekdays(mom, ""));
  1384. minPieces.push(minp);
  1385. shortPieces.push(shortp);
  1386. longPieces.push(longp);
  1387. mixedPieces.push(minp);
  1388. mixedPieces.push(shortp);
  1389. mixedPieces.push(longp);
  1390. }
  1391. minPieces.sort(cmpLenRev);
  1392. shortPieces.sort(cmpLenRev);
  1393. longPieces.sort(cmpLenRev);
  1394. mixedPieces.sort(cmpLenRev);
  1395. this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  1396. this._weekdaysShortRegex = this._weekdaysRegex;
  1397. this._weekdaysMinRegex = this._weekdaysRegex;
  1398. this._weekdaysStrictRegex = new RegExp(
  1399. "^(" + longPieces.join("|") + ")",
  1400. "i"
  1401. );
  1402. this._weekdaysShortStrictRegex = new RegExp(
  1403. "^(" + shortPieces.join("|") + ")",
  1404. "i"
  1405. );
  1406. this._weekdaysMinStrictRegex = new RegExp(
  1407. "^(" + minPieces.join("|") + ")",
  1408. "i"
  1409. );
  1410. }
  1411. function hFormat() {
  1412. return this.hours() % 12 || 12;
  1413. }
  1414. function kFormat() {
  1415. return this.hours() || 24;
  1416. }
  1417. addFormatToken("H", ["HH", 2], 0, "hour");
  1418. addFormatToken("h", ["hh", 2], 0, hFormat);
  1419. addFormatToken("k", ["kk", 2], 0, kFormat);
  1420. addFormatToken("hmm", 0, 0, function() {
  1421. return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  1422. });
  1423. addFormatToken("hmmss", 0, 0, function() {
  1424. return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
  1425. });
  1426. addFormatToken("Hmm", 0, 0, function() {
  1427. return "" + this.hours() + zeroFill(this.minutes(), 2);
  1428. });
  1429. addFormatToken("Hmmss", 0, 0, function() {
  1430. return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
  1431. });
  1432. function meridiem(token2, lowercase) {
  1433. addFormatToken(token2, 0, 0, function() {
  1434. return this.localeData().meridiem(
  1435. this.hours(),
  1436. this.minutes(),
  1437. lowercase
  1438. );
  1439. });
  1440. }
  1441. meridiem("a", true);
  1442. meridiem("A", false);
  1443. function matchMeridiem(isStrict, locale2) {
  1444. return locale2._meridiemParse;
  1445. }
  1446. addRegexToken("a", matchMeridiem);
  1447. addRegexToken("A", matchMeridiem);
  1448. addRegexToken("H", match1to2, match1to2HasZero);
  1449. addRegexToken("h", match1to2, match1to2NoLeadingZero);
  1450. addRegexToken("k", match1to2, match1to2NoLeadingZero);
  1451. addRegexToken("HH", match1to2, match2);
  1452. addRegexToken("hh", match1to2, match2);
  1453. addRegexToken("kk", match1to2, match2);
  1454. addRegexToken("hmm", match3to4);
  1455. addRegexToken("hmmss", match5to6);
  1456. addRegexToken("Hmm", match3to4);
  1457. addRegexToken("Hmmss", match5to6);
  1458. addParseToken(["H", "HH"], HOUR);
  1459. addParseToken(["k", "kk"], function(input, array, config) {
  1460. var kInput = toInt(input);
  1461. array[HOUR] = kInput === 24 ? 0 : kInput;
  1462. });
  1463. addParseToken(["a", "A"], function(input, array, config) {
  1464. config._isPm = config._locale.isPM(input);
  1465. config._meridiem = input;
  1466. });
  1467. addParseToken(["h", "hh"], function(input, array, config) {
  1468. array[HOUR] = toInt(input);
  1469. getParsingFlags(config).bigHour = true;
  1470. });
  1471. addParseToken("hmm", function(input, array, config) {
  1472. var pos = input.length - 2;
  1473. array[HOUR] = toInt(input.substr(0, pos));
  1474. array[MINUTE] = toInt(input.substr(pos));
  1475. getParsingFlags(config).bigHour = true;
  1476. });
  1477. addParseToken("hmmss", function(input, array, config) {
  1478. var pos1 = input.length - 4, pos2 = input.length - 2;
  1479. array[HOUR] = toInt(input.substr(0, pos1));
  1480. array[MINUTE] = toInt(input.substr(pos1, 2));
  1481. array[SECOND] = toInt(input.substr(pos2));
  1482. getParsingFlags(config).bigHour = true;
  1483. });
  1484. addParseToken("Hmm", function(input, array, config) {
  1485. var pos = input.length - 2;
  1486. array[HOUR] = toInt(input.substr(0, pos));
  1487. array[MINUTE] = toInt(input.substr(pos));
  1488. });
  1489. addParseToken("Hmmss", function(input, array, config) {
  1490. var pos1 = input.length - 4, pos2 = input.length - 2;
  1491. array[HOUR] = toInt(input.substr(0, pos1));
  1492. array[MINUTE] = toInt(input.substr(pos1, 2));
  1493. array[SECOND] = toInt(input.substr(pos2));
  1494. });
  1495. function localeIsPM(input) {
  1496. return (input + "").toLowerCase().charAt(0) === "p";
  1497. }
  1498. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  1499. var getSetHour = makeGetSet("Hours", true);
  1500. function localeMeridiem(hours2, minutes2, isLower) {
  1501. if (hours2 > 11) {
  1502. return isLower ? "pm" : "PM";
  1503. } else {
  1504. return isLower ? "am" : "AM";
  1505. }
  1506. }
  1507. var baseConfig = {
  1508. calendar: defaultCalendar,
  1509. longDateFormat: defaultLongDateFormat,
  1510. invalidDate: defaultInvalidDate,
  1511. ordinal: defaultOrdinal,
  1512. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  1513. relativeTime: defaultRelativeTime,
  1514. months: defaultLocaleMonths,
  1515. monthsShort: defaultLocaleMonthsShort,
  1516. week: defaultLocaleWeek,
  1517. weekdays: defaultLocaleWeekdays,
  1518. weekdaysMin: defaultLocaleWeekdaysMin,
  1519. weekdaysShort: defaultLocaleWeekdaysShort,
  1520. meridiemParse: defaultLocaleMeridiemParse
  1521. };
  1522. var locales = {};
  1523. var localeFamilies = {};
  1524. var globalLocale;
  1525. function commonPrefix(arr1, arr2) {
  1526. var i, minl = Math.min(arr1.length, arr2.length);
  1527. for (i = 0; i < minl; i += 1) {
  1528. if (arr1[i] !== arr2[i]) {
  1529. return i;
  1530. }
  1531. }
  1532. return minl;
  1533. }
  1534. function normalizeLocale(key) {
  1535. return key ? key.toLowerCase().replace("_", "-") : key;
  1536. }
  1537. function chooseLocale(names) {
  1538. var i = 0, j, next, locale2, split;
  1539. while (i < names.length) {
  1540. split = normalizeLocale(names[i]).split("-");
  1541. j = split.length;
  1542. next = normalizeLocale(names[i + 1]);
  1543. next = next ? next.split("-") : null;
  1544. while (j > 0) {
  1545. locale2 = loadLocale(split.slice(0, j).join("-"));
  1546. if (locale2) {
  1547. return locale2;
  1548. }
  1549. if (next && next.length >= j && commonPrefix(split, next) >= j - 1) {
  1550. break;
  1551. }
  1552. j--;
  1553. }
  1554. i++;
  1555. }
  1556. return globalLocale;
  1557. }
  1558. function isLocaleNameSane(name) {
  1559. return !!(name && name.match("^[^/\\\\]*$"));
  1560. }
  1561. function loadLocale(name) {
  1562. var oldLocale = null, aliasedRequire;
  1563. if (locales[name] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name)) {
  1564. try {
  1565. oldLocale = globalLocale._abbr;
  1566. aliasedRequire = __require;
  1567. aliasedRequire("./locale/" + name);
  1568. getSetGlobalLocale(oldLocale);
  1569. } catch (e) {
  1570. locales[name] = null;
  1571. }
  1572. }
  1573. return locales[name];
  1574. }
  1575. function getSetGlobalLocale(key, values) {
  1576. var data;
  1577. if (key) {
  1578. if (isUndefined(values)) {
  1579. data = getLocale(key);
  1580. } else {
  1581. data = defineLocale(key, values);
  1582. }
  1583. if (data) {
  1584. globalLocale = data;
  1585. } else {
  1586. if (typeof console !== "undefined" && console.warn) {
  1587. console.warn(
  1588. "Locale " + key + " not found. Did you forget to load it?"
  1589. );
  1590. }
  1591. }
  1592. }
  1593. return globalLocale._abbr;
  1594. }
  1595. function defineLocale(name, config) {
  1596. if (config !== null) {
  1597. var locale2, parentConfig = baseConfig;
  1598. config.abbr = name;
  1599. if (locales[name] != null) {
  1600. deprecateSimple(
  1601. "defineLocaleOverride",
  1602. "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
  1603. );
  1604. parentConfig = locales[name]._config;
  1605. } else if (config.parentLocale != null) {
  1606. if (locales[config.parentLocale] != null) {
  1607. parentConfig = locales[config.parentLocale]._config;
  1608. } else {
  1609. locale2 = loadLocale(config.parentLocale);
  1610. if (locale2 != null) {
  1611. parentConfig = locale2._config;
  1612. } else {
  1613. if (!localeFamilies[config.parentLocale]) {
  1614. localeFamilies[config.parentLocale] = [];
  1615. }
  1616. localeFamilies[config.parentLocale].push({
  1617. name,
  1618. config
  1619. });
  1620. return null;
  1621. }
  1622. }
  1623. }
  1624. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  1625. if (localeFamilies[name]) {
  1626. localeFamilies[name].forEach(function(x) {
  1627. defineLocale(x.name, x.config);
  1628. });
  1629. }
  1630. getSetGlobalLocale(name);
  1631. return locales[name];
  1632. } else {
  1633. delete locales[name];
  1634. return null;
  1635. }
  1636. }
  1637. function updateLocale(name, config) {
  1638. if (config != null) {
  1639. var locale2, tmpLocale, parentConfig = baseConfig;
  1640. if (locales[name] != null && locales[name].parentLocale != null) {
  1641. locales[name].set(mergeConfigs(locales[name]._config, config));
  1642. } else {
  1643. tmpLocale = loadLocale(name);
  1644. if (tmpLocale != null) {
  1645. parentConfig = tmpLocale._config;
  1646. }
  1647. config = mergeConfigs(parentConfig, config);
  1648. if (tmpLocale == null) {
  1649. config.abbr = name;
  1650. }
  1651. locale2 = new Locale(config);
  1652. locale2.parentLocale = locales[name];
  1653. locales[name] = locale2;
  1654. }
  1655. getSetGlobalLocale(name);
  1656. } else {
  1657. if (locales[name] != null) {
  1658. if (locales[name].parentLocale != null) {
  1659. locales[name] = locales[name].parentLocale;
  1660. if (name === getSetGlobalLocale()) {
  1661. getSetGlobalLocale(name);
  1662. }
  1663. } else if (locales[name] != null) {
  1664. delete locales[name];
  1665. }
  1666. }
  1667. }
  1668. return locales[name];
  1669. }
  1670. function getLocale(key) {
  1671. var locale2;
  1672. if (key && key._locale && key._locale._abbr) {
  1673. key = key._locale._abbr;
  1674. }
  1675. if (!key) {
  1676. return globalLocale;
  1677. }
  1678. if (!isArray(key)) {
  1679. locale2 = loadLocale(key);
  1680. if (locale2) {
  1681. return locale2;
  1682. }
  1683. key = [key];
  1684. }
  1685. return chooseLocale(key);
  1686. }
  1687. function listLocales() {
  1688. return keys(locales);
  1689. }
  1690. function checkOverflow(m) {
  1691. var overflow, a = m._a;
  1692. if (a && getParsingFlags(m).overflow === -2) {
  1693. overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;
  1694. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  1695. overflow = DATE;
  1696. }
  1697. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  1698. overflow = WEEK;
  1699. }
  1700. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  1701. overflow = WEEKDAY;
  1702. }
  1703. getParsingFlags(m).overflow = overflow;
  1704. }
  1705. return m;
  1706. }
  1707. var extendedIsoRegex = /^\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)?)?$/;
  1708. var basicIsoRegex = /^\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)?)?$/;
  1709. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  1710. var isoDates = [
  1711. ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
  1712. ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
  1713. ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
  1714. ["GGGG-[W]WW", /\d{4}-W\d\d/, false],
  1715. ["YYYY-DDD", /\d{4}-\d{3}/],
  1716. ["YYYY-MM", /\d{4}-\d\d/, false],
  1717. ["YYYYYYMMDD", /[+-]\d{10}/],
  1718. ["YYYYMMDD", /\d{8}/],
  1719. ["GGGG[W]WWE", /\d{4}W\d{3}/],
  1720. ["GGGG[W]WW", /\d{4}W\d{2}/, false],
  1721. ["YYYYDDD", /\d{7}/],
  1722. ["YYYYMM", /\d{6}/, false],
  1723. ["YYYY", /\d{4}/, false]
  1724. ];
  1725. var isoTimes = [
  1726. ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
  1727. ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
  1728. ["HH:mm:ss", /\d\d:\d\d:\d\d/],
  1729. ["HH:mm", /\d\d:\d\d/],
  1730. ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
  1731. ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
  1732. ["HHmmss", /\d\d\d\d\d\d/],
  1733. ["HHmm", /\d\d\d\d/],
  1734. ["HH", /\d\d/]
  1735. ];
  1736. var aspNetJsonRegex = /^\/?Date\((-?\d+)/i;
  1737. var rfc2822 = /^(?:(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}))$/;
  1738. var obsOffsets = {
  1739. UT: 0,
  1740. GMT: 0,
  1741. EDT: -4 * 60,
  1742. EST: -5 * 60,
  1743. CDT: -5 * 60,
  1744. CST: -6 * 60,
  1745. MDT: -6 * 60,
  1746. MST: -7 * 60,
  1747. PDT: -7 * 60,
  1748. PST: -8 * 60
  1749. };
  1750. function configFromISO(config) {
  1751. var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
  1752. if (match) {
  1753. getParsingFlags(config).iso = true;
  1754. for (i = 0, l = isoDatesLen; i < l; i++) {
  1755. if (isoDates[i][1].exec(match[1])) {
  1756. dateFormat = isoDates[i][0];
  1757. allowTime = isoDates[i][2] !== false;
  1758. break;
  1759. }
  1760. }
  1761. if (dateFormat == null) {
  1762. config._isValid = false;
  1763. return;
  1764. }
  1765. if (match[3]) {
  1766. for (i = 0, l = isoTimesLen; i < l; i++) {
  1767. if (isoTimes[i][1].exec(match[3])) {
  1768. timeFormat = (match[2] || " ") + isoTimes[i][0];
  1769. break;
  1770. }
  1771. }
  1772. if (timeFormat == null) {
  1773. config._isValid = false;
  1774. return;
  1775. }
  1776. }
  1777. if (!allowTime && timeFormat != null) {
  1778. config._isValid = false;
  1779. return;
  1780. }
  1781. if (match[4]) {
  1782. if (tzRegex.exec(match[4])) {
  1783. tzFormat = "Z";
  1784. } else {
  1785. config._isValid = false;
  1786. return;
  1787. }
  1788. }
  1789. config._f = dateFormat + (timeFormat || "") + (tzFormat || "");
  1790. configFromStringAndFormat(config);
  1791. } else {
  1792. config._isValid = false;
  1793. }
  1794. }
  1795. function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
  1796. var result = [
  1797. untruncateYear(yearStr),
  1798. defaultLocaleMonthsShort.indexOf(monthStr),
  1799. parseInt(dayStr, 10),
  1800. parseInt(hourStr, 10),
  1801. parseInt(minuteStr, 10)
  1802. ];
  1803. if (secondStr) {
  1804. result.push(parseInt(secondStr, 10));
  1805. }
  1806. return result;
  1807. }
  1808. function untruncateYear(yearStr) {
  1809. var year = parseInt(yearStr, 10);
  1810. if (year <= 49) {
  1811. return 2e3 + year;
  1812. } else if (year <= 999) {
  1813. return 1900 + year;
  1814. }
  1815. return year;
  1816. }
  1817. function preprocessRFC2822(s) {
  1818. return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
  1819. }
  1820. function checkWeekday(weekdayStr, parsedInput, config) {
  1821. if (weekdayStr) {
  1822. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(
  1823. parsedInput[0],
  1824. parsedInput[1],
  1825. parsedInput[2]
  1826. ).getDay();
  1827. if (weekdayProvided !== weekdayActual) {
  1828. getParsingFlags(config).weekdayMismatch = true;
  1829. config._isValid = false;
  1830. return false;
  1831. }
  1832. }
  1833. return true;
  1834. }
  1835. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  1836. if (obsOffset) {
  1837. return obsOffsets[obsOffset];
  1838. } else if (militaryOffset) {
  1839. return 0;
  1840. } else {
  1841. var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100;
  1842. return h * 60 + m;
  1843. }
  1844. }
  1845. function configFromRFC2822(config) {
  1846. var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray;
  1847. if (match) {
  1848. parsedArray = extractFromRFC2822Strings(
  1849. match[4],
  1850. match[3],
  1851. match[2],
  1852. match[5],
  1853. match[6],
  1854. match[7]
  1855. );
  1856. if (!checkWeekday(match[1], parsedArray, config)) {
  1857. return;
  1858. }
  1859. config._a = parsedArray;
  1860. config._tzm = calculateOffset(match[8], match[9], match[10]);
  1861. config._d = createUTCDate.apply(null, config._a);
  1862. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  1863. getParsingFlags(config).rfc2822 = true;
  1864. } else {
  1865. config._isValid = false;
  1866. }
  1867. }
  1868. function configFromString(config) {
  1869. var matched = aspNetJsonRegex.exec(config._i);
  1870. if (matched !== null) {
  1871. config._d = /* @__PURE__ */ new Date(+matched[1]);
  1872. return;
  1873. }
  1874. configFromISO(config);
  1875. if (config._isValid === false) {
  1876. delete config._isValid;
  1877. } else {
  1878. return;
  1879. }
  1880. configFromRFC2822(config);
  1881. if (config._isValid === false) {
  1882. delete config._isValid;
  1883. } else {
  1884. return;
  1885. }
  1886. if (config._strict) {
  1887. config._isValid = false;
  1888. } else {
  1889. hooks.createFromInputFallback(config);
  1890. }
  1891. }
  1892. hooks.createFromInputFallback = deprecate(
  1893. "value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
  1894. function(config) {
  1895. config._d = /* @__PURE__ */ new Date(config._i + (config._useUTC ? " UTC" : ""));
  1896. }
  1897. );
  1898. function defaults(a, b, c) {
  1899. if (a != null) {
  1900. return a;
  1901. }
  1902. if (b != null) {
  1903. return b;
  1904. }
  1905. return c;
  1906. }
  1907. function currentDateArray(config) {
  1908. var nowValue = new Date(hooks.now());
  1909. if (config._useUTC) {
  1910. return [
  1911. nowValue.getUTCFullYear(),
  1912. nowValue.getUTCMonth(),
  1913. nowValue.getUTCDate()
  1914. ];
  1915. }
  1916. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  1917. }
  1918. function configFromArray(config) {
  1919. var i, date, input = [], currentDate, expectedWeekday, yearToUse;
  1920. if (config._d) {
  1921. return;
  1922. }
  1923. currentDate = currentDateArray(config);
  1924. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  1925. dayOfYearFromWeekInfo(config);
  1926. }
  1927. if (config._dayOfYear != null) {
  1928. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  1929. if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
  1930. getParsingFlags(config)._overflowDayOfYear = true;
  1931. }
  1932. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  1933. config._a[MONTH] = date.getUTCMonth();
  1934. config._a[DATE] = date.getUTCDate();
  1935. }
  1936. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  1937. config._a[i] = input[i] = currentDate[i];
  1938. }
  1939. for (; i < 7; i++) {
  1940. config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
  1941. }
  1942. if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
  1943. config._nextDay = true;
  1944. config._a[HOUR] = 0;
  1945. }
  1946. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  1947. null,
  1948. input
  1949. );
  1950. expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
  1951. if (config._tzm != null) {
  1952. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  1953. }
  1954. if (config._nextDay) {
  1955. config._a[HOUR] = 24;
  1956. }
  1957. if (config._w && typeof config._w.d !== "undefined" && config._w.d !== expectedWeekday) {
  1958. getParsingFlags(config).weekdayMismatch = true;
  1959. }
  1960. }
  1961. function dayOfYearFromWeekInfo(config) {
  1962. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  1963. w = config._w;
  1964. if (w.GG != null || w.W != null || w.E != null) {
  1965. dow = 1;
  1966. doy = 4;
  1967. weekYear = defaults(
  1968. w.GG,
  1969. config._a[YEAR],
  1970. weekOfYear(createLocal(), 1, 4).year
  1971. );
  1972. week = defaults(w.W, 1);
  1973. weekday = defaults(w.E, 1);
  1974. if (weekday < 1 || weekday > 7) {
  1975. weekdayOverflow = true;
  1976. }
  1977. } else {
  1978. dow = config._locale._week.dow;
  1979. doy = config._locale._week.doy;
  1980. curWeek = weekOfYear(createLocal(), dow, doy);
  1981. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  1982. week = defaults(w.w, curWeek.week);
  1983. if (w.d != null) {
  1984. weekday = w.d;
  1985. if (weekday < 0 || weekday > 6) {
  1986. weekdayOverflow = true;
  1987. }
  1988. } else if (w.e != null) {
  1989. weekday = w.e + dow;
  1990. if (w.e < 0 || w.e > 6) {
  1991. weekdayOverflow = true;
  1992. }
  1993. } else {
  1994. weekday = dow;
  1995. }
  1996. }
  1997. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  1998. getParsingFlags(config)._overflowWeeks = true;
  1999. } else if (weekdayOverflow != null) {
  2000. getParsingFlags(config)._overflowWeekday = true;
  2001. } else {
  2002. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  2003. config._a[YEAR] = temp.year;
  2004. config._dayOfYear = temp.dayOfYear;
  2005. }
  2006. }
  2007. hooks.ISO_8601 = function() {
  2008. };
  2009. hooks.RFC_2822 = function() {
  2010. };
  2011. function configFromStringAndFormat(config) {
  2012. if (config._f === hooks.ISO_8601) {
  2013. configFromISO(config);
  2014. return;
  2015. }
  2016. if (config._f === hooks.RFC_2822) {
  2017. configFromRFC2822(config);
  2018. return;
  2019. }
  2020. config._a = [];
  2021. getParsingFlags(config).empty = true;
  2022. var string = "" + config._i, i, parsedInput, tokens2, token2, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen;
  2023. tokens2 = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  2024. tokenLen = tokens2.length;
  2025. for (i = 0; i < tokenLen; i++) {
  2026. token2 = tokens2[i];
  2027. parsedInput = (string.match(getParseRegexForToken(token2, config)) || [])[0];
  2028. if (parsedInput) {
  2029. skipped = string.substr(0, string.indexOf(parsedInput));
  2030. if (skipped.length > 0) {
  2031. getParsingFlags(config).unusedInput.push(skipped);
  2032. }
  2033. string = string.slice(
  2034. string.indexOf(parsedInput) + parsedInput.length
  2035. );
  2036. totalParsedInputLength += parsedInput.length;
  2037. }
  2038. if (formatTokenFunctions[token2]) {
  2039. if (parsedInput) {
  2040. getParsingFlags(config).empty = false;
  2041. } else {
  2042. getParsingFlags(config).unusedTokens.push(token2);
  2043. }
  2044. addTimeToArrayFromToken(token2, parsedInput, config);
  2045. } else if (config._strict && !parsedInput) {
  2046. getParsingFlags(config).unusedTokens.push(token2);
  2047. }
  2048. }
  2049. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  2050. if (string.length > 0) {
  2051. getParsingFlags(config).unusedInput.push(string);
  2052. }
  2053. if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
  2054. getParsingFlags(config).bigHour = void 0;
  2055. }
  2056. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  2057. getParsingFlags(config).meridiem = config._meridiem;
  2058. config._a[HOUR] = meridiemFixWrap(
  2059. config._locale,
  2060. config._a[HOUR],
  2061. config._meridiem
  2062. );
  2063. era = getParsingFlags(config).era;
  2064. if (era !== null) {
  2065. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  2066. }
  2067. configFromArray(config);
  2068. checkOverflow(config);
  2069. }
  2070. function meridiemFixWrap(locale2, hour, meridiem2) {
  2071. var isPm;
  2072. if (meridiem2 == null) {
  2073. return hour;
  2074. }
  2075. if (locale2.meridiemHour != null) {
  2076. return locale2.meridiemHour(hour, meridiem2);
  2077. } else if (locale2.isPM != null) {
  2078. isPm = locale2.isPM(meridiem2);
  2079. if (isPm && hour < 12) {
  2080. hour += 12;
  2081. }
  2082. if (!isPm && hour === 12) {
  2083. hour = 0;
  2084. }
  2085. return hour;
  2086. } else {
  2087. return hour;
  2088. }
  2089. }
  2090. function configFromStringAndArray(config) {
  2091. var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length;
  2092. if (configfLen === 0) {
  2093. getParsingFlags(config).invalidFormat = true;
  2094. config._d = /* @__PURE__ */ new Date(NaN);
  2095. return;
  2096. }
  2097. for (i = 0; i < configfLen; i++) {
  2098. currentScore = 0;
  2099. validFormatFound = false;
  2100. tempConfig = copyConfig({}, config);
  2101. if (config._useUTC != null) {
  2102. tempConfig._useUTC = config._useUTC;
  2103. }
  2104. tempConfig._f = config._f[i];
  2105. configFromStringAndFormat(tempConfig);
  2106. if (isValid(tempConfig)) {
  2107. validFormatFound = true;
  2108. }
  2109. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  2110. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  2111. getParsingFlags(tempConfig).score = currentScore;
  2112. if (!bestFormatIsValid) {
  2113. if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {
  2114. scoreToBeat = currentScore;
  2115. bestMoment = tempConfig;
  2116. if (validFormatFound) {
  2117. bestFormatIsValid = true;
  2118. }
  2119. }
  2120. } else {
  2121. if (currentScore < scoreToBeat) {
  2122. scoreToBeat = currentScore;
  2123. bestMoment = tempConfig;
  2124. }
  2125. }
  2126. }
  2127. extend(config, bestMoment || tempConfig);
  2128. }
  2129. function configFromObject(config) {
  2130. if (config._d) {
  2131. return;
  2132. }
  2133. var i = normalizeObjectUnits(config._i), dayOrDate = i.day === void 0 ? i.date : i.day;
  2134. config._a = map(
  2135. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  2136. function(obj) {
  2137. return obj && parseInt(obj, 10);
  2138. }
  2139. );
  2140. configFromArray(config);
  2141. }
  2142. function createFromConfig(config) {
  2143. var res = new Moment(checkOverflow(prepareConfig(config)));
  2144. if (res._nextDay) {
  2145. res.add(1, "d");
  2146. res._nextDay = void 0;
  2147. }
  2148. return res;
  2149. }
  2150. function prepareConfig(config) {
  2151. var input = config._i, format2 = config._f;
  2152. config._locale = config._locale || getLocale(config._l);
  2153. if (input === null || format2 === void 0 && input === "") {
  2154. return createInvalid({ nullInput: true });
  2155. }
  2156. if (typeof input === "string") {
  2157. config._i = input = config._locale.preparse(input);
  2158. }
  2159. if (isMoment(input)) {
  2160. return new Moment(checkOverflow(input));
  2161. } else if (isDate(input)) {
  2162. config._d = input;
  2163. } else if (isArray(format2)) {
  2164. configFromStringAndArray(config);
  2165. } else if (format2) {
  2166. configFromStringAndFormat(config);
  2167. } else {
  2168. configFromInput(config);
  2169. }
  2170. if (!isValid(config)) {
  2171. config._d = null;
  2172. }
  2173. return config;
  2174. }
  2175. function configFromInput(config) {
  2176. var input = config._i;
  2177. if (isUndefined(input)) {
  2178. config._d = new Date(hooks.now());
  2179. } else if (isDate(input)) {
  2180. config._d = new Date(input.valueOf());
  2181. } else if (typeof input === "string") {
  2182. configFromString(config);
  2183. } else if (isArray(input)) {
  2184. config._a = map(input.slice(0), function(obj) {
  2185. return parseInt(obj, 10);
  2186. });
  2187. configFromArray(config);
  2188. } else if (isObject(input)) {
  2189. configFromObject(config);
  2190. } else if (isNumber(input)) {
  2191. config._d = new Date(input);
  2192. } else {
  2193. hooks.createFromInputFallback(config);
  2194. }
  2195. }
  2196. function createLocalOrUTC(input, format2, locale2, strict, isUTC) {
  2197. var c = {};
  2198. if (format2 === true || format2 === false) {
  2199. strict = format2;
  2200. format2 = void 0;
  2201. }
  2202. if (locale2 === true || locale2 === false) {
  2203. strict = locale2;
  2204. locale2 = void 0;
  2205. }
  2206. if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {
  2207. input = void 0;
  2208. }
  2209. c._isAMomentObject = true;
  2210. c._useUTC = c._isUTC = isUTC;
  2211. c._l = locale2;
  2212. c._i = input;
  2213. c._f = format2;
  2214. c._strict = strict;
  2215. return createFromConfig(c);
  2216. }
  2217. function createLocal(input, format2, locale2, strict) {
  2218. return createLocalOrUTC(input, format2, locale2, strict, false);
  2219. }
  2220. var prototypeMin = deprecate(
  2221. "moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",
  2222. function() {
  2223. var other = createLocal.apply(null, arguments);
  2224. if (this.isValid() && other.isValid()) {
  2225. return other < this ? this : other;
  2226. } else {
  2227. return createInvalid();
  2228. }
  2229. }
  2230. );
  2231. var prototypeMax = deprecate(
  2232. "moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",
  2233. function() {
  2234. var other = createLocal.apply(null, arguments);
  2235. if (this.isValid() && other.isValid()) {
  2236. return other > this ? this : other;
  2237. } else {
  2238. return createInvalid();
  2239. }
  2240. }
  2241. );
  2242. function pickBy(fn, moments) {
  2243. var res, i;
  2244. if (moments.length === 1 && isArray(moments[0])) {
  2245. moments = moments[0];
  2246. }
  2247. if (!moments.length) {
  2248. return createLocal();
  2249. }
  2250. res = moments[0];
  2251. for (i = 1; i < moments.length; ++i) {
  2252. if (!moments[i].isValid() || moments[i][fn](res)) {
  2253. res = moments[i];
  2254. }
  2255. }
  2256. return res;
  2257. }
  2258. function min() {
  2259. var args = [].slice.call(arguments, 0);
  2260. return pickBy("isBefore", args);
  2261. }
  2262. function max() {
  2263. var args = [].slice.call(arguments, 0);
  2264. return pickBy("isAfter", args);
  2265. }
  2266. var now = function() {
  2267. return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
  2268. };
  2269. var ordering = [
  2270. "year",
  2271. "quarter",
  2272. "month",
  2273. "week",
  2274. "day",
  2275. "hour",
  2276. "minute",
  2277. "second",
  2278. "millisecond"
  2279. ];
  2280. function isDurationValid(m) {
  2281. var key, unitHasDecimal = false, i, orderLen = ordering.length;
  2282. for (key in m) {
  2283. if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
  2284. return false;
  2285. }
  2286. }
  2287. for (i = 0; i < orderLen; ++i) {
  2288. if (m[ordering[i]]) {
  2289. if (unitHasDecimal) {
  2290. return false;
  2291. }
  2292. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  2293. unitHasDecimal = true;
  2294. }
  2295. }
  2296. }
  2297. return true;
  2298. }
  2299. function isValid$1() {
  2300. return this._isValid;
  2301. }
  2302. function createInvalid$1() {
  2303. return createDuration(NaN);
  2304. }
  2305. function Duration(duration) {
  2306. var normalizedInput = normalizeObjectUnits(duration), years2 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months2 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0;
  2307. this._isValid = isDurationValid(normalizedInput);
  2308. this._milliseconds = +milliseconds2 + seconds2 * 1e3 + // 1000
  2309. minutes2 * 6e4 + // 1000 * 60
  2310. hours2 * 1e3 * 60 * 60;
  2311. this._days = +days2 + weeks2 * 7;
  2312. this._months = +months2 + quarters * 3 + years2 * 12;
  2313. this._data = {};
  2314. this._locale = getLocale();
  2315. this._bubble();
  2316. }
  2317. function isDuration(obj) {
  2318. return obj instanceof Duration;
  2319. }
  2320. function absRound(number) {
  2321. if (number < 0) {
  2322. return Math.round(-1 * number) * -1;
  2323. } else {
  2324. return Math.round(number);
  2325. }
  2326. }
  2327. function compareArrays(array1, array2, dontConvert) {
  2328. var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i;
  2329. for (i = 0; i < len; i++) {
  2330. if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
  2331. diffs++;
  2332. }
  2333. }
  2334. return diffs + lengthDiff;
  2335. }
  2336. function offset(token2, separator) {
  2337. addFormatToken(token2, 0, 0, function() {
  2338. var offset2 = this.utcOffset(), sign2 = "+";
  2339. if (offset2 < 0) {
  2340. offset2 = -offset2;
  2341. sign2 = "-";
  2342. }
  2343. return sign2 + zeroFill(~~(offset2 / 60), 2) + separator + zeroFill(~~offset2 % 60, 2);
  2344. });
  2345. }
  2346. offset("Z", ":");
  2347. offset("ZZ", "");
  2348. addRegexToken("Z", matchShortOffset);
  2349. addRegexToken("ZZ", matchShortOffset);
  2350. addParseToken(["Z", "ZZ"], function(input, array, config) {
  2351. config._useUTC = true;
  2352. config._tzm = offsetFromString(matchShortOffset, input);
  2353. });
  2354. var chunkOffset = /([\+\-]|\d\d)/gi;
  2355. function offsetFromString(matcher, string) {
  2356. var matches = (string || "").match(matcher), chunk, parts, minutes2;
  2357. if (matches === null) {
  2358. return null;
  2359. }
  2360. chunk = matches[matches.length - 1] || [];
  2361. parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
  2362. minutes2 = +(parts[1] * 60) + toInt(parts[2]);
  2363. return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2;
  2364. }
  2365. function cloneWithOffset(input, model) {
  2366. var res, diff2;
  2367. if (model._isUTC) {
  2368. res = model.clone();
  2369. diff2 = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
  2370. res._d.setTime(res._d.valueOf() + diff2);
  2371. hooks.updateOffset(res, false);
  2372. return res;
  2373. } else {
  2374. return createLocal(input).local();
  2375. }
  2376. }
  2377. function getDateOffset(m) {
  2378. return -Math.round(m._d.getTimezoneOffset());
  2379. }
  2380. hooks.updateOffset = function() {
  2381. };
  2382. function getSetOffset(input, keepLocalTime, keepMinutes) {
  2383. var offset2 = this._offset || 0, localAdjust;
  2384. if (!this.isValid()) {
  2385. return input != null ? this : NaN;
  2386. }
  2387. if (input != null) {
  2388. if (typeof input === "string") {
  2389. input = offsetFromString(matchShortOffset, input);
  2390. if (input === null) {
  2391. return this;
  2392. }
  2393. } else if (Math.abs(input) < 16 && !keepMinutes) {
  2394. input = input * 60;
  2395. }
  2396. if (!this._isUTC && keepLocalTime) {
  2397. localAdjust = getDateOffset(this);
  2398. }
  2399. this._offset = input;
  2400. this._isUTC = true;
  2401. if (localAdjust != null) {
  2402. this.add(localAdjust, "m");
  2403. }
  2404. if (offset2 !== input) {
  2405. if (!keepLocalTime || this._changeInProgress) {
  2406. addSubtract(
  2407. this,
  2408. createDuration(input - offset2, "m"),
  2409. 1,
  2410. false
  2411. );
  2412. } else if (!this._changeInProgress) {
  2413. this._changeInProgress = true;
  2414. hooks.updateOffset(this, true);
  2415. this._changeInProgress = null;
  2416. }
  2417. }
  2418. return this;
  2419. } else {
  2420. return this._isUTC ? offset2 : getDateOffset(this);
  2421. }
  2422. }
  2423. function getSetZone(input, keepLocalTime) {
  2424. if (input != null) {
  2425. if (typeof input !== "string") {
  2426. input = -input;
  2427. }
  2428. this.utcOffset(input, keepLocalTime);
  2429. return this;
  2430. } else {
  2431. return -this.utcOffset();
  2432. }
  2433. }
  2434. function setOffsetToUTC(keepLocalTime) {
  2435. return this.utcOffset(0, keepLocalTime);
  2436. }
  2437. function setOffsetToLocal(keepLocalTime) {
  2438. if (this._isUTC) {
  2439. this.utcOffset(0, keepLocalTime);
  2440. this._isUTC = false;
  2441. if (keepLocalTime) {
  2442. this.subtract(getDateOffset(this), "m");
  2443. }
  2444. }
  2445. return this;
  2446. }
  2447. function setOffsetToParsedOffset() {
  2448. if (this._tzm != null) {
  2449. this.utcOffset(this._tzm, false, true);
  2450. } else if (typeof this._i === "string") {
  2451. var tZone = offsetFromString(matchOffset, this._i);
  2452. if (tZone != null) {
  2453. this.utcOffset(tZone);
  2454. } else {
  2455. this.utcOffset(0, true);
  2456. }
  2457. }
  2458. return this;
  2459. }
  2460. function hasAlignedHourOffset(input) {
  2461. if (!this.isValid()) {
  2462. return false;
  2463. }
  2464. input = input ? createLocal(input).utcOffset() : 0;
  2465. return (this.utcOffset() - input) % 60 === 0;
  2466. }
  2467. function isDaylightSavingTime() {
  2468. return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
  2469. }
  2470. function isDaylightSavingTimeShifted() {
  2471. if (!isUndefined(this._isDSTShifted)) {
  2472. return this._isDSTShifted;
  2473. }
  2474. var c = {}, other;
  2475. copyConfig(c, this);
  2476. c = prepareConfig(c);
  2477. if (c._a) {
  2478. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  2479. this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  2480. } else {
  2481. this._isDSTShifted = false;
  2482. }
  2483. return this._isDSTShifted;
  2484. }
  2485. function isLocal() {
  2486. return this.isValid() ? !this._isUTC : false;
  2487. }
  2488. function isUtcOffset() {
  2489. return this.isValid() ? this._isUTC : false;
  2490. }
  2491. function isUtc() {
  2492. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  2493. }
  2494. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/;
  2495. var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  2496. function createDuration(input, key) {
  2497. var duration = input, match = null, sign2, ret, diffRes;
  2498. if (isDuration(input)) {
  2499. duration = {
  2500. ms: input._milliseconds,
  2501. d: input._days,
  2502. M: input._months
  2503. };
  2504. } else if (isNumber(input) || !isNaN(+input)) {
  2505. duration = {};
  2506. if (key) {
  2507. duration[key] = +input;
  2508. } else {
  2509. duration.milliseconds = +input;
  2510. }
  2511. } else if (match = aspNetRegex.exec(input)) {
  2512. sign2 = match[1] === "-" ? -1 : 1;
  2513. duration = {
  2514. y: 0,
  2515. d: toInt(match[DATE]) * sign2,
  2516. h: toInt(match[HOUR]) * sign2,
  2517. m: toInt(match[MINUTE]) * sign2,
  2518. s: toInt(match[SECOND]) * sign2,
  2519. ms: toInt(absRound(match[MILLISECOND] * 1e3)) * sign2
  2520. // the millisecond decimal point is included in the match
  2521. };
  2522. } else if (match = isoRegex.exec(input)) {
  2523. sign2 = match[1] === "-" ? -1 : 1;
  2524. duration = {
  2525. y: parseIso(match[2], sign2),
  2526. M: parseIso(match[3], sign2),
  2527. w: parseIso(match[4], sign2),
  2528. d: parseIso(match[5], sign2),
  2529. h: parseIso(match[6], sign2),
  2530. m: parseIso(match[7], sign2),
  2531. s: parseIso(match[8], sign2)
  2532. };
  2533. } else if (duration == null) {
  2534. duration = {};
  2535. } else if (typeof duration === "object" && ("from" in duration || "to" in duration)) {
  2536. diffRes = momentsDifference(
  2537. createLocal(duration.from),
  2538. createLocal(duration.to)
  2539. );
  2540. duration = {};
  2541. duration.ms = diffRes.milliseconds;
  2542. duration.M = diffRes.months;
  2543. }
  2544. ret = new Duration(duration);
  2545. if (isDuration(input) && hasOwnProp(input, "_locale")) {
  2546. ret._locale = input._locale;
  2547. }
  2548. if (isDuration(input) && hasOwnProp(input, "_isValid")) {
  2549. ret._isValid = input._isValid;
  2550. }
  2551. return ret;
  2552. }
  2553. createDuration.fn = Duration.prototype;
  2554. createDuration.invalid = createInvalid$1;
  2555. function parseIso(inp, sign2) {
  2556. var res = inp && parseFloat(inp.replace(",", "."));
  2557. return (isNaN(res) ? 0 : res) * sign2;
  2558. }
  2559. function positiveMomentsDifference(base, other) {
  2560. var res = {};
  2561. res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
  2562. if (base.clone().add(res.months, "M").isAfter(other)) {
  2563. --res.months;
  2564. }
  2565. res.milliseconds = +other - +base.clone().add(res.months, "M");
  2566. return res;
  2567. }
  2568. function momentsDifference(base, other) {
  2569. var res;
  2570. if (!(base.isValid() && other.isValid())) {
  2571. return { milliseconds: 0, months: 0 };
  2572. }
  2573. other = cloneWithOffset(other, base);
  2574. if (base.isBefore(other)) {
  2575. res = positiveMomentsDifference(base, other);
  2576. } else {
  2577. res = positiveMomentsDifference(other, base);
  2578. res.milliseconds = -res.milliseconds;
  2579. res.months = -res.months;
  2580. }
  2581. return res;
  2582. }
  2583. function createAdder(direction, name) {
  2584. return function(val, period) {
  2585. var dur, tmp;
  2586. if (period !== null && !isNaN(+period)) {
  2587. deprecateSimple(
  2588. name,
  2589. "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
  2590. );
  2591. tmp = val;
  2592. val = period;
  2593. period = tmp;
  2594. }
  2595. dur = createDuration(val, period);
  2596. addSubtract(this, dur, direction);
  2597. return this;
  2598. };
  2599. }
  2600. function addSubtract(mom, duration, isAdding, updateOffset) {
  2601. var milliseconds2 = duration._milliseconds, days2 = absRound(duration._days), months2 = absRound(duration._months);
  2602. if (!mom.isValid()) {
  2603. return;
  2604. }
  2605. updateOffset = updateOffset == null ? true : updateOffset;
  2606. if (months2) {
  2607. setMonth(mom, get(mom, "Month") + months2 * isAdding);
  2608. }
  2609. if (days2) {
  2610. set$1(mom, "Date", get(mom, "Date") + days2 * isAdding);
  2611. }
  2612. if (milliseconds2) {
  2613. mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding);
  2614. }
  2615. if (updateOffset) {
  2616. hooks.updateOffset(mom, days2 || months2);
  2617. }
  2618. }
  2619. var add = createAdder(1, "add");
  2620. var subtract = createAdder(-1, "subtract");
  2621. function isString(input) {
  2622. return typeof input === "string" || input instanceof String;
  2623. }
  2624. function isMomentInput(input) {
  2625. return isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === void 0;
  2626. }
  2627. function isMomentInputObject(input) {
  2628. var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [
  2629. "years",
  2630. "year",
  2631. "y",
  2632. "months",
  2633. "month",
  2634. "M",
  2635. "days",
  2636. "day",
  2637. "d",
  2638. "dates",
  2639. "date",
  2640. "D",
  2641. "hours",
  2642. "hour",
  2643. "h",
  2644. "minutes",
  2645. "minute",
  2646. "m",
  2647. "seconds",
  2648. "second",
  2649. "s",
  2650. "milliseconds",
  2651. "millisecond",
  2652. "ms"
  2653. ], i, property, propertyLen = properties.length;
  2654. for (i = 0; i < propertyLen; i += 1) {
  2655. property = properties[i];
  2656. propertyTest = propertyTest || hasOwnProp(input, property);
  2657. }
  2658. return objectTest && propertyTest;
  2659. }
  2660. function isNumberOrStringArray(input) {
  2661. var arrayTest = isArray(input), dataTypeTest = false;
  2662. if (arrayTest) {
  2663. dataTypeTest = input.filter(function(item) {
  2664. return !isNumber(item) && isString(input);
  2665. }).length === 0;
  2666. }
  2667. return arrayTest && dataTypeTest;
  2668. }
  2669. function isCalendarSpec(input) {
  2670. var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [
  2671. "sameDay",
  2672. "nextDay",
  2673. "lastDay",
  2674. "nextWeek",
  2675. "lastWeek",
  2676. "sameElse"
  2677. ], i, property;
  2678. for (i = 0; i < properties.length; i += 1) {
  2679. property = properties[i];
  2680. propertyTest = propertyTest || hasOwnProp(input, property);
  2681. }
  2682. return objectTest && propertyTest;
  2683. }
  2684. function getCalendarFormat(myMoment, now2) {
  2685. var diff2 = myMoment.diff(now2, "days", true);
  2686. return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse";
  2687. }
  2688. function calendar$1(time, formats) {
  2689. if (arguments.length === 1) {
  2690. if (!arguments[0]) {
  2691. time = void 0;
  2692. formats = void 0;
  2693. } else if (isMomentInput(arguments[0])) {
  2694. time = arguments[0];
  2695. formats = void 0;
  2696. } else if (isCalendarSpec(arguments[0])) {
  2697. formats = arguments[0];
  2698. time = void 0;
  2699. }
  2700. }
  2701. var now2 = time || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format2 = hooks.calendarFormat(this, sod) || "sameElse", output = formats && (isFunction(formats[format2]) ? formats[format2].call(this, now2) : formats[format2]);
  2702. return this.format(
  2703. output || this.localeData().calendar(format2, this, createLocal(now2))
  2704. );
  2705. }
  2706. function clone() {
  2707. return new Moment(this);
  2708. }
  2709. function isAfter(input, units) {
  2710. var localInput = isMoment(input) ? input : createLocal(input);
  2711. if (!(this.isValid() && localInput.isValid())) {
  2712. return false;
  2713. }
  2714. units = normalizeUnits(units) || "millisecond";
  2715. if (units === "millisecond") {
  2716. return this.valueOf() > localInput.valueOf();
  2717. } else {
  2718. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  2719. }
  2720. }
  2721. function isBefore(input, units) {
  2722. var localInput = isMoment(input) ? input : createLocal(input);
  2723. if (!(this.isValid() && localInput.isValid())) {
  2724. return false;
  2725. }
  2726. units = normalizeUnits(units) || "millisecond";
  2727. if (units === "millisecond") {
  2728. return this.valueOf() < localInput.valueOf();
  2729. } else {
  2730. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  2731. }
  2732. }
  2733. function isBetween(from2, to2, units, inclusivity) {
  2734. var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2);
  2735. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  2736. return false;
  2737. }
  2738. inclusivity = inclusivity || "()";
  2739. return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
  2740. }
  2741. function isSame(input, units) {
  2742. var localInput = isMoment(input) ? input : createLocal(input), inputMs;
  2743. if (!(this.isValid() && localInput.isValid())) {
  2744. return false;
  2745. }
  2746. units = normalizeUnits(units) || "millisecond";
  2747. if (units === "millisecond") {
  2748. return this.valueOf() === localInput.valueOf();
  2749. } else {
  2750. inputMs = localInput.valueOf();
  2751. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  2752. }
  2753. }
  2754. function isSameOrAfter(input, units) {
  2755. return this.isSame(input, units) || this.isAfter(input, units);
  2756. }
  2757. function isSameOrBefore(input, units) {
  2758. return this.isSame(input, units) || this.isBefore(input, units);
  2759. }
  2760. function diff(input, units, asFloat) {
  2761. var that, zoneDelta, output;
  2762. if (!this.isValid()) {
  2763. return NaN;
  2764. }
  2765. that = cloneWithOffset(input, this);
  2766. if (!that.isValid()) {
  2767. return NaN;
  2768. }
  2769. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  2770. units = normalizeUnits(units);
  2771. switch (units) {
  2772. case "year":
  2773. output = monthDiff(this, that) / 12;
  2774. break;
  2775. case "month":
  2776. output = monthDiff(this, that);
  2777. break;
  2778. case "quarter":
  2779. output = monthDiff(this, that) / 3;
  2780. break;
  2781. case "second":
  2782. output = (this - that) / 1e3;
  2783. break;
  2784. case "minute":
  2785. output = (this - that) / 6e4;
  2786. break;
  2787. case "hour":
  2788. output = (this - that) / 36e5;
  2789. break;
  2790. case "day":
  2791. output = (this - that - zoneDelta) / 864e5;
  2792. break;
  2793. case "week":
  2794. output = (this - that - zoneDelta) / 6048e5;
  2795. break;
  2796. default:
  2797. output = this - that;
  2798. }
  2799. return asFloat ? output : absFloor(output);
  2800. }
  2801. function monthDiff(a, b) {
  2802. if (a.date() < b.date()) {
  2803. return -monthDiff(b, a);
  2804. }
  2805. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), anchor = a.clone().add(wholeMonthDiff, "months"), anchor2, adjust;
  2806. if (b - anchor < 0) {
  2807. anchor2 = a.clone().add(wholeMonthDiff - 1, "months");
  2808. adjust = (b - anchor) / (anchor - anchor2);
  2809. } else {
  2810. anchor2 = a.clone().add(wholeMonthDiff + 1, "months");
  2811. adjust = (b - anchor) / (anchor2 - anchor);
  2812. }
  2813. return -(wholeMonthDiff + adjust) || 0;
  2814. }
  2815. hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
  2816. hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
  2817. function toString() {
  2818. return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
  2819. }
  2820. function toISOString(keepOffset) {
  2821. if (!this.isValid()) {
  2822. return null;
  2823. }
  2824. var utc = keepOffset !== true, m = utc ? this.clone().utc() : this;
  2825. if (m.year() < 0 || m.year() > 9999) {
  2826. return formatMoment(
  2827. m,
  2828. utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"
  2829. );
  2830. }
  2831. if (isFunction(Date.prototype.toISOString)) {
  2832. if (utc) {
  2833. return this.toDate().toISOString();
  2834. } else {
  2835. return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m, "Z"));
  2836. }
  2837. }
  2838. return formatMoment(
  2839. m,
  2840. utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"
  2841. );
  2842. }
  2843. function inspect() {
  2844. if (!this.isValid()) {
  2845. return "moment.invalid(/* " + this._i + " */)";
  2846. }
  2847. var func = "moment", zone = "", prefix, year, datetime, suffix;
  2848. if (!this.isLocal()) {
  2849. func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
  2850. zone = "Z";
  2851. }
  2852. prefix = "[" + func + '("]';
  2853. year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
  2854. datetime = "-MM-DD[T]HH:mm:ss.SSS";
  2855. suffix = zone + '[")]';
  2856. return this.format(prefix + year + datetime + suffix);
  2857. }
  2858. function format(inputString) {
  2859. if (!inputString) {
  2860. inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  2861. }
  2862. var output = formatMoment(this, inputString);
  2863. return this.localeData().postformat(output);
  2864. }
  2865. function from(time, withoutSuffix) {
  2866. if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
  2867. return createDuration({ to: this, from: time }).locale(this.locale()).humanize(!withoutSuffix);
  2868. } else {
  2869. return this.localeData().invalidDate();
  2870. }
  2871. }
  2872. function fromNow(withoutSuffix) {
  2873. return this.from(createLocal(), withoutSuffix);
  2874. }
  2875. function to(time, withoutSuffix) {
  2876. if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
  2877. return createDuration({ from: this, to: time }).locale(this.locale()).humanize(!withoutSuffix);
  2878. } else {
  2879. return this.localeData().invalidDate();
  2880. }
  2881. }
  2882. function toNow(withoutSuffix) {
  2883. return this.to(createLocal(), withoutSuffix);
  2884. }
  2885. function locale(key) {
  2886. var newLocaleData;
  2887. if (key === void 0) {
  2888. return this._locale._abbr;
  2889. } else {
  2890. newLocaleData = getLocale(key);
  2891. if (newLocaleData != null) {
  2892. this._locale = newLocaleData;
  2893. }
  2894. return this;
  2895. }
  2896. }
  2897. var lang = deprecate(
  2898. "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
  2899. function(key) {
  2900. if (key === void 0) {
  2901. return this.localeData();
  2902. } else {
  2903. return this.locale(key);
  2904. }
  2905. }
  2906. );
  2907. function localeData() {
  2908. return this._locale;
  2909. }
  2910. var MS_PER_SECOND = 1e3;
  2911. var MS_PER_MINUTE = 60 * MS_PER_SECOND;
  2912. var MS_PER_HOUR = 60 * MS_PER_MINUTE;
  2913. var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  2914. function mod$1(dividend, divisor) {
  2915. return (dividend % divisor + divisor) % divisor;
  2916. }
  2917. function localStartOfDate(y, m, d) {
  2918. if (y < 100 && y >= 0) {
  2919. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  2920. } else {
  2921. return new Date(y, m, d).valueOf();
  2922. }
  2923. }
  2924. function utcStartOfDate(y, m, d) {
  2925. if (y < 100 && y >= 0) {
  2926. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  2927. } else {
  2928. return Date.UTC(y, m, d);
  2929. }
  2930. }
  2931. function startOf(units) {
  2932. var time, startOfDate;
  2933. units = normalizeUnits(units);
  2934. if (units === void 0 || units === "millisecond" || !this.isValid()) {
  2935. return this;
  2936. }
  2937. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  2938. switch (units) {
  2939. case "year":
  2940. time = startOfDate(this.year(), 0, 1);
  2941. break;
  2942. case "quarter":
  2943. time = startOfDate(
  2944. this.year(),
  2945. this.month() - this.month() % 3,
  2946. 1
  2947. );
  2948. break;
  2949. case "month":
  2950. time = startOfDate(this.year(), this.month(), 1);
  2951. break;
  2952. case "week":
  2953. time = startOfDate(
  2954. this.year(),
  2955. this.month(),
  2956. this.date() - this.weekday()
  2957. );
  2958. break;
  2959. case "isoWeek":
  2960. time = startOfDate(
  2961. this.year(),
  2962. this.month(),
  2963. this.date() - (this.isoWeekday() - 1)
  2964. );
  2965. break;
  2966. case "day":
  2967. case "date":
  2968. time = startOfDate(this.year(), this.month(), this.date());
  2969. break;
  2970. case "hour":
  2971. time = this._d.valueOf();
  2972. time -= mod$1(
  2973. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  2974. MS_PER_HOUR
  2975. );
  2976. break;
  2977. case "minute":
  2978. time = this._d.valueOf();
  2979. time -= mod$1(time, MS_PER_MINUTE);
  2980. break;
  2981. case "second":
  2982. time = this._d.valueOf();
  2983. time -= mod$1(time, MS_PER_SECOND);
  2984. break;
  2985. }
  2986. this._d.setTime(time);
  2987. hooks.updateOffset(this, true);
  2988. return this;
  2989. }
  2990. function endOf(units) {
  2991. var time, startOfDate;
  2992. units = normalizeUnits(units);
  2993. if (units === void 0 || units === "millisecond" || !this.isValid()) {
  2994. return this;
  2995. }
  2996. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  2997. switch (units) {
  2998. case "year":
  2999. time = startOfDate(this.year() + 1, 0, 1) - 1;
  3000. break;
  3001. case "quarter":
  3002. time = startOfDate(
  3003. this.year(),
  3004. this.month() - this.month() % 3 + 3,
  3005. 1
  3006. ) - 1;
  3007. break;
  3008. case "month":
  3009. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  3010. break;
  3011. case "week":
  3012. time = startOfDate(
  3013. this.year(),
  3014. this.month(),
  3015. this.date() - this.weekday() + 7
  3016. ) - 1;
  3017. break;
  3018. case "isoWeek":
  3019. time = startOfDate(
  3020. this.year(),
  3021. this.month(),
  3022. this.date() - (this.isoWeekday() - 1) + 7
  3023. ) - 1;
  3024. break;
  3025. case "day":
  3026. case "date":
  3027. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  3028. break;
  3029. case "hour":
  3030. time = this._d.valueOf();
  3031. time += MS_PER_HOUR - mod$1(
  3032. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  3033. MS_PER_HOUR
  3034. ) - 1;
  3035. break;
  3036. case "minute":
  3037. time = this._d.valueOf();
  3038. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  3039. break;
  3040. case "second":
  3041. time = this._d.valueOf();
  3042. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  3043. break;
  3044. }
  3045. this._d.setTime(time);
  3046. hooks.updateOffset(this, true);
  3047. return this;
  3048. }
  3049. function valueOf() {
  3050. return this._d.valueOf() - (this._offset || 0) * 6e4;
  3051. }
  3052. function unix() {
  3053. return Math.floor(this.valueOf() / 1e3);
  3054. }
  3055. function toDate() {
  3056. return new Date(this.valueOf());
  3057. }
  3058. function toArray() {
  3059. var m = this;
  3060. return [
  3061. m.year(),
  3062. m.month(),
  3063. m.date(),
  3064. m.hour(),
  3065. m.minute(),
  3066. m.second(),
  3067. m.millisecond()
  3068. ];
  3069. }
  3070. function toObject() {
  3071. var m = this;
  3072. return {
  3073. years: m.year(),
  3074. months: m.month(),
  3075. date: m.date(),
  3076. hours: m.hours(),
  3077. minutes: m.minutes(),
  3078. seconds: m.seconds(),
  3079. milliseconds: m.milliseconds()
  3080. };
  3081. }
  3082. function toJSON() {
  3083. return this.isValid() ? this.toISOString() : null;
  3084. }
  3085. function isValid$2() {
  3086. return isValid(this);
  3087. }
  3088. function parsingFlags() {
  3089. return extend({}, getParsingFlags(this));
  3090. }
  3091. function invalidAt() {
  3092. return getParsingFlags(this).overflow;
  3093. }
  3094. function creationData() {
  3095. return {
  3096. input: this._i,
  3097. format: this._f,
  3098. locale: this._locale,
  3099. isUTC: this._isUTC,
  3100. strict: this._strict
  3101. };
  3102. }
  3103. addFormatToken("N", 0, 0, "eraAbbr");
  3104. addFormatToken("NN", 0, 0, "eraAbbr");
  3105. addFormatToken("NNN", 0, 0, "eraAbbr");
  3106. addFormatToken("NNNN", 0, 0, "eraName");
  3107. addFormatToken("NNNNN", 0, 0, "eraNarrow");
  3108. addFormatToken("y", ["y", 1], "yo", "eraYear");
  3109. addFormatToken("y", ["yy", 2], 0, "eraYear");
  3110. addFormatToken("y", ["yyy", 3], 0, "eraYear");
  3111. addFormatToken("y", ["yyyy", 4], 0, "eraYear");
  3112. addRegexToken("N", matchEraAbbr);
  3113. addRegexToken("NN", matchEraAbbr);
  3114. addRegexToken("NNN", matchEraAbbr);
  3115. addRegexToken("NNNN", matchEraName);
  3116. addRegexToken("NNNNN", matchEraNarrow);
  3117. addParseToken(
  3118. ["N", "NN", "NNN", "NNNN", "NNNNN"],
  3119. function(input, array, config, token2) {
  3120. var era = config._locale.erasParse(input, token2, config._strict);
  3121. if (era) {
  3122. getParsingFlags(config).era = era;
  3123. } else {
  3124. getParsingFlags(config).invalidEra = input;
  3125. }
  3126. }
  3127. );
  3128. addRegexToken("y", matchUnsigned);
  3129. addRegexToken("yy", matchUnsigned);
  3130. addRegexToken("yyy", matchUnsigned);
  3131. addRegexToken("yyyy", matchUnsigned);
  3132. addRegexToken("yo", matchEraYearOrdinal);
  3133. addParseToken(["y", "yy", "yyy", "yyyy"], YEAR);
  3134. addParseToken(["yo"], function(input, array, config, token2) {
  3135. var match;
  3136. if (config._locale._eraYearOrdinalRegex) {
  3137. match = input.match(config._locale._eraYearOrdinalRegex);
  3138. }
  3139. if (config._locale.eraYearOrdinalParse) {
  3140. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  3141. } else {
  3142. array[YEAR] = parseInt(input, 10);
  3143. }
  3144. });
  3145. function localeEras(m, format2) {
  3146. var i, l, date, eras = this._eras || getLocale("en")._eras;
  3147. for (i = 0, l = eras.length; i < l; ++i) {
  3148. switch (typeof eras[i].since) {
  3149. case "string":
  3150. date = hooks(eras[i].since).startOf("day");
  3151. eras[i].since = date.valueOf();
  3152. break;
  3153. }
  3154. switch (typeof eras[i].until) {
  3155. case "undefined":
  3156. eras[i].until = Infinity;
  3157. break;
  3158. case "string":
  3159. date = hooks(eras[i].until).startOf("day").valueOf();
  3160. eras[i].until = date.valueOf();
  3161. break;
  3162. }
  3163. }
  3164. return eras;
  3165. }
  3166. function localeErasParse(eraName, format2, strict) {
  3167. var i, l, eras = this.eras(), name, abbr, narrow;
  3168. eraName = eraName.toUpperCase();
  3169. for (i = 0, l = eras.length; i < l; ++i) {
  3170. name = eras[i].name.toUpperCase();
  3171. abbr = eras[i].abbr.toUpperCase();
  3172. narrow = eras[i].narrow.toUpperCase();
  3173. if (strict) {
  3174. switch (format2) {
  3175. case "N":
  3176. case "NN":
  3177. case "NNN":
  3178. if (abbr === eraName) {
  3179. return eras[i];
  3180. }
  3181. break;
  3182. case "NNNN":
  3183. if (name === eraName) {
  3184. return eras[i];
  3185. }
  3186. break;
  3187. case "NNNNN":
  3188. if (narrow === eraName) {
  3189. return eras[i];
  3190. }
  3191. break;
  3192. }
  3193. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  3194. return eras[i];
  3195. }
  3196. }
  3197. }
  3198. function localeErasConvertYear(era, year) {
  3199. var dir = era.since <= era.until ? 1 : -1;
  3200. if (year === void 0) {
  3201. return hooks(era.since).year();
  3202. } else {
  3203. return hooks(era.since).year() + (year - era.offset) * dir;
  3204. }
  3205. }
  3206. function getEraName() {
  3207. var i, l, val, eras = this.localeData().eras();
  3208. for (i = 0, l = eras.length; i < l; ++i) {
  3209. val = this.clone().startOf("day").valueOf();
  3210. if (eras[i].since <= val && val <= eras[i].until) {
  3211. return eras[i].name;
  3212. }
  3213. if (eras[i].until <= val && val <= eras[i].since) {
  3214. return eras[i].name;
  3215. }
  3216. }
  3217. return "";
  3218. }
  3219. function getEraNarrow() {
  3220. var i, l, val, eras = this.localeData().eras();
  3221. for (i = 0, l = eras.length; i < l; ++i) {
  3222. val = this.clone().startOf("day").valueOf();
  3223. if (eras[i].since <= val && val <= eras[i].until) {
  3224. return eras[i].narrow;
  3225. }
  3226. if (eras[i].until <= val && val <= eras[i].since) {
  3227. return eras[i].narrow;
  3228. }
  3229. }
  3230. return "";
  3231. }
  3232. function getEraAbbr() {
  3233. var i, l, val, eras = this.localeData().eras();
  3234. for (i = 0, l = eras.length; i < l; ++i) {
  3235. val = this.clone().startOf("day").valueOf();
  3236. if (eras[i].since <= val && val <= eras[i].until) {
  3237. return eras[i].abbr;
  3238. }
  3239. if (eras[i].until <= val && val <= eras[i].since) {
  3240. return eras[i].abbr;
  3241. }
  3242. }
  3243. return "";
  3244. }
  3245. function getEraYear() {
  3246. var i, l, dir, val, eras = this.localeData().eras();
  3247. for (i = 0, l = eras.length; i < l; ++i) {
  3248. dir = eras[i].since <= eras[i].until ? 1 : -1;
  3249. val = this.clone().startOf("day").valueOf();
  3250. if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) {
  3251. return (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset;
  3252. }
  3253. }
  3254. return this.year();
  3255. }
  3256. function erasNameRegex(isStrict) {
  3257. if (!hasOwnProp(this, "_erasNameRegex")) {
  3258. computeErasParse.call(this);
  3259. }
  3260. return isStrict ? this._erasNameRegex : this._erasRegex;
  3261. }
  3262. function erasAbbrRegex(isStrict) {
  3263. if (!hasOwnProp(this, "_erasAbbrRegex")) {
  3264. computeErasParse.call(this);
  3265. }
  3266. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  3267. }
  3268. function erasNarrowRegex(isStrict) {
  3269. if (!hasOwnProp(this, "_erasNarrowRegex")) {
  3270. computeErasParse.call(this);
  3271. }
  3272. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  3273. }
  3274. function matchEraAbbr(isStrict, locale2) {
  3275. return locale2.erasAbbrRegex(isStrict);
  3276. }
  3277. function matchEraName(isStrict, locale2) {
  3278. return locale2.erasNameRegex(isStrict);
  3279. }
  3280. function matchEraNarrow(isStrict, locale2) {
  3281. return locale2.erasNarrowRegex(isStrict);
  3282. }
  3283. function matchEraYearOrdinal(isStrict, locale2) {
  3284. return locale2._eraYearOrdinalRegex || matchUnsigned;
  3285. }
  3286. function computeErasParse() {
  3287. var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, erasName, erasAbbr, erasNarrow, eras = this.eras();
  3288. for (i = 0, l = eras.length; i < l; ++i) {
  3289. erasName = regexEscape(eras[i].name);
  3290. erasAbbr = regexEscape(eras[i].abbr);
  3291. erasNarrow = regexEscape(eras[i].narrow);
  3292. namePieces.push(erasName);
  3293. abbrPieces.push(erasAbbr);
  3294. narrowPieces.push(erasNarrow);
  3295. mixedPieces.push(erasName);
  3296. mixedPieces.push(erasAbbr);
  3297. mixedPieces.push(erasNarrow);
  3298. }
  3299. this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  3300. this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
  3301. this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i");
  3302. this._erasNarrowRegex = new RegExp(
  3303. "^(" + narrowPieces.join("|") + ")",
  3304. "i"
  3305. );
  3306. }
  3307. addFormatToken(0, ["gg", 2], 0, function() {
  3308. return this.weekYear() % 100;
  3309. });
  3310. addFormatToken(0, ["GG", 2], 0, function() {
  3311. return this.isoWeekYear() % 100;
  3312. });
  3313. function addWeekYearFormatToken(token2, getter) {
  3314. addFormatToken(0, [token2, token2.length], 0, getter);
  3315. }
  3316. addWeekYearFormatToken("gggg", "weekYear");
  3317. addWeekYearFormatToken("ggggg", "weekYear");
  3318. addWeekYearFormatToken("GGGG", "isoWeekYear");
  3319. addWeekYearFormatToken("GGGGG", "isoWeekYear");
  3320. addRegexToken("G", matchSigned);
  3321. addRegexToken("g", matchSigned);
  3322. addRegexToken("GG", match1to2, match2);
  3323. addRegexToken("gg", match1to2, match2);
  3324. addRegexToken("GGGG", match1to4, match4);
  3325. addRegexToken("gggg", match1to4, match4);
  3326. addRegexToken("GGGGG", match1to6, match6);
  3327. addRegexToken("ggggg", match1to6, match6);
  3328. addWeekParseToken(
  3329. ["gggg", "ggggg", "GGGG", "GGGGG"],
  3330. function(input, week, config, token2) {
  3331. week[token2.substr(0, 2)] = toInt(input);
  3332. }
  3333. );
  3334. addWeekParseToken(["gg", "GG"], function(input, week, config, token2) {
  3335. week[token2] = hooks.parseTwoDigitYear(input);
  3336. });
  3337. function getSetWeekYear(input) {
  3338. return getSetWeekYearHelper.call(
  3339. this,
  3340. input,
  3341. this.week(),
  3342. this.weekday() + this.localeData()._week.dow,
  3343. this.localeData()._week.dow,
  3344. this.localeData()._week.doy
  3345. );
  3346. }
  3347. function getSetISOWeekYear(input) {
  3348. return getSetWeekYearHelper.call(
  3349. this,
  3350. input,
  3351. this.isoWeek(),
  3352. this.isoWeekday(),
  3353. 1,
  3354. 4
  3355. );
  3356. }
  3357. function getISOWeeksInYear() {
  3358. return weeksInYear(this.year(), 1, 4);
  3359. }
  3360. function getISOWeeksInISOWeekYear() {
  3361. return weeksInYear(this.isoWeekYear(), 1, 4);
  3362. }
  3363. function getWeeksInYear() {
  3364. var weekInfo = this.localeData()._week;
  3365. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  3366. }
  3367. function getWeeksInWeekYear() {
  3368. var weekInfo = this.localeData()._week;
  3369. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  3370. }
  3371. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  3372. var weeksTarget;
  3373. if (input == null) {
  3374. return weekOfYear(this, dow, doy).year;
  3375. } else {
  3376. weeksTarget = weeksInYear(input, dow, doy);
  3377. if (week > weeksTarget) {
  3378. week = weeksTarget;
  3379. }
  3380. return setWeekAll.call(this, input, week, weekday, dow, doy);
  3381. }
  3382. }
  3383. function setWeekAll(weekYear, week, weekday, dow, doy) {
  3384. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  3385. this.year(date.getUTCFullYear());
  3386. this.month(date.getUTCMonth());
  3387. this.date(date.getUTCDate());
  3388. return this;
  3389. }
  3390. addFormatToken("Q", 0, "Qo", "quarter");
  3391. addRegexToken("Q", match1);
  3392. addParseToken("Q", function(input, array) {
  3393. array[MONTH] = (toInt(input) - 1) * 3;
  3394. });
  3395. function getSetQuarter(input) {
  3396. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  3397. }
  3398. addFormatToken("D", ["DD", 2], "Do", "date");
  3399. addRegexToken("D", match1to2, match1to2NoLeadingZero);
  3400. addRegexToken("DD", match1to2, match2);
  3401. addRegexToken("Do", function(isStrict, locale2) {
  3402. return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient;
  3403. });
  3404. addParseToken(["D", "DD"], DATE);
  3405. addParseToken("Do", function(input, array) {
  3406. array[DATE] = toInt(input.match(match1to2)[0]);
  3407. });
  3408. var getSetDayOfMonth = makeGetSet("Date", true);
  3409. addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
  3410. addRegexToken("DDD", match1to3);
  3411. addRegexToken("DDDD", match3);
  3412. addParseToken(["DDD", "DDDD"], function(input, array, config) {
  3413. config._dayOfYear = toInt(input);
  3414. });
  3415. function getSetDayOfYear(input) {
  3416. var dayOfYear = Math.round(
  3417. (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
  3418. ) + 1;
  3419. return input == null ? dayOfYear : this.add(input - dayOfYear, "d");
  3420. }
  3421. addFormatToken("m", ["mm", 2], 0, "minute");
  3422. addRegexToken("m", match1to2, match1to2HasZero);
  3423. addRegexToken("mm", match1to2, match2);
  3424. addParseToken(["m", "mm"], MINUTE);
  3425. var getSetMinute = makeGetSet("Minutes", false);
  3426. addFormatToken("s", ["ss", 2], 0, "second");
  3427. addRegexToken("s", match1to2, match1to2HasZero);
  3428. addRegexToken("ss", match1to2, match2);
  3429. addParseToken(["s", "ss"], SECOND);
  3430. var getSetSecond = makeGetSet("Seconds", false);
  3431. addFormatToken("S", 0, 0, function() {
  3432. return ~~(this.millisecond() / 100);
  3433. });
  3434. addFormatToken(0, ["SS", 2], 0, function() {
  3435. return ~~(this.millisecond() / 10);
  3436. });
  3437. addFormatToken(0, ["SSS", 3], 0, "millisecond");
  3438. addFormatToken(0, ["SSSS", 4], 0, function() {
  3439. return this.millisecond() * 10;
  3440. });
  3441. addFormatToken(0, ["SSSSS", 5], 0, function() {
  3442. return this.millisecond() * 100;
  3443. });
  3444. addFormatToken(0, ["SSSSSS", 6], 0, function() {
  3445. return this.millisecond() * 1e3;
  3446. });
  3447. addFormatToken(0, ["SSSSSSS", 7], 0, function() {
  3448. return this.millisecond() * 1e4;
  3449. });
  3450. addFormatToken(0, ["SSSSSSSS", 8], 0, function() {
  3451. return this.millisecond() * 1e5;
  3452. });
  3453. addFormatToken(0, ["SSSSSSSSS", 9], 0, function() {
  3454. return this.millisecond() * 1e6;
  3455. });
  3456. addRegexToken("S", match1to3, match1);
  3457. addRegexToken("SS", match1to3, match2);
  3458. addRegexToken("SSS", match1to3, match3);
  3459. var token;
  3460. var getSetMillisecond;
  3461. for (token = "SSSS"; token.length <= 9; token += "S") {
  3462. addRegexToken(token, matchUnsigned);
  3463. }
  3464. function parseMs(input, array) {
  3465. array[MILLISECOND] = toInt(("0." + input) * 1e3);
  3466. }
  3467. for (token = "S"; token.length <= 9; token += "S") {
  3468. addParseToken(token, parseMs);
  3469. }
  3470. getSetMillisecond = makeGetSet("Milliseconds", false);
  3471. addFormatToken("z", 0, 0, "zoneAbbr");
  3472. addFormatToken("zz", 0, 0, "zoneName");
  3473. function getZoneAbbr() {
  3474. return this._isUTC ? "UTC" : "";
  3475. }
  3476. function getZoneName() {
  3477. return this._isUTC ? "Coordinated Universal Time" : "";
  3478. }
  3479. var proto = Moment.prototype;
  3480. proto.add = add;
  3481. proto.calendar = calendar$1;
  3482. proto.clone = clone;
  3483. proto.diff = diff;
  3484. proto.endOf = endOf;
  3485. proto.format = format;
  3486. proto.from = from;
  3487. proto.fromNow = fromNow;
  3488. proto.to = to;
  3489. proto.toNow = toNow;
  3490. proto.get = stringGet;
  3491. proto.invalidAt = invalidAt;
  3492. proto.isAfter = isAfter;
  3493. proto.isBefore = isBefore;
  3494. proto.isBetween = isBetween;
  3495. proto.isSame = isSame;
  3496. proto.isSameOrAfter = isSameOrAfter;
  3497. proto.isSameOrBefore = isSameOrBefore;
  3498. proto.isValid = isValid$2;
  3499. proto.lang = lang;
  3500. proto.locale = locale;
  3501. proto.localeData = localeData;
  3502. proto.max = prototypeMax;
  3503. proto.min = prototypeMin;
  3504. proto.parsingFlags = parsingFlags;
  3505. proto.set = stringSet;
  3506. proto.startOf = startOf;
  3507. proto.subtract = subtract;
  3508. proto.toArray = toArray;
  3509. proto.toObject = toObject;
  3510. proto.toDate = toDate;
  3511. proto.toISOString = toISOString;
  3512. proto.inspect = inspect;
  3513. if (typeof Symbol !== "undefined" && Symbol.for != null) {
  3514. proto[Symbol.for("nodejs.util.inspect.custom")] = function() {
  3515. return "Moment<" + this.format() + ">";
  3516. };
  3517. }
  3518. proto.toJSON = toJSON;
  3519. proto.toString = toString;
  3520. proto.unix = unix;
  3521. proto.valueOf = valueOf;
  3522. proto.creationData = creationData;
  3523. proto.eraName = getEraName;
  3524. proto.eraNarrow = getEraNarrow;
  3525. proto.eraAbbr = getEraAbbr;
  3526. proto.eraYear = getEraYear;
  3527. proto.year = getSetYear;
  3528. proto.isLeapYear = getIsLeapYear;
  3529. proto.weekYear = getSetWeekYear;
  3530. proto.isoWeekYear = getSetISOWeekYear;
  3531. proto.quarter = proto.quarters = getSetQuarter;
  3532. proto.month = getSetMonth;
  3533. proto.daysInMonth = getDaysInMonth;
  3534. proto.week = proto.weeks = getSetWeek;
  3535. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  3536. proto.weeksInYear = getWeeksInYear;
  3537. proto.weeksInWeekYear = getWeeksInWeekYear;
  3538. proto.isoWeeksInYear = getISOWeeksInYear;
  3539. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  3540. proto.date = getSetDayOfMonth;
  3541. proto.day = proto.days = getSetDayOfWeek;
  3542. proto.weekday = getSetLocaleDayOfWeek;
  3543. proto.isoWeekday = getSetISODayOfWeek;
  3544. proto.dayOfYear = getSetDayOfYear;
  3545. proto.hour = proto.hours = getSetHour;
  3546. proto.minute = proto.minutes = getSetMinute;
  3547. proto.second = proto.seconds = getSetSecond;
  3548. proto.millisecond = proto.milliseconds = getSetMillisecond;
  3549. proto.utcOffset = getSetOffset;
  3550. proto.utc = setOffsetToUTC;
  3551. proto.local = setOffsetToLocal;
  3552. proto.parseZone = setOffsetToParsedOffset;
  3553. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  3554. proto.isDST = isDaylightSavingTime;
  3555. proto.isLocal = isLocal;
  3556. proto.isUtcOffset = isUtcOffset;
  3557. proto.isUtc = isUtc;
  3558. proto.isUTC = isUtc;
  3559. proto.zoneAbbr = getZoneAbbr;
  3560. proto.zoneName = getZoneName;
  3561. proto.dates = deprecate(
  3562. "dates accessor is deprecated. Use date instead.",
  3563. getSetDayOfMonth
  3564. );
  3565. proto.months = deprecate(
  3566. "months accessor is deprecated. Use month instead",
  3567. getSetMonth
  3568. );
  3569. proto.years = deprecate(
  3570. "years accessor is deprecated. Use year instead",
  3571. getSetYear
  3572. );
  3573. proto.zone = deprecate(
  3574. "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
  3575. getSetZone
  3576. );
  3577. proto.isDSTShifted = deprecate(
  3578. "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
  3579. isDaylightSavingTimeShifted
  3580. );
  3581. function createUnix(input) {
  3582. return createLocal(input * 1e3);
  3583. }
  3584. function createInZone() {
  3585. return createLocal.apply(null, arguments).parseZone();
  3586. }
  3587. function preParsePostFormat(string) {
  3588. return string;
  3589. }
  3590. var proto$1 = Locale.prototype;
  3591. proto$1.calendar = calendar;
  3592. proto$1.longDateFormat = longDateFormat;
  3593. proto$1.invalidDate = invalidDate;
  3594. proto$1.ordinal = ordinal;
  3595. proto$1.preparse = preParsePostFormat;
  3596. proto$1.postformat = preParsePostFormat;
  3597. proto$1.relativeTime = relativeTime;
  3598. proto$1.pastFuture = pastFuture;
  3599. proto$1.set = set;
  3600. proto$1.eras = localeEras;
  3601. proto$1.erasParse = localeErasParse;
  3602. proto$1.erasConvertYear = localeErasConvertYear;
  3603. proto$1.erasAbbrRegex = erasAbbrRegex;
  3604. proto$1.erasNameRegex = erasNameRegex;
  3605. proto$1.erasNarrowRegex = erasNarrowRegex;
  3606. proto$1.months = localeMonths;
  3607. proto$1.monthsShort = localeMonthsShort;
  3608. proto$1.monthsParse = localeMonthsParse;
  3609. proto$1.monthsRegex = monthsRegex;
  3610. proto$1.monthsShortRegex = monthsShortRegex;
  3611. proto$1.week = localeWeek;
  3612. proto$1.firstDayOfYear = localeFirstDayOfYear;
  3613. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  3614. proto$1.weekdays = localeWeekdays;
  3615. proto$1.weekdaysMin = localeWeekdaysMin;
  3616. proto$1.weekdaysShort = localeWeekdaysShort;
  3617. proto$1.weekdaysParse = localeWeekdaysParse;
  3618. proto$1.weekdaysRegex = weekdaysRegex;
  3619. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  3620. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  3621. proto$1.isPM = localeIsPM;
  3622. proto$1.meridiem = localeMeridiem;
  3623. function get$1(format2, index, field, setter) {
  3624. var locale2 = getLocale(), utc = createUTC().set(setter, index);
  3625. return locale2[field](utc, format2);
  3626. }
  3627. function listMonthsImpl(format2, index, field) {
  3628. if (isNumber(format2)) {
  3629. index = format2;
  3630. format2 = void 0;
  3631. }
  3632. format2 = format2 || "";
  3633. if (index != null) {
  3634. return get$1(format2, index, field, "month");
  3635. }
  3636. var i, out = [];
  3637. for (i = 0; i < 12; i++) {
  3638. out[i] = get$1(format2, i, field, "month");
  3639. }
  3640. return out;
  3641. }
  3642. function listWeekdaysImpl(localeSorted, format2, index, field) {
  3643. if (typeof localeSorted === "boolean") {
  3644. if (isNumber(format2)) {
  3645. index = format2;
  3646. format2 = void 0;
  3647. }
  3648. format2 = format2 || "";
  3649. } else {
  3650. format2 = localeSorted;
  3651. index = format2;
  3652. localeSorted = false;
  3653. if (isNumber(format2)) {
  3654. index = format2;
  3655. format2 = void 0;
  3656. }
  3657. format2 = format2 || "";
  3658. }
  3659. var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i, out = [];
  3660. if (index != null) {
  3661. return get$1(format2, (index + shift) % 7, field, "day");
  3662. }
  3663. for (i = 0; i < 7; i++) {
  3664. out[i] = get$1(format2, (i + shift) % 7, field, "day");
  3665. }
  3666. return out;
  3667. }
  3668. function listMonths(format2, index) {
  3669. return listMonthsImpl(format2, index, "months");
  3670. }
  3671. function listMonthsShort(format2, index) {
  3672. return listMonthsImpl(format2, index, "monthsShort");
  3673. }
  3674. function listWeekdays(localeSorted, format2, index) {
  3675. return listWeekdaysImpl(localeSorted, format2, index, "weekdays");
  3676. }
  3677. function listWeekdaysShort(localeSorted, format2, index) {
  3678. return listWeekdaysImpl(localeSorted, format2, index, "weekdaysShort");
  3679. }
  3680. function listWeekdaysMin(localeSorted, format2, index) {
  3681. return listWeekdaysImpl(localeSorted, format2, index, "weekdaysMin");
  3682. }
  3683. getSetGlobalLocale("en", {
  3684. eras: [
  3685. {
  3686. since: "0001-01-01",
  3687. until: Infinity,
  3688. offset: 1,
  3689. name: "Anno Domini",
  3690. narrow: "AD",
  3691. abbr: "AD"
  3692. },
  3693. {
  3694. since: "0000-12-31",
  3695. until: -Infinity,
  3696. offset: 1,
  3697. name: "Before Christ",
  3698. narrow: "BC",
  3699. abbr: "BC"
  3700. }
  3701. ],
  3702. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  3703. ordinal: function(number) {
  3704. var b = number % 10, output = toInt(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
  3705. return number + output;
  3706. }
  3707. });
  3708. hooks.lang = deprecate(
  3709. "moment.lang is deprecated. Use moment.locale instead.",
  3710. getSetGlobalLocale
  3711. );
  3712. hooks.langData = deprecate(
  3713. "moment.langData is deprecated. Use moment.localeData instead.",
  3714. getLocale
  3715. );
  3716. var mathAbs = Math.abs;
  3717. function abs() {
  3718. var data = this._data;
  3719. this._milliseconds = mathAbs(this._milliseconds);
  3720. this._days = mathAbs(this._days);
  3721. this._months = mathAbs(this._months);
  3722. data.milliseconds = mathAbs(data.milliseconds);
  3723. data.seconds = mathAbs(data.seconds);
  3724. data.minutes = mathAbs(data.minutes);
  3725. data.hours = mathAbs(data.hours);
  3726. data.months = mathAbs(data.months);
  3727. data.years = mathAbs(data.years);
  3728. return this;
  3729. }
  3730. function addSubtract$1(duration, input, value, direction) {
  3731. var other = createDuration(input, value);
  3732. duration._milliseconds += direction * other._milliseconds;
  3733. duration._days += direction * other._days;
  3734. duration._months += direction * other._months;
  3735. return duration._bubble();
  3736. }
  3737. function add$1(input, value) {
  3738. return addSubtract$1(this, input, value, 1);
  3739. }
  3740. function subtract$1(input, value) {
  3741. return addSubtract$1(this, input, value, -1);
  3742. }
  3743. function absCeil(number) {
  3744. if (number < 0) {
  3745. return Math.floor(number);
  3746. } else {
  3747. return Math.ceil(number);
  3748. }
  3749. }
  3750. function bubble() {
  3751. var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
  3752. if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) {
  3753. milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5;
  3754. days2 = 0;
  3755. months2 = 0;
  3756. }
  3757. data.milliseconds = milliseconds2 % 1e3;
  3758. seconds2 = absFloor(milliseconds2 / 1e3);
  3759. data.seconds = seconds2 % 60;
  3760. minutes2 = absFloor(seconds2 / 60);
  3761. data.minutes = minutes2 % 60;
  3762. hours2 = absFloor(minutes2 / 60);
  3763. data.hours = hours2 % 24;
  3764. days2 += absFloor(hours2 / 24);
  3765. monthsFromDays = absFloor(daysToMonths(days2));
  3766. months2 += monthsFromDays;
  3767. days2 -= absCeil(monthsToDays(monthsFromDays));
  3768. years2 = absFloor(months2 / 12);
  3769. months2 %= 12;
  3770. data.days = days2;
  3771. data.months = months2;
  3772. data.years = years2;
  3773. return this;
  3774. }
  3775. function daysToMonths(days2) {
  3776. return days2 * 4800 / 146097;
  3777. }
  3778. function monthsToDays(months2) {
  3779. return months2 * 146097 / 4800;
  3780. }
  3781. function as(units) {
  3782. if (!this.isValid()) {
  3783. return NaN;
  3784. }
  3785. var days2, months2, milliseconds2 = this._milliseconds;
  3786. units = normalizeUnits(units);
  3787. if (units === "month" || units === "quarter" || units === "year") {
  3788. days2 = this._days + milliseconds2 / 864e5;
  3789. months2 = this._months + daysToMonths(days2);
  3790. switch (units) {
  3791. case "month":
  3792. return months2;
  3793. case "quarter":
  3794. return months2 / 3;
  3795. case "year":
  3796. return months2 / 12;
  3797. }
  3798. } else {
  3799. days2 = this._days + Math.round(monthsToDays(this._months));
  3800. switch (units) {
  3801. case "week":
  3802. return days2 / 7 + milliseconds2 / 6048e5;
  3803. case "day":
  3804. return days2 + milliseconds2 / 864e5;
  3805. case "hour":
  3806. return days2 * 24 + milliseconds2 / 36e5;
  3807. case "minute":
  3808. return days2 * 1440 + milliseconds2 / 6e4;
  3809. case "second":
  3810. return days2 * 86400 + milliseconds2 / 1e3;
  3811. case "millisecond":
  3812. return Math.floor(days2 * 864e5) + milliseconds2;
  3813. default:
  3814. throw new Error("Unknown unit " + units);
  3815. }
  3816. }
  3817. }
  3818. function makeAs(alias) {
  3819. return function() {
  3820. return this.as(alias);
  3821. };
  3822. }
  3823. var asMilliseconds = makeAs("ms");
  3824. var asSeconds = makeAs("s");
  3825. var asMinutes = makeAs("m");
  3826. var asHours = makeAs("h");
  3827. var asDays = makeAs("d");
  3828. var asWeeks = makeAs("w");
  3829. var asMonths = makeAs("M");
  3830. var asQuarters = makeAs("Q");
  3831. var asYears = makeAs("y");
  3832. var valueOf$1 = asMilliseconds;
  3833. function clone$1() {
  3834. return createDuration(this);
  3835. }
  3836. function get$2(units) {
  3837. units = normalizeUnits(units);
  3838. return this.isValid() ? this[units + "s"]() : NaN;
  3839. }
  3840. function makeGetter(name) {
  3841. return function() {
  3842. return this.isValid() ? this._data[name] : NaN;
  3843. };
  3844. }
  3845. var milliseconds = makeGetter("milliseconds");
  3846. var seconds = makeGetter("seconds");
  3847. var minutes = makeGetter("minutes");
  3848. var hours = makeGetter("hours");
  3849. var days = makeGetter("days");
  3850. var months = makeGetter("months");
  3851. var years = makeGetter("years");
  3852. function weeks() {
  3853. return absFloor(this.days() / 7);
  3854. }
  3855. var round = Math.round;
  3856. var thresholds = {
  3857. ss: 44,
  3858. // a few seconds to seconds
  3859. s: 45,
  3860. // seconds to minute
  3861. m: 45,
  3862. // minutes to hour
  3863. h: 22,
  3864. // hours to day
  3865. d: 26,
  3866. // days to month/week
  3867. w: null,
  3868. // weeks to month
  3869. M: 11
  3870. // months to year
  3871. };
  3872. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale2) {
  3873. return locale2.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  3874. }
  3875. function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) {
  3876. var duration = createDuration(posNegDuration).abs(), seconds2 = round(duration.as("s")), minutes2 = round(duration.as("m")), hours2 = round(duration.as("h")), days2 = round(duration.as("d")), months2 = round(duration.as("M")), weeks2 = round(duration.as("w")), years2 = round(duration.as("y")), a = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2];
  3877. if (thresholds2.w != null) {
  3878. a = a || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2];
  3879. }
  3880. a = a || months2 <= 1 && ["M"] || months2 < thresholds2.M && ["MM", months2] || years2 <= 1 && ["y"] || ["yy", years2];
  3881. a[2] = withoutSuffix;
  3882. a[3] = +posNegDuration > 0;
  3883. a[4] = locale2;
  3884. return substituteTimeAgo.apply(null, a);
  3885. }
  3886. function getSetRelativeTimeRounding(roundingFunction) {
  3887. if (roundingFunction === void 0) {
  3888. return round;
  3889. }
  3890. if (typeof roundingFunction === "function") {
  3891. round = roundingFunction;
  3892. return true;
  3893. }
  3894. return false;
  3895. }
  3896. function getSetRelativeTimeThreshold(threshold, limit) {
  3897. if (thresholds[threshold] === void 0) {
  3898. return false;
  3899. }
  3900. if (limit === void 0) {
  3901. return thresholds[threshold];
  3902. }
  3903. thresholds[threshold] = limit;
  3904. if (threshold === "s") {
  3905. thresholds.ss = limit - 1;
  3906. }
  3907. return true;
  3908. }
  3909. function humanize(argWithSuffix, argThresholds) {
  3910. if (!this.isValid()) {
  3911. return this.localeData().invalidDate();
  3912. }
  3913. var withSuffix = false, th = thresholds, locale2, output;
  3914. if (typeof argWithSuffix === "object") {
  3915. argThresholds = argWithSuffix;
  3916. argWithSuffix = false;
  3917. }
  3918. if (typeof argWithSuffix === "boolean") {
  3919. withSuffix = argWithSuffix;
  3920. }
  3921. if (typeof argThresholds === "object") {
  3922. th = Object.assign({}, thresholds, argThresholds);
  3923. if (argThresholds.s != null && argThresholds.ss == null) {
  3924. th.ss = argThresholds.s - 1;
  3925. }
  3926. }
  3927. locale2 = this.localeData();
  3928. output = relativeTime$1(this, !withSuffix, th, locale2);
  3929. if (withSuffix) {
  3930. output = locale2.pastFuture(+this, output);
  3931. }
  3932. return locale2.postformat(output);
  3933. }
  3934. var abs$1 = Math.abs;
  3935. function sign(x) {
  3936. return (x > 0) - (x < 0) || +x;
  3937. }
  3938. function toISOString$1() {
  3939. if (!this.isValid()) {
  3940. return this.localeData().invalidDate();
  3941. }
  3942. var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
  3943. if (!total) {
  3944. return "P0D";
  3945. }
  3946. minutes2 = absFloor(seconds2 / 60);
  3947. hours2 = absFloor(minutes2 / 60);
  3948. seconds2 %= 60;
  3949. minutes2 %= 60;
  3950. years2 = absFloor(months2 / 12);
  3951. months2 %= 12;
  3952. s = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : "";
  3953. totalSign = total < 0 ? "-" : "";
  3954. ymSign = sign(this._months) !== sign(total) ? "-" : "";
  3955. daysSign = sign(this._days) !== sign(total) ? "-" : "";
  3956. hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "";
  3957. return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s + "S" : "");
  3958. }
  3959. var proto$2 = Duration.prototype;
  3960. proto$2.isValid = isValid$1;
  3961. proto$2.abs = abs;
  3962. proto$2.add = add$1;
  3963. proto$2.subtract = subtract$1;
  3964. proto$2.as = as;
  3965. proto$2.asMilliseconds = asMilliseconds;
  3966. proto$2.asSeconds = asSeconds;
  3967. proto$2.asMinutes = asMinutes;
  3968. proto$2.asHours = asHours;
  3969. proto$2.asDays = asDays;
  3970. proto$2.asWeeks = asWeeks;
  3971. proto$2.asMonths = asMonths;
  3972. proto$2.asQuarters = asQuarters;
  3973. proto$2.asYears = asYears;
  3974. proto$2.valueOf = valueOf$1;
  3975. proto$2._bubble = bubble;
  3976. proto$2.clone = clone$1;
  3977. proto$2.get = get$2;
  3978. proto$2.milliseconds = milliseconds;
  3979. proto$2.seconds = seconds;
  3980. proto$2.minutes = minutes;
  3981. proto$2.hours = hours;
  3982. proto$2.days = days;
  3983. proto$2.weeks = weeks;
  3984. proto$2.months = months;
  3985. proto$2.years = years;
  3986. proto$2.humanize = humanize;
  3987. proto$2.toISOString = toISOString$1;
  3988. proto$2.toString = toISOString$1;
  3989. proto$2.toJSON = toISOString$1;
  3990. proto$2.locale = locale;
  3991. proto$2.localeData = localeData;
  3992. proto$2.toIsoString = deprecate(
  3993. "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
  3994. toISOString$1
  3995. );
  3996. proto$2.lang = lang;
  3997. addFormatToken("X", 0, 0, "unix");
  3998. addFormatToken("x", 0, 0, "valueOf");
  3999. addRegexToken("x", matchSigned);
  4000. addRegexToken("X", matchTimestamp);
  4001. addParseToken("X", function(input, array, config) {
  4002. config._d = new Date(parseFloat(input) * 1e3);
  4003. });
  4004. addParseToken("x", function(input, array, config) {
  4005. config._d = new Date(toInt(input));
  4006. });
  4007. hooks.version = "2.30.1";
  4008. setHookCallback(createLocal);
  4009. hooks.fn = proto;
  4010. hooks.min = min;
  4011. hooks.max = max;
  4012. hooks.now = now;
  4013. hooks.utc = createUTC;
  4014. hooks.unix = createUnix;
  4015. hooks.months = listMonths;
  4016. hooks.isDate = isDate;
  4017. hooks.locale = getSetGlobalLocale;
  4018. hooks.invalid = createInvalid;
  4019. hooks.duration = createDuration;
  4020. hooks.isMoment = isMoment;
  4021. hooks.weekdays = listWeekdays;
  4022. hooks.parseZone = createInZone;
  4023. hooks.localeData = getLocale;
  4024. hooks.isDuration = isDuration;
  4025. hooks.monthsShort = listMonthsShort;
  4026. hooks.weekdaysMin = listWeekdaysMin;
  4027. hooks.defineLocale = defineLocale;
  4028. hooks.updateLocale = updateLocale;
  4029. hooks.locales = listLocales;
  4030. hooks.weekdaysShort = listWeekdaysShort;
  4031. hooks.normalizeUnits = normalizeUnits;
  4032. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  4033. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  4034. hooks.calendarFormat = getCalendarFormat;
  4035. hooks.prototype = proto;
  4036. hooks.HTML5_FMT = {
  4037. DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
  4038. // <input type="datetime-local" />
  4039. DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
  4040. // <input type="datetime-local" step="1" />
  4041. DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
  4042. // <input type="datetime-local" step="0.001" />
  4043. DATE: "YYYY-MM-DD",
  4044. // <input type="date" />
  4045. TIME: "HH:mm",
  4046. // <input type="time" />
  4047. TIME_SECONDS: "HH:mm:ss",
  4048. // <input type="time" step="1" />
  4049. TIME_MS: "HH:mm:ss.SSS",
  4050. // <input type="time" step="0.001" />
  4051. WEEK: "GGGG-[W]WW",
  4052. // <input type="week" />
  4053. MONTH: "YYYY-MM"
  4054. // <input type="month" />
  4055. };
  4056. var moment_default = hooks;
  4057. export {
  4058. moment_default as default
  4059. };
  4060. /*! Bundled license information:
  4061. moment/dist/moment.js:
  4062. (*! moment.js *)
  4063. (*! version : 2.30.1 *)
  4064. (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
  4065. (*! license : MIT *)
  4066. (*! momentjs.com *)
  4067. */
  4068. //# sourceMappingURL=moment.js.map