cdn.js 232 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598
  1. function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _createForOfIteratorHelper(o, allowArrayLike) {var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];if (!it) {if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {if (it) o = it;var i = 0;var F = function F() {};return { s: F, n: function n() {if (i >= o.length) return { done: true };return { done: false, value: o[i++] };}, e: function e(_e) {throw _e;}, f: F };}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion = true,didErr = false,err;return { s: function s() {it = it.call(o);}, n: function n() {var step = it.next();normalCompletion = step.done;return step;}, e: function e(_e2) {didErr = true;err = _e2;}, f: function f() {try {if (!normalCompletion && it.return != null) it.return();} finally {if (didErr) throw err;}} };}function _callSuper(t, o, e) {return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;} else if (call !== void 0) {throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct() {try {var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));} catch (t) {}return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {return !!t;})();}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });Object.defineProperty(subClass, "prototype", { writable: false });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);Object.defineProperty(Constructor, "prototype", { writable: false });return Constructor;}function _defineProperty(obj, key, value) {key = _toPropertyKey(key);if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == _typeof(i) ? i : String(i);}function _toPrimitive(t, r) {if ("object" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != _typeof(i)) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];return arr2;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);}(function () {var __defProp = Object.defineProperty;
  2. var __export = function __export(target, all) {
  3. for (var name in all)
  4. __defProp(target, name, {
  5. get: all[name],
  6. enumerable: true,
  7. configurable: true,
  8. set: function set(newValue) {return all[name] = function () {return newValue;};}
  9. });
  10. };
  11. // lib/index.mjs
  12. var exports_lib = {};
  13. __export(exports_lib, {
  14. yearsToQuarters: function yearsToQuarters() {
  15. {
  16. return _yearsToQuarters;
  17. }
  18. },
  19. yearsToMonths: function yearsToMonths() {
  20. {
  21. return _yearsToMonths;
  22. }
  23. },
  24. yearsToDays: function yearsToDays() {
  25. {
  26. return _yearsToDays;
  27. }
  28. },
  29. weeksToDays: function weeksToDays() {
  30. {
  31. return _weeksToDays;
  32. }
  33. },
  34. transpose: function transpose() {
  35. {
  36. return _transpose;
  37. }
  38. },
  39. toDate: function toDate() {
  40. {
  41. return _toDate;
  42. }
  43. },
  44. subYears: function subYears() {
  45. {
  46. return _subYears;
  47. }
  48. },
  49. subWeeks: function subWeeks() {
  50. {
  51. return _subWeeks;
  52. }
  53. },
  54. subSeconds: function subSeconds() {
  55. {
  56. return _subSeconds;
  57. }
  58. },
  59. subQuarters: function subQuarters() {
  60. {
  61. return _subQuarters;
  62. }
  63. },
  64. subMonths: function subMonths() {
  65. {
  66. return _subMonths;
  67. }
  68. },
  69. subMinutes: function subMinutes() {
  70. {
  71. return _subMinutes;
  72. }
  73. },
  74. subMilliseconds: function subMilliseconds() {
  75. {
  76. return _subMilliseconds;
  77. }
  78. },
  79. subISOWeekYears: function subISOWeekYears() {
  80. {
  81. return _subISOWeekYears;
  82. }
  83. },
  84. subHours: function subHours() {
  85. {
  86. return _subHours;
  87. }
  88. },
  89. subDays: function subDays() {
  90. {
  91. return _subDays;
  92. }
  93. },
  94. subBusinessDays: function subBusinessDays() {
  95. {
  96. return _subBusinessDays;
  97. }
  98. },
  99. sub: function sub() {
  100. {
  101. return _sub;
  102. }
  103. },
  104. startOfYesterday: function startOfYesterday() {
  105. {
  106. return _startOfYesterday;
  107. }
  108. },
  109. startOfYear: function startOfYear() {
  110. {
  111. return _startOfYear;
  112. }
  113. },
  114. startOfWeekYear: function startOfWeekYear() {
  115. {
  116. return _startOfWeekYear;
  117. }
  118. },
  119. startOfWeek: function startOfWeek() {
  120. {
  121. return _startOfWeek;
  122. }
  123. },
  124. startOfTomorrow: function startOfTomorrow() {
  125. {
  126. return _startOfTomorrow;
  127. }
  128. },
  129. startOfToday: function startOfToday() {
  130. {
  131. return _startOfToday;
  132. }
  133. },
  134. startOfSecond: function startOfSecond() {
  135. {
  136. return _startOfSecond;
  137. }
  138. },
  139. startOfQuarter: function startOfQuarter() {
  140. {
  141. return _startOfQuarter;
  142. }
  143. },
  144. startOfMonth: function startOfMonth() {
  145. {
  146. return _startOfMonth;
  147. }
  148. },
  149. startOfMinute: function startOfMinute() {
  150. {
  151. return _startOfMinute;
  152. }
  153. },
  154. startOfISOWeekYear: function startOfISOWeekYear() {
  155. {
  156. return _startOfISOWeekYear;
  157. }
  158. },
  159. startOfISOWeek: function startOfISOWeek() {
  160. {
  161. return _startOfISOWeek;
  162. }
  163. },
  164. startOfHour: function startOfHour() {
  165. {
  166. return _startOfHour;
  167. }
  168. },
  169. startOfDecade: function startOfDecade() {
  170. {
  171. return _startOfDecade;
  172. }
  173. },
  174. startOfDay: function startOfDay() {
  175. {
  176. return _startOfDay;
  177. }
  178. },
  179. setYear: function setYear() {
  180. {
  181. return _setYear;
  182. }
  183. },
  184. setWeekYear: function setWeekYear() {
  185. {
  186. return _setWeekYear;
  187. }
  188. },
  189. setWeek: function setWeek() {
  190. {
  191. return _setWeek;
  192. }
  193. },
  194. setSeconds: function setSeconds() {
  195. {
  196. return _setSeconds;
  197. }
  198. },
  199. setQuarter: function setQuarter() {
  200. {
  201. return _setQuarter;
  202. }
  203. },
  204. setMonth: function setMonth() {
  205. {
  206. return _setMonth;
  207. }
  208. },
  209. setMinutes: function setMinutes() {
  210. {
  211. return _setMinutes;
  212. }
  213. },
  214. setMilliseconds: function setMilliseconds() {
  215. {
  216. return _setMilliseconds;
  217. }
  218. },
  219. setISOWeekYear: function setISOWeekYear() {
  220. {
  221. return _setISOWeekYear;
  222. }
  223. },
  224. setISOWeek: function setISOWeek() {
  225. {
  226. return _setISOWeek;
  227. }
  228. },
  229. setISODay: function setISODay() {
  230. {
  231. return _setISODay;
  232. }
  233. },
  234. setHours: function setHours() {
  235. {
  236. return _setHours;
  237. }
  238. },
  239. setDefaultOptions: function setDefaultOptions() {
  240. {
  241. return setDefaultOptions2;
  242. }
  243. },
  244. setDayOfYear: function setDayOfYear() {
  245. {
  246. return _setDayOfYear;
  247. }
  248. },
  249. setDay: function setDay() {
  250. {
  251. return _setDay;
  252. }
  253. },
  254. setDate: function setDate() {
  255. {
  256. return _setDate;
  257. }
  258. },
  259. set: function set() {
  260. {
  261. return _set;
  262. }
  263. },
  264. secondsToMinutes: function secondsToMinutes() {
  265. {
  266. return _secondsToMinutes;
  267. }
  268. },
  269. secondsToMilliseconds: function secondsToMilliseconds() {
  270. {
  271. return _secondsToMilliseconds;
  272. }
  273. },
  274. secondsToHours: function secondsToHours() {
  275. {
  276. return _secondsToHours;
  277. }
  278. },
  279. roundToNearestMinutes: function roundToNearestMinutes() {
  280. {
  281. return _roundToNearestMinutes;
  282. }
  283. },
  284. roundToNearestHours: function roundToNearestHours() {
  285. {
  286. return _roundToNearestHours;
  287. }
  288. },
  289. quartersToYears: function quartersToYears() {
  290. {
  291. return _quartersToYears;
  292. }
  293. },
  294. quartersToMonths: function quartersToMonths() {
  295. {
  296. return _quartersToMonths;
  297. }
  298. },
  299. previousWednesday: function previousWednesday() {
  300. {
  301. return _previousWednesday;
  302. }
  303. },
  304. previousTuesday: function previousTuesday() {
  305. {
  306. return _previousTuesday;
  307. }
  308. },
  309. previousThursday: function previousThursday() {
  310. {
  311. return _previousThursday;
  312. }
  313. },
  314. previousSunday: function previousSunday() {
  315. {
  316. return _previousSunday;
  317. }
  318. },
  319. previousSaturday: function previousSaturday() {
  320. {
  321. return _previousSaturday;
  322. }
  323. },
  324. previousMonday: function previousMonday() {
  325. {
  326. return _previousMonday;
  327. }
  328. },
  329. previousFriday: function previousFriday() {
  330. {
  331. return _previousFriday;
  332. }
  333. },
  334. previousDay: function previousDay() {
  335. {
  336. return _previousDay;
  337. }
  338. },
  339. parsers: function parsers() {
  340. {
  341. return _parsers;
  342. }
  343. },
  344. parseJSON: function parseJSON() {
  345. {
  346. return _parseJSON;
  347. }
  348. },
  349. parseISO: function parseISO() {
  350. {
  351. return _parseISO;
  352. }
  353. },
  354. parse: function parse() {
  355. {
  356. return _parse;
  357. }
  358. },
  359. nextWednesday: function nextWednesday() {
  360. {
  361. return _nextWednesday;
  362. }
  363. },
  364. nextTuesday: function nextTuesday() {
  365. {
  366. return _nextTuesday;
  367. }
  368. },
  369. nextThursday: function nextThursday() {
  370. {
  371. return _nextThursday;
  372. }
  373. },
  374. nextSunday: function nextSunday() {
  375. {
  376. return _nextSunday;
  377. }
  378. },
  379. nextSaturday: function nextSaturday() {
  380. {
  381. return _nextSaturday;
  382. }
  383. },
  384. nextMonday: function nextMonday() {
  385. {
  386. return _nextMonday;
  387. }
  388. },
  389. nextFriday: function nextFriday() {
  390. {
  391. return _nextFriday;
  392. }
  393. },
  394. nextDay: function nextDay() {
  395. {
  396. return _nextDay;
  397. }
  398. },
  399. monthsToYears: function monthsToYears() {
  400. {
  401. return _monthsToYears;
  402. }
  403. },
  404. monthsToQuarters: function monthsToQuarters() {
  405. {
  406. return _monthsToQuarters;
  407. }
  408. },
  409. minutesToSeconds: function minutesToSeconds() {
  410. {
  411. return _minutesToSeconds;
  412. }
  413. },
  414. minutesToMilliseconds: function minutesToMilliseconds() {
  415. {
  416. return _minutesToMilliseconds;
  417. }
  418. },
  419. minutesToHours: function minutesToHours() {
  420. {
  421. return _minutesToHours;
  422. }
  423. },
  424. min: function min() {
  425. {
  426. return _min;
  427. }
  428. },
  429. millisecondsToSeconds: function millisecondsToSeconds() {
  430. {
  431. return _millisecondsToSeconds;
  432. }
  433. },
  434. millisecondsToMinutes: function millisecondsToMinutes() {
  435. {
  436. return _millisecondsToMinutes;
  437. }
  438. },
  439. millisecondsToHours: function millisecondsToHours() {
  440. {
  441. return _millisecondsToHours;
  442. }
  443. },
  444. milliseconds: function milliseconds() {
  445. {
  446. return _milliseconds;
  447. }
  448. },
  449. max: function max() {
  450. {
  451. return _max;
  452. }
  453. },
  454. longFormatters: function longFormatters() {
  455. {
  456. return _longFormatters;
  457. }
  458. },
  459. lightFormatters: function lightFormatters() {
  460. {
  461. return _lightFormatters;
  462. }
  463. },
  464. lightFormat: function lightFormat() {
  465. {
  466. return _lightFormat;
  467. }
  468. },
  469. lastDayOfYear: function lastDayOfYear() {
  470. {
  471. return _lastDayOfYear;
  472. }
  473. },
  474. lastDayOfWeek: function lastDayOfWeek() {
  475. {
  476. return _lastDayOfWeek;
  477. }
  478. },
  479. lastDayOfQuarter: function lastDayOfQuarter() {
  480. {
  481. return _lastDayOfQuarter;
  482. }
  483. },
  484. lastDayOfMonth: function lastDayOfMonth() {
  485. {
  486. return _lastDayOfMonth;
  487. }
  488. },
  489. lastDayOfISOWeekYear: function lastDayOfISOWeekYear() {
  490. {
  491. return _lastDayOfISOWeekYear;
  492. }
  493. },
  494. lastDayOfISOWeek: function lastDayOfISOWeek() {
  495. {
  496. return _lastDayOfISOWeek;
  497. }
  498. },
  499. lastDayOfDecade: function lastDayOfDecade() {
  500. {
  501. return _lastDayOfDecade;
  502. }
  503. },
  504. isYesterday: function isYesterday() {
  505. {
  506. return _isYesterday;
  507. }
  508. },
  509. isWithinInterval: function isWithinInterval() {
  510. {
  511. return _isWithinInterval;
  512. }
  513. },
  514. isWeekend: function isWeekend() {
  515. {
  516. return _isWeekend;
  517. }
  518. },
  519. isWednesday: function isWednesday() {
  520. {
  521. return _isWednesday;
  522. }
  523. },
  524. isValid: function isValid() {
  525. {
  526. return _isValid;
  527. }
  528. },
  529. isTuesday: function isTuesday() {
  530. {
  531. return _isTuesday;
  532. }
  533. },
  534. isTomorrow: function isTomorrow() {
  535. {
  536. return _isTomorrow;
  537. }
  538. },
  539. isToday: function isToday() {
  540. {
  541. return _isToday;
  542. }
  543. },
  544. isThursday: function isThursday() {
  545. {
  546. return _isThursday;
  547. }
  548. },
  549. isThisYear: function isThisYear() {
  550. {
  551. return _isThisYear;
  552. }
  553. },
  554. isThisWeek: function isThisWeek() {
  555. {
  556. return _isThisWeek;
  557. }
  558. },
  559. isThisSecond: function isThisSecond() {
  560. {
  561. return _isThisSecond;
  562. }
  563. },
  564. isThisQuarter: function isThisQuarter() {
  565. {
  566. return _isThisQuarter;
  567. }
  568. },
  569. isThisMonth: function isThisMonth() {
  570. {
  571. return _isThisMonth;
  572. }
  573. },
  574. isThisMinute: function isThisMinute() {
  575. {
  576. return _isThisMinute;
  577. }
  578. },
  579. isThisISOWeek: function isThisISOWeek() {
  580. {
  581. return _isThisISOWeek;
  582. }
  583. },
  584. isThisHour: function isThisHour() {
  585. {
  586. return _isThisHour;
  587. }
  588. },
  589. isSunday: function isSunday() {
  590. {
  591. return _isSunday;
  592. }
  593. },
  594. isSaturday: function isSaturday() {
  595. {
  596. return _isSaturday;
  597. }
  598. },
  599. isSameYear: function isSameYear() {
  600. {
  601. return _isSameYear;
  602. }
  603. },
  604. isSameWeek: function isSameWeek() {
  605. {
  606. return _isSameWeek;
  607. }
  608. },
  609. isSameSecond: function isSameSecond() {
  610. {
  611. return _isSameSecond;
  612. }
  613. },
  614. isSameQuarter: function isSameQuarter() {
  615. {
  616. return _isSameQuarter;
  617. }
  618. },
  619. isSameMonth: function isSameMonth() {
  620. {
  621. return _isSameMonth;
  622. }
  623. },
  624. isSameMinute: function isSameMinute() {
  625. {
  626. return _isSameMinute;
  627. }
  628. },
  629. isSameISOWeekYear: function isSameISOWeekYear() {
  630. {
  631. return _isSameISOWeekYear;
  632. }
  633. },
  634. isSameISOWeek: function isSameISOWeek() {
  635. {
  636. return _isSameISOWeek;
  637. }
  638. },
  639. isSameHour: function isSameHour() {
  640. {
  641. return _isSameHour;
  642. }
  643. },
  644. isSameDay: function isSameDay() {
  645. {
  646. return _isSameDay;
  647. }
  648. },
  649. isPast: function isPast() {
  650. {
  651. return _isPast;
  652. }
  653. },
  654. isMonday: function isMonday() {
  655. {
  656. return _isMonday;
  657. }
  658. },
  659. isMatch: function isMatch() {
  660. {
  661. return _isMatch;
  662. }
  663. },
  664. isLeapYear: function isLeapYear() {
  665. {
  666. return _isLeapYear;
  667. }
  668. },
  669. isLastDayOfMonth: function isLastDayOfMonth() {
  670. {
  671. return _isLastDayOfMonth;
  672. }
  673. },
  674. isFuture: function isFuture() {
  675. {
  676. return _isFuture;
  677. }
  678. },
  679. isFriday: function isFriday() {
  680. {
  681. return _isFriday;
  682. }
  683. },
  684. isFirstDayOfMonth: function isFirstDayOfMonth() {
  685. {
  686. return _isFirstDayOfMonth;
  687. }
  688. },
  689. isExists: function isExists() {
  690. {
  691. return _isExists;
  692. }
  693. },
  694. isEqual: function isEqual() {
  695. {
  696. return _isEqual;
  697. }
  698. },
  699. isDate: function isDate() {
  700. {
  701. return _isDate;
  702. }
  703. },
  704. isBefore: function isBefore() {
  705. {
  706. return _isBefore;
  707. }
  708. },
  709. isAfter: function isAfter() {
  710. {
  711. return _isAfter;
  712. }
  713. },
  714. intlFormatDistance: function intlFormatDistance() {
  715. {
  716. return _intlFormatDistance;
  717. }
  718. },
  719. intlFormat: function intlFormat() {
  720. {
  721. return _intlFormat;
  722. }
  723. },
  724. intervalToDuration: function intervalToDuration() {
  725. {
  726. return _intervalToDuration;
  727. }
  728. },
  729. interval: function interval() {
  730. {
  731. return _interval;
  732. }
  733. },
  734. hoursToSeconds: function hoursToSeconds() {
  735. {
  736. return _hoursToSeconds;
  737. }
  738. },
  739. hoursToMinutes: function hoursToMinutes() {
  740. {
  741. return _hoursToMinutes;
  742. }
  743. },
  744. hoursToMilliseconds: function hoursToMilliseconds() {
  745. {
  746. return _hoursToMilliseconds;
  747. }
  748. },
  749. getYear: function getYear() {
  750. {
  751. return _getYear;
  752. }
  753. },
  754. getWeeksInMonth: function getWeeksInMonth() {
  755. {
  756. return _getWeeksInMonth;
  757. }
  758. },
  759. getWeekYear: function getWeekYear() {
  760. {
  761. return _getWeekYear;
  762. }
  763. },
  764. getWeekOfMonth: function getWeekOfMonth() {
  765. {
  766. return _getWeekOfMonth;
  767. }
  768. },
  769. getWeek: function getWeek() {
  770. {
  771. return _getWeek;
  772. }
  773. },
  774. getUnixTime: function getUnixTime() {
  775. {
  776. return _getUnixTime;
  777. }
  778. },
  779. getTime: function getTime() {
  780. {
  781. return _getTime;
  782. }
  783. },
  784. getSeconds: function getSeconds() {
  785. {
  786. return _getSeconds;
  787. }
  788. },
  789. getQuarter: function getQuarter() {
  790. {
  791. return _getQuarter;
  792. }
  793. },
  794. getOverlappingDaysInIntervals: function getOverlappingDaysInIntervals() {
  795. {
  796. return _getOverlappingDaysInIntervals;
  797. }
  798. },
  799. getMonth: function getMonth() {
  800. {
  801. return _getMonth;
  802. }
  803. },
  804. getMinutes: function getMinutes() {
  805. {
  806. return _getMinutes;
  807. }
  808. },
  809. getMilliseconds: function getMilliseconds() {
  810. {
  811. return _getMilliseconds;
  812. }
  813. },
  814. getISOWeeksInYear: function getISOWeeksInYear() {
  815. {
  816. return _getISOWeeksInYear;
  817. }
  818. },
  819. getISOWeekYear: function getISOWeekYear() {
  820. {
  821. return _getISOWeekYear;
  822. }
  823. },
  824. getISOWeek: function getISOWeek() {
  825. {
  826. return _getISOWeek;
  827. }
  828. },
  829. getISODay: function getISODay() {
  830. {
  831. return _getISODay;
  832. }
  833. },
  834. getHours: function getHours() {
  835. {
  836. return _getHours;
  837. }
  838. },
  839. getDefaultOptions: function getDefaultOptions() {
  840. {
  841. return getDefaultOptions2;
  842. }
  843. },
  844. getDecade: function getDecade() {
  845. {
  846. return _getDecade;
  847. }
  848. },
  849. getDaysInYear: function getDaysInYear() {
  850. {
  851. return _getDaysInYear;
  852. }
  853. },
  854. getDaysInMonth: function getDaysInMonth() {
  855. {
  856. return _getDaysInMonth;
  857. }
  858. },
  859. getDayOfYear: function getDayOfYear() {
  860. {
  861. return _getDayOfYear;
  862. }
  863. },
  864. getDay: function getDay() {
  865. {
  866. return _getDay;
  867. }
  868. },
  869. getDate: function getDate() {
  870. {
  871. return _getDate;
  872. }
  873. },
  874. fromUnixTime: function fromUnixTime() {
  875. {
  876. return _fromUnixTime;
  877. }
  878. },
  879. formatters: function formatters() {
  880. {
  881. return _formatters;
  882. }
  883. },
  884. formatRelative: function formatRelative() {
  885. {
  886. return formatRelative3;
  887. }
  888. },
  889. formatRFC7231: function formatRFC7231() {
  890. {
  891. return _formatRFC;
  892. }
  893. },
  894. formatRFC3339: function formatRFC3339() {
  895. {
  896. return _formatRFC2;
  897. }
  898. },
  899. formatISODuration: function formatISODuration() {
  900. {
  901. return _formatISODuration;
  902. }
  903. },
  904. formatISO9075: function formatISO9075() {
  905. {
  906. return _formatISO;
  907. }
  908. },
  909. formatISO: function formatISO() {
  910. {
  911. return _formatISO2;
  912. }
  913. },
  914. formatDuration: function formatDuration() {
  915. {
  916. return _formatDuration;
  917. }
  918. },
  919. formatDistanceToNowStrict: function formatDistanceToNowStrict() {
  920. {
  921. return _formatDistanceToNowStrict;
  922. }
  923. },
  924. formatDistanceToNow: function formatDistanceToNow() {
  925. {
  926. return _formatDistanceToNow;
  927. }
  928. },
  929. formatDistanceStrict: function formatDistanceStrict() {
  930. {
  931. return _formatDistanceStrict;
  932. }
  933. },
  934. formatDistance: function formatDistance() {
  935. {
  936. return formatDistance3;
  937. }
  938. },
  939. formatDate: function formatDate() {
  940. {
  941. return _format;
  942. }
  943. },
  944. format: function format() {
  945. {
  946. return _format;
  947. }
  948. },
  949. endOfYesterday: function endOfYesterday() {
  950. {
  951. return _endOfYesterday;
  952. }
  953. },
  954. endOfYear: function endOfYear() {
  955. {
  956. return _endOfYear;
  957. }
  958. },
  959. endOfWeek: function endOfWeek() {
  960. {
  961. return _endOfWeek;
  962. }
  963. },
  964. endOfTomorrow: function endOfTomorrow() {
  965. {
  966. return _endOfTomorrow;
  967. }
  968. },
  969. endOfToday: function endOfToday() {
  970. {
  971. return _endOfToday;
  972. }
  973. },
  974. endOfSecond: function endOfSecond() {
  975. {
  976. return _endOfSecond;
  977. }
  978. },
  979. endOfQuarter: function endOfQuarter() {
  980. {
  981. return _endOfQuarter;
  982. }
  983. },
  984. endOfMonth: function endOfMonth() {
  985. {
  986. return _endOfMonth;
  987. }
  988. },
  989. endOfMinute: function endOfMinute() {
  990. {
  991. return _endOfMinute;
  992. }
  993. },
  994. endOfISOWeekYear: function endOfISOWeekYear() {
  995. {
  996. return _endOfISOWeekYear;
  997. }
  998. },
  999. endOfISOWeek: function endOfISOWeek() {
  1000. {
  1001. return _endOfISOWeek;
  1002. }
  1003. },
  1004. endOfHour: function endOfHour() {
  1005. {
  1006. return _endOfHour;
  1007. }
  1008. },
  1009. endOfDecade: function endOfDecade() {
  1010. {
  1011. return _endOfDecade;
  1012. }
  1013. },
  1014. endOfDay: function endOfDay() {
  1015. {
  1016. return _endOfDay;
  1017. }
  1018. },
  1019. eachYearOfInterval: function eachYearOfInterval() {
  1020. {
  1021. return _eachYearOfInterval;
  1022. }
  1023. },
  1024. eachWeekendOfYear: function eachWeekendOfYear() {
  1025. {
  1026. return _eachWeekendOfYear;
  1027. }
  1028. },
  1029. eachWeekendOfMonth: function eachWeekendOfMonth() {
  1030. {
  1031. return _eachWeekendOfMonth;
  1032. }
  1033. },
  1034. eachWeekendOfInterval: function eachWeekendOfInterval() {
  1035. {
  1036. return _eachWeekendOfInterval;
  1037. }
  1038. },
  1039. eachWeekOfInterval: function eachWeekOfInterval() {
  1040. {
  1041. return _eachWeekOfInterval;
  1042. }
  1043. },
  1044. eachQuarterOfInterval: function eachQuarterOfInterval() {
  1045. {
  1046. return _eachQuarterOfInterval;
  1047. }
  1048. },
  1049. eachMonthOfInterval: function eachMonthOfInterval() {
  1050. {
  1051. return _eachMonthOfInterval;
  1052. }
  1053. },
  1054. eachMinuteOfInterval: function eachMinuteOfInterval() {
  1055. {
  1056. return _eachMinuteOfInterval;
  1057. }
  1058. },
  1059. eachHourOfInterval: function eachHourOfInterval() {
  1060. {
  1061. return _eachHourOfInterval;
  1062. }
  1063. },
  1064. eachDayOfInterval: function eachDayOfInterval() {
  1065. {
  1066. return _eachDayOfInterval;
  1067. }
  1068. },
  1069. differenceInYears: function differenceInYears() {
  1070. {
  1071. return _differenceInYears;
  1072. }
  1073. },
  1074. differenceInWeeks: function differenceInWeeks() {
  1075. {
  1076. return _differenceInWeeks;
  1077. }
  1078. },
  1079. differenceInSeconds: function differenceInSeconds() {
  1080. {
  1081. return _differenceInSeconds;
  1082. }
  1083. },
  1084. differenceInQuarters: function differenceInQuarters() {
  1085. {
  1086. return _differenceInQuarters;
  1087. }
  1088. },
  1089. differenceInMonths: function differenceInMonths() {
  1090. {
  1091. return _differenceInMonths;
  1092. }
  1093. },
  1094. differenceInMinutes: function differenceInMinutes() {
  1095. {
  1096. return _differenceInMinutes;
  1097. }
  1098. },
  1099. differenceInMilliseconds: function differenceInMilliseconds() {
  1100. {
  1101. return _differenceInMilliseconds;
  1102. }
  1103. },
  1104. differenceInISOWeekYears: function differenceInISOWeekYears() {
  1105. {
  1106. return _differenceInISOWeekYears;
  1107. }
  1108. },
  1109. differenceInHours: function differenceInHours() {
  1110. {
  1111. return _differenceInHours;
  1112. }
  1113. },
  1114. differenceInDays: function differenceInDays() {
  1115. {
  1116. return _differenceInDays;
  1117. }
  1118. },
  1119. differenceInCalendarYears: function differenceInCalendarYears() {
  1120. {
  1121. return _differenceInCalendarYears;
  1122. }
  1123. },
  1124. differenceInCalendarWeeks: function differenceInCalendarWeeks() {
  1125. {
  1126. return _differenceInCalendarWeeks;
  1127. }
  1128. },
  1129. differenceInCalendarQuarters: function differenceInCalendarQuarters() {
  1130. {
  1131. return _differenceInCalendarQuarters;
  1132. }
  1133. },
  1134. differenceInCalendarMonths: function differenceInCalendarMonths() {
  1135. {
  1136. return _differenceInCalendarMonths;
  1137. }
  1138. },
  1139. differenceInCalendarISOWeeks: function differenceInCalendarISOWeeks() {
  1140. {
  1141. return _differenceInCalendarISOWeeks;
  1142. }
  1143. },
  1144. differenceInCalendarISOWeekYears: function differenceInCalendarISOWeekYears() {
  1145. {
  1146. return _differenceInCalendarISOWeekYears;
  1147. }
  1148. },
  1149. differenceInCalendarDays: function differenceInCalendarDays() {
  1150. {
  1151. return _differenceInCalendarDays;
  1152. }
  1153. },
  1154. differenceInBusinessDays: function differenceInBusinessDays() {
  1155. {
  1156. return _differenceInBusinessDays;
  1157. }
  1158. },
  1159. daysToWeeks: function daysToWeeks() {
  1160. {
  1161. return _daysToWeeks;
  1162. }
  1163. },
  1164. constructNow: function constructNow() {
  1165. {
  1166. return _constructNow;
  1167. }
  1168. },
  1169. constructFrom: function constructFrom() {
  1170. {
  1171. return _constructFrom;
  1172. }
  1173. },
  1174. compareDesc: function compareDesc() {
  1175. {
  1176. return _compareDesc;
  1177. }
  1178. },
  1179. compareAsc: function compareAsc() {
  1180. {
  1181. return _compareAsc;
  1182. }
  1183. },
  1184. closestTo: function closestTo() {
  1185. {
  1186. return _closestTo;
  1187. }
  1188. },
  1189. closestIndexTo: function closestIndexTo() {
  1190. {
  1191. return _closestIndexTo;
  1192. }
  1193. },
  1194. clamp: function clamp() {
  1195. {
  1196. return _clamp;
  1197. }
  1198. },
  1199. areIntervalsOverlapping: function areIntervalsOverlapping() {
  1200. {
  1201. return _areIntervalsOverlapping;
  1202. }
  1203. },
  1204. addYears: function addYears() {
  1205. {
  1206. return _addYears;
  1207. }
  1208. },
  1209. addWeeks: function addWeeks() {
  1210. {
  1211. return _addWeeks;
  1212. }
  1213. },
  1214. addSeconds: function addSeconds() {
  1215. {
  1216. return _addSeconds;
  1217. }
  1218. },
  1219. addQuarters: function addQuarters() {
  1220. {
  1221. return _addQuarters;
  1222. }
  1223. },
  1224. addMonths: function addMonths() {
  1225. {
  1226. return _addMonths;
  1227. }
  1228. },
  1229. addMinutes: function addMinutes() {
  1230. {
  1231. return _addMinutes;
  1232. }
  1233. },
  1234. addMilliseconds: function addMilliseconds() {
  1235. {
  1236. return _addMilliseconds;
  1237. }
  1238. },
  1239. addISOWeekYears: function addISOWeekYears() {
  1240. {
  1241. return _addISOWeekYears;
  1242. }
  1243. },
  1244. addHours: function addHours() {
  1245. {
  1246. return _addHours;
  1247. }
  1248. },
  1249. addDays: function addDays() {
  1250. {
  1251. return _addDays;
  1252. }
  1253. },
  1254. addBusinessDays: function addBusinessDays() {
  1255. {
  1256. return _addBusinessDays;
  1257. }
  1258. },
  1259. add: function add() {
  1260. {
  1261. return _add;
  1262. }
  1263. }
  1264. });
  1265. // lib/toDate.mjs
  1266. function _toDate(argument) {
  1267. var argStr = Object.prototype.toString.call(argument);
  1268. if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") {
  1269. return new argument.constructor(+argument);
  1270. } else if (typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]") {
  1271. return new Date(argument);
  1272. } else {
  1273. return new Date(NaN);
  1274. }
  1275. }
  1276. // lib/constructFrom.mjs
  1277. function _constructFrom(date, value) {
  1278. if (date instanceof Date) {
  1279. return new date.constructor(value);
  1280. } else {
  1281. return new Date(value);
  1282. }
  1283. }
  1284. // lib/addDays.mjs
  1285. function _addDays(date, amount) {
  1286. var _date = _toDate(date);
  1287. if (isNaN(amount))
  1288. return _constructFrom(date, NaN);
  1289. if (!amount) {
  1290. return _date;
  1291. }
  1292. _date.setDate(_date.getDate() + amount);
  1293. return _date;
  1294. }
  1295. // lib/addMonths.mjs
  1296. function _addMonths(date, amount) {
  1297. var _date = _toDate(date);
  1298. if (isNaN(amount))
  1299. return _constructFrom(date, NaN);
  1300. if (!amount) {
  1301. return _date;
  1302. }
  1303. var dayOfMonth = _date.getDate();
  1304. var endOfDesiredMonth = _constructFrom(date, _date.getTime());
  1305. endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
  1306. var daysInMonth = endOfDesiredMonth.getDate();
  1307. if (dayOfMonth >= daysInMonth) {
  1308. return endOfDesiredMonth;
  1309. } else {
  1310. _date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
  1311. return _date;
  1312. }
  1313. }
  1314. // lib/add.mjs
  1315. function _add(date, duration) {
  1316. var _duration$years =
  1317. duration.years,years = _duration$years === void 0 ? 0 : _duration$years,_duration$months = duration.months,months = _duration$months === void 0 ? 0 : _duration$months,_duration$weeks = duration.weeks,weeks = _duration$weeks === void 0 ? 0 : _duration$weeks,_duration$days = duration.days,days = _duration$days === void 0 ? 0 : _duration$days,_duration$hours = duration.hours,hours = _duration$hours === void 0 ? 0 : _duration$hours,_duration$minutes = duration.minutes,minutes = _duration$minutes === void 0 ? 0 : _duration$minutes,_duration$seconds = duration.seconds,seconds = _duration$seconds === void 0 ? 0 : _duration$seconds;
  1318. var _date = _toDate(date);
  1319. var dateWithMonths = months || years ? _addMonths(_date, months + years * 12) : _date;
  1320. var dateWithDays = days || weeks ? _addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
  1321. var minutesToAdd = minutes + hours * 60;
  1322. var secondsToAdd = seconds + minutesToAdd * 60;
  1323. var msToAdd = secondsToAdd * 1000;
  1324. var finalDate = _constructFrom(date, dateWithDays.getTime() + msToAdd);
  1325. return finalDate;
  1326. }
  1327. // lib/isSaturday.mjs
  1328. function _isSaturday(date) {
  1329. return _toDate(date).getDay() === 6;
  1330. }
  1331. // lib/isSunday.mjs
  1332. function _isSunday(date) {
  1333. return _toDate(date).getDay() === 0;
  1334. }
  1335. // lib/isWeekend.mjs
  1336. function _isWeekend(date) {
  1337. var day = _toDate(date).getDay();
  1338. return day === 0 || day === 6;
  1339. }
  1340. // lib/addBusinessDays.mjs
  1341. function _addBusinessDays(date, amount) {
  1342. var _date = _toDate(date);
  1343. var startedOnWeekend = _isWeekend(_date);
  1344. if (isNaN(amount))
  1345. return _constructFrom(date, NaN);
  1346. var hours = _date.getHours();
  1347. var sign = amount < 0 ? -1 : 1;
  1348. var fullWeeks = Math.trunc(amount / 5);
  1349. _date.setDate(_date.getDate() + fullWeeks * 7);
  1350. var restDays = Math.abs(amount % 5);
  1351. while (restDays > 0) {
  1352. _date.setDate(_date.getDate() + sign);
  1353. if (!_isWeekend(_date))
  1354. restDays -= 1;
  1355. }
  1356. if (startedOnWeekend && _isWeekend(_date) && amount !== 0) {
  1357. if (_isSaturday(_date))
  1358. _date.setDate(_date.getDate() + (sign < 0 ? 2 : -1));
  1359. if (_isSunday(_date))
  1360. _date.setDate(_date.getDate() + (sign < 0 ? 1 : -2));
  1361. }
  1362. _date.setHours(hours);
  1363. return _date;
  1364. }
  1365. // lib/addMilliseconds.mjs
  1366. function _addMilliseconds(date, amount) {
  1367. var timestamp = +_toDate(date);
  1368. return _constructFrom(date, timestamp + amount);
  1369. }
  1370. // lib/constants.mjs
  1371. var daysInWeek = 7;
  1372. var daysInYear = 365.2425;
  1373. var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
  1374. var minTime = -maxTime;
  1375. var millisecondsInWeek = 604800000;
  1376. var millisecondsInDay = 86400000;
  1377. var millisecondsInMinute = 60000;
  1378. var millisecondsInHour = 3600000;
  1379. var millisecondsInSecond = 1000;
  1380. var minutesInYear = 525600;
  1381. var minutesInMonth = 43200;
  1382. var minutesInDay = 1440;
  1383. var minutesInHour = 60;
  1384. var monthsInQuarter = 3;
  1385. var monthsInYear = 12;
  1386. var quartersInYear = 4;
  1387. var secondsInHour = 3600;
  1388. var secondsInMinute = 60;
  1389. var secondsInDay = secondsInHour * 24;
  1390. var secondsInWeek = secondsInDay * 7;
  1391. var secondsInYear = secondsInDay * daysInYear;
  1392. var secondsInMonth = secondsInYear / 12;
  1393. var secondsInQuarter = secondsInMonth * 3;
  1394. // lib/addHours.mjs
  1395. function _addHours(date, amount) {
  1396. return _addMilliseconds(date, amount * millisecondsInHour);
  1397. }
  1398. // lib/_lib/defaultOptions.mjs
  1399. function getDefaultOptions() {
  1400. return defaultOptions;
  1401. }
  1402. function setDefaultOptions(newOptions) {
  1403. defaultOptions = newOptions;
  1404. }
  1405. var defaultOptions = {};
  1406. // lib/startOfWeek.mjs
  1407. function _startOfWeek(date, options) {var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _defaultOptions3$loca;
  1408. var defaultOptions3 = getDefaultOptions();
  1409. var weekStartsOn = (_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 || (_options$locale = options.locale) === null || _options$locale === void 0 || (_options$locale = _options$locale.options) === null || _options$locale === void 0 ? void 0 : _options$locale.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions3$loca = defaultOptions3.locale) === null || _defaultOptions3$loca === void 0 || (_defaultOptions3$loca = _defaultOptions3$loca.options) === null || _defaultOptions3$loca === void 0 ? void 0 : _defaultOptions3$loca.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0;
  1410. var _date = _toDate(date);
  1411. var day = _date.getDay();
  1412. var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  1413. _date.setDate(_date.getDate() - diff);
  1414. _date.setHours(0, 0, 0, 0);
  1415. return _date;
  1416. }
  1417. // lib/startOfISOWeek.mjs
  1418. function _startOfISOWeek(date) {
  1419. return _startOfWeek(date, { weekStartsOn: 1 });
  1420. }
  1421. // lib/getISOWeekYear.mjs
  1422. function _getISOWeekYear(date) {
  1423. var _date = _toDate(date);
  1424. var year = _date.getFullYear();
  1425. var fourthOfJanuaryOfNextYear = _constructFrom(date, 0);
  1426. fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
  1427. fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
  1428. var startOfNextYear = _startOfISOWeek(fourthOfJanuaryOfNextYear);
  1429. var fourthOfJanuaryOfThisYear = _constructFrom(date, 0);
  1430. fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
  1431. fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
  1432. var startOfThisYear = _startOfISOWeek(fourthOfJanuaryOfThisYear);
  1433. if (_date.getTime() >= startOfNextYear.getTime()) {
  1434. return year + 1;
  1435. } else if (_date.getTime() >= startOfThisYear.getTime()) {
  1436. return year;
  1437. } else {
  1438. return year - 1;
  1439. }
  1440. }
  1441. // lib/startOfDay.mjs
  1442. function _startOfDay(date) {
  1443. var _date = _toDate(date);
  1444. _date.setHours(0, 0, 0, 0);
  1445. return _date;
  1446. }
  1447. // lib/_lib/getTimezoneOffsetInMilliseconds.mjs
  1448. function getTimezoneOffsetInMilliseconds(date) {
  1449. var _date = _toDate(date);
  1450. var utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
  1451. utcDate.setUTCFullYear(_date.getFullYear());
  1452. return +date - +utcDate;
  1453. }
  1454. // lib/differenceInCalendarDays.mjs
  1455. function _differenceInCalendarDays(dateLeft, dateRight) {
  1456. var startOfDayLeft = _startOfDay(dateLeft);
  1457. var startOfDayRight = _startOfDay(dateRight);
  1458. var timestampLeft = +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
  1459. var timestampRight = +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
  1460. return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
  1461. }
  1462. // lib/startOfISOWeekYear.mjs
  1463. function _startOfISOWeekYear(date) {
  1464. var year = _getISOWeekYear(date);
  1465. var fourthOfJanuary = _constructFrom(date, 0);
  1466. fourthOfJanuary.setFullYear(year, 0, 4);
  1467. fourthOfJanuary.setHours(0, 0, 0, 0);
  1468. return _startOfISOWeek(fourthOfJanuary);
  1469. }
  1470. // lib/setISOWeekYear.mjs
  1471. function _setISOWeekYear(date, weekYear) {
  1472. var _date = _toDate(date);
  1473. var diff = _differenceInCalendarDays(_date, _startOfISOWeekYear(_date));
  1474. var fourthOfJanuary = _constructFrom(date, 0);
  1475. fourthOfJanuary.setFullYear(weekYear, 0, 4);
  1476. fourthOfJanuary.setHours(0, 0, 0, 0);
  1477. _date = _startOfISOWeekYear(fourthOfJanuary);
  1478. _date.setDate(_date.getDate() + diff);
  1479. return _date;
  1480. }
  1481. // lib/addISOWeekYears.mjs
  1482. function _addISOWeekYears(date, amount) {
  1483. return _setISOWeekYear(date, _getISOWeekYear(date) + amount);
  1484. }
  1485. // lib/addMinutes.mjs
  1486. function _addMinutes(date, amount) {
  1487. return _addMilliseconds(date, amount * millisecondsInMinute);
  1488. }
  1489. // lib/addQuarters.mjs
  1490. function _addQuarters(date, amount) {
  1491. var months = amount * 3;
  1492. return _addMonths(date, months);
  1493. }
  1494. // lib/addSeconds.mjs
  1495. function _addSeconds(date, amount) {
  1496. return _addMilliseconds(date, amount * 1000);
  1497. }
  1498. // lib/addWeeks.mjs
  1499. function _addWeeks(date, amount) {
  1500. var days = amount * 7;
  1501. return _addDays(date, days);
  1502. }
  1503. // lib/addYears.mjs
  1504. function _addYears(date, amount) {
  1505. return _addMonths(date, amount * 12);
  1506. }
  1507. // lib/areIntervalsOverlapping.mjs
  1508. function _areIntervalsOverlapping(intervalLeft, intervalRight, options) {
  1509. var _sort = [
  1510. +_toDate(intervalLeft.start),
  1511. +_toDate(intervalLeft.end)].
  1512. sort(function (a, b) {return a - b;}),_sort2 = _slicedToArray(_sort, 2),leftStartTime = _sort2[0],leftEndTime = _sort2[1];
  1513. var _sort3 = [
  1514. +_toDate(intervalRight.start),
  1515. +_toDate(intervalRight.end)].
  1516. sort(function (a, b) {return a - b;}),_sort4 = _slicedToArray(_sort3, 2),rightStartTime = _sort4[0],rightEndTime = _sort4[1];
  1517. if (options !== null && options !== void 0 && options.inclusive)
  1518. return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
  1519. return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
  1520. }
  1521. // lib/max.mjs
  1522. function _max(dates) {
  1523. var result;
  1524. dates.forEach(function (dirtyDate) {
  1525. var currentDate = _toDate(dirtyDate);
  1526. if (result === undefined || result < currentDate || isNaN(Number(currentDate))) {
  1527. result = currentDate;
  1528. }
  1529. });
  1530. return result || new Date(NaN);
  1531. }
  1532. // lib/min.mjs
  1533. function _min(dates) {
  1534. var result;
  1535. dates.forEach(function (dirtyDate) {
  1536. var date = _toDate(dirtyDate);
  1537. if (!result || result > date || isNaN(+date)) {
  1538. result = date;
  1539. }
  1540. });
  1541. return result || new Date(NaN);
  1542. }
  1543. // lib/clamp.mjs
  1544. function _clamp(date, interval) {
  1545. return _min([_max([date, interval.start]), interval.end]);
  1546. }
  1547. // lib/closestIndexTo.mjs
  1548. function _closestIndexTo(dateToCompare, dates) {
  1549. var date = _toDate(dateToCompare);
  1550. if (isNaN(Number(date)))
  1551. return NaN;
  1552. var timeToCompare = date.getTime();
  1553. var result;
  1554. var minDistance;
  1555. dates.forEach(function (dirtyDate, index) {
  1556. var currentDate = _toDate(dirtyDate);
  1557. if (isNaN(Number(currentDate))) {
  1558. result = NaN;
  1559. minDistance = NaN;
  1560. return;
  1561. }
  1562. var distance = Math.abs(timeToCompare - currentDate.getTime());
  1563. if (result == null || distance < minDistance) {
  1564. result = index;
  1565. minDistance = distance;
  1566. }
  1567. });
  1568. return result;
  1569. }
  1570. // lib/closestTo.mjs
  1571. function _closestTo(dateToCompare, dates) {
  1572. var date = _toDate(dateToCompare);
  1573. if (isNaN(Number(date)))
  1574. return _constructFrom(dateToCompare, NaN);
  1575. var timeToCompare = date.getTime();
  1576. var result;
  1577. var minDistance;
  1578. dates.forEach(function (dirtyDate) {
  1579. var currentDate = _toDate(dirtyDate);
  1580. if (isNaN(Number(currentDate))) {
  1581. result = _constructFrom(dateToCompare, NaN);
  1582. minDistance = NaN;
  1583. return;
  1584. }
  1585. var distance = Math.abs(timeToCompare - currentDate.getTime());
  1586. if (result == null || distance < minDistance) {
  1587. result = currentDate;
  1588. minDistance = distance;
  1589. }
  1590. });
  1591. return result;
  1592. }
  1593. // lib/compareAsc.mjs
  1594. function _compareAsc(dateLeft, dateRight) {
  1595. var _dateLeft = _toDate(dateLeft);
  1596. var _dateRight = _toDate(dateRight);
  1597. var diff = _dateLeft.getTime() - _dateRight.getTime();
  1598. if (diff < 0) {
  1599. return -1;
  1600. } else if (diff > 0) {
  1601. return 1;
  1602. } else {
  1603. return diff;
  1604. }
  1605. }
  1606. // lib/compareDesc.mjs
  1607. function _compareDesc(dateLeft, dateRight) {
  1608. var _dateLeft = _toDate(dateLeft);
  1609. var _dateRight = _toDate(dateRight);
  1610. var diff = _dateLeft.getTime() - _dateRight.getTime();
  1611. if (diff > 0) {
  1612. return -1;
  1613. } else if (diff < 0) {
  1614. return 1;
  1615. } else {
  1616. return diff;
  1617. }
  1618. }
  1619. // lib/constructNow.mjs
  1620. function _constructNow(date) {
  1621. return _constructFrom(date, Date.now());
  1622. }
  1623. // lib/daysToWeeks.mjs
  1624. function _daysToWeeks(days) {
  1625. var weeks = days / daysInWeek;
  1626. var result = Math.trunc(weeks);
  1627. return result === 0 ? 0 : result;
  1628. }
  1629. // lib/isSameDay.mjs
  1630. function _isSameDay(dateLeft, dateRight) {
  1631. var dateLeftStartOfDay = _startOfDay(dateLeft);
  1632. var dateRightStartOfDay = _startOfDay(dateRight);
  1633. return +dateLeftStartOfDay === +dateRightStartOfDay;
  1634. }
  1635. // lib/isDate.mjs
  1636. function _isDate(value) {
  1637. return value instanceof Date || _typeof(value) === "object" && Object.prototype.toString.call(value) === "[object Date]";
  1638. }
  1639. // lib/isValid.mjs
  1640. function _isValid(date) {
  1641. if (!_isDate(date) && typeof date !== "number") {
  1642. return false;
  1643. }
  1644. var _date = _toDate(date);
  1645. return !isNaN(Number(_date));
  1646. }
  1647. // lib/differenceInBusinessDays.mjs
  1648. function _differenceInBusinessDays(dateLeft, dateRight) {
  1649. var _dateLeft = _toDate(dateLeft);
  1650. var _dateRight = _toDate(dateRight);
  1651. if (!_isValid(_dateLeft) || !_isValid(_dateRight))
  1652. return NaN;
  1653. var calendarDifference = _differenceInCalendarDays(_dateLeft, _dateRight);
  1654. var sign = calendarDifference < 0 ? -1 : 1;
  1655. var weeks = Math.trunc(calendarDifference / 7);
  1656. var result = weeks * 5;
  1657. _dateRight = _addDays(_dateRight, weeks * 7);
  1658. while (!_isSameDay(_dateLeft, _dateRight)) {
  1659. result += _isWeekend(_dateRight) ? 0 : sign;
  1660. _dateRight = _addDays(_dateRight, sign);
  1661. }
  1662. return result === 0 ? 0 : result;
  1663. }
  1664. // lib/differenceInCalendarISOWeekYears.mjs
  1665. function _differenceInCalendarISOWeekYears(dateLeft, dateRight) {
  1666. return _getISOWeekYear(dateLeft) - _getISOWeekYear(dateRight);
  1667. }
  1668. // lib/differenceInCalendarISOWeeks.mjs
  1669. function _differenceInCalendarISOWeeks(dateLeft, dateRight) {
  1670. var startOfISOWeekLeft = _startOfISOWeek(dateLeft);
  1671. var startOfISOWeekRight = _startOfISOWeek(dateRight);
  1672. var timestampLeft = +startOfISOWeekLeft - getTimezoneOffsetInMilliseconds(startOfISOWeekLeft);
  1673. var timestampRight = +startOfISOWeekRight - getTimezoneOffsetInMilliseconds(startOfISOWeekRight);
  1674. return Math.round((timestampLeft - timestampRight) / millisecondsInWeek);
  1675. }
  1676. // lib/differenceInCalendarMonths.mjs
  1677. function _differenceInCalendarMonths(dateLeft, dateRight) {
  1678. var _dateLeft = _toDate(dateLeft);
  1679. var _dateRight = _toDate(dateRight);
  1680. var yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();
  1681. var monthDiff = _dateLeft.getMonth() - _dateRight.getMonth();
  1682. return yearDiff * 12 + monthDiff;
  1683. }
  1684. // lib/getQuarter.mjs
  1685. function _getQuarter(date) {
  1686. var _date = _toDate(date);
  1687. var quarter = Math.trunc(_date.getMonth() / 3) + 1;
  1688. return quarter;
  1689. }
  1690. // lib/differenceInCalendarQuarters.mjs
  1691. function _differenceInCalendarQuarters(dateLeft, dateRight) {
  1692. var _dateLeft = _toDate(dateLeft);
  1693. var _dateRight = _toDate(dateRight);
  1694. var yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();
  1695. var quarterDiff = _getQuarter(_dateLeft) - _getQuarter(_dateRight);
  1696. return yearDiff * 4 + quarterDiff;
  1697. }
  1698. // lib/differenceInCalendarWeeks.mjs
  1699. function _differenceInCalendarWeeks(dateLeft, dateRight, options) {
  1700. var startOfWeekLeft = _startOfWeek(dateLeft, options);
  1701. var startOfWeekRight = _startOfWeek(dateRight, options);
  1702. var timestampLeft = +startOfWeekLeft - getTimezoneOffsetInMilliseconds(startOfWeekLeft);
  1703. var timestampRight = +startOfWeekRight - getTimezoneOffsetInMilliseconds(startOfWeekRight);
  1704. return Math.round((timestampLeft - timestampRight) / millisecondsInWeek);
  1705. }
  1706. // lib/differenceInCalendarYears.mjs
  1707. function _differenceInCalendarYears(dateLeft, dateRight) {
  1708. var _dateLeft = _toDate(dateLeft);
  1709. var _dateRight = _toDate(dateRight);
  1710. return _dateLeft.getFullYear() - _dateRight.getFullYear();
  1711. }
  1712. // lib/differenceInDays.mjs
  1713. function _differenceInDays(dateLeft, dateRight) {
  1714. var _dateLeft = _toDate(dateLeft);
  1715. var _dateRight = _toDate(dateRight);
  1716. var sign = compareLocalAsc(_dateLeft, _dateRight);
  1717. var difference = Math.abs(_differenceInCalendarDays(_dateLeft, _dateRight));
  1718. _dateLeft.setDate(_dateLeft.getDate() - sign * difference);
  1719. var isLastDayNotFull = Number(compareLocalAsc(_dateLeft, _dateRight) === -sign);
  1720. var result = sign * (difference - isLastDayNotFull);
  1721. return result === 0 ? 0 : result;
  1722. }
  1723. var compareLocalAsc = function compareLocalAsc(dateLeft, dateRight) {
  1724. var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
  1725. if (diff < 0) {
  1726. return -1;
  1727. } else if (diff > 0) {
  1728. return 1;
  1729. } else {
  1730. return diff;
  1731. }
  1732. };
  1733. // lib/_lib/getRoundingMethod.mjs
  1734. function getRoundingMethod(method) {
  1735. return function (number) {
  1736. var round = method ? Math[method] : Math.trunc;
  1737. var result = round(number);
  1738. return result === 0 ? 0 : result;
  1739. };
  1740. }
  1741. // lib/differenceInMilliseconds.mjs
  1742. function _differenceInMilliseconds(dateLeft, dateRight) {
  1743. return +_toDate(dateLeft) - +_toDate(dateRight);
  1744. }
  1745. // lib/differenceInHours.mjs
  1746. function _differenceInHours(dateLeft, dateRight, options) {
  1747. var diff = _differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
  1748. return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
  1749. }
  1750. // lib/subISOWeekYears.mjs
  1751. function _subISOWeekYears(date, amount) {
  1752. return _addISOWeekYears(date, -amount);
  1753. }
  1754. // lib/differenceInISOWeekYears.mjs
  1755. function _differenceInISOWeekYears(dateLeft, dateRight) {
  1756. var _dateLeft = _toDate(dateLeft);
  1757. var _dateRight = _toDate(dateRight);
  1758. var sign = _compareAsc(_dateLeft, _dateRight);
  1759. var difference = Math.abs(_differenceInCalendarISOWeekYears(_dateLeft, _dateRight));
  1760. _dateLeft = _subISOWeekYears(_dateLeft, sign * difference);
  1761. var isLastISOWeekYearNotFull = Number(_compareAsc(_dateLeft, _dateRight) === -sign);
  1762. var result = sign * (difference - isLastISOWeekYearNotFull);
  1763. return result === 0 ? 0 : result;
  1764. }
  1765. // lib/differenceInMinutes.mjs
  1766. function _differenceInMinutes(dateLeft, dateRight, options) {
  1767. var diff = _differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
  1768. return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
  1769. }
  1770. // lib/endOfDay.mjs
  1771. function _endOfDay(date) {
  1772. var _date = _toDate(date);
  1773. _date.setHours(23, 59, 59, 999);
  1774. return _date;
  1775. }
  1776. // lib/endOfMonth.mjs
  1777. function _endOfMonth(date) {
  1778. var _date = _toDate(date);
  1779. var month = _date.getMonth();
  1780. _date.setFullYear(_date.getFullYear(), month + 1, 0);
  1781. _date.setHours(23, 59, 59, 999);
  1782. return _date;
  1783. }
  1784. // lib/isLastDayOfMonth.mjs
  1785. function _isLastDayOfMonth(date) {
  1786. var _date = _toDate(date);
  1787. return +_endOfDay(_date) === +_endOfMonth(_date);
  1788. }
  1789. // lib/differenceInMonths.mjs
  1790. function _differenceInMonths(dateLeft, dateRight) {
  1791. var _dateLeft = _toDate(dateLeft);
  1792. var _dateRight = _toDate(dateRight);
  1793. var sign = _compareAsc(_dateLeft, _dateRight);
  1794. var difference = Math.abs(_differenceInCalendarMonths(_dateLeft, _dateRight));
  1795. var result;
  1796. if (difference < 1) {
  1797. result = 0;
  1798. } else {
  1799. if (_dateLeft.getMonth() === 1 && _dateLeft.getDate() > 27) {
  1800. _dateLeft.setDate(30);
  1801. }
  1802. _dateLeft.setMonth(_dateLeft.getMonth() - sign * difference);
  1803. var isLastMonthNotFull = _compareAsc(_dateLeft, _dateRight) === -sign;
  1804. if (_isLastDayOfMonth(_toDate(dateLeft)) && difference === 1 && _compareAsc(dateLeft, _dateRight) === 1) {
  1805. isLastMonthNotFull = false;
  1806. }
  1807. result = sign * (difference - Number(isLastMonthNotFull));
  1808. }
  1809. return result === 0 ? 0 : result;
  1810. }
  1811. // lib/differenceInQuarters.mjs
  1812. function _differenceInQuarters(dateLeft, dateRight, options) {
  1813. var diff = _differenceInMonths(dateLeft, dateRight) / 3;
  1814. return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
  1815. }
  1816. // lib/differenceInSeconds.mjs
  1817. function _differenceInSeconds(dateLeft, dateRight, options) {
  1818. var diff = _differenceInMilliseconds(dateLeft, dateRight) / 1000;
  1819. return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
  1820. }
  1821. // lib/differenceInWeeks.mjs
  1822. function _differenceInWeeks(dateLeft, dateRight, options) {
  1823. var diff = _differenceInDays(dateLeft, dateRight) / 7;
  1824. return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
  1825. }
  1826. // lib/differenceInYears.mjs
  1827. function _differenceInYears(dateLeft, dateRight) {
  1828. var _dateLeft = _toDate(dateLeft);
  1829. var _dateRight = _toDate(dateRight);
  1830. var sign = _compareAsc(_dateLeft, _dateRight);
  1831. var difference = Math.abs(_differenceInCalendarYears(_dateLeft, _dateRight));
  1832. _dateLeft.setFullYear(1584);
  1833. _dateRight.setFullYear(1584);
  1834. var isLastYearNotFull = _compareAsc(_dateLeft, _dateRight) === -sign;
  1835. var result = sign * (difference - +isLastYearNotFull);
  1836. return result === 0 ? 0 : result;
  1837. }
  1838. // lib/eachDayOfInterval.mjs
  1839. function _eachDayOfInterval(interval, options) {var _options$step;
  1840. var startDate = _toDate(interval.start);
  1841. var endDate = _toDate(interval.end);
  1842. var reversed = +startDate > +endDate;
  1843. var endTime = reversed ? +startDate : +endDate;
  1844. var currentDate = reversed ? endDate : startDate;
  1845. currentDate.setHours(0, 0, 0, 0);
  1846. var step = (_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1;
  1847. if (!step)
  1848. return [];
  1849. if (step < 0) {
  1850. step = -step;
  1851. reversed = !reversed;
  1852. }
  1853. var dates = [];
  1854. while (+currentDate <= endTime) {
  1855. dates.push(_toDate(currentDate));
  1856. currentDate.setDate(currentDate.getDate() + step);
  1857. currentDate.setHours(0, 0, 0, 0);
  1858. }
  1859. return reversed ? dates.reverse() : dates;
  1860. }
  1861. // lib/eachHourOfInterval.mjs
  1862. function _eachHourOfInterval(interval, options) {var _options$step2;
  1863. var startDate = _toDate(interval.start);
  1864. var endDate = _toDate(interval.end);
  1865. var reversed = +startDate > +endDate;
  1866. var endTime = reversed ? +startDate : +endDate;
  1867. var currentDate = reversed ? endDate : startDate;
  1868. currentDate.setMinutes(0, 0, 0);
  1869. var step = (_options$step2 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step2 !== void 0 ? _options$step2 : 1;
  1870. if (!step)
  1871. return [];
  1872. if (step < 0) {
  1873. step = -step;
  1874. reversed = !reversed;
  1875. }
  1876. var dates = [];
  1877. while (+currentDate <= endTime) {
  1878. dates.push(_toDate(currentDate));
  1879. currentDate = _addHours(currentDate, step);
  1880. }
  1881. return reversed ? dates.reverse() : dates;
  1882. }
  1883. // lib/startOfMinute.mjs
  1884. function _startOfMinute(date) {
  1885. var _date = _toDate(date);
  1886. _date.setSeconds(0, 0);
  1887. return _date;
  1888. }
  1889. // lib/eachMinuteOfInterval.mjs
  1890. function _eachMinuteOfInterval(interval, options) {var _options$step3;
  1891. var startDate = _startOfMinute(_toDate(interval.start));
  1892. var endDate = _toDate(interval.end);
  1893. var reversed = +startDate > +endDate;
  1894. var endTime = reversed ? +startDate : +endDate;
  1895. var currentDate = reversed ? endDate : startDate;
  1896. var step = (_options$step3 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step3 !== void 0 ? _options$step3 : 1;
  1897. if (!step)
  1898. return [];
  1899. if (step < 0) {
  1900. step = -step;
  1901. reversed = !reversed;
  1902. }
  1903. var dates = [];
  1904. while (+currentDate <= endTime) {
  1905. dates.push(_toDate(currentDate));
  1906. currentDate = _addMinutes(currentDate, step);
  1907. }
  1908. return reversed ? dates.reverse() : dates;
  1909. }
  1910. // lib/eachMonthOfInterval.mjs
  1911. function _eachMonthOfInterval(interval, options) {var _options$step4;
  1912. var startDate = _toDate(interval.start);
  1913. var endDate = _toDate(interval.end);
  1914. var reversed = +startDate > +endDate;
  1915. var endTime = reversed ? +startDate : +endDate;
  1916. var currentDate = reversed ? endDate : startDate;
  1917. currentDate.setHours(0, 0, 0, 0);
  1918. currentDate.setDate(1);
  1919. var step = (_options$step4 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step4 !== void 0 ? _options$step4 : 1;
  1920. if (!step)
  1921. return [];
  1922. if (step < 0) {
  1923. step = -step;
  1924. reversed = !reversed;
  1925. }
  1926. var dates = [];
  1927. while (+currentDate <= endTime) {
  1928. dates.push(_toDate(currentDate));
  1929. currentDate.setMonth(currentDate.getMonth() + step);
  1930. }
  1931. return reversed ? dates.reverse() : dates;
  1932. }
  1933. // lib/startOfQuarter.mjs
  1934. function _startOfQuarter(date) {
  1935. var _date = _toDate(date);
  1936. var currentMonth = _date.getMonth();
  1937. var month = currentMonth - currentMonth % 3;
  1938. _date.setMonth(month, 1);
  1939. _date.setHours(0, 0, 0, 0);
  1940. return _date;
  1941. }
  1942. // lib/eachQuarterOfInterval.mjs
  1943. function _eachQuarterOfInterval(interval, options) {var _options$step5;
  1944. var startDate = _toDate(interval.start);
  1945. var endDate = _toDate(interval.end);
  1946. var reversed = +startDate > +endDate;
  1947. var endTime = reversed ? +_startOfQuarter(startDate) : +_startOfQuarter(endDate);
  1948. var currentDate = reversed ? _startOfQuarter(endDate) : _startOfQuarter(startDate);
  1949. var step = (_options$step5 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step5 !== void 0 ? _options$step5 : 1;
  1950. if (!step)
  1951. return [];
  1952. if (step < 0) {
  1953. step = -step;
  1954. reversed = !reversed;
  1955. }
  1956. var dates = [];
  1957. while (+currentDate <= endTime) {
  1958. dates.push(_toDate(currentDate));
  1959. currentDate = _addQuarters(currentDate, step);
  1960. }
  1961. return reversed ? dates.reverse() : dates;
  1962. }
  1963. // lib/eachWeekOfInterval.mjs
  1964. function _eachWeekOfInterval(interval, options) {var _options$step6;
  1965. var startDate = _toDate(interval.start);
  1966. var endDate = _toDate(interval.end);
  1967. var reversed = +startDate > +endDate;
  1968. var startDateWeek = reversed ? _startOfWeek(endDate, options) : _startOfWeek(startDate, options);
  1969. var endDateWeek = reversed ? _startOfWeek(startDate, options) : _startOfWeek(endDate, options);
  1970. startDateWeek.setHours(15);
  1971. endDateWeek.setHours(15);
  1972. var endTime = +endDateWeek.getTime();
  1973. var currentDate = startDateWeek;
  1974. var step = (_options$step6 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step6 !== void 0 ? _options$step6 : 1;
  1975. if (!step)
  1976. return [];
  1977. if (step < 0) {
  1978. step = -step;
  1979. reversed = !reversed;
  1980. }
  1981. var dates = [];
  1982. while (+currentDate <= endTime) {
  1983. currentDate.setHours(0);
  1984. dates.push(_toDate(currentDate));
  1985. currentDate = _addWeeks(currentDate, step);
  1986. currentDate.setHours(15);
  1987. }
  1988. return reversed ? dates.reverse() : dates;
  1989. }
  1990. // lib/eachWeekendOfInterval.mjs
  1991. function _eachWeekendOfInterval(interval) {
  1992. var dateInterval = _eachDayOfInterval(interval);
  1993. var weekends = [];
  1994. var index = 0;
  1995. while (index < dateInterval.length) {
  1996. var date = dateInterval[index++];
  1997. if (_isWeekend(date))
  1998. weekends.push(date);
  1999. }
  2000. return weekends;
  2001. }
  2002. // lib/startOfMonth.mjs
  2003. function _startOfMonth(date) {
  2004. var _date = _toDate(date);
  2005. _date.setDate(1);
  2006. _date.setHours(0, 0, 0, 0);
  2007. return _date;
  2008. }
  2009. // lib/eachWeekendOfMonth.mjs
  2010. function _eachWeekendOfMonth(date) {
  2011. var start = _startOfMonth(date);
  2012. var end = _endOfMonth(date);
  2013. return _eachWeekendOfInterval({ start: start, end: end });
  2014. }
  2015. // lib/endOfYear.mjs
  2016. function _endOfYear(date) {
  2017. var _date = _toDate(date);
  2018. var year = _date.getFullYear();
  2019. _date.setFullYear(year + 1, 0, 0);
  2020. _date.setHours(23, 59, 59, 999);
  2021. return _date;
  2022. }
  2023. // lib/startOfYear.mjs
  2024. function _startOfYear(date) {
  2025. var cleanDate = _toDate(date);
  2026. var _date = _constructFrom(date, 0);
  2027. _date.setFullYear(cleanDate.getFullYear(), 0, 1);
  2028. _date.setHours(0, 0, 0, 0);
  2029. return _date;
  2030. }
  2031. // lib/eachWeekendOfYear.mjs
  2032. function _eachWeekendOfYear(date) {
  2033. var start = _startOfYear(date);
  2034. var end = _endOfYear(date);
  2035. return _eachWeekendOfInterval({ start: start, end: end });
  2036. }
  2037. // lib/eachYearOfInterval.mjs
  2038. function _eachYearOfInterval(interval, options) {var _options$step7;
  2039. var startDate = _toDate(interval.start);
  2040. var endDate = _toDate(interval.end);
  2041. var reversed = +startDate > +endDate;
  2042. var endTime = reversed ? +startDate : +endDate;
  2043. var currentDate = reversed ? endDate : startDate;
  2044. currentDate.setHours(0, 0, 0, 0);
  2045. currentDate.setMonth(0, 1);
  2046. var step = (_options$step7 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step7 !== void 0 ? _options$step7 : 1;
  2047. if (!step)
  2048. return [];
  2049. if (step < 0) {
  2050. step = -step;
  2051. reversed = !reversed;
  2052. }
  2053. var dates = [];
  2054. while (+currentDate <= endTime) {
  2055. dates.push(_toDate(currentDate));
  2056. currentDate.setFullYear(currentDate.getFullYear() + step);
  2057. }
  2058. return reversed ? dates.reverse() : dates;
  2059. }
  2060. // lib/endOfDecade.mjs
  2061. function _endOfDecade(date) {
  2062. var _date = _toDate(date);
  2063. var year = _date.getFullYear();
  2064. var decade = 9 + Math.floor(year / 10) * 10;
  2065. _date.setFullYear(decade, 11, 31);
  2066. _date.setHours(23, 59, 59, 999);
  2067. return _date;
  2068. }
  2069. // lib/endOfHour.mjs
  2070. function _endOfHour(date) {
  2071. var _date = _toDate(date);
  2072. _date.setMinutes(59, 59, 999);
  2073. return _date;
  2074. }
  2075. // lib/endOfWeek.mjs
  2076. function _endOfWeek(date, options) {var _ref4, _ref5, _ref6, _options$weekStartsOn2, _options$locale2, _defaultOptions4$loca;
  2077. var defaultOptions4 = getDefaultOptions();
  2078. var weekStartsOn = (_ref4 = (_ref5 = (_ref6 = (_options$weekStartsOn2 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn2 !== void 0 ? _options$weekStartsOn2 : options === null || options === void 0 || (_options$locale2 = options.locale) === null || _options$locale2 === void 0 || (_options$locale2 = _options$locale2.options) === null || _options$locale2 === void 0 ? void 0 : _options$locale2.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : defaultOptions4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : (_defaultOptions4$loca = defaultOptions4.locale) === null || _defaultOptions4$loca === void 0 || (_defaultOptions4$loca = _defaultOptions4$loca.options) === null || _defaultOptions4$loca === void 0 ? void 0 : _defaultOptions4$loca.weekStartsOn) !== null && _ref4 !== void 0 ? _ref4 : 0;
  2079. var _date = _toDate(date);
  2080. var day = _date.getDay();
  2081. var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
  2082. _date.setDate(_date.getDate() + diff);
  2083. _date.setHours(23, 59, 59, 999);
  2084. return _date;
  2085. }
  2086. // lib/endOfISOWeek.mjs
  2087. function _endOfISOWeek(date) {
  2088. return _endOfWeek(date, { weekStartsOn: 1 });
  2089. }
  2090. // lib/endOfISOWeekYear.mjs
  2091. function _endOfISOWeekYear(date) {
  2092. var year = _getISOWeekYear(date);
  2093. var fourthOfJanuaryOfNextYear = _constructFrom(date, 0);
  2094. fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
  2095. fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
  2096. var _date = _startOfISOWeek(fourthOfJanuaryOfNextYear);
  2097. _date.setMilliseconds(_date.getMilliseconds() - 1);
  2098. return _date;
  2099. }
  2100. // lib/endOfMinute.mjs
  2101. function _endOfMinute(date) {
  2102. var _date = _toDate(date);
  2103. _date.setSeconds(59, 999);
  2104. return _date;
  2105. }
  2106. // lib/endOfQuarter.mjs
  2107. function _endOfQuarter(date) {
  2108. var _date = _toDate(date);
  2109. var currentMonth = _date.getMonth();
  2110. var month = currentMonth - currentMonth % 3 + 3;
  2111. _date.setMonth(month, 0);
  2112. _date.setHours(23, 59, 59, 999);
  2113. return _date;
  2114. }
  2115. // lib/endOfSecond.mjs
  2116. function _endOfSecond(date) {
  2117. var _date = _toDate(date);
  2118. _date.setMilliseconds(999);
  2119. return _date;
  2120. }
  2121. // lib/endOfToday.mjs
  2122. function _endOfToday() {
  2123. return _endOfDay(Date.now());
  2124. }
  2125. // lib/endOfTomorrow.mjs
  2126. function _endOfTomorrow() {
  2127. var now = new Date();
  2128. var year = now.getFullYear();
  2129. var month = now.getMonth();
  2130. var day = now.getDate();
  2131. var date = new Date(0);
  2132. date.setFullYear(year, month, day + 1);
  2133. date.setHours(23, 59, 59, 999);
  2134. return date;
  2135. }
  2136. // lib/endOfYesterday.mjs
  2137. function _endOfYesterday() {
  2138. var now = new Date();
  2139. var year = now.getFullYear();
  2140. var month = now.getMonth();
  2141. var day = now.getDate();
  2142. var date = new Date(0);
  2143. date.setFullYear(year, month, day - 1);
  2144. date.setHours(23, 59, 59, 999);
  2145. return date;
  2146. }
  2147. // lib/locale/en-US/_lib/formatDistance.mjs
  2148. var formatDistanceLocale = {
  2149. lessThanXSeconds: {
  2150. one: "less than a second",
  2151. other: "less than {{count}} seconds"
  2152. },
  2153. xSeconds: {
  2154. one: "1 second",
  2155. other: "{{count}} seconds"
  2156. },
  2157. halfAMinute: "half a minute",
  2158. lessThanXMinutes: {
  2159. one: "less than a minute",
  2160. other: "less than {{count}} minutes"
  2161. },
  2162. xMinutes: {
  2163. one: "1 minute",
  2164. other: "{{count}} minutes"
  2165. },
  2166. aboutXHours: {
  2167. one: "about 1 hour",
  2168. other: "about {{count}} hours"
  2169. },
  2170. xHours: {
  2171. one: "1 hour",
  2172. other: "{{count}} hours"
  2173. },
  2174. xDays: {
  2175. one: "1 day",
  2176. other: "{{count}} days"
  2177. },
  2178. aboutXWeeks: {
  2179. one: "about 1 week",
  2180. other: "about {{count}} weeks"
  2181. },
  2182. xWeeks: {
  2183. one: "1 week",
  2184. other: "{{count}} weeks"
  2185. },
  2186. aboutXMonths: {
  2187. one: "about 1 month",
  2188. other: "about {{count}} months"
  2189. },
  2190. xMonths: {
  2191. one: "1 month",
  2192. other: "{{count}} months"
  2193. },
  2194. aboutXYears: {
  2195. one: "about 1 year",
  2196. other: "about {{count}} years"
  2197. },
  2198. xYears: {
  2199. one: "1 year",
  2200. other: "{{count}} years"
  2201. },
  2202. overXYears: {
  2203. one: "over 1 year",
  2204. other: "over {{count}} years"
  2205. },
  2206. almostXYears: {
  2207. one: "almost 1 year",
  2208. other: "almost {{count}} years"
  2209. }
  2210. };
  2211. var formatDistance = function formatDistance(token, count, options) {
  2212. var result;
  2213. var tokenValue = formatDistanceLocale[token];
  2214. if (typeof tokenValue === "string") {
  2215. result = tokenValue;
  2216. } else if (count === 1) {
  2217. result = tokenValue.one;
  2218. } else {
  2219. result = tokenValue.other.replace("{{count}}", count.toString());
  2220. }
  2221. if (options !== null && options !== void 0 && options.addSuffix) {
  2222. if (options.comparison && options.comparison > 0) {
  2223. return "in " + result;
  2224. } else {
  2225. return result + " ago";
  2226. }
  2227. }
  2228. return result;
  2229. };
  2230. // lib/locale/_lib/buildFormatLongFn.mjs
  2231. function buildFormatLongFn(args) {
  2232. return function () {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2233. var width = options.width ? String(options.width) : args.defaultWidth;
  2234. var format = args.formats[width] || args.formats[args.defaultWidth];
  2235. return format;
  2236. };
  2237. }
  2238. // lib/locale/en-US/_lib/formatLong.mjs
  2239. var dateFormats = {
  2240. full: "EEEE, MMMM do, y",
  2241. long: "MMMM do, y",
  2242. medium: "MMM d, y",
  2243. short: "MM/dd/yyyy"
  2244. };
  2245. var timeFormats = {
  2246. full: "h:mm:ss a zzzz",
  2247. long: "h:mm:ss a z",
  2248. medium: "h:mm:ss a",
  2249. short: "h:mm a"
  2250. };
  2251. var dateTimeFormats = {
  2252. full: "{{date}} 'at' {{time}}",
  2253. long: "{{date}} 'at' {{time}}",
  2254. medium: "{{date}}, {{time}}",
  2255. short: "{{date}}, {{time}}"
  2256. };
  2257. var formatLong = {
  2258. date: buildFormatLongFn({
  2259. formats: dateFormats,
  2260. defaultWidth: "full"
  2261. }),
  2262. time: buildFormatLongFn({
  2263. formats: timeFormats,
  2264. defaultWidth: "full"
  2265. }),
  2266. dateTime: buildFormatLongFn({
  2267. formats: dateTimeFormats,
  2268. defaultWidth: "full"
  2269. })
  2270. };
  2271. // lib/locale/en-US/_lib/formatRelative.mjs
  2272. var formatRelativeLocale = {
  2273. lastWeek: "'last' eeee 'at' p",
  2274. yesterday: "'yesterday at' p",
  2275. today: "'today at' p",
  2276. tomorrow: "'tomorrow at' p",
  2277. nextWeek: "eeee 'at' p",
  2278. other: "P"
  2279. };
  2280. var formatRelative = function formatRelative(token, _date, _baseDate, _options) {return formatRelativeLocale[token];};
  2281. // lib/locale/_lib/buildLocalizeFn.mjs
  2282. function buildLocalizeFn(args) {
  2283. return function (value, options) {
  2284. var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
  2285. var valuesArray;
  2286. if (context === "formatting" && args.formattingValues) {
  2287. var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
  2288. var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
  2289. valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
  2290. } else {
  2291. var _defaultWidth = args.defaultWidth;
  2292. var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
  2293. valuesArray = args.values[_width] || args.values[_defaultWidth];
  2294. }
  2295. var index = args.argumentCallback ? args.argumentCallback(value) : value;
  2296. return valuesArray[index];
  2297. };
  2298. }
  2299. // lib/locale/en-US/_lib/localize.mjs
  2300. var eraValues = {
  2301. narrow: ["B", "A"],
  2302. abbreviated: ["BC", "AD"],
  2303. wide: ["Before Christ", "Anno Domini"]
  2304. };
  2305. var quarterValues = {
  2306. narrow: ["1", "2", "3", "4"],
  2307. abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  2308. wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
  2309. };
  2310. var monthValues = {
  2311. narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
  2312. abbreviated: [
  2313. "Jan",
  2314. "Feb",
  2315. "Mar",
  2316. "Apr",
  2317. "May",
  2318. "Jun",
  2319. "Jul",
  2320. "Aug",
  2321. "Sep",
  2322. "Oct",
  2323. "Nov",
  2324. "Dec"],
  2325. wide: [
  2326. "January",
  2327. "February",
  2328. "March",
  2329. "April",
  2330. "May",
  2331. "June",
  2332. "July",
  2333. "August",
  2334. "September",
  2335. "October",
  2336. "November",
  2337. "December"]
  2338. };
  2339. var dayValues = {
  2340. narrow: ["S", "M", "T", "W", "T", "F", "S"],
  2341. short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  2342. abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  2343. wide: [
  2344. "Sunday",
  2345. "Monday",
  2346. "Tuesday",
  2347. "Wednesday",
  2348. "Thursday",
  2349. "Friday",
  2350. "Saturday"]
  2351. };
  2352. var dayPeriodValues = {
  2353. narrow: {
  2354. am: "a",
  2355. pm: "p",
  2356. midnight: "mi",
  2357. noon: "n",
  2358. morning: "morning",
  2359. afternoon: "afternoon",
  2360. evening: "evening",
  2361. night: "night"
  2362. },
  2363. abbreviated: {
  2364. am: "AM",
  2365. pm: "PM",
  2366. midnight: "midnight",
  2367. noon: "noon",
  2368. morning: "morning",
  2369. afternoon: "afternoon",
  2370. evening: "evening",
  2371. night: "night"
  2372. },
  2373. wide: {
  2374. am: "a.m.",
  2375. pm: "p.m.",
  2376. midnight: "midnight",
  2377. noon: "noon",
  2378. morning: "morning",
  2379. afternoon: "afternoon",
  2380. evening: "evening",
  2381. night: "night"
  2382. }
  2383. };
  2384. var formattingDayPeriodValues = {
  2385. narrow: {
  2386. am: "a",
  2387. pm: "p",
  2388. midnight: "mi",
  2389. noon: "n",
  2390. morning: "in the morning",
  2391. afternoon: "in the afternoon",
  2392. evening: "in the evening",
  2393. night: "at night"
  2394. },
  2395. abbreviated: {
  2396. am: "AM",
  2397. pm: "PM",
  2398. midnight: "midnight",
  2399. noon: "noon",
  2400. morning: "in the morning",
  2401. afternoon: "in the afternoon",
  2402. evening: "in the evening",
  2403. night: "at night"
  2404. },
  2405. wide: {
  2406. am: "a.m.",
  2407. pm: "p.m.",
  2408. midnight: "midnight",
  2409. noon: "noon",
  2410. morning: "in the morning",
  2411. afternoon: "in the afternoon",
  2412. evening: "in the evening",
  2413. night: "at night"
  2414. }
  2415. };
  2416. var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
  2417. var number = Number(dirtyNumber);
  2418. var rem100 = number % 100;
  2419. if (rem100 > 20 || rem100 < 10) {
  2420. switch (rem100 % 10) {
  2421. case 1:
  2422. return number + "st";
  2423. case 2:
  2424. return number + "nd";
  2425. case 3:
  2426. return number + "rd";
  2427. }
  2428. }
  2429. return number + "th";
  2430. };
  2431. var localize = {
  2432. ordinalNumber: ordinalNumber,
  2433. era: buildLocalizeFn({
  2434. values: eraValues,
  2435. defaultWidth: "wide"
  2436. }),
  2437. quarter: buildLocalizeFn({
  2438. values: quarterValues,
  2439. defaultWidth: "wide",
  2440. argumentCallback: function argumentCallback(quarter) {return quarter - 1;}
  2441. }),
  2442. month: buildLocalizeFn({
  2443. values: monthValues,
  2444. defaultWidth: "wide"
  2445. }),
  2446. day: buildLocalizeFn({
  2447. values: dayValues,
  2448. defaultWidth: "wide"
  2449. }),
  2450. dayPeriod: buildLocalizeFn({
  2451. values: dayPeriodValues,
  2452. defaultWidth: "wide",
  2453. formattingValues: formattingDayPeriodValues,
  2454. defaultFormattingWidth: "wide"
  2455. })
  2456. };
  2457. // lib/locale/_lib/buildMatchFn.mjs
  2458. function buildMatchFn(args) {
  2459. return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2460. var width = options.width;
  2461. var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
  2462. var matchResult = string.match(matchPattern);
  2463. if (!matchResult) {
  2464. return null;
  2465. }
  2466. var matchedString = matchResult[0];
  2467. var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
  2468. var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {return pattern.test(matchedString);}) : findKey(parsePatterns, function (pattern) {return pattern.test(matchedString);});
  2469. var value;
  2470. value = args.valueCallback ? args.valueCallback(key) : key;
  2471. value = options.valueCallback ? options.valueCallback(value) : value;
  2472. var rest = string.slice(matchedString.length);
  2473. return { value: value, rest: rest };
  2474. };
  2475. }
  2476. var findKey = function findKey(object, predicate) {
  2477. for (var key in object) {
  2478. if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
  2479. return key;
  2480. }
  2481. }
  2482. return;
  2483. };
  2484. var findIndex = function findIndex(array, predicate) {
  2485. for (var key = 0; key < array.length; key++) {
  2486. if (predicate(array[key])) {
  2487. return key;
  2488. }
  2489. }
  2490. return;
  2491. };
  2492. // lib/locale/_lib/buildMatchPatternFn.mjs
  2493. function buildMatchPatternFn(args) {
  2494. return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2495. var matchResult = string.match(args.matchPattern);
  2496. if (!matchResult)
  2497. return null;
  2498. var matchedString = matchResult[0];
  2499. var parseResult = string.match(args.parsePattern);
  2500. if (!parseResult)
  2501. return null;
  2502. var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
  2503. value = options.valueCallback ? options.valueCallback(value) : value;
  2504. var rest = string.slice(matchedString.length);
  2505. return { value: value, rest: rest };
  2506. };
  2507. }
  2508. // lib/locale/en-US/_lib/match.mjs
  2509. var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
  2510. var parseOrdinalNumberPattern = /\d+/i;
  2511. var matchEraPatterns = {
  2512. narrow: /^(b|a)/i,
  2513. abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  2514. wide: /^(before christ|before common era|anno domini|common era)/i
  2515. };
  2516. var parseEraPatterns = {
  2517. any: [/^b/i, /^(a|c)/i]
  2518. };
  2519. var matchQuarterPatterns = {
  2520. narrow: /^[1234]/i,
  2521. abbreviated: /^q[1234]/i,
  2522. wide: /^[1234](th|st|nd|rd)? quarter/i
  2523. };
  2524. var parseQuarterPatterns = {
  2525. any: [/1/i, /2/i, /3/i, /4/i]
  2526. };
  2527. var matchMonthPatterns = {
  2528. narrow: /^[jfmasond]/i,
  2529. abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  2530. wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
  2531. };
  2532. var parseMonthPatterns = {
  2533. narrow: [
  2534. /^j/i,
  2535. /^f/i,
  2536. /^m/i,
  2537. /^a/i,
  2538. /^m/i,
  2539. /^j/i,
  2540. /^j/i,
  2541. /^a/i,
  2542. /^s/i,
  2543. /^o/i,
  2544. /^n/i,
  2545. /^d/i],
  2546. any: [
  2547. /^ja/i,
  2548. /^f/i,
  2549. /^mar/i,
  2550. /^ap/i,
  2551. /^may/i,
  2552. /^jun/i,
  2553. /^jul/i,
  2554. /^au/i,
  2555. /^s/i,
  2556. /^o/i,
  2557. /^n/i,
  2558. /^d/i]
  2559. };
  2560. var matchDayPatterns = {
  2561. narrow: /^[smtwf]/i,
  2562. short: /^(su|mo|tu|we|th|fr|sa)/i,
  2563. abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  2564. wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
  2565. };
  2566. var parseDayPatterns = {
  2567. narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
  2568. any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
  2569. };
  2570. var matchDayPeriodPatterns = {
  2571. narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  2572. any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
  2573. };
  2574. var parseDayPeriodPatterns = {
  2575. any: {
  2576. am: /^a/i,
  2577. pm: /^p/i,
  2578. midnight: /^mi/i,
  2579. noon: /^no/i,
  2580. morning: /morning/i,
  2581. afternoon: /afternoon/i,
  2582. evening: /evening/i,
  2583. night: /night/i
  2584. }
  2585. };
  2586. var match = {
  2587. ordinalNumber: buildMatchPatternFn({
  2588. matchPattern: matchOrdinalNumberPattern,
  2589. parsePattern: parseOrdinalNumberPattern,
  2590. valueCallback: function valueCallback(value) {return parseInt(value, 10);}
  2591. }),
  2592. era: buildMatchFn({
  2593. matchPatterns: matchEraPatterns,
  2594. defaultMatchWidth: "wide",
  2595. parsePatterns: parseEraPatterns,
  2596. defaultParseWidth: "any"
  2597. }),
  2598. quarter: buildMatchFn({
  2599. matchPatterns: matchQuarterPatterns,
  2600. defaultMatchWidth: "wide",
  2601. parsePatterns: parseQuarterPatterns,
  2602. defaultParseWidth: "any",
  2603. valueCallback: function valueCallback(index) {return index + 1;}
  2604. }),
  2605. month: buildMatchFn({
  2606. matchPatterns: matchMonthPatterns,
  2607. defaultMatchWidth: "wide",
  2608. parsePatterns: parseMonthPatterns,
  2609. defaultParseWidth: "any"
  2610. }),
  2611. day: buildMatchFn({
  2612. matchPatterns: matchDayPatterns,
  2613. defaultMatchWidth: "wide",
  2614. parsePatterns: parseDayPatterns,
  2615. defaultParseWidth: "any"
  2616. }),
  2617. dayPeriod: buildMatchFn({
  2618. matchPatterns: matchDayPeriodPatterns,
  2619. defaultMatchWidth: "any",
  2620. parsePatterns: parseDayPeriodPatterns,
  2621. defaultParseWidth: "any"
  2622. })
  2623. };
  2624. // lib/locale/en-US.mjs
  2625. var enUS = {
  2626. code: "en-US",
  2627. formatDistance: formatDistance,
  2628. formatLong: formatLong,
  2629. formatRelative: formatRelative,
  2630. localize: localize,
  2631. match: match,
  2632. options: {
  2633. weekStartsOn: 0,
  2634. firstWeekContainsDate: 1
  2635. }
  2636. };
  2637. // lib/getDayOfYear.mjs
  2638. function _getDayOfYear(date) {
  2639. var _date = _toDate(date);
  2640. var diff = _differenceInCalendarDays(_date, _startOfYear(_date));
  2641. var dayOfYear = diff + 1;
  2642. return dayOfYear;
  2643. }
  2644. // lib/getISOWeek.mjs
  2645. function _getISOWeek(date) {
  2646. var _date = _toDate(date);
  2647. var diff = +_startOfISOWeek(_date) - +_startOfISOWeekYear(_date);
  2648. return Math.round(diff / millisecondsInWeek) + 1;
  2649. }
  2650. // lib/getWeekYear.mjs
  2651. function _getWeekYear(date, options) {var _ref7, _ref8, _ref9, _options$firstWeekCon, _options$locale3, _defaultOptions5$loca;
  2652. var _date = _toDate(date);
  2653. var year = _date.getFullYear();
  2654. var defaultOptions5 = getDefaultOptions();
  2655. var firstWeekContainsDate = (_ref7 = (_ref8 = (_ref9 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 || (_options$locale3 = options.locale) === null || _options$locale3 === void 0 || (_options$locale3 = _options$locale3.options) === null || _options$locale3 === void 0 ? void 0 : _options$locale3.firstWeekContainsDate) !== null && _ref9 !== void 0 ? _ref9 : defaultOptions5.firstWeekContainsDate) !== null && _ref8 !== void 0 ? _ref8 : (_defaultOptions5$loca = defaultOptions5.locale) === null || _defaultOptions5$loca === void 0 || (_defaultOptions5$loca = _defaultOptions5$loca.options) === null || _defaultOptions5$loca === void 0 ? void 0 : _defaultOptions5$loca.firstWeekContainsDate) !== null && _ref7 !== void 0 ? _ref7 : 1;
  2656. var firstWeekOfNextYear = _constructFrom(date, 0);
  2657. firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
  2658. firstWeekOfNextYear.setHours(0, 0, 0, 0);
  2659. var startOfNextYear = _startOfWeek(firstWeekOfNextYear, options);
  2660. var firstWeekOfThisYear = _constructFrom(date, 0);
  2661. firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
  2662. firstWeekOfThisYear.setHours(0, 0, 0, 0);
  2663. var startOfThisYear = _startOfWeek(firstWeekOfThisYear, options);
  2664. if (_date.getTime() >= startOfNextYear.getTime()) {
  2665. return year + 1;
  2666. } else if (_date.getTime() >= startOfThisYear.getTime()) {
  2667. return year;
  2668. } else {
  2669. return year - 1;
  2670. }
  2671. }
  2672. // lib/startOfWeekYear.mjs
  2673. function _startOfWeekYear(date, options) {var _ref10, _ref11, _ref12, _options$firstWeekCon2, _options$locale4, _defaultOptions6$loca;
  2674. var defaultOptions6 = getDefaultOptions();
  2675. var firstWeekContainsDate = (_ref10 = (_ref11 = (_ref12 = (_options$firstWeekCon2 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon2 !== void 0 ? _options$firstWeekCon2 : options === null || options === void 0 || (_options$locale4 = options.locale) === null || _options$locale4 === void 0 || (_options$locale4 = _options$locale4.options) === null || _options$locale4 === void 0 ? void 0 : _options$locale4.firstWeekContainsDate) !== null && _ref12 !== void 0 ? _ref12 : defaultOptions6.firstWeekContainsDate) !== null && _ref11 !== void 0 ? _ref11 : (_defaultOptions6$loca = defaultOptions6.locale) === null || _defaultOptions6$loca === void 0 || (_defaultOptions6$loca = _defaultOptions6$loca.options) === null || _defaultOptions6$loca === void 0 ? void 0 : _defaultOptions6$loca.firstWeekContainsDate) !== null && _ref10 !== void 0 ? _ref10 : 1;
  2676. var year = _getWeekYear(date, options);
  2677. var firstWeek = _constructFrom(date, 0);
  2678. firstWeek.setFullYear(year, 0, firstWeekContainsDate);
  2679. firstWeek.setHours(0, 0, 0, 0);
  2680. var _date = _startOfWeek(firstWeek, options);
  2681. return _date;
  2682. }
  2683. // lib/getWeek.mjs
  2684. function _getWeek(date, options) {
  2685. var _date = _toDate(date);
  2686. var diff = +_startOfWeek(_date, options) - +_startOfWeekYear(_date, options);
  2687. return Math.round(diff / millisecondsInWeek) + 1;
  2688. }
  2689. // lib/_lib/addLeadingZeros.mjs
  2690. function addLeadingZeros(number, targetLength) {
  2691. var sign = number < 0 ? "-" : "";
  2692. var output = Math.abs(number).toString().padStart(targetLength, "0");
  2693. return sign + output;
  2694. }
  2695. // lib/_lib/format/lightFormatters.mjs
  2696. var _lightFormatters = {
  2697. y: function y(date, token) {
  2698. var signedYear = date.getFullYear();
  2699. var year = signedYear > 0 ? signedYear : 1 - signedYear;
  2700. return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
  2701. },
  2702. M: function M(date, token) {
  2703. var month = date.getMonth();
  2704. return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
  2705. },
  2706. d: function d(date, token) {
  2707. return addLeadingZeros(date.getDate(), token.length);
  2708. },
  2709. a: function a(date, token) {
  2710. var dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
  2711. switch (token) {
  2712. case "a":
  2713. case "aa":
  2714. return dayPeriodEnumValue.toUpperCase();
  2715. case "aaa":
  2716. return dayPeriodEnumValue;
  2717. case "aaaaa":
  2718. return dayPeriodEnumValue[0];
  2719. case "aaaa":
  2720. default:
  2721. return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
  2722. }
  2723. },
  2724. h: function h(date, token) {
  2725. return addLeadingZeros(date.getHours() % 12 || 12, token.length);
  2726. },
  2727. H: function H(date, token) {
  2728. return addLeadingZeros(date.getHours(), token.length);
  2729. },
  2730. m: function m(date, token) {
  2731. return addLeadingZeros(date.getMinutes(), token.length);
  2732. },
  2733. s: function s(date, token) {
  2734. return addLeadingZeros(date.getSeconds(), token.length);
  2735. },
  2736. S: function S(date, token) {
  2737. var numberOfDigits = token.length;
  2738. var milliseconds = date.getMilliseconds();
  2739. var fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3));
  2740. return addLeadingZeros(fractionalSeconds, token.length);
  2741. }
  2742. };
  2743. // lib/_lib/format/formatters.mjs
  2744. var formatTimezoneShort = function formatTimezoneShort(offset) {var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  2745. var sign = offset > 0 ? "-" : "+";
  2746. var absOffset = Math.abs(offset);
  2747. var hours = Math.trunc(absOffset / 60);
  2748. var minutes = absOffset % 60;
  2749. if (minutes === 0) {
  2750. return sign + String(hours);
  2751. }
  2752. return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
  2753. };
  2754. var formatTimezoneWithOptionalMinutes = function formatTimezoneWithOptionalMinutes(offset, delimiter) {
  2755. if (offset % 60 === 0) {
  2756. var sign = offset > 0 ? "-" : "+";
  2757. return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
  2758. }
  2759. return formatTimezone(offset, delimiter);
  2760. };
  2761. var formatTimezone = function formatTimezone(offset) {var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  2762. var sign = offset > 0 ? "-" : "+";
  2763. var absOffset = Math.abs(offset);
  2764. var hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
  2765. var minutes = addLeadingZeros(absOffset % 60, 2);
  2766. return sign + hours + delimiter + minutes;
  2767. };
  2768. var dayPeriodEnum = {
  2769. am: "am",
  2770. pm: "pm",
  2771. midnight: "midnight",
  2772. noon: "noon",
  2773. morning: "morning",
  2774. afternoon: "afternoon",
  2775. evening: "evening",
  2776. night: "night"
  2777. };
  2778. var _formatters = {
  2779. G: function G(date, token, localize3) {
  2780. var era = date.getFullYear() > 0 ? 1 : 0;
  2781. switch (token) {
  2782. case "G":
  2783. case "GG":
  2784. case "GGG":
  2785. return localize3.era(era, { width: "abbreviated" });
  2786. case "GGGGG":
  2787. return localize3.era(era, { width: "narrow" });
  2788. case "GGGG":
  2789. default:
  2790. return localize3.era(era, { width: "wide" });
  2791. }
  2792. },
  2793. y: function y(date, token, localize3) {
  2794. if (token === "yo") {
  2795. var signedYear = date.getFullYear();
  2796. var year = signedYear > 0 ? signedYear : 1 - signedYear;
  2797. return localize3.ordinalNumber(year, { unit: "year" });
  2798. }
  2799. return _lightFormatters.y(date, token);
  2800. },
  2801. Y: function Y(date, token, localize3, options) {
  2802. var signedWeekYear = _getWeekYear(date, options);
  2803. var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
  2804. if (token === "YY") {
  2805. var twoDigitYear = weekYear % 100;
  2806. return addLeadingZeros(twoDigitYear, 2);
  2807. }
  2808. if (token === "Yo") {
  2809. return localize3.ordinalNumber(weekYear, { unit: "year" });
  2810. }
  2811. return addLeadingZeros(weekYear, token.length);
  2812. },
  2813. R: function R(date, token) {
  2814. var isoWeekYear = _getISOWeekYear(date);
  2815. return addLeadingZeros(isoWeekYear, token.length);
  2816. },
  2817. u: function u(date, token) {
  2818. var year = date.getFullYear();
  2819. return addLeadingZeros(year, token.length);
  2820. },
  2821. Q: function Q(date, token, localize3) {
  2822. var quarter = Math.ceil((date.getMonth() + 1) / 3);
  2823. switch (token) {
  2824. case "Q":
  2825. return String(quarter);
  2826. case "QQ":
  2827. return addLeadingZeros(quarter, 2);
  2828. case "Qo":
  2829. return localize3.ordinalNumber(quarter, { unit: "quarter" });
  2830. case "QQQ":
  2831. return localize3.quarter(quarter, {
  2832. width: "abbreviated",
  2833. context: "formatting"
  2834. });
  2835. case "QQQQQ":
  2836. return localize3.quarter(quarter, {
  2837. width: "narrow",
  2838. context: "formatting"
  2839. });
  2840. case "QQQQ":
  2841. default:
  2842. return localize3.quarter(quarter, {
  2843. width: "wide",
  2844. context: "formatting"
  2845. });
  2846. }
  2847. },
  2848. q: function q(date, token, localize3) {
  2849. var quarter = Math.ceil((date.getMonth() + 1) / 3);
  2850. switch (token) {
  2851. case "q":
  2852. return String(quarter);
  2853. case "qq":
  2854. return addLeadingZeros(quarter, 2);
  2855. case "qo":
  2856. return localize3.ordinalNumber(quarter, { unit: "quarter" });
  2857. case "qqq":
  2858. return localize3.quarter(quarter, {
  2859. width: "abbreviated",
  2860. context: "standalone"
  2861. });
  2862. case "qqqqq":
  2863. return localize3.quarter(quarter, {
  2864. width: "narrow",
  2865. context: "standalone"
  2866. });
  2867. case "qqqq":
  2868. default:
  2869. return localize3.quarter(quarter, {
  2870. width: "wide",
  2871. context: "standalone"
  2872. });
  2873. }
  2874. },
  2875. M: function M(date, token, localize3) {
  2876. var month = date.getMonth();
  2877. switch (token) {
  2878. case "M":
  2879. case "MM":
  2880. return _lightFormatters.M(date, token);
  2881. case "Mo":
  2882. return localize3.ordinalNumber(month + 1, { unit: "month" });
  2883. case "MMM":
  2884. return localize3.month(month, {
  2885. width: "abbreviated",
  2886. context: "formatting"
  2887. });
  2888. case "MMMMM":
  2889. return localize3.month(month, {
  2890. width: "narrow",
  2891. context: "formatting"
  2892. });
  2893. case "MMMM":
  2894. default:
  2895. return localize3.month(month, { width: "wide", context: "formatting" });
  2896. }
  2897. },
  2898. L: function L(date, token, localize3) {
  2899. var month = date.getMonth();
  2900. switch (token) {
  2901. case "L":
  2902. return String(month + 1);
  2903. case "LL":
  2904. return addLeadingZeros(month + 1, 2);
  2905. case "Lo":
  2906. return localize3.ordinalNumber(month + 1, { unit: "month" });
  2907. case "LLL":
  2908. return localize3.month(month, {
  2909. width: "abbreviated",
  2910. context: "standalone"
  2911. });
  2912. case "LLLLL":
  2913. return localize3.month(month, {
  2914. width: "narrow",
  2915. context: "standalone"
  2916. });
  2917. case "LLLL":
  2918. default:
  2919. return localize3.month(month, { width: "wide", context: "standalone" });
  2920. }
  2921. },
  2922. w: function w(date, token, localize3, options) {
  2923. var week = _getWeek(date, options);
  2924. if (token === "wo") {
  2925. return localize3.ordinalNumber(week, { unit: "week" });
  2926. }
  2927. return addLeadingZeros(week, token.length);
  2928. },
  2929. I: function I(date, token, localize3) {
  2930. var isoWeek = _getISOWeek(date);
  2931. if (token === "Io") {
  2932. return localize3.ordinalNumber(isoWeek, { unit: "week" });
  2933. }
  2934. return addLeadingZeros(isoWeek, token.length);
  2935. },
  2936. d: function d(date, token, localize3) {
  2937. if (token === "do") {
  2938. return localize3.ordinalNumber(date.getDate(), { unit: "date" });
  2939. }
  2940. return _lightFormatters.d(date, token);
  2941. },
  2942. D: function D(date, token, localize3) {
  2943. var dayOfYear = _getDayOfYear(date);
  2944. if (token === "Do") {
  2945. return localize3.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
  2946. }
  2947. return addLeadingZeros(dayOfYear, token.length);
  2948. },
  2949. E: function E(date, token, localize3) {
  2950. var dayOfWeek = date.getDay();
  2951. switch (token) {
  2952. case "E":
  2953. case "EE":
  2954. case "EEE":
  2955. return localize3.day(dayOfWeek, {
  2956. width: "abbreviated",
  2957. context: "formatting"
  2958. });
  2959. case "EEEEE":
  2960. return localize3.day(dayOfWeek, {
  2961. width: "narrow",
  2962. context: "formatting"
  2963. });
  2964. case "EEEEEE":
  2965. return localize3.day(dayOfWeek, {
  2966. width: "short",
  2967. context: "formatting"
  2968. });
  2969. case "EEEE":
  2970. default:
  2971. return localize3.day(dayOfWeek, {
  2972. width: "wide",
  2973. context: "formatting"
  2974. });
  2975. }
  2976. },
  2977. e: function e(date, token, localize3, options) {
  2978. var dayOfWeek = date.getDay();
  2979. var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
  2980. switch (token) {
  2981. case "e":
  2982. return String(localDayOfWeek);
  2983. case "ee":
  2984. return addLeadingZeros(localDayOfWeek, 2);
  2985. case "eo":
  2986. return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
  2987. case "eee":
  2988. return localize3.day(dayOfWeek, {
  2989. width: "abbreviated",
  2990. context: "formatting"
  2991. });
  2992. case "eeeee":
  2993. return localize3.day(dayOfWeek, {
  2994. width: "narrow",
  2995. context: "formatting"
  2996. });
  2997. case "eeeeee":
  2998. return localize3.day(dayOfWeek, {
  2999. width: "short",
  3000. context: "formatting"
  3001. });
  3002. case "eeee":
  3003. default:
  3004. return localize3.day(dayOfWeek, {
  3005. width: "wide",
  3006. context: "formatting"
  3007. });
  3008. }
  3009. },
  3010. c: function c(date, token, localize3, options) {
  3011. var dayOfWeek = date.getDay();
  3012. var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
  3013. switch (token) {
  3014. case "c":
  3015. return String(localDayOfWeek);
  3016. case "cc":
  3017. return addLeadingZeros(localDayOfWeek, token.length);
  3018. case "co":
  3019. return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
  3020. case "ccc":
  3021. return localize3.day(dayOfWeek, {
  3022. width: "abbreviated",
  3023. context: "standalone"
  3024. });
  3025. case "ccccc":
  3026. return localize3.day(dayOfWeek, {
  3027. width: "narrow",
  3028. context: "standalone"
  3029. });
  3030. case "cccccc":
  3031. return localize3.day(dayOfWeek, {
  3032. width: "short",
  3033. context: "standalone"
  3034. });
  3035. case "cccc":
  3036. default:
  3037. return localize3.day(dayOfWeek, {
  3038. width: "wide",
  3039. context: "standalone"
  3040. });
  3041. }
  3042. },
  3043. i: function i(date, token, localize3) {
  3044. var dayOfWeek = date.getDay();
  3045. var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
  3046. switch (token) {
  3047. case "i":
  3048. return String(isoDayOfWeek);
  3049. case "ii":
  3050. return addLeadingZeros(isoDayOfWeek, token.length);
  3051. case "io":
  3052. return localize3.ordinalNumber(isoDayOfWeek, { unit: "day" });
  3053. case "iii":
  3054. return localize3.day(dayOfWeek, {
  3055. width: "abbreviated",
  3056. context: "formatting"
  3057. });
  3058. case "iiiii":
  3059. return localize3.day(dayOfWeek, {
  3060. width: "narrow",
  3061. context: "formatting"
  3062. });
  3063. case "iiiiii":
  3064. return localize3.day(dayOfWeek, {
  3065. width: "short",
  3066. context: "formatting"
  3067. });
  3068. case "iiii":
  3069. default:
  3070. return localize3.day(dayOfWeek, {
  3071. width: "wide",
  3072. context: "formatting"
  3073. });
  3074. }
  3075. },
  3076. a: function a(date, token, localize3) {
  3077. var hours = date.getHours();
  3078. var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
  3079. switch (token) {
  3080. case "a":
  3081. case "aa":
  3082. return localize3.dayPeriod(dayPeriodEnumValue, {
  3083. width: "abbreviated",
  3084. context: "formatting"
  3085. });
  3086. case "aaa":
  3087. return localize3.dayPeriod(dayPeriodEnumValue, {
  3088. width: "abbreviated",
  3089. context: "formatting"
  3090. }).toLowerCase();
  3091. case "aaaaa":
  3092. return localize3.dayPeriod(dayPeriodEnumValue, {
  3093. width: "narrow",
  3094. context: "formatting"
  3095. });
  3096. case "aaaa":
  3097. default:
  3098. return localize3.dayPeriod(dayPeriodEnumValue, {
  3099. width: "wide",
  3100. context: "formatting"
  3101. });
  3102. }
  3103. },
  3104. b: function b(date, token, localize3) {
  3105. var hours = date.getHours();
  3106. var dayPeriodEnumValue;
  3107. if (hours === 12) {
  3108. dayPeriodEnumValue = dayPeriodEnum.noon;
  3109. } else if (hours === 0) {
  3110. dayPeriodEnumValue = dayPeriodEnum.midnight;
  3111. } else {
  3112. dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
  3113. }
  3114. switch (token) {
  3115. case "b":
  3116. case "bb":
  3117. return localize3.dayPeriod(dayPeriodEnumValue, {
  3118. width: "abbreviated",
  3119. context: "formatting"
  3120. });
  3121. case "bbb":
  3122. return localize3.dayPeriod(dayPeriodEnumValue, {
  3123. width: "abbreviated",
  3124. context: "formatting"
  3125. }).toLowerCase();
  3126. case "bbbbb":
  3127. return localize3.dayPeriod(dayPeriodEnumValue, {
  3128. width: "narrow",
  3129. context: "formatting"
  3130. });
  3131. case "bbbb":
  3132. default:
  3133. return localize3.dayPeriod(dayPeriodEnumValue, {
  3134. width: "wide",
  3135. context: "formatting"
  3136. });
  3137. }
  3138. },
  3139. B: function B(date, token, localize3) {
  3140. var hours = date.getHours();
  3141. var dayPeriodEnumValue;
  3142. if (hours >= 17) {
  3143. dayPeriodEnumValue = dayPeriodEnum.evening;
  3144. } else if (hours >= 12) {
  3145. dayPeriodEnumValue = dayPeriodEnum.afternoon;
  3146. } else if (hours >= 4) {
  3147. dayPeriodEnumValue = dayPeriodEnum.morning;
  3148. } else {
  3149. dayPeriodEnumValue = dayPeriodEnum.night;
  3150. }
  3151. switch (token) {
  3152. case "B":
  3153. case "BB":
  3154. case "BBB":
  3155. return localize3.dayPeriod(dayPeriodEnumValue, {
  3156. width: "abbreviated",
  3157. context: "formatting"
  3158. });
  3159. case "BBBBB":
  3160. return localize3.dayPeriod(dayPeriodEnumValue, {
  3161. width: "narrow",
  3162. context: "formatting"
  3163. });
  3164. case "BBBB":
  3165. default:
  3166. return localize3.dayPeriod(dayPeriodEnumValue, {
  3167. width: "wide",
  3168. context: "formatting"
  3169. });
  3170. }
  3171. },
  3172. h: function h(date, token, localize3) {
  3173. if (token === "ho") {
  3174. var hours = date.getHours() % 12;
  3175. if (hours === 0)
  3176. hours = 12;
  3177. return localize3.ordinalNumber(hours, { unit: "hour" });
  3178. }
  3179. return _lightFormatters.h(date, token);
  3180. },
  3181. H: function H(date, token, localize3) {
  3182. if (token === "Ho") {
  3183. return localize3.ordinalNumber(date.getHours(), { unit: "hour" });
  3184. }
  3185. return _lightFormatters.H(date, token);
  3186. },
  3187. K: function K(date, token, localize3) {
  3188. var hours = date.getHours() % 12;
  3189. if (token === "Ko") {
  3190. return localize3.ordinalNumber(hours, { unit: "hour" });
  3191. }
  3192. return addLeadingZeros(hours, token.length);
  3193. },
  3194. k: function k(date, token, localize3) {
  3195. var hours = date.getHours();
  3196. if (hours === 0)
  3197. hours = 24;
  3198. if (token === "ko") {
  3199. return localize3.ordinalNumber(hours, { unit: "hour" });
  3200. }
  3201. return addLeadingZeros(hours, token.length);
  3202. },
  3203. m: function m(date, token, localize3) {
  3204. if (token === "mo") {
  3205. return localize3.ordinalNumber(date.getMinutes(), { unit: "minute" });
  3206. }
  3207. return _lightFormatters.m(date, token);
  3208. },
  3209. s: function s(date, token, localize3) {
  3210. if (token === "so") {
  3211. return localize3.ordinalNumber(date.getSeconds(), { unit: "second" });
  3212. }
  3213. return _lightFormatters.s(date, token);
  3214. },
  3215. S: function S(date, token) {
  3216. return _lightFormatters.S(date, token);
  3217. },
  3218. X: function X(date, token, _localize) {
  3219. var timezoneOffset = date.getTimezoneOffset();
  3220. if (timezoneOffset === 0) {
  3221. return "Z";
  3222. }
  3223. switch (token) {
  3224. case "X":
  3225. return formatTimezoneWithOptionalMinutes(timezoneOffset);
  3226. case "XXXX":
  3227. case "XX":
  3228. return formatTimezone(timezoneOffset);
  3229. case "XXXXX":
  3230. case "XXX":
  3231. default:
  3232. return formatTimezone(timezoneOffset, ":");
  3233. }
  3234. },
  3235. x: function x(date, token, _localize) {
  3236. var timezoneOffset = date.getTimezoneOffset();
  3237. switch (token) {
  3238. case "x":
  3239. return formatTimezoneWithOptionalMinutes(timezoneOffset);
  3240. case "xxxx":
  3241. case "xx":
  3242. return formatTimezone(timezoneOffset);
  3243. case "xxxxx":
  3244. case "xxx":
  3245. default:
  3246. return formatTimezone(timezoneOffset, ":");
  3247. }
  3248. },
  3249. O: function O(date, token, _localize) {
  3250. var timezoneOffset = date.getTimezoneOffset();
  3251. switch (token) {
  3252. case "O":
  3253. case "OO":
  3254. case "OOO":
  3255. return "GMT" + formatTimezoneShort(timezoneOffset, ":");
  3256. case "OOOO":
  3257. default:
  3258. return "GMT" + formatTimezone(timezoneOffset, ":");
  3259. }
  3260. },
  3261. z: function z(date, token, _localize) {
  3262. var timezoneOffset = date.getTimezoneOffset();
  3263. switch (token) {
  3264. case "z":
  3265. case "zz":
  3266. case "zzz":
  3267. return "GMT" + formatTimezoneShort(timezoneOffset, ":");
  3268. case "zzzz":
  3269. default:
  3270. return "GMT" + formatTimezone(timezoneOffset, ":");
  3271. }
  3272. },
  3273. t: function t(date, token, _localize) {
  3274. var timestamp = Math.trunc(date.getTime() / 1000);
  3275. return addLeadingZeros(timestamp, token.length);
  3276. },
  3277. T: function T(date, token, _localize) {
  3278. var timestamp = date.getTime();
  3279. return addLeadingZeros(timestamp, token.length);
  3280. }
  3281. };
  3282. // lib/_lib/format/longFormatters.mjs
  3283. var dateLongFormatter = function dateLongFormatter(pattern, formatLong3) {
  3284. switch (pattern) {
  3285. case "P":
  3286. return formatLong3.date({ width: "short" });
  3287. case "PP":
  3288. return formatLong3.date({ width: "medium" });
  3289. case "PPP":
  3290. return formatLong3.date({ width: "long" });
  3291. case "PPPP":
  3292. default:
  3293. return formatLong3.date({ width: "full" });
  3294. }
  3295. };
  3296. var timeLongFormatter = function timeLongFormatter(pattern, formatLong3) {
  3297. switch (pattern) {
  3298. case "p":
  3299. return formatLong3.time({ width: "short" });
  3300. case "pp":
  3301. return formatLong3.time({ width: "medium" });
  3302. case "ppp":
  3303. return formatLong3.time({ width: "long" });
  3304. case "pppp":
  3305. default:
  3306. return formatLong3.time({ width: "full" });
  3307. }
  3308. };
  3309. var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong3) {
  3310. var matchResult = pattern.match(/(P+)(p+)?/) || [];
  3311. var datePattern = matchResult[1];
  3312. var timePattern = matchResult[2];
  3313. if (!timePattern) {
  3314. return dateLongFormatter(pattern, formatLong3);
  3315. }
  3316. var dateTimeFormat;
  3317. switch (datePattern) {
  3318. case "P":
  3319. dateTimeFormat = formatLong3.dateTime({ width: "short" });
  3320. break;
  3321. case "PP":
  3322. dateTimeFormat = formatLong3.dateTime({ width: "medium" });
  3323. break;
  3324. case "PPP":
  3325. dateTimeFormat = formatLong3.dateTime({ width: "long" });
  3326. break;
  3327. case "PPPP":
  3328. default:
  3329. dateTimeFormat = formatLong3.dateTime({ width: "full" });
  3330. break;
  3331. }
  3332. return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong3)).replace("{{time}}", timeLongFormatter(timePattern, formatLong3));
  3333. };
  3334. var _longFormatters = {
  3335. p: timeLongFormatter,
  3336. P: dateTimeLongFormatter
  3337. };
  3338. // lib/_lib/protectedTokens.mjs
  3339. function isProtectedDayOfYearToken(token) {
  3340. return dayOfYearTokenRE.test(token);
  3341. }
  3342. function isProtectedWeekYearToken(token) {
  3343. return weekYearTokenRE.test(token);
  3344. }
  3345. function warnOrThrowProtectedError(token, format, input) {
  3346. var _message = message(token, format, input);
  3347. console.warn(_message);
  3348. if (throwTokens.includes(token))
  3349. throw new RangeError(_message);
  3350. }
  3351. var message = function message(token, format, input) {
  3352. var subject = token[0] === "Y" ? "years" : "days of the month";
  3353. return "Use `".concat(token.toLowerCase(), "` instead of `").concat(token, "` (in `").concat(format, "`) for formatting ").concat(subject, " to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md");
  3354. };
  3355. var dayOfYearTokenRE = /^D+$/;
  3356. var weekYearTokenRE = /^Y+$/;
  3357. var throwTokens = ["D", "DD", "YY", "YYYY"];
  3358. // lib/format.mjs
  3359. function _format(date, formatStr, options) {var _ref13, _options$locale5, _ref14, _ref15, _ref16, _options$firstWeekCon3, _options$locale6, _defaultOptions7$loca, _ref17, _ref18, _ref19, _options$weekStartsOn3, _options$locale7, _defaultOptions7$loca2;
  3360. var defaultOptions7 = getDefaultOptions();
  3361. var locale = (_ref13 = (_options$locale5 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale5 !== void 0 ? _options$locale5 : defaultOptions7.locale) !== null && _ref13 !== void 0 ? _ref13 : enUS;
  3362. var firstWeekContainsDate = (_ref14 = (_ref15 = (_ref16 = (_options$firstWeekCon3 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon3 !== void 0 ? _options$firstWeekCon3 : options === null || options === void 0 || (_options$locale6 = options.locale) === null || _options$locale6 === void 0 || (_options$locale6 = _options$locale6.options) === null || _options$locale6 === void 0 ? void 0 : _options$locale6.firstWeekContainsDate) !== null && _ref16 !== void 0 ? _ref16 : defaultOptions7.firstWeekContainsDate) !== null && _ref15 !== void 0 ? _ref15 : (_defaultOptions7$loca = defaultOptions7.locale) === null || _defaultOptions7$loca === void 0 || (_defaultOptions7$loca = _defaultOptions7$loca.options) === null || _defaultOptions7$loca === void 0 ? void 0 : _defaultOptions7$loca.firstWeekContainsDate) !== null && _ref14 !== void 0 ? _ref14 : 1;
  3363. var weekStartsOn = (_ref17 = (_ref18 = (_ref19 = (_options$weekStartsOn3 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn3 !== void 0 ? _options$weekStartsOn3 : options === null || options === void 0 || (_options$locale7 = options.locale) === null || _options$locale7 === void 0 || (_options$locale7 = _options$locale7.options) === null || _options$locale7 === void 0 ? void 0 : _options$locale7.weekStartsOn) !== null && _ref19 !== void 0 ? _ref19 : defaultOptions7.weekStartsOn) !== null && _ref18 !== void 0 ? _ref18 : (_defaultOptions7$loca2 = defaultOptions7.locale) === null || _defaultOptions7$loca2 === void 0 || (_defaultOptions7$loca2 = _defaultOptions7$loca2.options) === null || _defaultOptions7$loca2 === void 0 ? void 0 : _defaultOptions7$loca2.weekStartsOn) !== null && _ref17 !== void 0 ? _ref17 : 0;
  3364. var originalDate = _toDate(date);
  3365. if (!_isValid(originalDate)) {
  3366. throw new RangeError("Invalid time value");
  3367. }
  3368. var parts = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
  3369. var firstCharacter = substring[0];
  3370. if (firstCharacter === "p" || firstCharacter === "P") {
  3371. var longFormatter = _longFormatters[firstCharacter];
  3372. return longFormatter(substring, locale.formatLong);
  3373. }
  3374. return substring;
  3375. }).join("").match(formattingTokensRegExp).map(function (substring) {
  3376. if (substring === "''") {
  3377. return { isToken: false, value: "'" };
  3378. }
  3379. var firstCharacter = substring[0];
  3380. if (firstCharacter === "'") {
  3381. return { isToken: false, value: cleanEscapedString(substring) };
  3382. }
  3383. if (_formatters[firstCharacter]) {
  3384. return { isToken: true, value: substring };
  3385. }
  3386. if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
  3387. throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
  3388. }
  3389. return { isToken: false, value: substring };
  3390. });
  3391. if (locale.localize.preprocessor) {
  3392. parts = locale.localize.preprocessor(originalDate, parts);
  3393. }
  3394. var formatterOptions = {
  3395. firstWeekContainsDate: firstWeekContainsDate,
  3396. weekStartsOn: weekStartsOn,
  3397. locale: locale
  3398. };
  3399. return parts.map(function (part) {
  3400. if (!part.isToken)
  3401. return part.value;
  3402. var token = part.value;
  3403. if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token) || !(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
  3404. warnOrThrowProtectedError(token, formatStr, String(date));
  3405. }
  3406. var formatter = _formatters[token[0]];
  3407. return formatter(originalDate, token, locale.localize, formatterOptions);
  3408. }).join("");
  3409. }
  3410. var cleanEscapedString = function cleanEscapedString(input) {
  3411. var matched = input.match(escapedStringRegExp);
  3412. if (!matched) {
  3413. return input;
  3414. }
  3415. return matched[1].replace(doubleQuoteRegExp, "'");
  3416. };
  3417. var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
  3418. var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
  3419. var escapedStringRegExp = /^'([^]*?)'?$/;
  3420. var doubleQuoteRegExp = /''/g;
  3421. var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
  3422. // lib/formatDistance.mjs
  3423. function formatDistance3(date, baseDate, options) {var _ref20, _options$locale8;
  3424. var defaultOptions8 = getDefaultOptions();
  3425. var locale = (_ref20 = (_options$locale8 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale8 !== void 0 ? _options$locale8 : defaultOptions8.locale) !== null && _ref20 !== void 0 ? _ref20 : enUS;
  3426. var minutesInAlmostTwoDays = 2520;
  3427. var comparison = _compareAsc(date, baseDate);
  3428. if (isNaN(comparison)) {
  3429. throw new RangeError("Invalid time value");
  3430. }
  3431. var localizeOptions = Object.assign({}, options, {
  3432. addSuffix: options === null || options === void 0 ? void 0 : options.addSuffix,
  3433. comparison: comparison
  3434. });
  3435. var dateLeft;
  3436. var dateRight;
  3437. if (comparison > 0) {
  3438. dateLeft = _toDate(baseDate);
  3439. dateRight = _toDate(date);
  3440. } else {
  3441. dateLeft = _toDate(date);
  3442. dateRight = _toDate(baseDate);
  3443. }
  3444. var seconds = _differenceInSeconds(dateRight, dateLeft);
  3445. var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1000;
  3446. var minutes = Math.round((seconds - offsetInSeconds) / 60);
  3447. var months;
  3448. if (minutes < 2) {
  3449. if (options !== null && options !== void 0 && options.includeSeconds) {
  3450. if (seconds < 5) {
  3451. return locale.formatDistance("lessThanXSeconds", 5, localizeOptions);
  3452. } else if (seconds < 10) {
  3453. return locale.formatDistance("lessThanXSeconds", 10, localizeOptions);
  3454. } else if (seconds < 20) {
  3455. return locale.formatDistance("lessThanXSeconds", 20, localizeOptions);
  3456. } else if (seconds < 40) {
  3457. return locale.formatDistance("halfAMinute", 0, localizeOptions);
  3458. } else if (seconds < 60) {
  3459. return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
  3460. } else {
  3461. return locale.formatDistance("xMinutes", 1, localizeOptions);
  3462. }
  3463. } else {
  3464. if (minutes === 0) {
  3465. return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
  3466. } else {
  3467. return locale.formatDistance("xMinutes", minutes, localizeOptions);
  3468. }
  3469. }
  3470. } else if (minutes < 45) {
  3471. return locale.formatDistance("xMinutes", minutes, localizeOptions);
  3472. } else if (minutes < 90) {
  3473. return locale.formatDistance("aboutXHours", 1, localizeOptions);
  3474. } else if (minutes < minutesInDay) {
  3475. var hours = Math.round(minutes / 60);
  3476. return locale.formatDistance("aboutXHours", hours, localizeOptions);
  3477. } else if (minutes < minutesInAlmostTwoDays) {
  3478. return locale.formatDistance("xDays", 1, localizeOptions);
  3479. } else if (minutes < minutesInMonth) {
  3480. var _days = Math.round(minutes / minutesInDay);
  3481. return locale.formatDistance("xDays", _days, localizeOptions);
  3482. } else if (minutes < minutesInMonth * 2) {
  3483. months = Math.round(minutes / minutesInMonth);
  3484. return locale.formatDistance("aboutXMonths", months, localizeOptions);
  3485. }
  3486. months = _differenceInMonths(dateRight, dateLeft);
  3487. if (months < 12) {
  3488. var nearestMonth = Math.round(minutes / minutesInMonth);
  3489. return locale.formatDistance("xMonths", nearestMonth, localizeOptions);
  3490. } else {
  3491. var monthsSinceStartOfYear = months % 12;
  3492. var years = Math.trunc(months / 12);
  3493. if (monthsSinceStartOfYear < 3) {
  3494. return locale.formatDistance("aboutXYears", years, localizeOptions);
  3495. } else if (monthsSinceStartOfYear < 9) {
  3496. return locale.formatDistance("overXYears", years, localizeOptions);
  3497. } else {
  3498. return locale.formatDistance("almostXYears", years + 1, localizeOptions);
  3499. }
  3500. }
  3501. }
  3502. // lib/formatDistanceStrict.mjs
  3503. function _formatDistanceStrict(date, baseDate, options) {var _ref21, _options$locale9, _options$roundingMeth;
  3504. var defaultOptions9 = getDefaultOptions();
  3505. var locale = (_ref21 = (_options$locale9 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale9 !== void 0 ? _options$locale9 : defaultOptions9.locale) !== null && _ref21 !== void 0 ? _ref21 : enUS;
  3506. var comparison = _compareAsc(date, baseDate);
  3507. if (isNaN(comparison)) {
  3508. throw new RangeError("Invalid time value");
  3509. }
  3510. var localizeOptions = Object.assign({}, options, {
  3511. addSuffix: options === null || options === void 0 ? void 0 : options.addSuffix,
  3512. comparison: comparison
  3513. });
  3514. var dateLeft;
  3515. var dateRight;
  3516. if (comparison > 0) {
  3517. dateLeft = _toDate(baseDate);
  3518. dateRight = _toDate(date);
  3519. } else {
  3520. dateLeft = _toDate(date);
  3521. dateRight = _toDate(baseDate);
  3522. }
  3523. var roundingMethod = getRoundingMethod((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : "round");
  3524. var milliseconds = dateRight.getTime() - dateLeft.getTime();
  3525. var minutes = milliseconds / millisecondsInMinute;
  3526. var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft);
  3527. var dstNormalizedMinutes = (milliseconds - timezoneOffset) / millisecondsInMinute;
  3528. var defaultUnit = options === null || options === void 0 ? void 0 : options.unit;
  3529. var unit;
  3530. if (!defaultUnit) {
  3531. if (minutes < 1) {
  3532. unit = "second";
  3533. } else if (minutes < 60) {
  3534. unit = "minute";
  3535. } else if (minutes < minutesInDay) {
  3536. unit = "hour";
  3537. } else if (dstNormalizedMinutes < minutesInMonth) {
  3538. unit = "day";
  3539. } else if (dstNormalizedMinutes < minutesInYear) {
  3540. unit = "month";
  3541. } else {
  3542. unit = "year";
  3543. }
  3544. } else {
  3545. unit = defaultUnit;
  3546. }
  3547. if (unit === "second") {
  3548. var seconds = roundingMethod(milliseconds / 1000);
  3549. return locale.formatDistance("xSeconds", seconds, localizeOptions);
  3550. } else if (unit === "minute") {
  3551. var roundedMinutes = roundingMethod(minutes);
  3552. return locale.formatDistance("xMinutes", roundedMinutes, localizeOptions);
  3553. } else if (unit === "hour") {
  3554. var hours = roundingMethod(minutes / 60);
  3555. return locale.formatDistance("xHours", hours, localizeOptions);
  3556. } else if (unit === "day") {
  3557. var _days2 = roundingMethod(dstNormalizedMinutes / minutesInDay);
  3558. return locale.formatDistance("xDays", _days2, localizeOptions);
  3559. } else if (unit === "month") {
  3560. var _months = roundingMethod(dstNormalizedMinutes / minutesInMonth);
  3561. return _months === 12 && defaultUnit !== "month" ? locale.formatDistance("xYears", 1, localizeOptions) : locale.formatDistance("xMonths", _months, localizeOptions);
  3562. } else {
  3563. var years = roundingMethod(dstNormalizedMinutes / minutesInYear);
  3564. return locale.formatDistance("xYears", years, localizeOptions);
  3565. }
  3566. }
  3567. // lib/formatDistanceToNow.mjs
  3568. function _formatDistanceToNow(date, options) {
  3569. return formatDistance3(date, _constructNow(date), options);
  3570. }
  3571. // lib/formatDistanceToNowStrict.mjs
  3572. function _formatDistanceToNowStrict(date, options) {
  3573. return _formatDistanceStrict(date, _constructNow(date), options);
  3574. }
  3575. // lib/formatDuration.mjs
  3576. function _formatDuration(duration, options) {var _ref22, _options$locale10, _options$format, _options$zero, _options$delimiter;
  3577. var defaultOptions10 = getDefaultOptions();
  3578. var locale = (_ref22 = (_options$locale10 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale10 !== void 0 ? _options$locale10 : defaultOptions10.locale) !== null && _ref22 !== void 0 ? _ref22 : enUS;
  3579. var format2 = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat;
  3580. var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false;
  3581. var delimiter = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : " ";
  3582. if (!locale.formatDistance) {
  3583. return "";
  3584. }
  3585. var result = format2.reduce(function (acc, unit) {
  3586. var token = "x".concat(unit.replace(/(^.)/, function (m) {return m.toUpperCase();}));
  3587. var value = duration[unit];
  3588. if (value !== undefined && (zero || duration[unit])) {
  3589. return acc.concat(locale.formatDistance(token, value));
  3590. }
  3591. return acc;
  3592. }, []).join(delimiter);
  3593. return result;
  3594. }
  3595. var defaultFormat = [
  3596. "years",
  3597. "months",
  3598. "weeks",
  3599. "days",
  3600. "hours",
  3601. "minutes",
  3602. "seconds"];
  3603. // lib/formatISO.mjs
  3604. function _formatISO2(date, options) {var _options$format2, _options$representati;
  3605. var _date = _toDate(date);
  3606. if (isNaN(_date.getTime())) {
  3607. throw new RangeError("Invalid time value");
  3608. }
  3609. var format2 = (_options$format2 = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format2 !== void 0 ? _options$format2 : "extended";
  3610. var representation = (_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : "complete";
  3611. var result = "";
  3612. var tzOffset = "";
  3613. var dateDelimiter = format2 === "extended" ? "-" : "";
  3614. var timeDelimiter = format2 === "extended" ? ":" : "";
  3615. if (representation !== "time") {
  3616. var day = addLeadingZeros(_date.getDate(), 2);
  3617. var month = addLeadingZeros(_date.getMonth() + 1, 2);
  3618. var year = addLeadingZeros(_date.getFullYear(), 4);
  3619. result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);
  3620. }
  3621. if (representation !== "date") {
  3622. var offset = _date.getTimezoneOffset();
  3623. if (offset !== 0) {
  3624. var absoluteOffset = Math.abs(offset);
  3625. var hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
  3626. var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
  3627. var sign = offset < 0 ? "+" : "-";
  3628. tzOffset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset);
  3629. } else {
  3630. tzOffset = "Z";
  3631. }
  3632. var hour = addLeadingZeros(_date.getHours(), 2);
  3633. var minute = addLeadingZeros(_date.getMinutes(), 2);
  3634. var second = addLeadingZeros(_date.getSeconds(), 2);
  3635. var separator = result === "" ? "" : "T";
  3636. var time = [hour, minute, second].join(timeDelimiter);
  3637. result = "".concat(result).concat(separator).concat(time).concat(tzOffset);
  3638. }
  3639. return result;
  3640. }
  3641. // lib/formatISO9075.mjs
  3642. function _formatISO(date, options) {var _options$format3, _options$representati2;
  3643. var _date = _toDate(date);
  3644. if (!_isValid(_date)) {
  3645. throw new RangeError("Invalid time value");
  3646. }
  3647. var format2 = (_options$format3 = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format3 !== void 0 ? _options$format3 : "extended";
  3648. var representation = (_options$representati2 = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati2 !== void 0 ? _options$representati2 : "complete";
  3649. var result = "";
  3650. var dateDelimiter = format2 === "extended" ? "-" : "";
  3651. var timeDelimiter = format2 === "extended" ? ":" : "";
  3652. if (representation !== "time") {
  3653. var day = addLeadingZeros(_date.getDate(), 2);
  3654. var month = addLeadingZeros(_date.getMonth() + 1, 2);
  3655. var year = addLeadingZeros(_date.getFullYear(), 4);
  3656. result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);
  3657. }
  3658. if (representation !== "date") {
  3659. var hour = addLeadingZeros(_date.getHours(), 2);
  3660. var minute = addLeadingZeros(_date.getMinutes(), 2);
  3661. var second = addLeadingZeros(_date.getSeconds(), 2);
  3662. var separator = result === "" ? "" : " ";
  3663. result = "".concat(result).concat(separator).concat(hour).concat(timeDelimiter).concat(minute).concat(timeDelimiter).concat(second);
  3664. }
  3665. return result;
  3666. }
  3667. // lib/formatISODuration.mjs
  3668. function _formatISODuration(duration) {
  3669. var _duration$years2 =
  3670. duration.years,years = _duration$years2 === void 0 ? 0 : _duration$years2,_duration$months2 = duration.months,months = _duration$months2 === void 0 ? 0 : _duration$months2,_duration$days2 = duration.days,days = _duration$days2 === void 0 ? 0 : _duration$days2,_duration$hours2 = duration.hours,hours = _duration$hours2 === void 0 ? 0 : _duration$hours2,_duration$minutes2 = duration.minutes,minutes = _duration$minutes2 === void 0 ? 0 : _duration$minutes2,_duration$seconds2 = duration.seconds,seconds = _duration$seconds2 === void 0 ? 0 : _duration$seconds2;
  3671. return "P".concat(years, "Y").concat(months, "M").concat(days, "DT").concat(hours, "H").concat(minutes, "M").concat(seconds, "S");
  3672. }
  3673. // lib/formatRFC3339.mjs
  3674. function _formatRFC2(date, options) {var _options$fractionDigi;
  3675. var _date = _toDate(date);
  3676. if (!_isValid(_date)) {
  3677. throw new RangeError("Invalid time value");
  3678. }
  3679. var fractionDigits = (_options$fractionDigi = options === null || options === void 0 ? void 0 : options.fractionDigits) !== null && _options$fractionDigi !== void 0 ? _options$fractionDigi : 0;
  3680. var day = addLeadingZeros(_date.getDate(), 2);
  3681. var month = addLeadingZeros(_date.getMonth() + 1, 2);
  3682. var year = _date.getFullYear();
  3683. var hour = addLeadingZeros(_date.getHours(), 2);
  3684. var minute = addLeadingZeros(_date.getMinutes(), 2);
  3685. var second = addLeadingZeros(_date.getSeconds(), 2);
  3686. var fractionalSecond = "";
  3687. if (fractionDigits > 0) {
  3688. var milliseconds = _date.getMilliseconds();
  3689. var fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, fractionDigits - 3));
  3690. fractionalSecond = "." + addLeadingZeros(fractionalSeconds, fractionDigits);
  3691. }
  3692. var offset = "";
  3693. var tzOffset = _date.getTimezoneOffset();
  3694. if (tzOffset !== 0) {
  3695. var absoluteOffset = Math.abs(tzOffset);
  3696. var hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
  3697. var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
  3698. var sign = tzOffset < 0 ? "+" : "-";
  3699. offset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset);
  3700. } else {
  3701. offset = "Z";
  3702. }
  3703. return "".concat(year, "-").concat(month, "-").concat(day, "T").concat(hour, ":").concat(minute, ":").concat(second).concat(fractionalSecond).concat(offset);
  3704. }
  3705. // lib/formatRFC7231.mjs
  3706. function _formatRFC(date) {
  3707. var _date = _toDate(date);
  3708. if (!_isValid(_date)) {
  3709. throw new RangeError("Invalid time value");
  3710. }
  3711. var dayName = days[_date.getUTCDay()];
  3712. var dayOfMonth = addLeadingZeros(_date.getUTCDate(), 2);
  3713. var monthName = months[_date.getUTCMonth()];
  3714. var year = _date.getUTCFullYear();
  3715. var hour = addLeadingZeros(_date.getUTCHours(), 2);
  3716. var minute = addLeadingZeros(_date.getUTCMinutes(), 2);
  3717. var second = addLeadingZeros(_date.getUTCSeconds(), 2);
  3718. return "".concat(dayName, ", ").concat(dayOfMonth, " ").concat(monthName, " ").concat(year, " ").concat(hour, ":").concat(minute, ":").concat(second, " GMT");
  3719. }
  3720. var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
  3721. var months = [
  3722. "Jan",
  3723. "Feb",
  3724. "Mar",
  3725. "Apr",
  3726. "May",
  3727. "Jun",
  3728. "Jul",
  3729. "Aug",
  3730. "Sep",
  3731. "Oct",
  3732. "Nov",
  3733. "Dec"];
  3734. // lib/formatRelative.mjs
  3735. function formatRelative3(date, baseDate, options) {var _ref23, _options$locale11, _ref24, _ref25, _ref26, _options$weekStartsOn4, _options$locale12, _defaultOptions11$loc;
  3736. var _date = _toDate(date);
  3737. var _baseDate = _toDate(baseDate);
  3738. var defaultOptions11 = getDefaultOptions();
  3739. var locale = (_ref23 = (_options$locale11 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale11 !== void 0 ? _options$locale11 : defaultOptions11.locale) !== null && _ref23 !== void 0 ? _ref23 : enUS;
  3740. var weekStartsOn = (_ref24 = (_ref25 = (_ref26 = (_options$weekStartsOn4 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn4 !== void 0 ? _options$weekStartsOn4 : options === null || options === void 0 || (_options$locale12 = options.locale) === null || _options$locale12 === void 0 || (_options$locale12 = _options$locale12.options) === null || _options$locale12 === void 0 ? void 0 : _options$locale12.weekStartsOn) !== null && _ref26 !== void 0 ? _ref26 : defaultOptions11.weekStartsOn) !== null && _ref25 !== void 0 ? _ref25 : (_defaultOptions11$loc = defaultOptions11.locale) === null || _defaultOptions11$loc === void 0 || (_defaultOptions11$loc = _defaultOptions11$loc.options) === null || _defaultOptions11$loc === void 0 ? void 0 : _defaultOptions11$loc.weekStartsOn) !== null && _ref24 !== void 0 ? _ref24 : 0;
  3741. var diff = _differenceInCalendarDays(_date, _baseDate);
  3742. if (isNaN(diff)) {
  3743. throw new RangeError("Invalid time value");
  3744. }
  3745. var token;
  3746. if (diff < -6) {
  3747. token = "other";
  3748. } else if (diff < -1) {
  3749. token = "lastWeek";
  3750. } else if (diff < 0) {
  3751. token = "yesterday";
  3752. } else if (diff < 1) {
  3753. token = "today";
  3754. } else if (diff < 2) {
  3755. token = "tomorrow";
  3756. } else if (diff < 7) {
  3757. token = "nextWeek";
  3758. } else {
  3759. token = "other";
  3760. }
  3761. var formatStr = locale.formatRelative(token, _date, _baseDate, {
  3762. locale: locale,
  3763. weekStartsOn: weekStartsOn
  3764. });
  3765. return _format(_date, formatStr, { locale: locale, weekStartsOn: weekStartsOn });
  3766. }
  3767. // lib/fromUnixTime.mjs
  3768. function _fromUnixTime(unixTime) {
  3769. return _toDate(unixTime * 1000);
  3770. }
  3771. // lib/getDate.mjs
  3772. function _getDate(date) {
  3773. var _date = _toDate(date);
  3774. var dayOfMonth = _date.getDate();
  3775. return dayOfMonth;
  3776. }
  3777. // lib/getDay.mjs
  3778. function _getDay(date) {
  3779. var _date = _toDate(date);
  3780. var day = _date.getDay();
  3781. return day;
  3782. }
  3783. // lib/getDaysInMonth.mjs
  3784. function _getDaysInMonth(date) {
  3785. var _date = _toDate(date);
  3786. var year = _date.getFullYear();
  3787. var monthIndex = _date.getMonth();
  3788. var lastDayOfMonth = _constructFrom(date, 0);
  3789. lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
  3790. lastDayOfMonth.setHours(0, 0, 0, 0);
  3791. return lastDayOfMonth.getDate();
  3792. }
  3793. // lib/isLeapYear.mjs
  3794. function _isLeapYear(date) {
  3795. var _date = _toDate(date);
  3796. var year = _date.getFullYear();
  3797. return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
  3798. }
  3799. // lib/getDaysInYear.mjs
  3800. function _getDaysInYear(date) {
  3801. var _date = _toDate(date);
  3802. if (String(new Date(_date)) === "Invalid Date") {
  3803. return NaN;
  3804. }
  3805. return _isLeapYear(_date) ? 366 : 365;
  3806. }
  3807. // lib/getDecade.mjs
  3808. function _getDecade(date) {
  3809. var _date = _toDate(date);
  3810. var year = _date.getFullYear();
  3811. var decade = Math.floor(year / 10) * 10;
  3812. return decade;
  3813. }
  3814. // lib/getDefaultOptions.mjs
  3815. function getDefaultOptions2() {
  3816. return Object.assign({}, getDefaultOptions());
  3817. }
  3818. // lib/getHours.mjs
  3819. function _getHours(date) {
  3820. var _date = _toDate(date);
  3821. var hours = _date.getHours();
  3822. return hours;
  3823. }
  3824. // lib/getISODay.mjs
  3825. function _getISODay(date) {
  3826. var _date = _toDate(date);
  3827. var day = _date.getDay();
  3828. if (day === 0) {
  3829. day = 7;
  3830. }
  3831. return day;
  3832. }
  3833. // lib/getISOWeeksInYear.mjs
  3834. function _getISOWeeksInYear(date) {
  3835. var thisYear = _startOfISOWeekYear(date);
  3836. var nextYear = _startOfISOWeekYear(_addWeeks(thisYear, 60));
  3837. var diff = +nextYear - +thisYear;
  3838. return Math.round(diff / millisecondsInWeek);
  3839. }
  3840. // lib/getMilliseconds.mjs
  3841. function _getMilliseconds(date) {
  3842. var _date = _toDate(date);
  3843. var milliseconds = _date.getMilliseconds();
  3844. return milliseconds;
  3845. }
  3846. // lib/getMinutes.mjs
  3847. function _getMinutes(date) {
  3848. var _date = _toDate(date);
  3849. var minutes = _date.getMinutes();
  3850. return minutes;
  3851. }
  3852. // lib/getMonth.mjs
  3853. function _getMonth(date) {
  3854. var _date = _toDate(date);
  3855. var month = _date.getMonth();
  3856. return month;
  3857. }
  3858. // lib/getOverlappingDaysInIntervals.mjs
  3859. function _getOverlappingDaysInIntervals(intervalLeft, intervalRight) {
  3860. var _sort5 = [
  3861. +_toDate(intervalLeft.start),
  3862. +_toDate(intervalLeft.end)].
  3863. sort(function (a, b) {return a - b;}),_sort6 = _slicedToArray(_sort5, 2),leftStart = _sort6[0],leftEnd = _sort6[1];
  3864. var _sort7 = [
  3865. +_toDate(intervalRight.start),
  3866. +_toDate(intervalRight.end)].
  3867. sort(function (a, b) {return a - b;}),_sort8 = _slicedToArray(_sort7, 2),rightStart = _sort8[0],rightEnd = _sort8[1];
  3868. var isOverlapping = leftStart < rightEnd && rightStart < leftEnd;
  3869. if (!isOverlapping)
  3870. return 0;
  3871. var overlapLeft = rightStart < leftStart ? leftStart : rightStart;
  3872. var left = overlapLeft - getTimezoneOffsetInMilliseconds(overlapLeft);
  3873. var overlapRight = rightEnd > leftEnd ? leftEnd : rightEnd;
  3874. var right = overlapRight - getTimezoneOffsetInMilliseconds(overlapRight);
  3875. return Math.ceil((right - left) / millisecondsInDay);
  3876. }
  3877. // lib/getSeconds.mjs
  3878. function _getSeconds(date) {
  3879. var _date = _toDate(date);
  3880. var seconds = _date.getSeconds();
  3881. return seconds;
  3882. }
  3883. // lib/getTime.mjs
  3884. function _getTime(date) {
  3885. var _date = _toDate(date);
  3886. var timestamp = _date.getTime();
  3887. return timestamp;
  3888. }
  3889. // lib/getUnixTime.mjs
  3890. function _getUnixTime(date) {
  3891. return Math.trunc(+_toDate(date) / 1000);
  3892. }
  3893. // lib/getWeekOfMonth.mjs
  3894. function _getWeekOfMonth(date, options) {var _ref27, _ref28, _ref29, _options$weekStartsOn5, _options$locale13, _defaultOptions13$loc;
  3895. var defaultOptions13 = getDefaultOptions();
  3896. var weekStartsOn = (_ref27 = (_ref28 = (_ref29 = (_options$weekStartsOn5 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn5 !== void 0 ? _options$weekStartsOn5 : options === null || options === void 0 || (_options$locale13 = options.locale) === null || _options$locale13 === void 0 || (_options$locale13 = _options$locale13.options) === null || _options$locale13 === void 0 ? void 0 : _options$locale13.weekStartsOn) !== null && _ref29 !== void 0 ? _ref29 : defaultOptions13.weekStartsOn) !== null && _ref28 !== void 0 ? _ref28 : (_defaultOptions13$loc = defaultOptions13.locale) === null || _defaultOptions13$loc === void 0 || (_defaultOptions13$loc = _defaultOptions13$loc.options) === null || _defaultOptions13$loc === void 0 ? void 0 : _defaultOptions13$loc.weekStartsOn) !== null && _ref27 !== void 0 ? _ref27 : 0;
  3897. var currentDayOfMonth = _getDate(date);
  3898. if (isNaN(currentDayOfMonth))
  3899. return NaN;
  3900. var startWeekDay = _getDay(_startOfMonth(date));
  3901. var lastDayOfFirstWeek = weekStartsOn - startWeekDay;
  3902. if (lastDayOfFirstWeek <= 0)
  3903. lastDayOfFirstWeek += 7;
  3904. var remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek;
  3905. return Math.ceil(remainingDaysAfterFirstWeek / 7) + 1;
  3906. }
  3907. // lib/lastDayOfMonth.mjs
  3908. function _lastDayOfMonth(date) {
  3909. var _date = _toDate(date);
  3910. var month = _date.getMonth();
  3911. _date.setFullYear(_date.getFullYear(), month + 1, 0);
  3912. _date.setHours(0, 0, 0, 0);
  3913. return _date;
  3914. }
  3915. // lib/getWeeksInMonth.mjs
  3916. function _getWeeksInMonth(date, options) {
  3917. return _differenceInCalendarWeeks(_lastDayOfMonth(date), _startOfMonth(date), options) + 1;
  3918. }
  3919. // lib/getYear.mjs
  3920. function _getYear(date) {
  3921. return _toDate(date).getFullYear();
  3922. }
  3923. // lib/hoursToMilliseconds.mjs
  3924. function _hoursToMilliseconds(hours) {
  3925. return Math.trunc(hours * millisecondsInHour);
  3926. }
  3927. // lib/hoursToMinutes.mjs
  3928. function _hoursToMinutes(hours) {
  3929. return Math.trunc(hours * minutesInHour);
  3930. }
  3931. // lib/hoursToSeconds.mjs
  3932. function _hoursToSeconds(hours) {
  3933. return Math.trunc(hours * secondsInHour);
  3934. }
  3935. // lib/interval.mjs
  3936. function _interval(start, end, options) {
  3937. var _start = _toDate(start);
  3938. if (isNaN(+_start))
  3939. throw new TypeError("Start date is invalid");
  3940. var _end = _toDate(end);
  3941. if (isNaN(+_end))
  3942. throw new TypeError("End date is invalid");
  3943. if (options !== null && options !== void 0 && options.assertPositive && +_start > +_end)
  3944. throw new TypeError("End date must be after start date");
  3945. return { start: _start, end: _end };
  3946. }
  3947. // lib/intervalToDuration.mjs
  3948. function _intervalToDuration(interval2) {
  3949. var start = _toDate(interval2.start);
  3950. var end = _toDate(interval2.end);
  3951. var duration = {};
  3952. var years = _differenceInYears(end, start);
  3953. if (years)
  3954. duration.years = years;
  3955. var remainingMonths = _add(start, { years: duration.years });
  3956. var months2 = _differenceInMonths(end, remainingMonths);
  3957. if (months2)
  3958. duration.months = months2;
  3959. var remainingDays = _add(remainingMonths, { months: duration.months });
  3960. var days2 = _differenceInDays(end, remainingDays);
  3961. if (days2)
  3962. duration.days = days2;
  3963. var remainingHours = _add(remainingDays, { days: duration.days });
  3964. var hours = _differenceInHours(end, remainingHours);
  3965. if (hours)
  3966. duration.hours = hours;
  3967. var remainingMinutes = _add(remainingHours, { hours: duration.hours });
  3968. var minutes = _differenceInMinutes(end, remainingMinutes);
  3969. if (minutes)
  3970. duration.minutes = minutes;
  3971. var remainingSeconds = _add(remainingMinutes, { minutes: duration.minutes });
  3972. var seconds = _differenceInSeconds(end, remainingSeconds);
  3973. if (seconds)
  3974. duration.seconds = seconds;
  3975. return duration;
  3976. }
  3977. // lib/intlFormat.mjs
  3978. function _intlFormat(date, formatOrLocale, localeOptions) {var _localeOptions;
  3979. var formatOptions;
  3980. if (isFormatOptions(formatOrLocale)) {
  3981. formatOptions = formatOrLocale;
  3982. } else {
  3983. localeOptions = formatOrLocale;
  3984. }
  3985. return new Intl.DateTimeFormat((_localeOptions = localeOptions) === null || _localeOptions === void 0 ? void 0 : _localeOptions.locale, formatOptions).format(_toDate(date));
  3986. }
  3987. var isFormatOptions = function isFormatOptions(opts) {
  3988. return opts !== undefined && !("locale" in opts);
  3989. };
  3990. // lib/intlFormatDistance.mjs
  3991. function _intlFormatDistance(date, baseDate, options) {
  3992. var value = 0;
  3993. var unit;
  3994. var dateLeft = _toDate(date);
  3995. var dateRight = _toDate(baseDate);
  3996. if (!(options !== null && options !== void 0 && options.unit)) {
  3997. var diffInSeconds = _differenceInSeconds(dateLeft, dateRight);
  3998. if (Math.abs(diffInSeconds) < secondsInMinute) {
  3999. value = _differenceInSeconds(dateLeft, dateRight);
  4000. unit = "second";
  4001. } else if (Math.abs(diffInSeconds) < secondsInHour) {
  4002. value = _differenceInMinutes(dateLeft, dateRight);
  4003. unit = "minute";
  4004. } else if (Math.abs(diffInSeconds) < secondsInDay && Math.abs(_differenceInCalendarDays(dateLeft, dateRight)) < 1) {
  4005. value = _differenceInHours(dateLeft, dateRight);
  4006. unit = "hour";
  4007. } else if (Math.abs(diffInSeconds) < secondsInWeek && (value = _differenceInCalendarDays(dateLeft, dateRight)) && Math.abs(value) < 7) {
  4008. unit = "day";
  4009. } else if (Math.abs(diffInSeconds) < secondsInMonth) {
  4010. value = _differenceInCalendarWeeks(dateLeft, dateRight);
  4011. unit = "week";
  4012. } else if (Math.abs(diffInSeconds) < secondsInQuarter) {
  4013. value = _differenceInCalendarMonths(dateLeft, dateRight);
  4014. unit = "month";
  4015. } else if (Math.abs(diffInSeconds) < secondsInYear) {
  4016. if (_differenceInCalendarQuarters(dateLeft, dateRight) < 4) {
  4017. value = _differenceInCalendarQuarters(dateLeft, dateRight);
  4018. unit = "quarter";
  4019. } else {
  4020. value = _differenceInCalendarYears(dateLeft, dateRight);
  4021. unit = "year";
  4022. }
  4023. } else {
  4024. value = _differenceInCalendarYears(dateLeft, dateRight);
  4025. unit = "year";
  4026. }
  4027. } else {
  4028. unit = options === null || options === void 0 ? void 0 : options.unit;
  4029. if (unit === "second") {
  4030. value = _differenceInSeconds(dateLeft, dateRight);
  4031. } else if (unit === "minute") {
  4032. value = _differenceInMinutes(dateLeft, dateRight);
  4033. } else if (unit === "hour") {
  4034. value = _differenceInHours(dateLeft, dateRight);
  4035. } else if (unit === "day") {
  4036. value = _differenceInCalendarDays(dateLeft, dateRight);
  4037. } else if (unit === "week") {
  4038. value = _differenceInCalendarWeeks(dateLeft, dateRight);
  4039. } else if (unit === "month") {
  4040. value = _differenceInCalendarMonths(dateLeft, dateRight);
  4041. } else if (unit === "quarter") {
  4042. value = _differenceInCalendarQuarters(dateLeft, dateRight);
  4043. } else if (unit === "year") {
  4044. value = _differenceInCalendarYears(dateLeft, dateRight);
  4045. }
  4046. }
  4047. var rtf = new Intl.RelativeTimeFormat(options === null || options === void 0 ? void 0 : options.locale, {
  4048. localeMatcher: options === null || options === void 0 ? void 0 : options.localeMatcher,
  4049. numeric: (options === null || options === void 0 ? void 0 : options.numeric) || "auto",
  4050. style: options === null || options === void 0 ? void 0 : options.style
  4051. });
  4052. return rtf.format(value, unit);
  4053. }
  4054. // lib/isAfter.mjs
  4055. function _isAfter(date, dateToCompare) {
  4056. var _date = _toDate(date);
  4057. var _dateToCompare = _toDate(dateToCompare);
  4058. return _date.getTime() > _dateToCompare.getTime();
  4059. }
  4060. // lib/isBefore.mjs
  4061. function _isBefore(date, dateToCompare) {
  4062. var _date = _toDate(date);
  4063. var _dateToCompare = _toDate(dateToCompare);
  4064. return +_date < +_dateToCompare;
  4065. }
  4066. // lib/isEqual.mjs
  4067. function _isEqual(leftDate, rightDate) {
  4068. var _dateLeft = _toDate(leftDate);
  4069. var _dateRight = _toDate(rightDate);
  4070. return +_dateLeft === +_dateRight;
  4071. }
  4072. // lib/isExists.mjs
  4073. function _isExists(year, month, day) {
  4074. var date = new Date(year, month, day);
  4075. return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day;
  4076. }
  4077. // lib/isFirstDayOfMonth.mjs
  4078. function _isFirstDayOfMonth(date) {
  4079. return _toDate(date).getDate() === 1;
  4080. }
  4081. // lib/isFriday.mjs
  4082. function _isFriday(date) {
  4083. return _toDate(date).getDay() === 5;
  4084. }
  4085. // lib/isFuture.mjs
  4086. function _isFuture(date) {
  4087. return +_toDate(date) > Date.now();
  4088. }
  4089. // lib/transpose.mjs
  4090. function _transpose(fromDate, constructor) {
  4091. var date = constructor instanceof Date ? _constructFrom(constructor, 0) : new constructor(0);
  4092. date.setFullYear(fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate());
  4093. date.setHours(fromDate.getHours(), fromDate.getMinutes(), fromDate.getSeconds(), fromDate.getMilliseconds());
  4094. return date;
  4095. }
  4096. // lib/parse/_lib/Setter.mjs
  4097. var TIMEZONE_UNIT_PRIORITY = 10;var
  4098. Setter = /*#__PURE__*/function () {function Setter() {_classCallCheck(this, Setter);_defineProperty(this, "subPriority",
  4099. 0);}_createClass(Setter, [{ key: "validate", value:
  4100. function validate(_utcDate, _options) {
  4101. return true;
  4102. } }]);return Setter;}();var
  4103. ValueSetter = /*#__PURE__*/function (_Setter2) {_inherits(ValueSetter, _Setter2);
  4104. function ValueSetter(value, validateValue, setValue, priority, subPriority) {var _this;_classCallCheck(this, ValueSetter);
  4105. _this = _callSuper(this, ValueSetter);
  4106. _this.value = value;
  4107. _this.validateValue = validateValue;
  4108. _this.setValue = setValue;
  4109. _this.priority = priority;
  4110. if (subPriority) {
  4111. _this.subPriority = subPriority;
  4112. }return _this;
  4113. }_createClass(ValueSetter, [{ key: "validate", value:
  4114. function validate(date, options) {
  4115. return this.validateValue(date, this.value, options);
  4116. } }, { key: "set", value:
  4117. function set(date, flags, options) {
  4118. return this.setValue(date, flags, this.value, options);
  4119. } }]);return ValueSetter;}(Setter);var
  4120. DateToSystemTimezoneSetter = /*#__PURE__*/function (_Setter3) {_inherits(DateToSystemTimezoneSetter, _Setter3);function DateToSystemTimezoneSetter() {var _this2;_classCallCheck(this, DateToSystemTimezoneSetter);for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this2 = _callSuper(this, DateToSystemTimezoneSetter, [].concat(args));_defineProperty(_assertThisInitialized(_this2), "priority",
  4121. TIMEZONE_UNIT_PRIORITY);_defineProperty(_assertThisInitialized(_this2), "subPriority",
  4122. -1);return _this2;}_createClass(DateToSystemTimezoneSetter, [{ key: "set", value:
  4123. function set(date, flags) {
  4124. if (flags.timestampIsSet)
  4125. return date;
  4126. return _constructFrom(date, _transpose(date, Date));
  4127. } }]);return DateToSystemTimezoneSetter;}(Setter);
  4128. // lib/parse/_lib/Parser.mjs
  4129. var Parser = /*#__PURE__*/function () {function Parser() {_classCallCheck(this, Parser);}_createClass(Parser, [{ key: "run", value:
  4130. function run(dateString, token, match3, options) {
  4131. var result = this.parse(dateString, token, match3, options);
  4132. if (!result) {
  4133. return null;
  4134. }
  4135. return {
  4136. setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
  4137. rest: result.rest
  4138. };
  4139. } }, { key: "validate", value:
  4140. function validate(_utcDate, _value, _options) {
  4141. return true;
  4142. } }]);return Parser;}();
  4143. // lib/parse/_lib/parsers/EraParser.mjs
  4144. var EraParser = /*#__PURE__*/function (_Parser) {_inherits(EraParser, _Parser);function EraParser() {var _this3;_classCallCheck(this, EraParser);for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}_this3 = _callSuper(this, EraParser, [].concat(args));_defineProperty(_assertThisInitialized(_this3), "priority",
  4145. 140);_defineProperty(_assertThisInitialized(_this3), "incompatibleTokens",
  4146. ["R", "u", "t", "T"]);return _this3;}_createClass(EraParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "G":case "GG":case "GGG":return match3.era(dateString, { width: "abbreviated" }) || match3.era(dateString, { width: "narrow" });case "GGGGG":return match3.era(dateString, { width: "narrow" });case "GGGG":default:return match3.era(dateString, { width: "wide" }) || match3.era(dateString, { width: "abbreviated" }) || match3.era(dateString, { width: "narrow" });}} }, { key: "set", value: function set(date, flags, value) {flags.era = value;date.setFullYear(value, 0, 1);date.setHours(0, 0, 0, 0);return date;} }]);return EraParser;}(Parser);
  4147. // lib/parse/_lib/constants.mjs
  4148. var numericPatterns = {
  4149. month: /^(1[0-2]|0?\d)/,
  4150. date: /^(3[0-1]|[0-2]?\d)/,
  4151. dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
  4152. week: /^(5[0-3]|[0-4]?\d)/,
  4153. hour23h: /^(2[0-3]|[0-1]?\d)/,
  4154. hour24h: /^(2[0-4]|[0-1]?\d)/,
  4155. hour11h: /^(1[0-1]|0?\d)/,
  4156. hour12h: /^(1[0-2]|0?\d)/,
  4157. minute: /^[0-5]?\d/,
  4158. second: /^[0-5]?\d/,
  4159. singleDigit: /^\d/,
  4160. twoDigits: /^\d{1,2}/,
  4161. threeDigits: /^\d{1,3}/,
  4162. fourDigits: /^\d{1,4}/,
  4163. anyDigitsSigned: /^-?\d+/,
  4164. singleDigitSigned: /^-?\d/,
  4165. twoDigitsSigned: /^-?\d{1,2}/,
  4166. threeDigitsSigned: /^-?\d{1,3}/,
  4167. fourDigitsSigned: /^-?\d{1,4}/
  4168. };
  4169. var timezonePatterns = {
  4170. basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
  4171. basic: /^([+-])(\d{2})(\d{2})|Z/,
  4172. basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
  4173. extended: /^([+-])(\d{2}):(\d{2})|Z/,
  4174. extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
  4175. };
  4176. // lib/parse/_lib/utils.mjs
  4177. function mapValue(parseFnResult, mapFn) {
  4178. if (!parseFnResult) {
  4179. return parseFnResult;
  4180. }
  4181. return {
  4182. value: mapFn(parseFnResult.value),
  4183. rest: parseFnResult.rest
  4184. };
  4185. }
  4186. function parseNumericPattern(pattern, dateString) {
  4187. var matchResult = dateString.match(pattern);
  4188. if (!matchResult) {
  4189. return null;
  4190. }
  4191. return {
  4192. value: parseInt(matchResult[0], 10),
  4193. rest: dateString.slice(matchResult[0].length)
  4194. };
  4195. }
  4196. function parseTimezonePattern(pattern, dateString) {
  4197. var matchResult = dateString.match(pattern);
  4198. if (!matchResult) {
  4199. return null;
  4200. }
  4201. if (matchResult[0] === "Z") {
  4202. return {
  4203. value: 0,
  4204. rest: dateString.slice(1)
  4205. };
  4206. }
  4207. var sign = matchResult[1] === "+" ? 1 : -1;
  4208. var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
  4209. var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
  4210. var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
  4211. return {
  4212. value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
  4213. rest: dateString.slice(matchResult[0].length)
  4214. };
  4215. }
  4216. function parseAnyDigitsSigned(dateString) {
  4217. return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
  4218. }
  4219. function parseNDigits(n, dateString) {
  4220. switch (n) {
  4221. case 1:
  4222. return parseNumericPattern(numericPatterns.singleDigit, dateString);
  4223. case 2:
  4224. return parseNumericPattern(numericPatterns.twoDigits, dateString);
  4225. case 3:
  4226. return parseNumericPattern(numericPatterns.threeDigits, dateString);
  4227. case 4:
  4228. return parseNumericPattern(numericPatterns.fourDigits, dateString);
  4229. default:
  4230. return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
  4231. }
  4232. }
  4233. function parseNDigitsSigned(n, dateString) {
  4234. switch (n) {
  4235. case 1:
  4236. return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
  4237. case 2:
  4238. return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
  4239. case 3:
  4240. return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
  4241. case 4:
  4242. return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
  4243. default:
  4244. return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
  4245. }
  4246. }
  4247. function dayPeriodEnumToHours(dayPeriod) {
  4248. switch (dayPeriod) {
  4249. case "morning":
  4250. return 4;
  4251. case "evening":
  4252. return 17;
  4253. case "pm":
  4254. case "noon":
  4255. case "afternoon":
  4256. return 12;
  4257. case "am":
  4258. case "midnight":
  4259. case "night":
  4260. default:
  4261. return 0;
  4262. }
  4263. }
  4264. function normalizeTwoDigitYear(twoDigitYear, currentYear) {
  4265. var isCommonEra = currentYear > 0;
  4266. var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
  4267. var result;
  4268. if (absCurrentYear <= 50) {
  4269. result = twoDigitYear || 100;
  4270. } else {
  4271. var rangeEnd = absCurrentYear + 50;
  4272. var rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
  4273. var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
  4274. result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
  4275. }
  4276. return isCommonEra ? result : 1 - result;
  4277. }
  4278. function isLeapYearIndex(year) {
  4279. return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
  4280. }
  4281. // lib/parse/_lib/parsers/YearParser.mjs
  4282. var YearParser = /*#__PURE__*/function (_Parser2) {_inherits(YearParser, _Parser2);function YearParser() {var _this4;_classCallCheck(this, YearParser);for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {args[_key3] = arguments[_key3];}_this4 = _callSuper(this, YearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this4), "priority",
  4283. 130);_defineProperty(_assertThisInitialized(_this4), "incompatibleTokens",
  4284. ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);return _this4;}_createClass(YearParser, [{ key: "parse", value:
  4285. function parse(dateString, token, match3) {
  4286. var valueCallback = function valueCallback(year) {return {
  4287. year: year,
  4288. isTwoDigitYear: token === "yy"
  4289. };};
  4290. switch (token) {
  4291. case "y":
  4292. return mapValue(parseNDigits(4, dateString), valueCallback);
  4293. case "yo":
  4294. return mapValue(match3.ordinalNumber(dateString, {
  4295. unit: "year"
  4296. }), valueCallback);
  4297. default:
  4298. return mapValue(parseNDigits(token.length, dateString), valueCallback);
  4299. }
  4300. } }, { key: "validate", value:
  4301. function validate(_date, value) {
  4302. return value.isTwoDigitYear || value.year > 0;
  4303. } }, { key: "set", value:
  4304. function set(date, flags, value) {
  4305. var currentYear = date.getFullYear();
  4306. if (value.isTwoDigitYear) {
  4307. var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
  4308. date.setFullYear(normalizedTwoDigitYear, 0, 1);
  4309. date.setHours(0, 0, 0, 0);
  4310. return date;
  4311. }
  4312. var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
  4313. date.setFullYear(year, 0, 1);
  4314. date.setHours(0, 0, 0, 0);
  4315. return date;
  4316. } }]);return YearParser;}(Parser);
  4317. // lib/parse/_lib/parsers/LocalWeekYearParser.mjs
  4318. var LocalWeekYearParser = /*#__PURE__*/function (_Parser3) {_inherits(LocalWeekYearParser, _Parser3);function LocalWeekYearParser() {var _this5;_classCallCheck(this, LocalWeekYearParser);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}_this5 = _callSuper(this, LocalWeekYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this5), "priority",
  4319. 130);_defineProperty(_assertThisInitialized(_this5), "incompatibleTokens",
  4320. [
  4321. "y",
  4322. "R",
  4323. "u",
  4324. "Q",
  4325. "q",
  4326. "M",
  4327. "L",
  4328. "I",
  4329. "d",
  4330. "D",
  4331. "i",
  4332. "t",
  4333. "T"]);return _this5;}_createClass(LocalWeekYearParser, [{ key: "parse", value: function parse(dateString, token, match3) {var valueCallback = function valueCallback(year) {return { year: year, isTwoDigitYear: token === "YY" };};switch (token) {case "Y":return mapValue(parseNDigits(4, dateString), valueCallback);case "Yo":return mapValue(match3.ordinalNumber(dateString, { unit: "year" }), valueCallback);default:return mapValue(parseNDigits(token.length, dateString), valueCallback);}} }, { key: "validate", value: function validate(_date, value) {return value.isTwoDigitYear || value.year > 0;} }, { key: "set", value: function set(date, flags, value, options) {var currentYear = _getWeekYear(date, options);if (value.isTwoDigitYear) {var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);date.setFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);date.setHours(0, 0, 0, 0);return _startOfWeek(date, options);}var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;date.setFullYear(year, 0, options.firstWeekContainsDate);date.setHours(0, 0, 0, 0);return _startOfWeek(date, options);} }]);return LocalWeekYearParser;}(Parser);
  4334. // lib/parse/_lib/parsers/ISOWeekYearParser.mjs
  4335. var ISOWeekYearParser = /*#__PURE__*/function (_Parser4) {_inherits(ISOWeekYearParser, _Parser4);function ISOWeekYearParser() {var _this6;_classCallCheck(this, ISOWeekYearParser);for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}_this6 = _callSuper(this, ISOWeekYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this6), "priority",
  4336. 130);_defineProperty(_assertThisInitialized(_this6), "incompatibleTokens",
  4337. [
  4338. "G",
  4339. "y",
  4340. "Y",
  4341. "u",
  4342. "Q",
  4343. "q",
  4344. "M",
  4345. "L",
  4346. "w",
  4347. "d",
  4348. "D",
  4349. "e",
  4350. "c",
  4351. "t",
  4352. "T"]);return _this6;}_createClass(ISOWeekYearParser, [{ key: "parse", value: function parse(dateString, token) {if (token === "R") {return parseNDigitsSigned(4, dateString);}return parseNDigitsSigned(token.length, dateString);} }, { key: "set", value: function set(date, _flags, value) {var firstWeekOfYear = _constructFrom(date, 0);firstWeekOfYear.setFullYear(value, 0, 4);firstWeekOfYear.setHours(0, 0, 0, 0);return _startOfISOWeek(firstWeekOfYear);} }]);return ISOWeekYearParser;}(Parser);
  4353. // lib/parse/_lib/parsers/ExtendedYearParser.mjs
  4354. var ExtendedYearParser = /*#__PURE__*/function (_Parser5) {_inherits(ExtendedYearParser, _Parser5);function ExtendedYearParser() {var _this7;_classCallCheck(this, ExtendedYearParser);for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}_this7 = _callSuper(this, ExtendedYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this7), "priority",
  4355. 130);_defineProperty(_assertThisInitialized(_this7), "incompatibleTokens",
  4356. ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);return _this7;}_createClass(ExtendedYearParser, [{ key: "parse", value: function parse(dateString, token) {if (token === "u") {return parseNDigitsSigned(4, dateString);}return parseNDigitsSigned(token.length, dateString);} }, { key: "set", value: function set(date, _flags, value) {date.setFullYear(value, 0, 1);date.setHours(0, 0, 0, 0);return date;} }]);return ExtendedYearParser;}(Parser);
  4357. // lib/parse/_lib/parsers/QuarterParser.mjs
  4358. var QuarterParser = /*#__PURE__*/function (_Parser6) {_inherits(QuarterParser, _Parser6);function QuarterParser() {var _this8;_classCallCheck(this, QuarterParser);for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}_this8 = _callSuper(this, QuarterParser, [].concat(args));_defineProperty(_assertThisInitialized(_this8), "priority",
  4359. 120);_defineProperty(_assertThisInitialized(_this8), "incompatibleTokens",
  4360. [
  4361. "Y",
  4362. "R",
  4363. "q",
  4364. "M",
  4365. "L",
  4366. "w",
  4367. "I",
  4368. "d",
  4369. "D",
  4370. "i",
  4371. "e",
  4372. "c",
  4373. "t",
  4374. "T"]);return _this8;}_createClass(QuarterParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "Q":case "QQ":return parseNDigits(token.length, dateString);case "Qo":return match3.ordinalNumber(dateString, { unit: "quarter" });case "QQQ":return match3.quarter(dateString, { width: "abbreviated", context: "formatting" }) || match3.quarter(dateString, { width: "narrow", context: "formatting" });case "QQQQQ":return match3.quarter(dateString, { width: "narrow", context: "formatting" });case "QQQQ":default:return match3.quarter(dateString, { width: "wide", context: "formatting" }) || match3.quarter(dateString, { width: "abbreviated", context: "formatting" }) || match3.quarter(dateString, { width: "narrow", context: "formatting" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 4;} }, { key: "set", value: function set(date, _flags, value) {date.setMonth((value - 1) * 3, 1);date.setHours(0, 0, 0, 0);return date;} }]);return QuarterParser;}(Parser);
  4375. // lib/parse/_lib/parsers/StandAloneQuarterParser.mjs
  4376. var StandAloneQuarterParser = /*#__PURE__*/function (_Parser7) {_inherits(StandAloneQuarterParser, _Parser7);function StandAloneQuarterParser() {var _this9;_classCallCheck(this, StandAloneQuarterParser);for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}_this9 = _callSuper(this, StandAloneQuarterParser, [].concat(args));_defineProperty(_assertThisInitialized(_this9), "priority",
  4377. 120);_defineProperty(_assertThisInitialized(_this9), "incompatibleTokens",
  4378. [
  4379. "Y",
  4380. "R",
  4381. "Q",
  4382. "M",
  4383. "L",
  4384. "w",
  4385. "I",
  4386. "d",
  4387. "D",
  4388. "i",
  4389. "e",
  4390. "c",
  4391. "t",
  4392. "T"]);return _this9;}_createClass(StandAloneQuarterParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "q":case "qq":return parseNDigits(token.length, dateString);case "qo":return match3.ordinalNumber(dateString, { unit: "quarter" });case "qqq":return match3.quarter(dateString, { width: "abbreviated", context: "standalone" }) || match3.quarter(dateString, { width: "narrow", context: "standalone" });case "qqqqq":return match3.quarter(dateString, { width: "narrow", context: "standalone" });case "qqqq":default:return match3.quarter(dateString, { width: "wide", context: "standalone" }) || match3.quarter(dateString, { width: "abbreviated", context: "standalone" }) || match3.quarter(dateString, { width: "narrow", context: "standalone" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 4;} }, { key: "set", value: function set(date, _flags, value) {date.setMonth((value - 1) * 3, 1);date.setHours(0, 0, 0, 0);return date;} }]);return StandAloneQuarterParser;}(Parser);
  4393. // lib/parse/_lib/parsers/MonthParser.mjs
  4394. var MonthParser = /*#__PURE__*/function (_Parser8) {_inherits(MonthParser, _Parser8);function MonthParser() {var _this10;_classCallCheck(this, MonthParser);for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {args[_key9] = arguments[_key9];}_this10 = _callSuper(this, MonthParser, [].concat(args));_defineProperty(_assertThisInitialized(_this10), "incompatibleTokens",
  4395. [
  4396. "Y",
  4397. "R",
  4398. "q",
  4399. "Q",
  4400. "L",
  4401. "w",
  4402. "I",
  4403. "D",
  4404. "i",
  4405. "e",
  4406. "c",
  4407. "t",
  4408. "T"]);_defineProperty(_assertThisInitialized(_this10), "priority",
  4409. 110);return _this10;}_createClass(MonthParser, [{ key: "parse", value:
  4410. function parse(dateString, token, match3) {
  4411. var valueCallback = function valueCallback(value) {return value - 1;};
  4412. switch (token) {
  4413. case "M":
  4414. return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
  4415. case "MM":
  4416. return mapValue(parseNDigits(2, dateString), valueCallback);
  4417. case "Mo":
  4418. return mapValue(match3.ordinalNumber(dateString, {
  4419. unit: "month"
  4420. }), valueCallback);
  4421. case "MMM":
  4422. return match3.month(dateString, {
  4423. width: "abbreviated",
  4424. context: "formatting"
  4425. }) || match3.month(dateString, { width: "narrow", context: "formatting" });
  4426. case "MMMMM":
  4427. return match3.month(dateString, {
  4428. width: "narrow",
  4429. context: "formatting"
  4430. });
  4431. case "MMMM":
  4432. default:
  4433. return match3.month(dateString, { width: "wide", context: "formatting" }) || match3.month(dateString, {
  4434. width: "abbreviated",
  4435. context: "formatting"
  4436. }) || match3.month(dateString, { width: "narrow", context: "formatting" });
  4437. }
  4438. } }, { key: "validate", value:
  4439. function validate(_date, value) {
  4440. return value >= 0 && value <= 11;
  4441. } }, { key: "set", value:
  4442. function set(date, _flags, value) {
  4443. date.setMonth(value, 1);
  4444. date.setHours(0, 0, 0, 0);
  4445. return date;
  4446. } }]);return MonthParser;}(Parser);
  4447. // lib/parse/_lib/parsers/StandAloneMonthParser.mjs
  4448. var StandAloneMonthParser = /*#__PURE__*/function (_Parser9) {_inherits(StandAloneMonthParser, _Parser9);function StandAloneMonthParser() {var _this11;_classCallCheck(this, StandAloneMonthParser);for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {args[_key10] = arguments[_key10];}_this11 = _callSuper(this, StandAloneMonthParser, [].concat(args));_defineProperty(_assertThisInitialized(_this11), "priority",
  4449. 110);_defineProperty(_assertThisInitialized(_this11), "incompatibleTokens",
  4450. [
  4451. "Y",
  4452. "R",
  4453. "q",
  4454. "Q",
  4455. "M",
  4456. "w",
  4457. "I",
  4458. "D",
  4459. "i",
  4460. "e",
  4461. "c",
  4462. "t",
  4463. "T"]);return _this11;}_createClass(StandAloneMonthParser, [{ key: "parse", value: function parse(dateString, token, match3) {var valueCallback = function valueCallback(value) {return value - 1;};switch (token) {case "L":return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);case "LL":return mapValue(parseNDigits(2, dateString), valueCallback);case "Lo":return mapValue(match3.ordinalNumber(dateString, { unit: "month" }), valueCallback);case "LLL":return match3.month(dateString, { width: "abbreviated", context: "standalone" }) || match3.month(dateString, { width: "narrow", context: "standalone" });case "LLLLL":return match3.month(dateString, { width: "narrow", context: "standalone" });case "LLLL":default:return match3.month(dateString, { width: "wide", context: "standalone" }) || match3.month(dateString, { width: "abbreviated", context: "standalone" }) || match3.month(dateString, { width: "narrow", context: "standalone" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 11;} }, { key: "set", value: function set(date, _flags, value) {date.setMonth(value, 1);date.setHours(0, 0, 0, 0);return date;} }]);return StandAloneMonthParser;}(Parser);
  4464. // lib/setWeek.mjs
  4465. function _setWeek(date, week, options) {
  4466. var _date = _toDate(date);
  4467. var diff = _getWeek(_date, options) - week;
  4468. _date.setDate(_date.getDate() - diff * 7);
  4469. return _date;
  4470. }
  4471. // lib/parse/_lib/parsers/LocalWeekParser.mjs
  4472. var LocalWeekParser = /*#__PURE__*/function (_Parser10) {_inherits(LocalWeekParser, _Parser10);function LocalWeekParser() {var _this12;_classCallCheck(this, LocalWeekParser);for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {args[_key11] = arguments[_key11];}_this12 = _callSuper(this, LocalWeekParser, [].concat(args));_defineProperty(_assertThisInitialized(_this12), "priority",
  4473. 100);_defineProperty(_assertThisInitialized(_this12), "incompatibleTokens",
  4474. [
  4475. "y",
  4476. "R",
  4477. "u",
  4478. "q",
  4479. "Q",
  4480. "M",
  4481. "L",
  4482. "I",
  4483. "d",
  4484. "D",
  4485. "i",
  4486. "t",
  4487. "T"]);return _this12;}_createClass(LocalWeekParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "w":return parseNumericPattern(numericPatterns.week, dateString);case "wo":return match3.ordinalNumber(dateString, { unit: "week" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 53;} }, { key: "set", value: function set(date, _flags, value, options) {return _startOfWeek(_setWeek(date, value, options), options);} }]);return LocalWeekParser;}(Parser);
  4488. // lib/setISOWeek.mjs
  4489. function _setISOWeek(date, week) {
  4490. var _date = _toDate(date);
  4491. var diff = _getISOWeek(_date) - week;
  4492. _date.setDate(_date.getDate() - diff * 7);
  4493. return _date;
  4494. }
  4495. // lib/parse/_lib/parsers/ISOWeekParser.mjs
  4496. var ISOWeekParser = /*#__PURE__*/function (_Parser11) {_inherits(ISOWeekParser, _Parser11);function ISOWeekParser() {var _this13;_classCallCheck(this, ISOWeekParser);for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {args[_key12] = arguments[_key12];}_this13 = _callSuper(this, ISOWeekParser, [].concat(args));_defineProperty(_assertThisInitialized(_this13), "priority",
  4497. 100);_defineProperty(_assertThisInitialized(_this13), "incompatibleTokens",
  4498. [
  4499. "y",
  4500. "Y",
  4501. "u",
  4502. "q",
  4503. "Q",
  4504. "M",
  4505. "L",
  4506. "w",
  4507. "d",
  4508. "D",
  4509. "e",
  4510. "c",
  4511. "t",
  4512. "T"]);return _this13;}_createClass(ISOWeekParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "I":return parseNumericPattern(numericPatterns.week, dateString);case "Io":return match3.ordinalNumber(dateString, { unit: "week" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 53;} }, { key: "set", value: function set(date, _flags, value) {return _startOfISOWeek(_setISOWeek(date, value));} }]);return ISOWeekParser;}(Parser);
  4513. // lib/parse/_lib/parsers/DateParser.mjs
  4514. var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  4515. var DAYS_IN_MONTH_LEAP_YEAR = [
  4516. 31,
  4517. 29,
  4518. 31,
  4519. 30,
  4520. 31,
  4521. 30,
  4522. 31,
  4523. 31,
  4524. 30,
  4525. 31,
  4526. 30,
  4527. 31];var
  4528. DateParser = /*#__PURE__*/function (_Parser12) {_inherits(DateParser, _Parser12);function DateParser() {var _this14;_classCallCheck(this, DateParser);for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {args[_key13] = arguments[_key13];}_this14 = _callSuper(this, DateParser, [].concat(args));_defineProperty(_assertThisInitialized(_this14), "priority",
  4529. 90);_defineProperty(_assertThisInitialized(_this14), "subPriority",
  4530. 1);_defineProperty(_assertThisInitialized(_this14), "incompatibleTokens",
  4531. [
  4532. "Y",
  4533. "R",
  4534. "q",
  4535. "Q",
  4536. "w",
  4537. "I",
  4538. "D",
  4539. "i",
  4540. "e",
  4541. "c",
  4542. "t",
  4543. "T"]);return _this14;}_createClass(DateParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "d":return parseNumericPattern(numericPatterns.date, dateString);case "do":return match3.ordinalNumber(dateString, { unit: "date" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(date, value) {var year = date.getFullYear();var isLeapYear3 = isLeapYearIndex(year);var month = date.getMonth();if (isLeapYear3) {return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];} else {return value >= 1 && value <= DAYS_IN_MONTH[month];}} }, { key: "set", value: function set(date, _flags, value) {date.setDate(value);date.setHours(0, 0, 0, 0);return date;} }]);return DateParser;}(Parser);
  4544. // lib/parse/_lib/parsers/DayOfYearParser.mjs
  4545. var DayOfYearParser = /*#__PURE__*/function (_Parser13) {_inherits(DayOfYearParser, _Parser13);function DayOfYearParser() {var _this15;_classCallCheck(this, DayOfYearParser);for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {args[_key14] = arguments[_key14];}_this15 = _callSuper(this, DayOfYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this15), "priority",
  4546. 90);_defineProperty(_assertThisInitialized(_this15), "subpriority",
  4547. 1);_defineProperty(_assertThisInitialized(_this15), "incompatibleTokens",
  4548. [
  4549. "Y",
  4550. "R",
  4551. "q",
  4552. "Q",
  4553. "M",
  4554. "L",
  4555. "w",
  4556. "I",
  4557. "d",
  4558. "E",
  4559. "i",
  4560. "e",
  4561. "c",
  4562. "t",
  4563. "T"]);return _this15;}_createClass(DayOfYearParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "D":case "DD":return parseNumericPattern(numericPatterns.dayOfYear, dateString);case "Do":return match3.ordinalNumber(dateString, { unit: "date" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(date, value) {var year = date.getFullYear();var isLeapYear3 = isLeapYearIndex(year);if (isLeapYear3) {return value >= 1 && value <= 366;} else {return value >= 1 && value <= 365;}} }, { key: "set", value: function set(date, _flags, value) {date.setMonth(0, value);date.setHours(0, 0, 0, 0);return date;} }]);return DayOfYearParser;}(Parser);
  4564. // lib/setDay.mjs
  4565. function _setDay(date, day, options) {var _ref30, _ref31, _ref32, _options$weekStartsOn6, _options$locale14, _defaultOptions14$loc;
  4566. var defaultOptions14 = getDefaultOptions();
  4567. var weekStartsOn = (_ref30 = (_ref31 = (_ref32 = (_options$weekStartsOn6 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn6 !== void 0 ? _options$weekStartsOn6 : options === null || options === void 0 || (_options$locale14 = options.locale) === null || _options$locale14 === void 0 || (_options$locale14 = _options$locale14.options) === null || _options$locale14 === void 0 ? void 0 : _options$locale14.weekStartsOn) !== null && _ref32 !== void 0 ? _ref32 : defaultOptions14.weekStartsOn) !== null && _ref31 !== void 0 ? _ref31 : (_defaultOptions14$loc = defaultOptions14.locale) === null || _defaultOptions14$loc === void 0 || (_defaultOptions14$loc = _defaultOptions14$loc.options) === null || _defaultOptions14$loc === void 0 ? void 0 : _defaultOptions14$loc.weekStartsOn) !== null && _ref30 !== void 0 ? _ref30 : 0;
  4568. var _date = _toDate(date);
  4569. var currentDay = _date.getDay();
  4570. var remainder = day % 7;
  4571. var dayIndex = (remainder + 7) % 7;
  4572. var delta = 7 - weekStartsOn;
  4573. var diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
  4574. return _addDays(_date, diff);
  4575. }
  4576. // lib/parse/_lib/parsers/DayParser.mjs
  4577. var DayParser = /*#__PURE__*/function (_Parser14) {_inherits(DayParser, _Parser14);function DayParser() {var _this16;_classCallCheck(this, DayParser);for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {args[_key15] = arguments[_key15];}_this16 = _callSuper(this, DayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this16), "priority",
  4578. 90);_defineProperty(_assertThisInitialized(_this16), "incompatibleTokens",
  4579. ["D", "i", "e", "c", "t", "T"]);return _this16;}_createClass(DayParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "E":case "EE":case "EEE":return match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "EEEEE":return match3.day(dateString, { width: "narrow", context: "formatting" });case "EEEEEE":return match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "EEEE":default:return match3.day(dateString, { width: "wide", context: "formatting" }) || match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 6;} }, { key: "set", value: function set(date, _flags, value, options) {date = _setDay(date, value, options);date.setHours(0, 0, 0, 0);return date;} }]);return DayParser;}(Parser);
  4580. // lib/parse/_lib/parsers/LocalDayParser.mjs
  4581. var LocalDayParser = /*#__PURE__*/function (_Parser15) {_inherits(LocalDayParser, _Parser15);function LocalDayParser() {var _this17;_classCallCheck(this, LocalDayParser);for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {args[_key16] = arguments[_key16];}_this17 = _callSuper(this, LocalDayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this17), "priority",
  4582. 90);_defineProperty(_assertThisInitialized(_this17), "incompatibleTokens",
  4583. [
  4584. "y",
  4585. "R",
  4586. "u",
  4587. "q",
  4588. "Q",
  4589. "M",
  4590. "L",
  4591. "I",
  4592. "d",
  4593. "D",
  4594. "E",
  4595. "i",
  4596. "c",
  4597. "t",
  4598. "T"]);return _this17;}_createClass(LocalDayParser, [{ key: "parse", value: function parse(dateString, token, match3, options) {var valueCallback = function valueCallback(value) {var wholeWeekDays = Math.floor((value - 1) / 7) * 7;return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;};switch (token) {case "e":case "ee":return mapValue(parseNDigits(token.length, dateString), valueCallback);case "eo":return mapValue(match3.ordinalNumber(dateString, { unit: "day" }), valueCallback);case "eee":return match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "eeeee":return match3.day(dateString, { width: "narrow", context: "formatting" });case "eeeeee":return match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "eeee":default:return match3.day(dateString, { width: "wide", context: "formatting" }) || match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 6;} }, { key: "set", value: function set(date, _flags, value, options) {date = _setDay(date, value, options);date.setHours(0, 0, 0, 0);return date;} }]);return LocalDayParser;}(Parser);
  4599. // lib/parse/_lib/parsers/StandAloneLocalDayParser.mjs
  4600. var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser16) {_inherits(StandAloneLocalDayParser, _Parser16);function StandAloneLocalDayParser() {var _this18;_classCallCheck(this, StandAloneLocalDayParser);for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {args[_key17] = arguments[_key17];}_this18 = _callSuper(this, StandAloneLocalDayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this18), "priority",
  4601. 90);_defineProperty(_assertThisInitialized(_this18), "incompatibleTokens",
  4602. [
  4603. "y",
  4604. "R",
  4605. "u",
  4606. "q",
  4607. "Q",
  4608. "M",
  4609. "L",
  4610. "I",
  4611. "d",
  4612. "D",
  4613. "E",
  4614. "i",
  4615. "e",
  4616. "t",
  4617. "T"]);return _this18;}_createClass(StandAloneLocalDayParser, [{ key: "parse", value: function parse(dateString, token, match3, options) {var valueCallback = function valueCallback(value) {var wholeWeekDays = Math.floor((value - 1) / 7) * 7;return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;};switch (token) {case "c":case "cc":return mapValue(parseNDigits(token.length, dateString), valueCallback);case "co":return mapValue(match3.ordinalNumber(dateString, { unit: "day" }), valueCallback);case "ccc":return match3.day(dateString, { width: "abbreviated", context: "standalone" }) || match3.day(dateString, { width: "short", context: "standalone" }) || match3.day(dateString, { width: "narrow", context: "standalone" });case "ccccc":return match3.day(dateString, { width: "narrow", context: "standalone" });case "cccccc":return match3.day(dateString, { width: "short", context: "standalone" }) || match3.day(dateString, { width: "narrow", context: "standalone" });case "cccc":default:return match3.day(dateString, { width: "wide", context: "standalone" }) || match3.day(dateString, { width: "abbreviated", context: "standalone" }) || match3.day(dateString, { width: "short", context: "standalone" }) || match3.day(dateString, { width: "narrow", context: "standalone" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 6;} }, { key: "set", value: function set(date, _flags, value, options) {date = _setDay(date, value, options);date.setHours(0, 0, 0, 0);return date;} }]);return StandAloneLocalDayParser;}(Parser);
  4618. // lib/setISODay.mjs
  4619. function _setISODay(date, day) {
  4620. var _date = _toDate(date);
  4621. var currentDay = _getISODay(_date);
  4622. var diff = day - currentDay;
  4623. return _addDays(_date, diff);
  4624. }
  4625. // lib/parse/_lib/parsers/ISODayParser.mjs
  4626. var ISODayParser = /*#__PURE__*/function (_Parser17) {_inherits(ISODayParser, _Parser17);function ISODayParser() {var _this19;_classCallCheck(this, ISODayParser);for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {args[_key18] = arguments[_key18];}_this19 = _callSuper(this, ISODayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this19), "priority",
  4627. 90);_defineProperty(_assertThisInitialized(_this19), "incompatibleTokens",
  4628. [
  4629. "y",
  4630. "Y",
  4631. "u",
  4632. "q",
  4633. "Q",
  4634. "M",
  4635. "L",
  4636. "w",
  4637. "d",
  4638. "D",
  4639. "E",
  4640. "e",
  4641. "c",
  4642. "t",
  4643. "T"]);return _this19;}_createClass(ISODayParser, [{ key: "parse", value: function parse(dateString, token, match3) {var valueCallback = function valueCallback(value) {if (value === 0) {return 7;}return value;};switch (token) {case "i":case "ii":return parseNDigits(token.length, dateString);case "io":return match3.ordinalNumber(dateString, { unit: "day" });case "iii":return mapValue(match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);case "iiiii":return mapValue(match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);case "iiiiii":return mapValue(match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);case "iiii":default:return mapValue(match3.day(dateString, { width: "wide", context: "formatting" }) || match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 7;} }, { key: "set", value: function set(date, _flags, value) {date = _setISODay(date, value);date.setHours(0, 0, 0, 0);return date;} }]);return ISODayParser;}(Parser);
  4644. // lib/parse/_lib/parsers/AMPMParser.mjs
  4645. var AMPMParser = /*#__PURE__*/function (_Parser18) {_inherits(AMPMParser, _Parser18);function AMPMParser() {var _this20;_classCallCheck(this, AMPMParser);for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {args[_key19] = arguments[_key19];}_this20 = _callSuper(this, AMPMParser, [].concat(args));_defineProperty(_assertThisInitialized(_this20), "priority",
  4646. 80);_defineProperty(_assertThisInitialized(_this20), "incompatibleTokens",
  4647. ["b", "B", "H", "k", "t", "T"]);return _this20;}_createClass(AMPMParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "a":case "aa":case "aaa":return match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "aaaaa":return match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "aaaa":default:return match3.dayPeriod(dateString, { width: "wide", context: "formatting" }) || match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });}} }, { key: "set", value: function set(date, _flags, value) {date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);return date;} }]);return AMPMParser;}(Parser);
  4648. // lib/parse/_lib/parsers/AMPMMidnightParser.mjs
  4649. var AMPMMidnightParser = /*#__PURE__*/function (_Parser19) {_inherits(AMPMMidnightParser, _Parser19);function AMPMMidnightParser() {var _this21;_classCallCheck(this, AMPMMidnightParser);for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {args[_key20] = arguments[_key20];}_this21 = _callSuper(this, AMPMMidnightParser, [].concat(args));_defineProperty(_assertThisInitialized(_this21), "priority",
  4650. 80);_defineProperty(_assertThisInitialized(_this21), "incompatibleTokens",
  4651. ["a", "B", "H", "k", "t", "T"]);return _this21;}_createClass(AMPMMidnightParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "b":case "bb":case "bbb":return match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "bbbbb":return match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "bbbb":default:return match3.dayPeriod(dateString, { width: "wide", context: "formatting" }) || match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });}} }, { key: "set", value: function set(date, _flags, value) {date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);return date;} }]);return AMPMMidnightParser;}(Parser);
  4652. // lib/parse/_lib/parsers/DayPeriodParser.mjs
  4653. var DayPeriodParser = /*#__PURE__*/function (_Parser20) {_inherits(DayPeriodParser, _Parser20);function DayPeriodParser() {var _this22;_classCallCheck(this, DayPeriodParser);for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {args[_key21] = arguments[_key21];}_this22 = _callSuper(this, DayPeriodParser, [].concat(args));_defineProperty(_assertThisInitialized(_this22), "priority",
  4654. 80);_defineProperty(_assertThisInitialized(_this22), "incompatibleTokens",
  4655. ["a", "b", "t", "T"]);return _this22;}_createClass(DayPeriodParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "B":case "BB":case "BBB":return match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "BBBBB":return match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "BBBB":default:return match3.dayPeriod(dateString, { width: "wide", context: "formatting" }) || match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });}} }, { key: "set", value: function set(date, _flags, value) {date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);return date;} }]);return DayPeriodParser;}(Parser);
  4656. // lib/parse/_lib/parsers/Hour1to12Parser.mjs
  4657. var Hour1to12Parser = /*#__PURE__*/function (_Parser21) {_inherits(Hour1to12Parser, _Parser21);function Hour1to12Parser() {var _this23;_classCallCheck(this, Hour1to12Parser);for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {args[_key22] = arguments[_key22];}_this23 = _callSuper(this, Hour1to12Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this23), "priority",
  4658. 70);_defineProperty(_assertThisInitialized(_this23), "incompatibleTokens",
  4659. ["H", "K", "k", "t", "T"]);return _this23;}_createClass(Hour1to12Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "h":return parseNumericPattern(numericPatterns.hour12h, dateString);case "ho":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 12;} }, { key: "set", value: function set(date, _flags, value) {var isPM = date.getHours() >= 12;if (isPM && value < 12) {date.setHours(value + 12, 0, 0, 0);} else if (!isPM && value === 12) {date.setHours(0, 0, 0, 0);} else {date.setHours(value, 0, 0, 0);}return date;} }]);return Hour1to12Parser;}(Parser);
  4660. // lib/parse/_lib/parsers/Hour0to23Parser.mjs
  4661. var Hour0to23Parser = /*#__PURE__*/function (_Parser22) {_inherits(Hour0to23Parser, _Parser22);function Hour0to23Parser() {var _this24;_classCallCheck(this, Hour0to23Parser);for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {args[_key23] = arguments[_key23];}_this24 = _callSuper(this, Hour0to23Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this24), "priority",
  4662. 70);_defineProperty(_assertThisInitialized(_this24), "incompatibleTokens",
  4663. ["a", "b", "h", "K", "k", "t", "T"]);return _this24;}_createClass(Hour0to23Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "H":return parseNumericPattern(numericPatterns.hour23h, dateString);case "Ho":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 23;} }, { key: "set", value: function set(date, _flags, value) {date.setHours(value, 0, 0, 0);return date;} }]);return Hour0to23Parser;}(Parser);
  4664. // lib/parse/_lib/parsers/Hour0To11Parser.mjs
  4665. var Hour0To11Parser = /*#__PURE__*/function (_Parser23) {_inherits(Hour0To11Parser, _Parser23);function Hour0To11Parser() {var _this25;_classCallCheck(this, Hour0To11Parser);for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {args[_key24] = arguments[_key24];}_this25 = _callSuper(this, Hour0To11Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this25), "priority",
  4666. 70);_defineProperty(_assertThisInitialized(_this25), "incompatibleTokens",
  4667. ["h", "H", "k", "t", "T"]);return _this25;}_createClass(Hour0To11Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "K":return parseNumericPattern(numericPatterns.hour11h, dateString);case "Ko":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 11;} }, { key: "set", value: function set(date, _flags, value) {var isPM = date.getHours() >= 12;if (isPM && value < 12) {date.setHours(value + 12, 0, 0, 0);} else {date.setHours(value, 0, 0, 0);}return date;} }]);return Hour0To11Parser;}(Parser);
  4668. // lib/parse/_lib/parsers/Hour1To24Parser.mjs
  4669. var Hour1To24Parser = /*#__PURE__*/function (_Parser24) {_inherits(Hour1To24Parser, _Parser24);function Hour1To24Parser() {var _this26;_classCallCheck(this, Hour1To24Parser);for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {args[_key25] = arguments[_key25];}_this26 = _callSuper(this, Hour1To24Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this26), "priority",
  4670. 70);_defineProperty(_assertThisInitialized(_this26), "incompatibleTokens",
  4671. ["a", "b", "h", "H", "K", "t", "T"]);return _this26;}_createClass(Hour1To24Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "k":return parseNumericPattern(numericPatterns.hour24h, dateString);case "ko":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 24;} }, { key: "set", value: function set(date, _flags, value) {var hours = value <= 24 ? value % 24 : value;date.setHours(hours, 0, 0, 0);return date;} }]);return Hour1To24Parser;}(Parser);
  4672. // lib/parse/_lib/parsers/MinuteParser.mjs
  4673. var MinuteParser = /*#__PURE__*/function (_Parser25) {_inherits(MinuteParser, _Parser25);function MinuteParser() {var _this27;_classCallCheck(this, MinuteParser);for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {args[_key26] = arguments[_key26];}_this27 = _callSuper(this, MinuteParser, [].concat(args));_defineProperty(_assertThisInitialized(_this27), "priority",
  4674. 60);_defineProperty(_assertThisInitialized(_this27), "incompatibleTokens",
  4675. ["t", "T"]);return _this27;}_createClass(MinuteParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "m":return parseNumericPattern(numericPatterns.minute, dateString);case "mo":return match3.ordinalNumber(dateString, { unit: "minute" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 59;} }, { key: "set", value: function set(date, _flags, value) {date.setMinutes(value, 0, 0);return date;} }]);return MinuteParser;}(Parser);
  4676. // lib/parse/_lib/parsers/SecondParser.mjs
  4677. var SecondParser = /*#__PURE__*/function (_Parser26) {_inherits(SecondParser, _Parser26);function SecondParser() {var _this28;_classCallCheck(this, SecondParser);for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {args[_key27] = arguments[_key27];}_this28 = _callSuper(this, SecondParser, [].concat(args));_defineProperty(_assertThisInitialized(_this28), "priority",
  4678. 50);_defineProperty(_assertThisInitialized(_this28), "incompatibleTokens",
  4679. ["t", "T"]);return _this28;}_createClass(SecondParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "s":return parseNumericPattern(numericPatterns.second, dateString);case "so":return match3.ordinalNumber(dateString, { unit: "second" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 59;} }, { key: "set", value: function set(date, _flags, value) {date.setSeconds(value, 0);return date;} }]);return SecondParser;}(Parser);
  4680. // lib/parse/_lib/parsers/FractionOfSecondParser.mjs
  4681. var FractionOfSecondParser = /*#__PURE__*/function (_Parser27) {_inherits(FractionOfSecondParser, _Parser27);function FractionOfSecondParser() {var _this29;_classCallCheck(this, FractionOfSecondParser);for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {args[_key28] = arguments[_key28];}_this29 = _callSuper(this, FractionOfSecondParser, [].concat(args));_defineProperty(_assertThisInitialized(_this29), "priority",
  4682. 30);_defineProperty(_assertThisInitialized(_this29), "incompatibleTokens",
  4683. ["t", "T"]);return _this29;}_createClass(FractionOfSecondParser, [{ key: "parse", value: function parse(dateString, token) {var valueCallback = function valueCallback(value) {return Math.trunc(value * Math.pow(10, -token.length + 3));};return mapValue(parseNDigits(token.length, dateString), valueCallback);} }, { key: "set", value: function set(date, _flags, value) {date.setMilliseconds(value);return date;} }]);return FractionOfSecondParser;}(Parser);
  4684. // lib/parse/_lib/parsers/ISOTimezoneWithZParser.mjs
  4685. var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser28) {_inherits(ISOTimezoneWithZParser, _Parser28);function ISOTimezoneWithZParser() {var _this30;_classCallCheck(this, ISOTimezoneWithZParser);for (var _len29 = arguments.length, args = new Array(_len29), _key29 = 0; _key29 < _len29; _key29++) {args[_key29] = arguments[_key29];}_this30 = _callSuper(this, ISOTimezoneWithZParser, [].concat(args));_defineProperty(_assertThisInitialized(_this30), "priority",
  4686. 10);_defineProperty(_assertThisInitialized(_this30), "incompatibleTokens",
  4687. ["t", "T", "x"]);return _this30;}_createClass(ISOTimezoneWithZParser, [{ key: "parse", value: function parse(dateString, token) {switch (token) {case "X":return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);case "XX":return parseTimezonePattern(timezonePatterns.basic, dateString);case "XXXX":return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);case "XXXXX":return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);case "XXX":default:return parseTimezonePattern(timezonePatterns.extended, dateString);}} }, { key: "set", value: function set(date, flags, value) {if (flags.timestampIsSet) return date;return _constructFrom(date, date.getTime() - getTimezoneOffsetInMilliseconds(date) - value);} }]);return ISOTimezoneWithZParser;}(Parser);
  4688. // lib/parse/_lib/parsers/ISOTimezoneParser.mjs
  4689. var ISOTimezoneParser = /*#__PURE__*/function (_Parser29) {_inherits(ISOTimezoneParser, _Parser29);function ISOTimezoneParser() {var _this31;_classCallCheck(this, ISOTimezoneParser);for (var _len30 = arguments.length, args = new Array(_len30), _key30 = 0; _key30 < _len30; _key30++) {args[_key30] = arguments[_key30];}_this31 = _callSuper(this, ISOTimezoneParser, [].concat(args));_defineProperty(_assertThisInitialized(_this31), "priority",
  4690. 10);_defineProperty(_assertThisInitialized(_this31), "incompatibleTokens",
  4691. ["t", "T", "X"]);return _this31;}_createClass(ISOTimezoneParser, [{ key: "parse", value: function parse(dateString, token) {switch (token) {case "x":return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);case "xx":return parseTimezonePattern(timezonePatterns.basic, dateString);case "xxxx":return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);case "xxxxx":return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);case "xxx":default:return parseTimezonePattern(timezonePatterns.extended, dateString);}} }, { key: "set", value: function set(date, flags, value) {if (flags.timestampIsSet) return date;return _constructFrom(date, date.getTime() - getTimezoneOffsetInMilliseconds(date) - value);} }]);return ISOTimezoneParser;}(Parser);
  4692. // lib/parse/_lib/parsers/TimestampSecondsParser.mjs
  4693. var TimestampSecondsParser = /*#__PURE__*/function (_Parser30) {_inherits(TimestampSecondsParser, _Parser30);function TimestampSecondsParser() {var _this32;_classCallCheck(this, TimestampSecondsParser);for (var _len31 = arguments.length, args = new Array(_len31), _key31 = 0; _key31 < _len31; _key31++) {args[_key31] = arguments[_key31];}_this32 = _callSuper(this, TimestampSecondsParser, [].concat(args));_defineProperty(_assertThisInitialized(_this32), "priority",
  4694. 40);_defineProperty(_assertThisInitialized(_this32), "incompatibleTokens",
  4695. "*");return _this32;}_createClass(TimestampSecondsParser, [{ key: "parse", value: function parse(dateString) {return parseAnyDigitsSigned(dateString);} }, { key: "set", value: function set(date, _flags, value) {return [_constructFrom(date, value * 1000), { timestampIsSet: true }];} }]);return TimestampSecondsParser;}(Parser);
  4696. // lib/parse/_lib/parsers/TimestampMillisecondsParser.mjs
  4697. var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser31) {_inherits(TimestampMillisecondsParser, _Parser31);function TimestampMillisecondsParser() {var _this33;_classCallCheck(this, TimestampMillisecondsParser);for (var _len32 = arguments.length, args = new Array(_len32), _key32 = 0; _key32 < _len32; _key32++) {args[_key32] = arguments[_key32];}_this33 = _callSuper(this, TimestampMillisecondsParser, [].concat(args));_defineProperty(_assertThisInitialized(_this33), "priority",
  4698. 20);_defineProperty(_assertThisInitialized(_this33), "incompatibleTokens",
  4699. "*");return _this33;}_createClass(TimestampMillisecondsParser, [{ key: "parse", value: function parse(dateString) {return parseAnyDigitsSigned(dateString);} }, { key: "set", value: function set(date, _flags, value) {return [_constructFrom(date, value), { timestampIsSet: true }];} }]);return TimestampMillisecondsParser;}(Parser);
  4700. // lib/parse/_lib/parsers.mjs
  4701. var _parsers = {
  4702. G: new EraParser(),
  4703. y: new YearParser(),
  4704. Y: new LocalWeekYearParser(),
  4705. R: new ISOWeekYearParser(),
  4706. u: new ExtendedYearParser(),
  4707. Q: new QuarterParser(),
  4708. q: new StandAloneQuarterParser(),
  4709. M: new MonthParser(),
  4710. L: new StandAloneMonthParser(),
  4711. w: new LocalWeekParser(),
  4712. I: new ISOWeekParser(),
  4713. d: new DateParser(),
  4714. D: new DayOfYearParser(),
  4715. E: new DayParser(),
  4716. e: new LocalDayParser(),
  4717. c: new StandAloneLocalDayParser(),
  4718. i: new ISODayParser(),
  4719. a: new AMPMParser(),
  4720. b: new AMPMMidnightParser(),
  4721. B: new DayPeriodParser(),
  4722. h: new Hour1to12Parser(),
  4723. H: new Hour0to23Parser(),
  4724. K: new Hour0To11Parser(),
  4725. k: new Hour1To24Parser(),
  4726. m: new MinuteParser(),
  4727. s: new SecondParser(),
  4728. S: new FractionOfSecondParser(),
  4729. X: new ISOTimezoneWithZParser(),
  4730. x: new ISOTimezoneParser(),
  4731. t: new TimestampSecondsParser(),
  4732. T: new TimestampMillisecondsParser()
  4733. };
  4734. // lib/parse.mjs
  4735. function _parse(dateStr, formatStr, referenceDate, options) {var _ref33, _options$locale15, _ref34, _ref35, _ref36, _options$firstWeekCon4, _options$locale16, _defaultOptions14$loc2, _ref37, _ref38, _ref39, _options$weekStartsOn7, _options$locale17, _defaultOptions14$loc3;
  4736. var defaultOptions14 = getDefaultOptions2();
  4737. var locale = (_ref33 = (_options$locale15 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale15 !== void 0 ? _options$locale15 : defaultOptions14.locale) !== null && _ref33 !== void 0 ? _ref33 : enUS;
  4738. var firstWeekContainsDate = (_ref34 = (_ref35 = (_ref36 = (_options$firstWeekCon4 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon4 !== void 0 ? _options$firstWeekCon4 : options === null || options === void 0 || (_options$locale16 = options.locale) === null || _options$locale16 === void 0 || (_options$locale16 = _options$locale16.options) === null || _options$locale16 === void 0 ? void 0 : _options$locale16.firstWeekContainsDate) !== null && _ref36 !== void 0 ? _ref36 : defaultOptions14.firstWeekContainsDate) !== null && _ref35 !== void 0 ? _ref35 : (_defaultOptions14$loc2 = defaultOptions14.locale) === null || _defaultOptions14$loc2 === void 0 || (_defaultOptions14$loc2 = _defaultOptions14$loc2.options) === null || _defaultOptions14$loc2 === void 0 ? void 0 : _defaultOptions14$loc2.firstWeekContainsDate) !== null && _ref34 !== void 0 ? _ref34 : 1;
  4739. var weekStartsOn = (_ref37 = (_ref38 = (_ref39 = (_options$weekStartsOn7 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn7 !== void 0 ? _options$weekStartsOn7 : options === null || options === void 0 || (_options$locale17 = options.locale) === null || _options$locale17 === void 0 || (_options$locale17 = _options$locale17.options) === null || _options$locale17 === void 0 ? void 0 : _options$locale17.weekStartsOn) !== null && _ref39 !== void 0 ? _ref39 : defaultOptions14.weekStartsOn) !== null && _ref38 !== void 0 ? _ref38 : (_defaultOptions14$loc3 = defaultOptions14.locale) === null || _defaultOptions14$loc3 === void 0 || (_defaultOptions14$loc3 = _defaultOptions14$loc3.options) === null || _defaultOptions14$loc3 === void 0 ? void 0 : _defaultOptions14$loc3.weekStartsOn) !== null && _ref37 !== void 0 ? _ref37 : 0;
  4740. if (formatStr === "") {
  4741. if (dateStr === "") {
  4742. return _toDate(referenceDate);
  4743. } else {
  4744. return _constructFrom(referenceDate, NaN);
  4745. }
  4746. }
  4747. var subFnOptions = {
  4748. firstWeekContainsDate: firstWeekContainsDate,
  4749. weekStartsOn: weekStartsOn,
  4750. locale: locale
  4751. };
  4752. var setters = [new DateToSystemTimezoneSetter()];
  4753. var tokens = formatStr.match(longFormattingTokensRegExp2).map(function (substring) {
  4754. var firstCharacter = substring[0];
  4755. if (firstCharacter in _longFormatters) {
  4756. var longFormatter = _longFormatters[firstCharacter];
  4757. return longFormatter(substring, locale.formatLong);
  4758. }
  4759. return substring;
  4760. }).join("").match(formattingTokensRegExp2);
  4761. var usedTokens = [];var _iterator = _createForOfIteratorHelper(
  4762. tokens),_step;try {var _loop = function _loop() {var token = _step.value;
  4763. if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {
  4764. warnOrThrowProtectedError(token, formatStr, dateStr);
  4765. }
  4766. if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
  4767. warnOrThrowProtectedError(token, formatStr, dateStr);
  4768. }
  4769. var firstCharacter = token[0];
  4770. var parser = _parsers[firstCharacter];
  4771. if (parser) {
  4772. var incompatibleTokens = parser.incompatibleTokens;
  4773. if (Array.isArray(incompatibleTokens)) {
  4774. var incompatibleToken = usedTokens.find(function (usedToken) {return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;});
  4775. if (incompatibleToken) {
  4776. throw new RangeError("The format string mustn't contain `".concat(incompatibleToken.fullToken, "` and `").concat(token, "` at the same time"));
  4777. }
  4778. } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
  4779. throw new RangeError("The format string mustn't contain `".concat(token, "` and any other token at the same time"));
  4780. }
  4781. usedTokens.push({ token: firstCharacter, fullToken: token });
  4782. var parseResult = parser.run(dateStr, token, locale.match, subFnOptions);
  4783. if (!parseResult) {return { v:
  4784. _constructFrom(referenceDate, NaN) };
  4785. }
  4786. setters.push(parseResult.setter);
  4787. dateStr = parseResult.rest;
  4788. } else {
  4789. if (firstCharacter.match(unescapedLatinCharacterRegExp2)) {
  4790. throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
  4791. }
  4792. if (token === "''") {
  4793. token = "'";
  4794. } else if (firstCharacter === "'") {
  4795. token = cleanEscapedString2(token);
  4796. }
  4797. if (dateStr.indexOf(token) === 0) {
  4798. dateStr = dateStr.slice(token.length);
  4799. } else {return { v:
  4800. _constructFrom(referenceDate, NaN) };
  4801. }
  4802. }
  4803. },_ret;for (_iterator.s(); !(_step = _iterator.n()).done;) {_ret = _loop();if (_ret) return _ret.v;}} catch (err) {_iterator.e(err);} finally {_iterator.f();}
  4804. if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
  4805. return _constructFrom(referenceDate, NaN);
  4806. }
  4807. var uniquePrioritySetters = setters.map(function (setter) {return setter.priority;}).sort(function (a, b) {return b - a;}).filter(function (priority, index, array) {return array.indexOf(priority) === index;}).map(function (priority) {return setters.filter(function (setter) {return setter.priority === priority;}).sort(function (a, b) {return b.subPriority - a.subPriority;});}).map(function (setterArray) {return setterArray[0];});
  4808. var date = _toDate(referenceDate);
  4809. if (isNaN(date.getTime())) {
  4810. return _constructFrom(referenceDate, NaN);
  4811. }
  4812. var flags = {};var _iterator2 = _createForOfIteratorHelper(
  4813. uniquePrioritySetters),_step2;try {for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {var setter = _step2.value;
  4814. if (!setter.validate(date, subFnOptions)) {
  4815. return _constructFrom(referenceDate, NaN);
  4816. }
  4817. var result = setter.set(date, flags, subFnOptions);
  4818. if (Array.isArray(result)) {
  4819. date = result[0];
  4820. Object.assign(flags, result[1]);
  4821. } else {
  4822. date = result;
  4823. }
  4824. }} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}
  4825. return _constructFrom(referenceDate, date);
  4826. }
  4827. var cleanEscapedString2 = function cleanEscapedString2(input) {
  4828. return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'");
  4829. };
  4830. var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
  4831. var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
  4832. var escapedStringRegExp2 = /^'([^]*?)'?$/;
  4833. var doubleQuoteRegExp2 = /''/g;
  4834. var notWhitespaceRegExp = /\S/;
  4835. var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/;
  4836. // lib/isMatch.mjs
  4837. function _isMatch(dateStr, formatStr, options) {
  4838. return _isValid(_parse(dateStr, formatStr, new Date(), options));
  4839. }
  4840. // lib/isMonday.mjs
  4841. function _isMonday(date) {
  4842. return _toDate(date).getDay() === 1;
  4843. }
  4844. // lib/isPast.mjs
  4845. function _isPast(date) {
  4846. return +_toDate(date) < Date.now();
  4847. }
  4848. // lib/startOfHour.mjs
  4849. function _startOfHour(date) {
  4850. var _date = _toDate(date);
  4851. _date.setMinutes(0, 0, 0);
  4852. return _date;
  4853. }
  4854. // lib/isSameHour.mjs
  4855. function _isSameHour(dateLeft, dateRight) {
  4856. var dateLeftStartOfHour = _startOfHour(dateLeft);
  4857. var dateRightStartOfHour = _startOfHour(dateRight);
  4858. return +dateLeftStartOfHour === +dateRightStartOfHour;
  4859. }
  4860. // lib/isSameWeek.mjs
  4861. function _isSameWeek(dateLeft, dateRight, options) {
  4862. var dateLeftStartOfWeek = _startOfWeek(dateLeft, options);
  4863. var dateRightStartOfWeek = _startOfWeek(dateRight, options);
  4864. return +dateLeftStartOfWeek === +dateRightStartOfWeek;
  4865. }
  4866. // lib/isSameISOWeek.mjs
  4867. function _isSameISOWeek(dateLeft, dateRight) {
  4868. return _isSameWeek(dateLeft, dateRight, { weekStartsOn: 1 });
  4869. }
  4870. // lib/isSameISOWeekYear.mjs
  4871. function _isSameISOWeekYear(dateLeft, dateRight) {
  4872. var dateLeftStartOfYear = _startOfISOWeekYear(dateLeft);
  4873. var dateRightStartOfYear = _startOfISOWeekYear(dateRight);
  4874. return +dateLeftStartOfYear === +dateRightStartOfYear;
  4875. }
  4876. // lib/isSameMinute.mjs
  4877. function _isSameMinute(dateLeft, dateRight) {
  4878. var dateLeftStartOfMinute = _startOfMinute(dateLeft);
  4879. var dateRightStartOfMinute = _startOfMinute(dateRight);
  4880. return +dateLeftStartOfMinute === +dateRightStartOfMinute;
  4881. }
  4882. // lib/isSameMonth.mjs
  4883. function _isSameMonth(dateLeft, dateRight) {
  4884. var _dateLeft = _toDate(dateLeft);
  4885. var _dateRight = _toDate(dateRight);
  4886. return _dateLeft.getFullYear() === _dateRight.getFullYear() && _dateLeft.getMonth() === _dateRight.getMonth();
  4887. }
  4888. // lib/isSameQuarter.mjs
  4889. function _isSameQuarter(dateLeft, dateRight) {
  4890. var dateLeftStartOfQuarter = _startOfQuarter(dateLeft);
  4891. var dateRightStartOfQuarter = _startOfQuarter(dateRight);
  4892. return +dateLeftStartOfQuarter === +dateRightStartOfQuarter;
  4893. }
  4894. // lib/startOfSecond.mjs
  4895. function _startOfSecond(date) {
  4896. var _date = _toDate(date);
  4897. _date.setMilliseconds(0);
  4898. return _date;
  4899. }
  4900. // lib/isSameSecond.mjs
  4901. function _isSameSecond(dateLeft, dateRight) {
  4902. var dateLeftStartOfSecond = _startOfSecond(dateLeft);
  4903. var dateRightStartOfSecond = _startOfSecond(dateRight);
  4904. return +dateLeftStartOfSecond === +dateRightStartOfSecond;
  4905. }
  4906. // lib/isSameYear.mjs
  4907. function _isSameYear(dateLeft, dateRight) {
  4908. var _dateLeft = _toDate(dateLeft);
  4909. var _dateRight = _toDate(dateRight);
  4910. return _dateLeft.getFullYear() === _dateRight.getFullYear();
  4911. }
  4912. // lib/isThisHour.mjs
  4913. function _isThisHour(date) {
  4914. return _isSameHour(date, _constructNow(date));
  4915. }
  4916. // lib/isThisISOWeek.mjs
  4917. function _isThisISOWeek(date) {
  4918. return _isSameISOWeek(date, _constructNow(date));
  4919. }
  4920. // lib/isThisMinute.mjs
  4921. function _isThisMinute(date) {
  4922. return _isSameMinute(date, _constructNow(date));
  4923. }
  4924. // lib/isThisMonth.mjs
  4925. function _isThisMonth(date) {
  4926. return _isSameMonth(date, _constructNow(date));
  4927. }
  4928. // lib/isThisQuarter.mjs
  4929. function _isThisQuarter(date) {
  4930. return _isSameQuarter(date, _constructNow(date));
  4931. }
  4932. // lib/isThisSecond.mjs
  4933. function _isThisSecond(date) {
  4934. return _isSameSecond(date, _constructNow(date));
  4935. }
  4936. // lib/isThisWeek.mjs
  4937. function _isThisWeek(date, options) {
  4938. return _isSameWeek(date, _constructNow(date), options);
  4939. }
  4940. // lib/isThisYear.mjs
  4941. function _isThisYear(date) {
  4942. return _isSameYear(date, _constructNow(date));
  4943. }
  4944. // lib/isThursday.mjs
  4945. function _isThursday(date) {
  4946. return _toDate(date).getDay() === 4;
  4947. }
  4948. // lib/isToday.mjs
  4949. function _isToday(date) {
  4950. return _isSameDay(date, _constructNow(date));
  4951. }
  4952. // lib/isTomorrow.mjs
  4953. function _isTomorrow(date) {
  4954. return _isSameDay(date, _addDays(_constructNow(date), 1));
  4955. }
  4956. // lib/isTuesday.mjs
  4957. function _isTuesday(date) {
  4958. return _toDate(date).getDay() === 2;
  4959. }
  4960. // lib/isWednesday.mjs
  4961. function _isWednesday(date) {
  4962. return _toDate(date).getDay() === 3;
  4963. }
  4964. // lib/isWithinInterval.mjs
  4965. function _isWithinInterval(date, interval2) {
  4966. var time = +_toDate(date);
  4967. var _sort9 = [
  4968. +_toDate(interval2.start),
  4969. +_toDate(interval2.end)].
  4970. sort(function (a, b) {return a - b;}),_sort10 = _slicedToArray(_sort9, 2),startTime = _sort10[0],endTime = _sort10[1];
  4971. return time >= startTime && time <= endTime;
  4972. }
  4973. // lib/subDays.mjs
  4974. function _subDays(date, amount) {
  4975. return _addDays(date, -amount);
  4976. }
  4977. // lib/isYesterday.mjs
  4978. function _isYesterday(date) {
  4979. return _isSameDay(date, _subDays(_constructNow(date), 1));
  4980. }
  4981. // lib/lastDayOfDecade.mjs
  4982. function _lastDayOfDecade(date) {
  4983. var _date = _toDate(date);
  4984. var year = _date.getFullYear();
  4985. var decade = 9 + Math.floor(year / 10) * 10;
  4986. _date.setFullYear(decade + 1, 0, 0);
  4987. _date.setHours(0, 0, 0, 0);
  4988. return _date;
  4989. }
  4990. // lib/lastDayOfWeek.mjs
  4991. function _lastDayOfWeek(date, options) {var _ref40, _ref41, _ref42, _options$weekStartsOn8, _options$locale18, _defaultOptions15$loc;
  4992. var defaultOptions15 = getDefaultOptions();
  4993. var weekStartsOn = (_ref40 = (_ref41 = (_ref42 = (_options$weekStartsOn8 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn8 !== void 0 ? _options$weekStartsOn8 : options === null || options === void 0 || (_options$locale18 = options.locale) === null || _options$locale18 === void 0 || (_options$locale18 = _options$locale18.options) === null || _options$locale18 === void 0 ? void 0 : _options$locale18.weekStartsOn) !== null && _ref42 !== void 0 ? _ref42 : defaultOptions15.weekStartsOn) !== null && _ref41 !== void 0 ? _ref41 : (_defaultOptions15$loc = defaultOptions15.locale) === null || _defaultOptions15$loc === void 0 || (_defaultOptions15$loc = _defaultOptions15$loc.options) === null || _defaultOptions15$loc === void 0 ? void 0 : _defaultOptions15$loc.weekStartsOn) !== null && _ref40 !== void 0 ? _ref40 : 0;
  4994. var _date = _toDate(date);
  4995. var day = _date.getDay();
  4996. var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
  4997. _date.setHours(0, 0, 0, 0);
  4998. _date.setDate(_date.getDate() + diff);
  4999. return _date;
  5000. }
  5001. // lib/lastDayOfISOWeek.mjs
  5002. function _lastDayOfISOWeek(date) {
  5003. return _lastDayOfWeek(date, { weekStartsOn: 1 });
  5004. }
  5005. // lib/lastDayOfISOWeekYear.mjs
  5006. function _lastDayOfISOWeekYear(date) {
  5007. var year = _getISOWeekYear(date);
  5008. var fourthOfJanuary = _constructFrom(date, 0);
  5009. fourthOfJanuary.setFullYear(year + 1, 0, 4);
  5010. fourthOfJanuary.setHours(0, 0, 0, 0);
  5011. var _date = _startOfISOWeek(fourthOfJanuary);
  5012. _date.setDate(_date.getDate() - 1);
  5013. return _date;
  5014. }
  5015. // lib/lastDayOfQuarter.mjs
  5016. function _lastDayOfQuarter(date) {
  5017. var _date = _toDate(date);
  5018. var currentMonth = _date.getMonth();
  5019. var month = currentMonth - currentMonth % 3 + 3;
  5020. _date.setMonth(month, 0);
  5021. _date.setHours(0, 0, 0, 0);
  5022. return _date;
  5023. }
  5024. // lib/lastDayOfYear.mjs
  5025. function _lastDayOfYear(date) {
  5026. var _date = _toDate(date);
  5027. var year = _date.getFullYear();
  5028. _date.setFullYear(year + 1, 0, 0);
  5029. _date.setHours(0, 0, 0, 0);
  5030. return _date;
  5031. }
  5032. // lib/lightFormat.mjs
  5033. function _lightFormat(date, formatStr) {
  5034. var _date = _toDate(date);
  5035. if (!_isValid(_date)) {
  5036. throw new RangeError("Invalid time value");
  5037. }
  5038. var tokens = formatStr.match(formattingTokensRegExp3);
  5039. if (!tokens)
  5040. return "";
  5041. var result = tokens.map(function (substring) {
  5042. if (substring === "''") {
  5043. return "'";
  5044. }
  5045. var firstCharacter = substring[0];
  5046. if (firstCharacter === "'") {
  5047. return cleanEscapedString3(substring);
  5048. }
  5049. var formatter = _lightFormatters[firstCharacter];
  5050. if (formatter) {
  5051. return formatter(_date, substring);
  5052. }
  5053. if (firstCharacter.match(unescapedLatinCharacterRegExp3)) {
  5054. throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
  5055. }
  5056. return substring;
  5057. }).join("");
  5058. return result;
  5059. }
  5060. var cleanEscapedString3 = function cleanEscapedString3(input) {
  5061. var matches = input.match(escapedStringRegExp3);
  5062. if (!matches) {
  5063. return input;
  5064. }
  5065. return matches[1].replace(doubleQuoteRegExp3, "'");
  5066. };
  5067. var formattingTokensRegExp3 = /(\w)\1*|''|'(''|[^'])+('|$)|./g;
  5068. var escapedStringRegExp3 = /^'([^]*?)'?$/;
  5069. var doubleQuoteRegExp3 = /''/g;
  5070. var unescapedLatinCharacterRegExp3 = /[a-zA-Z]/;
  5071. // lib/milliseconds.mjs
  5072. function _milliseconds(_ref43)
  5073. {var years = _ref43.years,months2 = _ref43.months,weeks = _ref43.weeks,days2 = _ref43.days,hours = _ref43.hours,minutes = _ref43.minutes,seconds = _ref43.seconds;
  5074. var totalDays = 0;
  5075. if (years)
  5076. totalDays += years * daysInYear;
  5077. if (months2)
  5078. totalDays += months2 * (daysInYear / 12);
  5079. if (weeks)
  5080. totalDays += weeks * 7;
  5081. if (days2)
  5082. totalDays += days2;
  5083. var totalSeconds = totalDays * 24 * 60 * 60;
  5084. if (hours)
  5085. totalSeconds += hours * 60 * 60;
  5086. if (minutes)
  5087. totalSeconds += minutes * 60;
  5088. if (seconds)
  5089. totalSeconds += seconds;
  5090. return Math.trunc(totalSeconds * 1000);
  5091. }
  5092. // lib/millisecondsToHours.mjs
  5093. function _millisecondsToHours(milliseconds2) {
  5094. var hours = milliseconds2 / millisecondsInHour;
  5095. return Math.trunc(hours);
  5096. }
  5097. // lib/millisecondsToMinutes.mjs
  5098. function _millisecondsToMinutes(milliseconds2) {
  5099. var minutes = milliseconds2 / millisecondsInMinute;
  5100. return Math.trunc(minutes);
  5101. }
  5102. // lib/millisecondsToSeconds.mjs
  5103. function _millisecondsToSeconds(milliseconds2) {
  5104. var seconds = milliseconds2 / millisecondsInSecond;
  5105. return Math.trunc(seconds);
  5106. }
  5107. // lib/minutesToHours.mjs
  5108. function _minutesToHours(minutes) {
  5109. var hours = minutes / minutesInHour;
  5110. return Math.trunc(hours);
  5111. }
  5112. // lib/minutesToMilliseconds.mjs
  5113. function _minutesToMilliseconds(minutes) {
  5114. return Math.trunc(minutes * millisecondsInMinute);
  5115. }
  5116. // lib/minutesToSeconds.mjs
  5117. function _minutesToSeconds(minutes) {
  5118. return Math.trunc(minutes * secondsInMinute);
  5119. }
  5120. // lib/monthsToQuarters.mjs
  5121. function _monthsToQuarters(months2) {
  5122. var quarters = months2 / monthsInQuarter;
  5123. return Math.trunc(quarters);
  5124. }
  5125. // lib/monthsToYears.mjs
  5126. function _monthsToYears(months2) {
  5127. var years = months2 / monthsInYear;
  5128. return Math.trunc(years);
  5129. }
  5130. // lib/nextDay.mjs
  5131. function _nextDay(date, day) {
  5132. var delta = day - _getDay(date);
  5133. if (delta <= 0)
  5134. delta += 7;
  5135. return _addDays(date, delta);
  5136. }
  5137. // lib/nextFriday.mjs
  5138. function _nextFriday(date) {
  5139. return _nextDay(date, 5);
  5140. }
  5141. // lib/nextMonday.mjs
  5142. function _nextMonday(date) {
  5143. return _nextDay(date, 1);
  5144. }
  5145. // lib/nextSaturday.mjs
  5146. function _nextSaturday(date) {
  5147. return _nextDay(date, 6);
  5148. }
  5149. // lib/nextSunday.mjs
  5150. function _nextSunday(date) {
  5151. return _nextDay(date, 0);
  5152. }
  5153. // lib/nextThursday.mjs
  5154. function _nextThursday(date) {
  5155. return _nextDay(date, 4);
  5156. }
  5157. // lib/nextTuesday.mjs
  5158. function _nextTuesday(date) {
  5159. return _nextDay(date, 2);
  5160. }
  5161. // lib/nextWednesday.mjs
  5162. function _nextWednesday(date) {
  5163. return _nextDay(date, 3);
  5164. }
  5165. // lib/parseISO.mjs
  5166. function _parseISO(argument, options) {var _options$additionalDi;
  5167. var additionalDigits = (_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2;
  5168. var dateStrings = splitDateString(argument);
  5169. var date;
  5170. if (dateStrings.date) {
  5171. var parseYearResult = parseYear(dateStrings.date, additionalDigits);
  5172. date = parseDate(parseYearResult.restDateString, parseYearResult.year);
  5173. }
  5174. if (!date || isNaN(date.getTime())) {
  5175. return new Date(NaN);
  5176. }
  5177. var timestamp = date.getTime();
  5178. var time = 0;
  5179. var offset;
  5180. if (dateStrings.time) {
  5181. time = parseTime(dateStrings.time);
  5182. if (isNaN(time)) {
  5183. return new Date(NaN);
  5184. }
  5185. }
  5186. if (dateStrings.timezone) {
  5187. offset = parseTimezone(dateStrings.timezone);
  5188. if (isNaN(offset)) {
  5189. return new Date(NaN);
  5190. }
  5191. } else {
  5192. var dirtyDate = new Date(timestamp + time);
  5193. var result = new Date(0);
  5194. result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
  5195. result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
  5196. return result;
  5197. }
  5198. return new Date(timestamp + time + offset);
  5199. }
  5200. var splitDateString = function splitDateString(dateString) {
  5201. var dateStrings = {};
  5202. var array = dateString.split(patterns.dateTimeDelimiter);
  5203. var timeString;
  5204. if (array.length > 2) {
  5205. return dateStrings;
  5206. }
  5207. if (/:/.test(array[0])) {
  5208. timeString = array[0];
  5209. } else {
  5210. dateStrings.date = array[0];
  5211. timeString = array[1];
  5212. if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
  5213. dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
  5214. timeString = dateString.substr(dateStrings.date.length, dateString.length);
  5215. }
  5216. }
  5217. if (timeString) {
  5218. var token = patterns.timezone.exec(timeString);
  5219. if (token) {
  5220. dateStrings.time = timeString.replace(token[1], "");
  5221. dateStrings.timezone = token[1];
  5222. } else {
  5223. dateStrings.time = timeString;
  5224. }
  5225. }
  5226. return dateStrings;
  5227. };
  5228. var parseYear = function parseYear(dateString, additionalDigits) {
  5229. var regex = new RegExp("^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)");
  5230. var captures = dateString.match(regex);
  5231. if (!captures)
  5232. return { year: NaN, restDateString: "" };
  5233. var year = captures[1] ? parseInt(captures[1]) : null;
  5234. var century = captures[2] ? parseInt(captures[2]) : null;
  5235. return {
  5236. year: century === null ? year : century * 100,
  5237. restDateString: dateString.slice((captures[1] || captures[2]).length)
  5238. };
  5239. };
  5240. var parseDate = function parseDate(dateString, year) {
  5241. if (year === null)
  5242. return new Date(NaN);
  5243. var captures = dateString.match(dateRegex);
  5244. if (!captures)
  5245. return new Date(NaN);
  5246. var isWeekDate = !!captures[4];
  5247. var dayOfYear = parseDateUnit(captures[1]);
  5248. var month = parseDateUnit(captures[2]) - 1;
  5249. var day = parseDateUnit(captures[3]);
  5250. var week = parseDateUnit(captures[4]);
  5251. var dayOfWeek = parseDateUnit(captures[5]) - 1;
  5252. if (isWeekDate) {
  5253. if (!validateWeekDate(year, week, dayOfWeek)) {
  5254. return new Date(NaN);
  5255. }
  5256. return dayOfISOWeekYear(year, week, dayOfWeek);
  5257. } else {
  5258. var date = new Date(0);
  5259. if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
  5260. return new Date(NaN);
  5261. }
  5262. date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
  5263. return date;
  5264. }
  5265. };
  5266. var parseDateUnit = function parseDateUnit(value) {
  5267. return value ? parseInt(value) : 1;
  5268. };
  5269. var parseTime = function parseTime(timeString) {
  5270. var captures = timeString.match(timeRegex);
  5271. if (!captures)
  5272. return NaN;
  5273. var hours = parseTimeUnit(captures[1]);
  5274. var minutes = parseTimeUnit(captures[2]);
  5275. var seconds = parseTimeUnit(captures[3]);
  5276. if (!validateTime(hours, minutes, seconds)) {
  5277. return NaN;
  5278. }
  5279. return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
  5280. };
  5281. var parseTimeUnit = function parseTimeUnit(value) {
  5282. return value && parseFloat(value.replace(",", ".")) || 0;
  5283. };
  5284. var parseTimezone = function parseTimezone(timezoneString) {
  5285. if (timezoneString === "Z")
  5286. return 0;
  5287. var captures = timezoneString.match(timezoneRegex);
  5288. if (!captures)
  5289. return 0;
  5290. var sign = captures[1] === "+" ? -1 : 1;
  5291. var hours = parseInt(captures[2]);
  5292. var minutes = captures[3] && parseInt(captures[3]) || 0;
  5293. if (!validateTimezone(hours, minutes)) {
  5294. return NaN;
  5295. }
  5296. return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
  5297. };
  5298. var dayOfISOWeekYear = function dayOfISOWeekYear(isoWeekYear, week, day) {
  5299. var date = new Date(0);
  5300. date.setUTCFullYear(isoWeekYear, 0, 4);
  5301. var fourthOfJanuaryDay = date.getUTCDay() || 7;
  5302. var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
  5303. date.setUTCDate(date.getUTCDate() + diff);
  5304. return date;
  5305. };
  5306. var isLeapYearIndex2 = function isLeapYearIndex2(year) {
  5307. return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
  5308. };
  5309. var validateDate = function validateDate(year, month, date) {
  5310. return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28));
  5311. };
  5312. var validateDayOfYearDate = function validateDayOfYearDate(year, dayOfYear) {
  5313. return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365);
  5314. };
  5315. var validateWeekDate = function validateWeekDate(_year, week, day) {
  5316. return week >= 1 && week <= 53 && day >= 0 && day <= 6;
  5317. };
  5318. var validateTime = function validateTime(hours, minutes, seconds) {
  5319. if (hours === 24) {
  5320. return minutes === 0 && seconds === 0;
  5321. }
  5322. return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
  5323. };
  5324. var validateTimezone = function validateTimezone(_hours, minutes) {
  5325. return minutes >= 0 && minutes <= 59;
  5326. };
  5327. var patterns = {
  5328. dateTimeDelimiter: /[T ]/,
  5329. timeZoneDelimiter: /[Z ]/i,
  5330. timezone: /([Z+-].*)$/
  5331. };
  5332. var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
  5333. var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
  5334. var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
  5335. var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  5336. // lib/parseJSON.mjs
  5337. function _parseJSON(dateStr) {
  5338. var parts = dateStr.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);
  5339. if (parts) {
  5340. return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4] - (+parts[9] || 0) * (parts[8] == "-" ? -1 : 1), +parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1), +parts[6], +((parts[7] || "0") + "00").substring(0, 3)));
  5341. }
  5342. return new Date(NaN);
  5343. }
  5344. // lib/previousDay.mjs
  5345. function _previousDay(date, day) {
  5346. var delta = _getDay(date) - day;
  5347. if (delta <= 0)
  5348. delta += 7;
  5349. return _subDays(date, delta);
  5350. }
  5351. // lib/previousFriday.mjs
  5352. function _previousFriday(date) {
  5353. return _previousDay(date, 5);
  5354. }
  5355. // lib/previousMonday.mjs
  5356. function _previousMonday(date) {
  5357. return _previousDay(date, 1);
  5358. }
  5359. // lib/previousSaturday.mjs
  5360. function _previousSaturday(date) {
  5361. return _previousDay(date, 6);
  5362. }
  5363. // lib/previousSunday.mjs
  5364. function _previousSunday(date) {
  5365. return _previousDay(date, 0);
  5366. }
  5367. // lib/previousThursday.mjs
  5368. function _previousThursday(date) {
  5369. return _previousDay(date, 4);
  5370. }
  5371. // lib/previousTuesday.mjs
  5372. function _previousTuesday(date) {
  5373. return _previousDay(date, 2);
  5374. }
  5375. // lib/previousWednesday.mjs
  5376. function _previousWednesday(date) {
  5377. return _previousDay(date, 3);
  5378. }
  5379. // lib/quartersToMonths.mjs
  5380. function _quartersToMonths(quarters) {
  5381. return Math.trunc(quarters * monthsInQuarter);
  5382. }
  5383. // lib/quartersToYears.mjs
  5384. function _quartersToYears(quarters) {
  5385. var years = quarters / quartersInYear;
  5386. return Math.trunc(years);
  5387. }
  5388. // lib/roundToNearestHours.mjs
  5389. function _roundToNearestHours(date, options) {var _options$nearestTo, _options$roundingMeth2;
  5390. var nearestTo = (_options$nearestTo = options === null || options === void 0 ? void 0 : options.nearestTo) !== null && _options$nearestTo !== void 0 ? _options$nearestTo : 1;
  5391. if (nearestTo < 1 || nearestTo > 12)
  5392. return _constructFrom(date, NaN);
  5393. var _date = _toDate(date);
  5394. var fractionalMinutes = _date.getMinutes() / 60;
  5395. var fractionalSeconds = _date.getSeconds() / 60 / 60;
  5396. var fractionalMilliseconds = _date.getMilliseconds() / 1000 / 60 / 60;
  5397. var hours = _date.getHours() + fractionalMinutes + fractionalSeconds + fractionalMilliseconds;
  5398. var method = (_options$roundingMeth2 = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth2 !== void 0 ? _options$roundingMeth2 : "round";
  5399. var roundingMethod = getRoundingMethod(method);
  5400. var roundedHours = roundingMethod(hours / nearestTo) * nearestTo;
  5401. var result = _constructFrom(date, _date);
  5402. result.setHours(roundedHours, 0, 0, 0);
  5403. return result;
  5404. }
  5405. // lib/roundToNearestMinutes.mjs
  5406. function _roundToNearestMinutes(date, options) {var _options$nearestTo2, _options$roundingMeth3;
  5407. var nearestTo = (_options$nearestTo2 = options === null || options === void 0 ? void 0 : options.nearestTo) !== null && _options$nearestTo2 !== void 0 ? _options$nearestTo2 : 1;
  5408. if (nearestTo < 1 || nearestTo > 30)
  5409. return _constructFrom(date, NaN);
  5410. var _date = _toDate(date);
  5411. var fractionalSeconds = _date.getSeconds() / 60;
  5412. var fractionalMilliseconds = _date.getMilliseconds() / 1000 / 60;
  5413. var minutes = _date.getMinutes() + fractionalSeconds + fractionalMilliseconds;
  5414. var method = (_options$roundingMeth3 = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth3 !== void 0 ? _options$roundingMeth3 : "round";
  5415. var roundingMethod = getRoundingMethod(method);
  5416. var roundedMinutes = roundingMethod(minutes / nearestTo) * nearestTo;
  5417. var result = _constructFrom(date, _date);
  5418. result.setMinutes(roundedMinutes, 0, 0);
  5419. return result;
  5420. }
  5421. // lib/secondsToHours.mjs
  5422. function _secondsToHours(seconds) {
  5423. var hours = seconds / secondsInHour;
  5424. return Math.trunc(hours);
  5425. }
  5426. // lib/secondsToMilliseconds.mjs
  5427. function _secondsToMilliseconds(seconds) {
  5428. return seconds * millisecondsInSecond;
  5429. }
  5430. // lib/secondsToMinutes.mjs
  5431. function _secondsToMinutes(seconds) {
  5432. var minutes = seconds / secondsInMinute;
  5433. return Math.trunc(minutes);
  5434. }
  5435. // lib/setMonth.mjs
  5436. function _setMonth(date, month) {
  5437. var _date = _toDate(date);
  5438. var year = _date.getFullYear();
  5439. var day = _date.getDate();
  5440. var dateWithDesiredMonth = _constructFrom(date, 0);
  5441. dateWithDesiredMonth.setFullYear(year, month, 15);
  5442. dateWithDesiredMonth.setHours(0, 0, 0, 0);
  5443. var daysInMonth = _getDaysInMonth(dateWithDesiredMonth);
  5444. _date.setMonth(month, Math.min(day, daysInMonth));
  5445. return _date;
  5446. }
  5447. // lib/set.mjs
  5448. function _set(date, values) {
  5449. var _date = _toDate(date);
  5450. if (isNaN(+_date)) {
  5451. return _constructFrom(date, NaN);
  5452. }
  5453. if (values.year != null) {
  5454. _date.setFullYear(values.year);
  5455. }
  5456. if (values.month != null) {
  5457. _date = _setMonth(_date, values.month);
  5458. }
  5459. if (values.date != null) {
  5460. _date.setDate(values.date);
  5461. }
  5462. if (values.hours != null) {
  5463. _date.setHours(values.hours);
  5464. }
  5465. if (values.minutes != null) {
  5466. _date.setMinutes(values.minutes);
  5467. }
  5468. if (values.seconds != null) {
  5469. _date.setSeconds(values.seconds);
  5470. }
  5471. if (values.milliseconds != null) {
  5472. _date.setMilliseconds(values.milliseconds);
  5473. }
  5474. return _date;
  5475. }
  5476. // lib/setDate.mjs
  5477. function _setDate(date, dayOfMonth) {
  5478. var _date = _toDate(date);
  5479. _date.setDate(dayOfMonth);
  5480. return _date;
  5481. }
  5482. // lib/setDayOfYear.mjs
  5483. function _setDayOfYear(date, dayOfYear) {
  5484. var _date = _toDate(date);
  5485. _date.setMonth(0);
  5486. _date.setDate(dayOfYear);
  5487. return _date;
  5488. }
  5489. // lib/setDefaultOptions.mjs
  5490. function setDefaultOptions2(options) {
  5491. var result = {};
  5492. var defaultOptions16 = getDefaultOptions();
  5493. for (var property in defaultOptions16) {
  5494. if (Object.prototype.hasOwnProperty.call(defaultOptions16, property)) {
  5495. result[property] = defaultOptions16[property];
  5496. }
  5497. }
  5498. for (var _property in options) {
  5499. if (Object.prototype.hasOwnProperty.call(options, _property)) {
  5500. if (options[_property] === undefined) {
  5501. delete result[_property];
  5502. } else {
  5503. result[_property] = options[_property];
  5504. }
  5505. }
  5506. }
  5507. setDefaultOptions(result);
  5508. }
  5509. // lib/setHours.mjs
  5510. function _setHours(date, hours) {
  5511. var _date = _toDate(date);
  5512. _date.setHours(hours);
  5513. return _date;
  5514. }
  5515. // lib/setMilliseconds.mjs
  5516. function _setMilliseconds(date, milliseconds2) {
  5517. var _date = _toDate(date);
  5518. _date.setMilliseconds(milliseconds2);
  5519. return _date;
  5520. }
  5521. // lib/setMinutes.mjs
  5522. function _setMinutes(date, minutes) {
  5523. var _date = _toDate(date);
  5524. _date.setMinutes(minutes);
  5525. return _date;
  5526. }
  5527. // lib/setQuarter.mjs
  5528. function _setQuarter(date, quarter) {
  5529. var _date = _toDate(date);
  5530. var oldQuarter = Math.trunc(_date.getMonth() / 3) + 1;
  5531. var diff = quarter - oldQuarter;
  5532. return _setMonth(_date, _date.getMonth() + diff * 3);
  5533. }
  5534. // lib/setSeconds.mjs
  5535. function _setSeconds(date, seconds) {
  5536. var _date = _toDate(date);
  5537. _date.setSeconds(seconds);
  5538. return _date;
  5539. }
  5540. // lib/setWeekYear.mjs
  5541. function _setWeekYear(date, weekYear, options) {var _ref44, _ref45, _ref46, _options$firstWeekCon5, _options$locale19, _defaultOptions17$loc;
  5542. var defaultOptions17 = getDefaultOptions();
  5543. var firstWeekContainsDate = (_ref44 = (_ref45 = (_ref46 = (_options$firstWeekCon5 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon5 !== void 0 ? _options$firstWeekCon5 : options === null || options === void 0 || (_options$locale19 = options.locale) === null || _options$locale19 === void 0 || (_options$locale19 = _options$locale19.options) === null || _options$locale19 === void 0 ? void 0 : _options$locale19.firstWeekContainsDate) !== null && _ref46 !== void 0 ? _ref46 : defaultOptions17.firstWeekContainsDate) !== null && _ref45 !== void 0 ? _ref45 : (_defaultOptions17$loc = defaultOptions17.locale) === null || _defaultOptions17$loc === void 0 || (_defaultOptions17$loc = _defaultOptions17$loc.options) === null || _defaultOptions17$loc === void 0 ? void 0 : _defaultOptions17$loc.firstWeekContainsDate) !== null && _ref44 !== void 0 ? _ref44 : 1;
  5544. var _date = _toDate(date);
  5545. var diff = _differenceInCalendarDays(_date, _startOfWeekYear(_date, options));
  5546. var firstWeek = _constructFrom(date, 0);
  5547. firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate);
  5548. firstWeek.setHours(0, 0, 0, 0);
  5549. _date = _startOfWeekYear(firstWeek, options);
  5550. _date.setDate(_date.getDate() + diff);
  5551. return _date;
  5552. }
  5553. // lib/setYear.mjs
  5554. function _setYear(date, year) {
  5555. var _date = _toDate(date);
  5556. if (isNaN(+_date)) {
  5557. return _constructFrom(date, NaN);
  5558. }
  5559. _date.setFullYear(year);
  5560. return _date;
  5561. }
  5562. // lib/startOfDecade.mjs
  5563. function _startOfDecade(date) {
  5564. var _date = _toDate(date);
  5565. var year = _date.getFullYear();
  5566. var decade = Math.floor(year / 10) * 10;
  5567. _date.setFullYear(decade, 0, 1);
  5568. _date.setHours(0, 0, 0, 0);
  5569. return _date;
  5570. }
  5571. // lib/startOfToday.mjs
  5572. function _startOfToday() {
  5573. return _startOfDay(Date.now());
  5574. }
  5575. // lib/startOfTomorrow.mjs
  5576. function _startOfTomorrow() {
  5577. var now = new Date();
  5578. var year = now.getFullYear();
  5579. var month = now.getMonth();
  5580. var day = now.getDate();
  5581. var date = new Date(0);
  5582. date.setFullYear(year, month, day + 1);
  5583. date.setHours(0, 0, 0, 0);
  5584. return date;
  5585. }
  5586. // lib/startOfYesterday.mjs
  5587. function _startOfYesterday() {
  5588. var now = new Date();
  5589. var year = now.getFullYear();
  5590. var month = now.getMonth();
  5591. var day = now.getDate();
  5592. var date = new Date(0);
  5593. date.setFullYear(year, month, day - 1);
  5594. date.setHours(0, 0, 0, 0);
  5595. return date;
  5596. }
  5597. // lib/subMonths.mjs
  5598. function _subMonths(date, amount) {
  5599. return _addMonths(date, -amount);
  5600. }
  5601. // lib/sub.mjs
  5602. function _sub(date, duration) {
  5603. var _duration$years3 =
  5604. duration.years,years = _duration$years3 === void 0 ? 0 : _duration$years3,_duration$months3 = duration.months,months2 = _duration$months3 === void 0 ? 0 : _duration$months3,_duration$weeks2 = duration.weeks,weeks = _duration$weeks2 === void 0 ? 0 : _duration$weeks2,_duration$days3 = duration.days,days2 = _duration$days3 === void 0 ? 0 : _duration$days3,_duration$hours3 = duration.hours,hours = _duration$hours3 === void 0 ? 0 : _duration$hours3,_duration$minutes3 = duration.minutes,minutes = _duration$minutes3 === void 0 ? 0 : _duration$minutes3,_duration$seconds3 = duration.seconds,seconds = _duration$seconds3 === void 0 ? 0 : _duration$seconds3;
  5605. var dateWithoutMonths = _subMonths(date, months2 + years * 12);
  5606. var dateWithoutDays = _subDays(dateWithoutMonths, days2 + weeks * 7);
  5607. var minutestoSub = minutes + hours * 60;
  5608. var secondstoSub = seconds + minutestoSub * 60;
  5609. var mstoSub = secondstoSub * 1000;
  5610. var finalDate = _constructFrom(date, dateWithoutDays.getTime() - mstoSub);
  5611. return finalDate;
  5612. }
  5613. // lib/subBusinessDays.mjs
  5614. function _subBusinessDays(date, amount) {
  5615. return _addBusinessDays(date, -amount);
  5616. }
  5617. // lib/subHours.mjs
  5618. function _subHours(date, amount) {
  5619. return _addHours(date, -amount);
  5620. }
  5621. // lib/subMilliseconds.mjs
  5622. function _subMilliseconds(date, amount) {
  5623. return _addMilliseconds(date, -amount);
  5624. }
  5625. // lib/subMinutes.mjs
  5626. function _subMinutes(date, amount) {
  5627. return _addMinutes(date, -amount);
  5628. }
  5629. // lib/subQuarters.mjs
  5630. function _subQuarters(date, amount) {
  5631. return _addQuarters(date, -amount);
  5632. }
  5633. // lib/subSeconds.mjs
  5634. function _subSeconds(date, amount) {
  5635. return _addSeconds(date, -amount);
  5636. }
  5637. // lib/subWeeks.mjs
  5638. function _subWeeks(date, amount) {
  5639. return _addWeeks(date, -amount);
  5640. }
  5641. // lib/subYears.mjs
  5642. function _subYears(date, amount) {
  5643. return _addYears(date, -amount);
  5644. }
  5645. // lib/weeksToDays.mjs
  5646. function _weeksToDays(weeks) {
  5647. return Math.trunc(weeks * daysInWeek);
  5648. }
  5649. // lib/yearsToDays.mjs
  5650. function _yearsToDays(years) {
  5651. return Math.trunc(years * daysInYear);
  5652. }
  5653. // lib/yearsToMonths.mjs
  5654. function _yearsToMonths(years) {
  5655. return Math.trunc(years * monthsInYear);
  5656. }
  5657. // lib/yearsToQuarters.mjs
  5658. function _yearsToQuarters(years) {
  5659. return Math.trunc(years * quartersInYear);
  5660. }
  5661. // lib/cdn.js
  5662. window.dateFns = _objectSpread(_objectSpread({},
  5663. window.dateFns),
  5664. exports_lib);
  5665. //# debugId=CCBC78CA46C31FB264756e2164756e21
  5666. })();
  5667. //# sourceMappingURL=cdn.js.map