chunk-5ZFLGPRZ.js 118 KB

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