1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586 |
-
- 'use strict';
-
- var path$1 = require('path');
- var crypto = require('crypto');
- var childProcess = require('child_process');
- var fs$1 = require('fs');
- var readline = require('readline');
- var os = require('os');
- var tty = require('tty');
- var require$$0 = require('util');
- var require$$0$1 = require('events');
- var assert = require('assert');
-
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
-
- var path__default = _interopDefaultLegacy(path$1);
- var crypto__default = _interopDefaultLegacy(crypto);
- var childProcess__default = _interopDefaultLegacy(childProcess);
- var fs__default = _interopDefaultLegacy(fs$1);
- var readline__default = _interopDefaultLegacy(readline);
- var os__default = _interopDefaultLegacy(os);
- var tty__default = _interopDefaultLegacy(tty);
- var require$$0__default = _interopDefaultLegacy(require$$0);
- var require$$0__default$1 = _interopDefaultLegacy(require$$0$1);
- var assert__default = _interopDefaultLegacy(assert);
-
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-
- function getAugmentedNamespace(n) {
- if (n.__esModule) return n;
- var a = Object.defineProperty({}, '__esModule', {value: true});
- Object.keys(n).forEach(function (k) {
- var d = Object.getOwnPropertyDescriptor(n, k);
- Object.defineProperty(a, k, d.get ? d : {
- enumerable: true,
- get: function () {
- return n[k];
- }
- });
- });
- return a;
- }
-
- function createCommonjsModule(fn, basedir, module) {
- return module = {
- path: basedir,
- exports: {},
- require: function (path, base) {
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
- }
- }, fn(module, module.exports), module.exports;
- }
-
- function commonjsRegister (path, loader) {
- DYNAMIC_REQUIRE_LOADERS[path] = loader;
- }
-
- const DYNAMIC_REQUIRE_LOADERS = Object.create(null);
- const DYNAMIC_REQUIRE_CACHE = Object.create(null);
- const DEFAULT_PARENT_MODULE = {
- id: '<' + 'rollup>', exports: {}, parent: undefined, filename: null, loaded: false, children: [], paths: []
- };
- const CHECKED_EXTENSIONS = ['', '.js', '.json'];
-
- function normalize (path) {
- path = path.replace(/\\/g, '/');
- const parts = path.split('/');
- const slashed = parts[0] === '';
- for (let i = 1; i < parts.length; i++) {
- if (parts[i] === '.' || parts[i] === '') {
- parts.splice(i--, 1);
- }
- }
- for (let i = 1; i < parts.length; i++) {
- if (parts[i] !== '..') continue;
- if (i > 0 && parts[i - 1] !== '..' && parts[i - 1] !== '.') {
- parts.splice(--i, 2);
- i--;
- }
- }
- path = parts.join('/');
- if (slashed && path[0] !== '/')
- path = '/' + path;
- else if (path.length === 0)
- path = '.';
- return path;
- }
-
- function join () {
- if (arguments.length === 0)
- return '.';
- let joined;
- for (let i = 0; i < arguments.length; ++i) {
- let arg = arguments[i];
- if (arg.length > 0) {
- if (joined === undefined)
- joined = arg;
- else
- joined += '/' + arg;
- }
- }
- if (joined === undefined)
- return '.';
-
- return joined;
- }
-
- function isPossibleNodeModulesPath (modulePath) {
- let c0 = modulePath[0];
- if (c0 === '/' || c0 === '\\') return false;
- let c1 = modulePath[1], c2 = modulePath[2];
- if ((c0 === '.' && (!c1 || c1 === '/' || c1 === '\\')) ||
- (c0 === '.' && c1 === '.' && (!c2 || c2 === '/' || c2 === '\\'))) return false;
- if (c1 === ':' && (c2 === '/' || c2 === '\\'))
- return false;
- return true;
- }
-
- function dirname (path) {
- if (path.length === 0)
- return '.';
-
- let i = path.length - 1;
- while (i > 0) {
- const c = path.charCodeAt(i);
- if ((c === 47 || c === 92) && i !== path.length - 1)
- break;
- i--;
- }
-
- if (i > 0)
- return path.substr(0, i);
-
- if (path.chartCodeAt(0) === 47 || path.chartCodeAt(0) === 92)
- return path.charAt(0);
-
- return '.';
- }
-
- function commonjsResolveImpl (path, originalModuleDir, testCache) {
- const shouldTryNodeModules = isPossibleNodeModulesPath(path);
- path = normalize(path);
- let relPath;
- if (path[0] === '/') {
- originalModuleDir = '/';
- }
- while (true) {
- if (!shouldTryNodeModules) {
- relPath = originalModuleDir ? normalize(originalModuleDir + '/' + path) : path;
- } else if (originalModuleDir) {
- relPath = normalize(originalModuleDir + '/node_modules/' + path);
- } else {
- relPath = normalize(join('node_modules', path));
- }
-
- if (relPath.endsWith('/..')) {
- break;
- }
-
- for (let extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
- const resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
- if (DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
- return resolvedPath;
- } if (DYNAMIC_REQUIRE_LOADERS[resolvedPath]) {
- return resolvedPath;
- } }
- if (!shouldTryNodeModules) break;
- const nextDir = normalize(originalModuleDir + '/..');
- if (nextDir === originalModuleDir) break;
- originalModuleDir = nextDir;
- }
- return null;
- }
-
- function commonjsResolve (path, originalModuleDir) {
- const resolvedPath = commonjsResolveImpl(path, originalModuleDir);
- if (resolvedPath !== null) {
- return resolvedPath;
- }
- return require.resolve(path);
- }
-
- function commonjsRequire (path, originalModuleDir) {
- const resolvedPath = commonjsResolveImpl(path, originalModuleDir);
- if (resolvedPath !== null) {
- let cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
- if (cachedModule) return cachedModule.exports;
- const loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
- if (loader) {
- DYNAMIC_REQUIRE_CACHE[resolvedPath] = cachedModule = {
- id: resolvedPath,
- filename: resolvedPath,
- path: dirname(resolvedPath),
- exports: {},
- parent: DEFAULT_PARENT_MODULE,
- loaded: false,
- children: [],
- paths: [],
- require: function (path, base) {
- return commonjsRequire(path, (base === undefined || base === null) ? cachedModule.path : base);
- }
- };
- try {
- loader.call(commonjsGlobal, cachedModule, cachedModule.exports);
- } catch (error) {
- delete DYNAMIC_REQUIRE_CACHE[resolvedPath];
- throw error;
- }
- cachedModule.loaded = true;
- return cachedModule.exports;
- } }
- return require(path);
- }
-
- commonjsRequire.cache = DYNAMIC_REQUIRE_CACHE;
- commonjsRequire.resolve = commonjsResolve;
-
-
- function identity(value) {
- return value;
- }
-
- var identity_1 = identity;
-
-
-
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
-
- var _freeGlobal = freeGlobal;
-
-
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
-
-
- var root = _freeGlobal || freeSelf || Function('return this')();
-
- var _root = root;
-
-
- var Symbol$1 = _root.Symbol;
-
- var _Symbol = Symbol$1;
-
-
- var objectProto$h = Object.prototype;
-
-
- var hasOwnProperty$e = objectProto$h.hasOwnProperty;
-
-
- var nativeObjectToString$1 = objectProto$h.toString;
-
-
- var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
-
-
- function getRawTag(value) {
- var isOwn = hasOwnProperty$e.call(value, symToStringTag$1),
- tag = value[symToStringTag$1];
-
- try {
- value[symToStringTag$1] = undefined;
- var unmasked = true;
- } catch (e) {}
-
- var result = nativeObjectToString$1.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag$1] = tag;
- } else {
- delete value[symToStringTag$1];
- }
- }
- return result;
- }
-
- var _getRawTag = getRawTag;
-
-
- var objectProto$g = Object.prototype;
-
-
- var nativeObjectToString = objectProto$g.toString;
-
-
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
-
- var _objectToString = objectToString;
-
-
- var nullTag = '[object Null]',
- undefinedTag = '[object Undefined]';
-
-
- var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
-
-
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag && symToStringTag in Object(value))
- ? _getRawTag(value)
- : _objectToString(value);
- }
-
- var _baseGetTag = baseGetTag;
-
-
- function isObject$1(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
- }
-
- var isObject_1 = isObject$1;
-
-
- var asyncTag = '[object AsyncFunction]',
- funcTag$2 = '[object Function]',
- genTag$1 = '[object GeneratorFunction]',
- proxyTag = '[object Proxy]';
-
-
- function isFunction(value) {
- if (!isObject_1(value)) {
- return false;
- }
-
-
- var tag = _baseGetTag(value);
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
- }
-
- var isFunction_1 = isFunction;
-
-
- var coreJsData = _root['__core-js_shared__'];
-
- var _coreJsData = coreJsData;
-
-
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
- }());
-
-
- function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
- }
-
- var _isMasked = isMasked;
-
-
- var funcProto$2 = Function.prototype;
-
-
- var funcToString$2 = funcProto$2.toString;
-
-
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString$2.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
- }
-
- var _toSource = toSource;
-
-
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-
-
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
-
- var funcProto$1 = Function.prototype,
- objectProto$f = Object.prototype;
-
-
- var funcToString$1 = funcProto$1.toString;
-
-
- var hasOwnProperty$d = objectProto$f.hasOwnProperty;
-
-
- var reIsNative = RegExp('^' +
- funcToString$1.call(hasOwnProperty$d).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
-
-
- function baseIsNative(value) {
- if (!isObject_1(value) || _isMasked(value)) {
- return false;
- }
- var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
- return pattern.test(_toSource(value));
- }
-
- var _baseIsNative = baseIsNative;
-
-
- function getValue(object, key) {
- return object == null ? undefined : object[key];
- }
-
- var _getValue = getValue;
-
-
- function getNative(object, key) {
- var value = _getValue(object, key);
- return _baseIsNative(value) ? value : undefined;
- }
-
- var _getNative = getNative;
-
-
- var WeakMap$1 = _getNative(_root, 'WeakMap');
-
- var _WeakMap = WeakMap$1;
-
-
- var metaMap = _WeakMap && new _WeakMap;
-
- var _metaMap = metaMap;
-
-
- var baseSetData = !_metaMap ? identity_1 : function(func, data) {
- _metaMap.set(func, data);
- return func;
- };
-
- var _baseSetData = baseSetData;
-
-
- var objectCreate = Object.create;
-
-
- var baseCreate = (function() {
- function object() {}
- return function(proto) {
- if (!isObject_1(proto)) {
- return {};
- }
- if (objectCreate) {
- return objectCreate(proto);
- }
- object.prototype = proto;
- var result = new object;
- object.prototype = undefined;
- return result;
- };
- }());
-
- var _baseCreate = baseCreate;
-
-
- function createCtor(Ctor) {
- return function() {
-
-
-
- var args = arguments;
- switch (args.length) {
- case 0: return new Ctor;
- case 1: return new Ctor(args[0]);
- case 2: return new Ctor(args[0], args[1]);
- case 3: return new Ctor(args[0], args[1], args[2]);
- case 4: return new Ctor(args[0], args[1], args[2], args[3]);
- case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
- case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
- case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
- }
- var thisBinding = _baseCreate(Ctor.prototype),
- result = Ctor.apply(thisBinding, args);
-
-
-
- return isObject_1(result) ? result : thisBinding;
- };
- }
-
- var _createCtor = createCtor;
-
-
- var WRAP_BIND_FLAG$6 = 1;
-
-
- function createBind(func, bitmask, thisArg) {
- var isBind = bitmask & WRAP_BIND_FLAG$6,
- Ctor = _createCtor(func);
-
- function wrapper() {
- var fn = (this && this !== _root && this instanceof wrapper) ? Ctor : func;
- return fn.apply(isBind ? thisArg : this, arguments);
- }
- return wrapper;
- }
-
- var _createBind = createBind;
-
-
- function apply(func, thisArg, args) {
- switch (args.length) {
- case 0: return func.call(thisArg);
- case 1: return func.call(thisArg, args[0]);
- case 2: return func.call(thisArg, args[0], args[1]);
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
- }
-
- var _apply = apply;
-
-
- var nativeMax$3 = Math.max;
-
-
- function composeArgs(args, partials, holders, isCurried) {
- var argsIndex = -1,
- argsLength = args.length,
- holdersLength = holders.length,
- leftIndex = -1,
- leftLength = partials.length,
- rangeLength = nativeMax$3(argsLength - holdersLength, 0),
- result = Array(leftLength + rangeLength),
- isUncurried = !isCurried;
-
- while (++leftIndex < leftLength) {
- result[leftIndex] = partials[leftIndex];
- }
- while (++argsIndex < holdersLength) {
- if (isUncurried || argsIndex < argsLength) {
- result[holders[argsIndex]] = args[argsIndex];
- }
- }
- while (rangeLength--) {
- result[leftIndex++] = args[argsIndex++];
- }
- return result;
- }
-
- var _composeArgs = composeArgs;
-
-
- var nativeMax$2 = Math.max;
-
-
- function composeArgsRight(args, partials, holders, isCurried) {
- var argsIndex = -1,
- argsLength = args.length,
- holdersIndex = -1,
- holdersLength = holders.length,
- rightIndex = -1,
- rightLength = partials.length,
- rangeLength = nativeMax$2(argsLength - holdersLength, 0),
- result = Array(rangeLength + rightLength),
- isUncurried = !isCurried;
-
- while (++argsIndex < rangeLength) {
- result[argsIndex] = args[argsIndex];
- }
- var offset = argsIndex;
- while (++rightIndex < rightLength) {
- result[offset + rightIndex] = partials[rightIndex];
- }
- while (++holdersIndex < holdersLength) {
- if (isUncurried || argsIndex < argsLength) {
- result[offset + holders[holdersIndex]] = args[argsIndex++];
- }
- }
- return result;
- }
-
- var _composeArgsRight = composeArgsRight;
-
-
- function countHolders(array, placeholder) {
- var length = array.length,
- result = 0;
-
- while (length--) {
- if (array[length] === placeholder) {
- ++result;
- }
- }
- return result;
- }
-
- var _countHolders = countHolders;
-
-
- function baseLodash() {
-
- }
-
- var _baseLodash = baseLodash;
-
-
- var MAX_ARRAY_LENGTH = 4294967295;
-
-
- function LazyWrapper(value) {
- this.__wrapped__ = value;
- this.__actions__ = [];
- this.__dir__ = 1;
- this.__filtered__ = false;
- this.__iteratees__ = [];
- this.__takeCount__ = MAX_ARRAY_LENGTH;
- this.__views__ = [];
- }
-
-
- LazyWrapper.prototype = _baseCreate(_baseLodash.prototype);
- LazyWrapper.prototype.constructor = LazyWrapper;
-
- var _LazyWrapper = LazyWrapper;
-
-
- function noop() {
-
- }
-
- var noop_1 = noop;
-
-
- var getData = !_metaMap ? noop_1 : function(func) {
- return _metaMap.get(func);
- };
-
- var _getData = getData;
-
-
- var realNames = {};
-
- var _realNames = realNames;
-
-
- var objectProto$e = Object.prototype;
-
-
- var hasOwnProperty$c = objectProto$e.hasOwnProperty;
-
-
- function getFuncName(func) {
- var result = (func.name + ''),
- array = _realNames[result],
- length = hasOwnProperty$c.call(_realNames, result) ? array.length : 0;
-
- while (length--) {
- var data = array[length],
- otherFunc = data.func;
- if (otherFunc == null || otherFunc == func) {
- return data.name;
- }
- }
- return result;
- }
-
- var _getFuncName = getFuncName;
-
-
- function LodashWrapper(value, chainAll) {
- this.__wrapped__ = value;
- this.__actions__ = [];
- this.__chain__ = !!chainAll;
- this.__index__ = 0;
- this.__values__ = undefined;
- }
-
- LodashWrapper.prototype = _baseCreate(_baseLodash.prototype);
- LodashWrapper.prototype.constructor = LodashWrapper;
-
- var _LodashWrapper = LodashWrapper;
-
-
- var isArray$3 = Array.isArray;
-
- var isArray_1 = isArray$3;
-
-
- function isObjectLike(value) {
- return value != null && typeof value == 'object';
- }
-
- var isObjectLike_1 = isObjectLike;
-
-
- function copyArray(source, array) {
- var index = -1,
- length = source.length;
-
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
- }
-
- var _copyArray = copyArray;
-
-
- function wrapperClone(wrapper) {
- if (wrapper instanceof _LazyWrapper) {
- return wrapper.clone();
- }
- var result = new _LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
- result.__actions__ = _copyArray(wrapper.__actions__);
- result.__index__ = wrapper.__index__;
- result.__values__ = wrapper.__values__;
- return result;
- }
-
- var _wrapperClone = wrapperClone;
-
-
- var objectProto$d = Object.prototype;
-
-
- var hasOwnProperty$b = objectProto$d.hasOwnProperty;
-
-
- function lodash(value) {
- if (isObjectLike_1(value) && !isArray_1(value) && !(value instanceof _LazyWrapper)) {
- if (value instanceof _LodashWrapper) {
- return value;
- }
- if (hasOwnProperty$b.call(value, '__wrapped__')) {
- return _wrapperClone(value);
- }
- }
- return new _LodashWrapper(value);
- }
-
-
- lodash.prototype = _baseLodash.prototype;
- lodash.prototype.constructor = lodash;
-
- var wrapperLodash = lodash;
-
-
- function isLaziable(func) {
- var funcName = _getFuncName(func),
- other = wrapperLodash[funcName];
-
- if (typeof other != 'function' || !(funcName in _LazyWrapper.prototype)) {
- return false;
- }
- if (func === other) {
- return true;
- }
- var data = _getData(other);
- return !!data && func === data[0];
- }
-
- var _isLaziable = isLaziable;
-
-
- var HOT_COUNT = 800,
- HOT_SPAN = 16;
-
-
- var nativeNow = Date.now;
-
-
- function shortOut(func) {
- var count = 0,
- lastCalled = 0;
-
- return function() {
- var stamp = nativeNow(),
- remaining = HOT_SPAN - (stamp - lastCalled);
-
- lastCalled = stamp;
- if (remaining > 0) {
- if (++count >= HOT_COUNT) {
- return arguments[0];
- }
- } else {
- count = 0;
- }
- return func.apply(undefined, arguments);
- };
- }
-
- var _shortOut = shortOut;
-
-
- var setData = _shortOut(_baseSetData);
-
- var _setData = setData;
-
-
- var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
- reSplitDetails = /,? & /;
-
-
- function getWrapDetails(source) {
- var match = source.match(reWrapDetails);
- return match ? match[1].split(reSplitDetails) : [];
- }
-
- var _getWrapDetails = getWrapDetails;
-
-
- var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
-
-
- function insertWrapDetails(source, details) {
- var length = details.length;
- if (!length) {
- return source;
- }
- var lastIndex = length - 1;
- details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
- details = details.join(length > 2 ? ', ' : ' ');
- return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
- }
-
- var _insertWrapDetails = insertWrapDetails;
-
-
- function constant(value) {
- return function() {
- return value;
- };
- }
-
- var constant_1 = constant;
-
- var defineProperty = (function() {
- try {
- var func = _getNative(Object, 'defineProperty');
- func({}, '', {});
- return func;
- } catch (e) {}
- }());
-
- var _defineProperty = defineProperty;
-
-
- var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
- return _defineProperty(func, 'toString', {
- 'configurable': true,
- 'enumerable': false,
- 'value': constant_1(string),
- 'writable': true
- });
- };
-
- var _baseSetToString = baseSetToString;
-
-
- var setToString = _shortOut(_baseSetToString);
-
- var _setToString = setToString;
-
-
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array == null ? 0 : array.length;
-
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
-
- var _arrayEach = arrayEach;
-
-
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 1 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- if (predicate(array[index], index, array)) {
- return index;
- }
- }
- return -1;
- }
-
- var _baseFindIndex = baseFindIndex;
-
-
- function baseIsNaN(value) {
- return value !== value;
- }
-
- var _baseIsNaN = baseIsNaN;
-
-
- function strictIndexOf(array, value, fromIndex) {
- var index = fromIndex - 1,
- length = array.length;
-
- while (++index < length) {
- if (array[index] === value) {
- return index;
- }
- }
- return -1;
- }
-
- var _strictIndexOf = strictIndexOf;
-
-
- function baseIndexOf(array, value, fromIndex) {
- return value === value
- ? _strictIndexOf(array, value, fromIndex)
- : _baseFindIndex(array, _baseIsNaN, fromIndex);
- }
-
- var _baseIndexOf = baseIndexOf;
-
-
- function arrayIncludes(array, value) {
- var length = array == null ? 0 : array.length;
- return !!length && _baseIndexOf(array, value, 0) > -1;
- }
-
- var _arrayIncludes = arrayIncludes;
-
-
- var WRAP_BIND_FLAG$5 = 1,
- WRAP_BIND_KEY_FLAG$4 = 2,
- WRAP_CURRY_FLAG$4 = 8,
- WRAP_CURRY_RIGHT_FLAG$2 = 16,
- WRAP_PARTIAL_FLAG$2 = 32,
- WRAP_PARTIAL_RIGHT_FLAG$2 = 64,
- WRAP_ARY_FLAG$3 = 128,
- WRAP_REARG_FLAG$2 = 256,
- WRAP_FLIP_FLAG$1 = 512;
-
-
- var wrapFlags = [
- ['ary', WRAP_ARY_FLAG$3],
- ['bind', WRAP_BIND_FLAG$5],
- ['bindKey', WRAP_BIND_KEY_FLAG$4],
- ['curry', WRAP_CURRY_FLAG$4],
- ['curryRight', WRAP_CURRY_RIGHT_FLAG$2],
- ['flip', WRAP_FLIP_FLAG$1],
- ['partial', WRAP_PARTIAL_FLAG$2],
- ['partialRight', WRAP_PARTIAL_RIGHT_FLAG$2],
- ['rearg', WRAP_REARG_FLAG$2]
- ];
-
-
- function updateWrapDetails(details, bitmask) {
- _arrayEach(wrapFlags, function(pair) {
- var value = '_.' + pair[0];
- if ((bitmask & pair[1]) && !_arrayIncludes(details, value)) {
- details.push(value);
- }
- });
- return details.sort();
- }
-
- var _updateWrapDetails = updateWrapDetails;
-
-
- function setWrapToString(wrapper, reference, bitmask) {
- var source = (reference + '');
- return _setToString(wrapper, _insertWrapDetails(source, _updateWrapDetails(_getWrapDetails(source), bitmask)));
- }
-
- var _setWrapToString = setWrapToString;
-
-
- var WRAP_BIND_FLAG$4 = 1,
- WRAP_BIND_KEY_FLAG$3 = 2,
- WRAP_CURRY_BOUND_FLAG$1 = 4,
- WRAP_CURRY_FLAG$3 = 8,
- WRAP_PARTIAL_FLAG$1 = 32,
- WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
-
-
- function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
- var isCurry = bitmask & WRAP_CURRY_FLAG$3,
- newHolders = isCurry ? holders : undefined,
- newHoldersRight = isCurry ? undefined : holders,
- newPartials = isCurry ? partials : undefined,
- newPartialsRight = isCurry ? undefined : partials;
-
- bitmask |= (isCurry ? WRAP_PARTIAL_FLAG$1 : WRAP_PARTIAL_RIGHT_FLAG$1);
- bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$1 : WRAP_PARTIAL_FLAG$1);
-
- if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
- bitmask &= ~(WRAP_BIND_FLAG$4 | WRAP_BIND_KEY_FLAG$3);
- }
- var newData = [
- func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
- newHoldersRight, argPos, ary, arity
- ];
-
- var result = wrapFunc.apply(undefined, newData);
- if (_isLaziable(func)) {
- _setData(result, newData);
- }
- result.placeholder = placeholder;
- return _setWrapToString(result, func, bitmask);
- }
-
- var _createRecurry = createRecurry;
-
-
- function getHolder(func) {
- var object = func;
- return object.placeholder;
- }
-
- var _getHolder = getHolder;
-
-
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
-
-
- var reIsUint = /^(?:0|[1-9]\d*)$/;
-
-
- function isIndex(value, length) {
- var type = typeof value;
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
-
- return !!length &&
- (type == 'number' ||
- (type != 'symbol' && reIsUint.test(value))) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
-
- var _isIndex = isIndex;
-
-
- var nativeMin$1 = Math.min;
-
-
- function reorder(array, indexes) {
- var arrLength = array.length,
- length = nativeMin$1(indexes.length, arrLength),
- oldArray = _copyArray(array);
-
- while (length--) {
- var index = indexes[length];
- array[length] = _isIndex(index, arrLength) ? oldArray[index] : undefined;
- }
- return array;
- }
-
- var _reorder = reorder;
-
-
- var PLACEHOLDER$1 = '__lodash_placeholder__';
-
-
- function replaceHolders(array, placeholder) {
- var index = -1,
- length = array.length,
- resIndex = 0,
- result = [];
-
- while (++index < length) {
- var value = array[index];
- if (value === placeholder || value === PLACEHOLDER$1) {
- array[index] = PLACEHOLDER$1;
- result[resIndex++] = index;
- }
- }
- return result;
- }
-
- var _replaceHolders = replaceHolders;
-
-
- var WRAP_BIND_FLAG$3 = 1,
- WRAP_BIND_KEY_FLAG$2 = 2,
- WRAP_CURRY_FLAG$2 = 8,
- WRAP_CURRY_RIGHT_FLAG$1 = 16,
- WRAP_ARY_FLAG$2 = 128,
- WRAP_FLIP_FLAG = 512;
-
-
- function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
- var isAry = bitmask & WRAP_ARY_FLAG$2,
- isBind = bitmask & WRAP_BIND_FLAG$3,
- isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2,
- isCurried = bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1),
- isFlip = bitmask & WRAP_FLIP_FLAG,
- Ctor = isBindKey ? undefined : _createCtor(func);
-
- function wrapper() {
- var length = arguments.length,
- args = Array(length),
- index = length;
-
- while (index--) {
- args[index] = arguments[index];
- }
- if (isCurried) {
- var placeholder = _getHolder(wrapper),
- holdersCount = _countHolders(args, placeholder);
- }
- if (partials) {
- args = _composeArgs(args, partials, holders, isCurried);
- }
- if (partialsRight) {
- args = _composeArgsRight(args, partialsRight, holdersRight, isCurried);
- }
- length -= holdersCount;
- if (isCurried && length < arity) {
- var newHolders = _replaceHolders(args, placeholder);
- return _createRecurry(
- func, bitmask, createHybrid, wrapper.placeholder, thisArg,
- args, newHolders, argPos, ary, arity - length
- );
- }
- var thisBinding = isBind ? thisArg : this,
- fn = isBindKey ? thisBinding[func] : func;
-
- length = args.length;
- if (argPos) {
- args = _reorder(args, argPos);
- } else if (isFlip && length > 1) {
- args.reverse();
- }
- if (isAry && ary < length) {
- args.length = ary;
- }
- if (this && this !== _root && this instanceof wrapper) {
- fn = Ctor || _createCtor(fn);
- }
- return fn.apply(thisBinding, args);
- }
- return wrapper;
- }
-
- var _createHybrid = createHybrid;
-
-
- function createCurry(func, bitmask, arity) {
- var Ctor = _createCtor(func);
-
- function wrapper() {
- var length = arguments.length,
- args = Array(length),
- index = length,
- placeholder = _getHolder(wrapper);
-
- while (index--) {
- args[index] = arguments[index];
- }
- var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
- ? []
- : _replaceHolders(args, placeholder);
-
- length -= holders.length;
- if (length < arity) {
- return _createRecurry(
- func, bitmask, _createHybrid, wrapper.placeholder, undefined,
- args, holders, undefined, undefined, arity - length);
- }
- var fn = (this && this !== _root && this instanceof wrapper) ? Ctor : func;
- return _apply(fn, this, args);
- }
- return wrapper;
- }
-
- var _createCurry = createCurry;
-
-
- var WRAP_BIND_FLAG$2 = 1;
-
-
- function createPartial(func, bitmask, thisArg, partials) {
- var isBind = bitmask & WRAP_BIND_FLAG$2,
- Ctor = _createCtor(func);
-
- function wrapper() {
- var argsIndex = -1,
- argsLength = arguments.length,
- leftIndex = -1,
- leftLength = partials.length,
- args = Array(leftLength + argsLength),
- fn = (this && this !== _root && this instanceof wrapper) ? Ctor : func;
-
- while (++leftIndex < leftLength) {
- args[leftIndex] = partials[leftIndex];
- }
- while (argsLength--) {
- args[leftIndex++] = arguments[++argsIndex];
- }
- return _apply(fn, isBind ? thisArg : this, args);
- }
- return wrapper;
- }
-
- var _createPartial = createPartial;
-
-
- var PLACEHOLDER = '__lodash_placeholder__';
-
-
- var WRAP_BIND_FLAG$1 = 1,
- WRAP_BIND_KEY_FLAG$1 = 2,
- WRAP_CURRY_BOUND_FLAG = 4,
- WRAP_CURRY_FLAG$1 = 8,
- WRAP_ARY_FLAG$1 = 128,
- WRAP_REARG_FLAG$1 = 256;
-
-
- var nativeMin = Math.min;
-
-
- function mergeData(data, source) {
- var bitmask = data[1],
- srcBitmask = source[1],
- newBitmask = bitmask | srcBitmask,
- isCommon = newBitmask < (WRAP_BIND_FLAG$1 | WRAP_BIND_KEY_FLAG$1 | WRAP_ARY_FLAG$1);
-
- var isCombo =
- ((srcBitmask == WRAP_ARY_FLAG$1) && (bitmask == WRAP_CURRY_FLAG$1)) ||
- ((srcBitmask == WRAP_ARY_FLAG$1) && (bitmask == WRAP_REARG_FLAG$1) && (data[7].length <= source[8])) ||
- ((srcBitmask == (WRAP_ARY_FLAG$1 | WRAP_REARG_FLAG$1)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG$1));
-
-
- if (!(isCommon || isCombo)) {
- return data;
- }
-
- if (srcBitmask & WRAP_BIND_FLAG$1) {
- data[2] = source[2];
-
- newBitmask |= bitmask & WRAP_BIND_FLAG$1 ? 0 : WRAP_CURRY_BOUND_FLAG;
- }
-
- var value = source[3];
- if (value) {
- var partials = data[3];
- data[3] = partials ? _composeArgs(partials, value, source[4]) : value;
- data[4] = partials ? _replaceHolders(data[3], PLACEHOLDER) : source[4];
- }
-
- value = source[5];
- if (value) {
- partials = data[5];
- data[5] = partials ? _composeArgsRight(partials, value, source[6]) : value;
- data[6] = partials ? _replaceHolders(data[5], PLACEHOLDER) : source[6];
- }
-
- value = source[7];
- if (value) {
- data[7] = value;
- }
-
- if (srcBitmask & WRAP_ARY_FLAG$1) {
- data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
- }
-
- if (data[9] == null) {
- data[9] = source[9];
- }
-
- data[0] = source[0];
- data[1] = newBitmask;
-
- return data;
- }
-
- var _mergeData = mergeData;
-
-
- var reWhitespace = /\s/;
-
-
- function trimmedEndIndex(string) {
- var index = string.length;
-
- while (index-- && reWhitespace.test(string.charAt(index))) {}
- return index;
- }
-
- var _trimmedEndIndex = trimmedEndIndex;
-
-
- var reTrimStart = /^\s+/;
-
-
- function baseTrim(string) {
- return string
- ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
- : string;
- }
-
- var _baseTrim = baseTrim;
-
-
- var symbolTag$3 = '[object Symbol]';
-
-
- function isSymbol(value) {
- return typeof value == 'symbol' ||
- (isObjectLike_1(value) && _baseGetTag(value) == symbolTag$3);
- }
-
- var isSymbol_1 = isSymbol;
-
-
- var NAN = 0 / 0;
-
-
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
-
-
- var reIsBinary = /^0b[01]+$/i;
-
-
- var reIsOctal = /^0o[0-7]+$/i;
-
-
- var freeParseInt = parseInt;
-
-
- function toNumber(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol_1(value)) {
- return NAN;
- }
- if (isObject_1(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject_1(other) ? (other + '') : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = _baseTrim(value);
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
- }
-
- var toNumber_1 = toNumber;
-
-
- var INFINITY$2 = 1 / 0,
- MAX_INTEGER = 1.7976931348623157e+308;
-
-
- function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber_1(value);
- if (value === INFINITY$2 || value === -INFINITY$2) {
- var sign = (value < 0 ? -1 : 1);
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
- }
-
- var toFinite_1 = toFinite;
-
-
- function toInteger(value) {
- var result = toFinite_1(value),
- remainder = result % 1;
-
- return result === result ? (remainder ? result - remainder : result) : 0;
- }
-
- var toInteger_1 = toInteger;
-
-
- var FUNC_ERROR_TEXT$1 = 'Expected a function';
-
-
- var WRAP_BIND_FLAG = 1,
- WRAP_BIND_KEY_FLAG = 2,
- WRAP_CURRY_FLAG = 8,
- WRAP_CURRY_RIGHT_FLAG = 16,
- WRAP_PARTIAL_FLAG = 32,
- WRAP_PARTIAL_RIGHT_FLAG = 64;
-
-
- var nativeMax$1 = Math.max;
-
-
- function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
- var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
- if (!isBindKey && typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- var length = partials ? partials.length : 0;
- if (!length) {
- bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
- partials = holders = undefined;
- }
- ary = ary === undefined ? ary : nativeMax$1(toInteger_1(ary), 0);
- arity = arity === undefined ? arity : toInteger_1(arity);
- length -= holders ? holders.length : 0;
-
- if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
- var partialsRight = partials,
- holdersRight = holders;
-
- partials = holders = undefined;
- }
- var data = isBindKey ? undefined : _getData(func);
-
- var newData = [
- func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
- argPos, ary, arity
- ];
-
- if (data) {
- _mergeData(newData, data);
- }
- func = newData[0];
- bitmask = newData[1];
- thisArg = newData[2];
- partials = newData[3];
- holders = newData[4];
- arity = newData[9] = newData[9] === undefined
- ? (isBindKey ? 0 : func.length)
- : nativeMax$1(newData[9] - length, 0);
-
- if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
- bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
- }
- if (!bitmask || bitmask == WRAP_BIND_FLAG) {
- var result = _createBind(func, bitmask, thisArg);
- } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
- result = _createCurry(func, bitmask, arity);
- } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
- result = _createPartial(func, bitmask, thisArg, partials);
- } else {
- result = _createHybrid.apply(undefined, newData);
- }
- var setter = data ? _baseSetData : _setData;
- return _setWrapToString(setter(result, newData), func, bitmask);
- }
-
- var _createWrap = createWrap;
-
- commonjsRegister("/$$rollup_base$$/node_modules/lodash/curry.js", function (module, exports) {
- var createWrap = _createWrap;
-
-
- var WRAP_CURRY_FLAG = 8;
-
-
- function curry(func, arity, guard) {
- arity = guard ? undefined : arity;
- var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
- result.placeholder = curry.placeholder;
- return result;
- }
-
-
- curry.placeholder = {};
-
- module.exports = curry;
-
- });
-
- commonjsRegister("/$$rollup_base$$/node_modules/lodash/curryRight.js", function (module, exports) {
- var createWrap = _createWrap;
-
-
- var WRAP_CURRY_RIGHT_FLAG = 16;
-
-
- function curryRight(func, arity, guard) {
- arity = guard ? undefined : arity;
- var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
- result.placeholder = curryRight.placeholder;
- return result;
- }
-
-
- curryRight.placeholder = {};
-
- module.exports = curryRight;
-
- });
-
-
-
- var _mapping = createCommonjsModule(function (module, exports) {
- exports.aliasToReal = {
-
-
- 'each': 'forEach',
- 'eachRight': 'forEachRight',
- 'entries': 'toPairs',
- 'entriesIn': 'toPairsIn',
- 'extend': 'assignIn',
- 'extendAll': 'assignInAll',
- 'extendAllWith': 'assignInAllWith',
- 'extendWith': 'assignInWith',
- 'first': 'head',
-
-
- 'conforms': 'conformsTo',
- 'matches': 'isMatch',
- 'property': 'get',
-
-
- '__': 'placeholder',
- 'F': 'stubFalse',
- 'T': 'stubTrue',
- 'all': 'every',
- 'allPass': 'overEvery',
- 'always': 'constant',
- 'any': 'some',
- 'anyPass': 'overSome',
- 'apply': 'spread',
- 'assoc': 'set',
- 'assocPath': 'set',
- 'complement': 'negate',
- 'compose': 'flowRight',
- 'contains': 'includes',
- 'dissoc': 'unset',
- 'dissocPath': 'unset',
- 'dropLast': 'dropRight',
- 'dropLastWhile': 'dropRightWhile',
- 'equals': 'isEqual',
- 'identical': 'eq',
- 'indexBy': 'keyBy',
- 'init': 'initial',
- 'invertObj': 'invert',
- 'juxt': 'over',
- 'omitAll': 'omit',
- 'nAry': 'ary',
- 'path': 'get',
- 'pathEq': 'matchesProperty',
- 'pathOr': 'getOr',
- 'paths': 'at',
- 'pickAll': 'pick',
- 'pipe': 'flow',
- 'pluck': 'map',
- 'prop': 'get',
- 'propEq': 'matchesProperty',
- 'propOr': 'getOr',
- 'props': 'at',
- 'symmetricDifference': 'xor',
- 'symmetricDifferenceBy': 'xorBy',
- 'symmetricDifferenceWith': 'xorWith',
- 'takeLast': 'takeRight',
- 'takeLastWhile': 'takeRightWhile',
- 'unapply': 'rest',
- 'unnest': 'flatten',
- 'useWith': 'overArgs',
- 'where': 'conformsTo',
- 'whereEq': 'isMatch',
- 'zipObj': 'zipObject'
- };
-
-
- exports.aryMethod = {
- '1': [
- 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
- 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
- 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
- 'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
- 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
- 'uniqueId', 'words', 'zipAll'
- ],
- '2': [
- 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
- 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
- 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
- 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
- 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
- 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
- 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
- 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
- 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
- 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
- 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
- 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
- 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
- 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
- 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
- 'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
- 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
- 'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight',
- 'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars',
- 'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith',
- 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
- 'zipObjectDeep'
- ],
- '3': [
- 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
- 'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr',
- 'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith',
- 'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth',
- 'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd',
- 'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight',
- 'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy',
- 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy',
- 'xorWith', 'zipWith'
- ],
- '4': [
- 'fill', 'setWith', 'updateWith'
- ]
- };
-
-
- exports.aryRearg = {
- '2': [1, 0],
- '3': [2, 0, 1],
- '4': [3, 2, 0, 1]
- };
-
-
- exports.iterateeAry = {
- 'dropRightWhile': 1,
- 'dropWhile': 1,
- 'every': 1,
- 'filter': 1,
- 'find': 1,
- 'findFrom': 1,
- 'findIndex': 1,
- 'findIndexFrom': 1,
- 'findKey': 1,
- 'findLast': 1,
- 'findLastFrom': 1,
- 'findLastIndex': 1,
- 'findLastIndexFrom': 1,
- 'findLastKey': 1,
- 'flatMap': 1,
- 'flatMapDeep': 1,
- 'flatMapDepth': 1,
- 'forEach': 1,
- 'forEachRight': 1,
- 'forIn': 1,
- 'forInRight': 1,
- 'forOwn': 1,
- 'forOwnRight': 1,
- 'map': 1,
- 'mapKeys': 1,
- 'mapValues': 1,
- 'partition': 1,
- 'reduce': 2,
- 'reduceRight': 2,
- 'reject': 1,
- 'remove': 1,
- 'some': 1,
- 'takeRightWhile': 1,
- 'takeWhile': 1,
- 'times': 1,
- 'transform': 2
- };
-
-
- exports.iterateeRearg = {
- 'mapKeys': [1],
- 'reduceRight': [1, 0]
- };
-
-
- exports.methodRearg = {
- 'assignInAllWith': [1, 0],
- 'assignInWith': [1, 2, 0],
- 'assignAllWith': [1, 0],
- 'assignWith': [1, 2, 0],
- 'differenceBy': [1, 2, 0],
- 'differenceWith': [1, 2, 0],
- 'getOr': [2, 1, 0],
- 'intersectionBy': [1, 2, 0],
- 'intersectionWith': [1, 2, 0],
- 'isEqualWith': [1, 2, 0],
- 'isMatchWith': [2, 1, 0],
- 'mergeAllWith': [1, 0],
- 'mergeWith': [1, 2, 0],
- 'padChars': [2, 1, 0],
- 'padCharsEnd': [2, 1, 0],
- 'padCharsStart': [2, 1, 0],
- 'pullAllBy': [2, 1, 0],
- 'pullAllWith': [2, 1, 0],
- 'rangeStep': [1, 2, 0],
- 'rangeStepRight': [1, 2, 0],
- 'setWith': [3, 1, 2, 0],
- 'sortedIndexBy': [2, 1, 0],
- 'sortedLastIndexBy': [2, 1, 0],
- 'unionBy': [1, 2, 0],
- 'unionWith': [1, 2, 0],
- 'updateWith': [3, 1, 2, 0],
- 'xorBy': [1, 2, 0],
- 'xorWith': [1, 2, 0],
- 'zipWith': [1, 2, 0]
- };
-
-
- exports.methodSpread = {
- 'assignAll': { 'start': 0 },
- 'assignAllWith': { 'start': 0 },
- 'assignInAll': { 'start': 0 },
- 'assignInAllWith': { 'start': 0 },
- 'defaultsAll': { 'start': 0 },
- 'defaultsDeepAll': { 'start': 0 },
- 'invokeArgs': { 'start': 2 },
- 'invokeArgsMap': { 'start': 2 },
- 'mergeAll': { 'start': 0 },
- 'mergeAllWith': { 'start': 0 },
- 'partial': { 'start': 1 },
- 'partialRight': { 'start': 1 },
- 'without': { 'start': 1 },
- 'zipAll': { 'start': 0 }
- };
-
-
- exports.mutate = {
- 'array': {
- 'fill': true,
- 'pull': true,
- 'pullAll': true,
- 'pullAllBy': true,
- 'pullAllWith': true,
- 'pullAt': true,
- 'remove': true,
- 'reverse': true
- },
- 'object': {
- 'assign': true,
- 'assignAll': true,
- 'assignAllWith': true,
- 'assignIn': true,
- 'assignInAll': true,
- 'assignInAllWith': true,
- 'assignInWith': true,
- 'assignWith': true,
- 'defaults': true,
- 'defaultsAll': true,
- 'defaultsDeep': true,
- 'defaultsDeepAll': true,
- 'merge': true,
- 'mergeAll': true,
- 'mergeAllWith': true,
- 'mergeWith': true,
- },
- 'set': {
- 'set': true,
- 'setWith': true,
- 'unset': true,
- 'update': true,
- 'updateWith': true
- }
- };
-
-
- exports.realToAlias = (function() {
- var hasOwnProperty = Object.prototype.hasOwnProperty,
- object = exports.aliasToReal,
- result = {};
-
- for (var key in object) {
- var value = object[key];
- if (hasOwnProperty.call(result, value)) {
- result[value].push(key);
- } else {
- result[value] = [key];
- }
- }
- return result;
- }());
-
-
- exports.remap = {
- 'assignAll': 'assign',
- 'assignAllWith': 'assignWith',
- 'assignInAll': 'assignIn',
- 'assignInAllWith': 'assignInWith',
- 'curryN': 'curry',
- 'curryRightN': 'curryRight',
- 'defaultsAll': 'defaults',
- 'defaultsDeepAll': 'defaultsDeep',
- 'findFrom': 'find',
- 'findIndexFrom': 'findIndex',
- 'findLastFrom': 'findLast',
- 'findLastIndexFrom': 'findLastIndex',
- 'getOr': 'get',
- 'includesFrom': 'includes',
- 'indexOfFrom': 'indexOf',
- 'invokeArgs': 'invoke',
- 'invokeArgsMap': 'invokeMap',
- 'lastIndexOfFrom': 'lastIndexOf',
- 'mergeAll': 'merge',
- 'mergeAllWith': 'mergeWith',
- 'padChars': 'pad',
- 'padCharsEnd': 'padEnd',
- 'padCharsStart': 'padStart',
- 'propertyOf': 'get',
- 'rangeStep': 'range',
- 'rangeStepRight': 'rangeRight',
- 'restFrom': 'rest',
- 'spreadFrom': 'spread',
- 'trimChars': 'trim',
- 'trimCharsEnd': 'trimEnd',
- 'trimCharsStart': 'trimStart',
- 'zipAll': 'zip'
- };
-
-
- exports.skipFixed = {
- 'castArray': true,
- 'flow': true,
- 'flowRight': true,
- 'iteratee': true,
- 'mixin': true,
- 'rearg': true,
- 'runInContext': true
- };
-
-
- exports.skipRearg = {
- 'add': true,
- 'assign': true,
- 'assignIn': true,
- 'bind': true,
- 'bindKey': true,
- 'concat': true,
- 'difference': true,
- 'divide': true,
- 'eq': true,
- 'gt': true,
- 'gte': true,
- 'isEqual': true,
- 'lt': true,
- 'lte': true,
- 'matchesProperty': true,
- 'merge': true,
- 'multiply': true,
- 'overArgs': true,
- 'partial': true,
- 'partialRight': true,
- 'propertyOf': true,
- 'random': true,
- 'range': true,
- 'rangeRight': true,
- 'subtract': true,
- 'zip': true,
- 'zipObject': true,
- 'zipObjectDeep': true
- };
- }, "/$$rollup_base$$/node_modules/lodash/fp");
-
-
- var placeholder = {};
-
-
- var push = Array.prototype.push;
-
-
- function baseArity(func, n) {
- return n == 2
- ? function(a, b) { return func.apply(undefined, arguments); }
- : function(a) { return func.apply(undefined, arguments); };
- }
-
-
- function baseAry(func, n) {
- return n == 2
- ? function(a, b) { return func(a, b); }
- : function(a) { return func(a); };
- }
-
-
- function cloneArray(array) {
- var length = array ? array.length : 0,
- result = Array(length);
-
- while (length--) {
- result[length] = array[length];
- }
- return result;
- }
-
-
- function createCloner(func) {
- return function(object) {
- return func({}, object);
- };
- }
-
-
- function flatSpread(func, start) {
- return function() {
- var length = arguments.length,
- lastIndex = length - 1,
- args = Array(length);
-
- while (length--) {
- args[length] = arguments[length];
- }
- var array = args[start],
- otherArgs = args.slice(0, start);
-
- if (array) {
- push.apply(otherArgs, array);
- }
- if (start != lastIndex) {
- push.apply(otherArgs, args.slice(start + 1));
- }
- return func.apply(this, otherArgs);
- };
- }
-
-
- function wrapImmutable(func, cloner) {
- return function() {
- var length = arguments.length;
- if (!length) {
- return;
- }
- var args = Array(length);
- while (length--) {
- args[length] = arguments[length];
- }
- var result = args[0] = cloner.apply(undefined, args);
- func.apply(undefined, args);
- return result;
- };
- }
-
-
- function baseConvert(util, name, func, options) {
- var isLib = typeof name == 'function',
- isObj = name === Object(name);
-
- if (isObj) {
- options = func;
- func = name;
- name = undefined;
- }
- if (func == null) {
- throw new TypeError;
- }
- options || (options = {});
-
- var config = {
- 'cap': 'cap' in options ? options.cap : true,
- 'curry': 'curry' in options ? options.curry : true,
- 'fixed': 'fixed' in options ? options.fixed : true,
- 'immutable': 'immutable' in options ? options.immutable : true,
- 'rearg': 'rearg' in options ? options.rearg : true
- };
-
- var defaultHolder = isLib ? func : placeholder,
- forceCurry = ('curry' in options) && options.curry,
- forceFixed = ('fixed' in options) && options.fixed,
- forceRearg = ('rearg' in options) && options.rearg,
- pristine = isLib ? func.runInContext() : undefined;
-
- var helpers = isLib ? func : {
- 'ary': util.ary,
- 'assign': util.assign,
- 'clone': util.clone,
- 'curry': util.curry,
- 'forEach': util.forEach,
- 'isArray': util.isArray,
- 'isError': util.isError,
- 'isFunction': util.isFunction,
- 'isWeakMap': util.isWeakMap,
- 'iteratee': util.iteratee,
- 'keys': util.keys,
- 'rearg': util.rearg,
- 'toInteger': util.toInteger,
- 'toPath': util.toPath
- };
-
- var ary = helpers.ary,
- assign = helpers.assign,
- clone = helpers.clone,
- curry = helpers.curry,
- each = helpers.forEach,
- isArray = helpers.isArray,
- isError = helpers.isError,
- isFunction = helpers.isFunction,
- isWeakMap = helpers.isWeakMap,
- keys = helpers.keys,
- rearg = helpers.rearg,
- toInteger = helpers.toInteger,
- toPath = helpers.toPath;
-
- var aryMethodKeys = keys(_mapping.aryMethod);
-
- var wrappers = {
- 'castArray': function(castArray) {
- return function() {
- var value = arguments[0];
- return isArray(value)
- ? castArray(cloneArray(value))
- : castArray.apply(undefined, arguments);
- };
- },
- 'iteratee': function(iteratee) {
- return function() {
- var func = arguments[0],
- arity = arguments[1],
- result = iteratee(func, arity),
- length = result.length;
-
- if (config.cap && typeof arity == 'number') {
- arity = arity > 2 ? (arity - 2) : 1;
- return (length && length <= arity) ? result : baseAry(result, arity);
- }
- return result;
- };
- },
- 'mixin': function(mixin) {
- return function(source) {
- var func = this;
- if (!isFunction(func)) {
- return mixin(func, Object(source));
- }
- var pairs = [];
- each(keys(source), function(key) {
- if (isFunction(source[key])) {
- pairs.push([key, func.prototype[key]]);
- }
- });
-
- mixin(func, Object(source));
-
- each(pairs, function(pair) {
- var value = pair[1];
- if (isFunction(value)) {
- func.prototype[pair[0]] = value;
- } else {
- delete func.prototype[pair[0]];
- }
- });
- return func;
- };
- },
- 'nthArg': function(nthArg) {
- return function(n) {
- var arity = n < 0 ? 1 : (toInteger(n) + 1);
- return curry(nthArg(n), arity);
- };
- },
- 'rearg': function(rearg) {
- return function(func, indexes) {
- var arity = indexes ? indexes.length : 0;
- return curry(rearg(func, indexes), arity);
- };
- },
- 'runInContext': function(runInContext) {
- return function(context) {
- return baseConvert(util, runInContext(context), options);
- };
- }
- };
-
-
-
-
-
- function castCap(name, func) {
- if (config.cap) {
- var indexes = _mapping.iterateeRearg[name];
- if (indexes) {
- return iterateeRearg(func, indexes);
- }
- var n = !isLib && _mapping.iterateeAry[name];
- if (n) {
- return iterateeAry(func, n);
- }
- }
- return func;
- }
-
-
-
- function castCurry(name, func, n) {
- return (forceCurry || (config.curry && n > 1))
- ? curry(func, n)
- : func;
- }
-
-
-
- function castFixed(name, func, n) {
- if (config.fixed && (forceFixed || !_mapping.skipFixed[name])) {
- var data = _mapping.methodSpread[name],
- start = data && data.start;
-
- return start === undefined ? ary(func, n) : flatSpread(func, start);
- }
- return func;
- }
-
-
-
- function castRearg(name, func, n) {
- return (config.rearg && n > 1 && (forceRearg || !_mapping.skipRearg[name]))
- ? rearg(func, _mapping.methodRearg[name] || _mapping.aryRearg[n])
- : func;
- }
-
-
-
- function cloneByPath(object, path) {
- path = toPath(path);
-
- var index = -1,
- length = path.length,
- lastIndex = length - 1,
- result = clone(Object(object)),
- nested = result;
-
- while (nested != null && ++index < length) {
- var key = path[index],
- value = nested[key];
-
- if (value != null &&
- !(isFunction(value) || isError(value) || isWeakMap(value))) {
- nested[key] = clone(index == lastIndex ? value : Object(value));
- }
- nested = nested[key];
- }
- return result;
- }
-
-
-
- function convertLib(options) {
- return _.runInContext.convert(options)(undefined);
- }
-
-
-
- function createConverter(name, func) {
- var realName = _mapping.aliasToReal[name] || name,
- methodName = _mapping.remap[realName] || realName,
- oldOptions = options;
-
- return function(options) {
- var newUtil = isLib ? pristine : helpers,
- newFunc = isLib ? pristine[methodName] : func,
- newOptions = assign(assign({}, oldOptions), options);
-
- return baseConvert(newUtil, realName, newFunc, newOptions);
- };
- }
-
-
-
- function iterateeAry(func, n) {
- return overArg(func, function(func) {
- return typeof func == 'function' ? baseAry(func, n) : func;
- });
- }
-
-
-
- function iterateeRearg(func, indexes) {
- return overArg(func, function(func) {
- var n = indexes.length;
- return baseArity(rearg(baseAry(func, n), indexes), n);
- });
- }
-
-
-
- function overArg(func, transform) {
- return function() {
- var length = arguments.length;
- if (!length) {
- return func();
- }
- var args = Array(length);
- while (length--) {
- args[length] = arguments[length];
- }
- var index = config.rearg ? 0 : (length - 1);
- args[index] = transform(args[index]);
- return func.apply(undefined, args);
- };
- }
-
-
-
- function wrap(name, func, placeholder) {
- var result,
- realName = _mapping.aliasToReal[name] || name,
- wrapped = func,
- wrapper = wrappers[realName];
-
- if (wrapper) {
- wrapped = wrapper(func);
- }
- else if (config.immutable) {
- if (_mapping.mutate.array[realName]) {
- wrapped = wrapImmutable(func, cloneArray);
- }
- else if (_mapping.mutate.object[realName]) {
- wrapped = wrapImmutable(func, createCloner(func));
- }
- else if (_mapping.mutate.set[realName]) {
- wrapped = wrapImmutable(func, cloneByPath);
- }
- }
- each(aryMethodKeys, function(aryKey) {
- each(_mapping.aryMethod[aryKey], function(otherName) {
- if (realName == otherName) {
- var data = _mapping.methodSpread[realName],
- afterRearg = data && data.afterRearg;
-
- result = afterRearg
- ? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)
- : castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey);
-
- result = castCap(realName, result);
- result = castCurry(realName, result, aryKey);
- return false;
- }
- });
- return !result;
- });
-
- result || (result = wrapped);
- if (result == func) {
- result = forceCurry ? curry(result, 1) : function() {
- return func.apply(this, arguments);
- };
- }
- result.convert = createConverter(realName, func);
- result.placeholder = func.placeholder = placeholder;
-
- return result;
- }
-
-
-
- if (!isObj) {
- return wrap(name, func, defaultHolder);
- }
- var _ = func;
-
-
- var pairs = [];
- each(aryMethodKeys, function(aryKey) {
- each(_mapping.aryMethod[aryKey], function(key) {
- var func = _[_mapping.remap[key] || key];
- if (func) {
- pairs.push([key, wrap(key, func, _)]);
- }
- });
- });
-
-
- each(keys(_), function(key) {
- var func = _[key];
- if (typeof func == 'function') {
- var length = pairs.length;
- while (length--) {
- if (pairs[length][0] == key) {
- return;
- }
- }
- func.convert = createConverter(key, func);
- pairs.push([key, func]);
- }
- });
-
-
- each(pairs, function(pair) {
- _[pair[0]] = pair[1];
- });
-
- _.convert = convertLib;
- _.placeholder = _;
-
-
- each(keys(_), function(key) {
- each(_mapping.realToAlias[key] || [], function(alias) {
- _[alias] = _[key];
- });
- });
-
- return _;
- }
-
- var _baseConvert = baseConvert;
-
-
- var WRAP_ARY_FLAG = 128;
-
-
- function ary(func, n, guard) {
- n = guard ? undefined : n;
- n = (func && n == null) ? func.length : n;
- return _createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
- }
-
- var ary_1 = ary;
-
-
- function baseAssignValue(object, key, value) {
- if (key == '__proto__' && _defineProperty) {
- _defineProperty(object, key, {
- 'configurable': true,
- 'enumerable': true,
- 'value': value,
- 'writable': true
- });
- } else {
- object[key] = value;
- }
- }
-
- var _baseAssignValue = baseAssignValue;
-
-
- function eq(value, other) {
- return value === other || (value !== value && other !== other);
- }
-
- var eq_1 = eq;
-
-
- var objectProto$c = Object.prototype;
-
-
- var hasOwnProperty$a = objectProto$c.hasOwnProperty;
-
-
- function assignValue(object, key, value) {
- var objValue = object[key];
- if (!(hasOwnProperty$a.call(object, key) && eq_1(objValue, value)) ||
- (value === undefined && !(key in object))) {
- _baseAssignValue(object, key, value);
- }
- }
-
- var _assignValue = assignValue;
-
-
- function copyObject(source, props, object, customizer) {
- var isNew = !object;
- object || (object = {});
-
- var index = -1,
- length = props.length;
-
- while (++index < length) {
- var key = props[index];
-
- var newValue = customizer
- ? customizer(object[key], source[key], key, object, source)
- : undefined;
-
- if (newValue === undefined) {
- newValue = source[key];
- }
- if (isNew) {
- _baseAssignValue(object, key, newValue);
- } else {
- _assignValue(object, key, newValue);
- }
- }
- return object;
- }
-
- var _copyObject = copyObject;
-
-
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
-
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
-
- var _baseTimes = baseTimes;
-
-
- var argsTag$3 = '[object Arguments]';
-
-
- function baseIsArguments(value) {
- return isObjectLike_1(value) && _baseGetTag(value) == argsTag$3;
- }
-
- var _baseIsArguments = baseIsArguments;
-
-
- var objectProto$b = Object.prototype;
-
-
- var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
-
-
- var propertyIsEnumerable$1 = objectProto$b.propertyIsEnumerable;
-
-
- var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
- return isObjectLike_1(value) && hasOwnProperty$9.call(value, 'callee') &&
- !propertyIsEnumerable$1.call(value, 'callee');
- };
-
- var isArguments_1 = isArguments;
-
-
- function stubFalse() {
- return false;
- }
-
- var stubFalse_1 = stubFalse;
-
- var isBuffer_1 = createCommonjsModule(function (module, exports) {
-
- var freeExports = exports && !exports.nodeType && exports;
-
-
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
-
-
- var moduleExports = freeModule && freeModule.exports === freeExports;
-
-
- var Buffer = moduleExports ? _root.Buffer : undefined;
-
-
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
-
-
- var isBuffer = nativeIsBuffer || stubFalse_1;
-
- module.exports = isBuffer;
- }, "/$$rollup_base$$/node_modules/lodash");
-
-
- var MAX_SAFE_INTEGER = 9007199254740991;
-
-
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
-
- var isLength_1 = isLength;
-
-
- var argsTag$2 = '[object Arguments]',
- arrayTag$2 = '[object Array]',
- boolTag$3 = '[object Boolean]',
- dateTag$3 = '[object Date]',
- errorTag$3 = '[object Error]',
- funcTag$1 = '[object Function]',
- mapTag$5 = '[object Map]',
- numberTag$3 = '[object Number]',
- objectTag$4 = '[object Object]',
- regexpTag$3 = '[object RegExp]',
- setTag$5 = '[object Set]',
- stringTag$3 = '[object String]',
- weakMapTag$3 = '[object WeakMap]';
-
- var arrayBufferTag$3 = '[object ArrayBuffer]',
- dataViewTag$4 = '[object DataView]',
- float32Tag$2 = '[object Float32Array]',
- float64Tag$2 = '[object Float64Array]',
- int8Tag$2 = '[object Int8Array]',
- int16Tag$2 = '[object Int16Array]',
- int32Tag$2 = '[object Int32Array]',
- uint8Tag$2 = '[object Uint8Array]',
- uint8ClampedTag$2 = '[object Uint8ClampedArray]',
- uint16Tag$2 = '[object Uint16Array]',
- uint32Tag$2 = '[object Uint32Array]';
-
-
- var typedArrayTags = {};
- typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
- typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
- typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
- typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
- typedArrayTags[uint32Tag$2] = true;
- typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] =
- typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] =
- typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] =
- typedArrayTags[errorTag$3] = typedArrayTags[funcTag$1] =
- typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] =
- typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] =
- typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] =
- typedArrayTags[weakMapTag$3] = false;
-
-
- function baseIsTypedArray(value) {
- return isObjectLike_1(value) &&
- isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
- }
-
- var _baseIsTypedArray = baseIsTypedArray;
-
-
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
-
- var _baseUnary = baseUnary;
-
- var _nodeUtil = createCommonjsModule(function (module, exports) {
-
- var freeExports = exports && !exports.nodeType && exports;
-
-
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
-
-
- var moduleExports = freeModule && freeModule.exports === freeExports;
-
-
- var freeProcess = moduleExports && _freeGlobal.process;
-
-
- var nodeUtil = (function() {
- try {
-
- var types = freeModule && freeModule.require && freeModule.require('util').types;
-
- if (types) {
- return types;
- }
-
-
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
- } catch (e) {}
- }());
-
- module.exports = nodeUtil;
- }, "/$$rollup_base$$/node_modules/lodash");
-
-
- var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
-
-
- var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
-
- var isTypedArray_1 = isTypedArray;
-
-
- var objectProto$a = Object.prototype;
-
-
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
-
-
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray_1(value),
- isArg = !isArr && isArguments_1(value),
- isBuff = !isArr && !isArg && isBuffer_1(value),
- isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
- skipIndexes = isArr || isArg || isBuff || isType,
- result = skipIndexes ? _baseTimes(value.length, String) : [],
- length = result.length;
-
- for (var key in value) {
- if ((inherited || hasOwnProperty$8.call(value, key)) &&
- !(skipIndexes && (
-
- key == 'length' ||
-
- (isBuff && (key == 'offset' || key == 'parent')) ||
-
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
-
- _isIndex(key, length)
- ))) {
- result.push(key);
- }
- }
- return result;
- }
-
- var _arrayLikeKeys = arrayLikeKeys;
-
-
- var objectProto$9 = Object.prototype;
-
-
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$9;
-
- return value === proto;
- }
-
- var _isPrototype = isPrototype;
-
-
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
-
- var _overArg = overArg;
-
-
- var nativeKeys = _overArg(Object.keys, Object);
-
- var _nativeKeys = nativeKeys;
-
-
- var objectProto$8 = Object.prototype;
-
-
- var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
-
-
- function baseKeys(object) {
- if (!_isPrototype(object)) {
- return _nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty$7.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
-
- var _baseKeys = baseKeys;
-
-
- function isArrayLike(value) {
- return value != null && isLength_1(value.length) && !isFunction_1(value);
- }
-
- var isArrayLike_1 = isArrayLike;
-
-
- function keys(object) {
- return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
- }
-
- var keys_1 = keys;
-
-
- function baseAssign(object, source) {
- return object && _copyObject(source, keys_1(source), object);
- }
-
- var _baseAssign = baseAssign;
-
-
- function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
- }
-
- var _listCacheClear = listCacheClear;
-
-
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq_1(array[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
-
- var _assocIndexOf = assocIndexOf;
-
-
- var arrayProto = Array.prototype;
-
-
- var splice = arrayProto.splice;
-
-
- function listCacheDelete(key) {
- var data = this.__data__,
- index = _assocIndexOf(data, key);
-
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- --this.size;
- return true;
- }
-
- var _listCacheDelete = listCacheDelete;
-
-
- function listCacheGet(key) {
- var data = this.__data__,
- index = _assocIndexOf(data, key);
-
- return index < 0 ? undefined : data[index][1];
- }
-
- var _listCacheGet = listCacheGet;
-
-
- function listCacheHas(key) {
- return _assocIndexOf(this.__data__, key) > -1;
- }
-
- var _listCacheHas = listCacheHas;
-
-
- function listCacheSet(key, value) {
- var data = this.__data__,
- index = _assocIndexOf(data, key);
-
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
- }
- return this;
- }
-
- var _listCacheSet = listCacheSet;
-
-
- function ListCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
-
-
- ListCache.prototype.clear = _listCacheClear;
- ListCache.prototype['delete'] = _listCacheDelete;
- ListCache.prototype.get = _listCacheGet;
- ListCache.prototype.has = _listCacheHas;
- ListCache.prototype.set = _listCacheSet;
-
- var _ListCache = ListCache;
-
-
- function stackClear() {
- this.__data__ = new _ListCache;
- this.size = 0;
- }
-
- var _stackClear = stackClear;
-
-
- function stackDelete(key) {
- var data = this.__data__,
- result = data['delete'](key);
-
- this.size = data.size;
- return result;
- }
-
- var _stackDelete = stackDelete;
-
-
- function stackGet(key) {
- return this.__data__.get(key);
- }
-
- var _stackGet = stackGet;
-
-
- function stackHas(key) {
- return this.__data__.has(key);
- }
-
- var _stackHas = stackHas;
-
-
- var Map$1 = _getNative(_root, 'Map');
-
- var _Map = Map$1;
-
-
- var nativeCreate = _getNative(Object, 'create');
-
- var _nativeCreate = nativeCreate;
-
-
- function hashClear() {
- this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
- this.size = 0;
- }
-
- var _hashClear = hashClear;
-
-
- function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
- }
-
- var _hashDelete = hashDelete;
-
-
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
-
-
- var objectProto$7 = Object.prototype;
-
-
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
-
-
- function hashGet(key) {
- var data = this.__data__;
- if (_nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED$2 ? undefined : result;
- }
- return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
- }
-
- var _hashGet = hashGet;
-
-
- var objectProto$6 = Object.prototype;
-
-
- var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
-
-
- function hashHas(key) {
- var data = this.__data__;
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
- }
-
- var _hashHas = hashHas;
-
-
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
-
-
- function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
- return this;
- }
-
- var _hashSet = hashSet;
-
-
- function Hash(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
-
-
- Hash.prototype.clear = _hashClear;
- Hash.prototype['delete'] = _hashDelete;
- Hash.prototype.get = _hashGet;
- Hash.prototype.has = _hashHas;
- Hash.prototype.set = _hashSet;
-
- var _Hash = Hash;
-
-
- function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- 'hash': new _Hash,
- 'map': new (_Map || _ListCache),
- 'string': new _Hash
- };
- }
-
- var _mapCacheClear = mapCacheClear;
-
-
- function isKeyable(value) {
- var type = typeof value;
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
- ? (value !== '__proto__')
- : (value === null);
- }
-
- var _isKeyable = isKeyable;
-
-
- function getMapData(map, key) {
- var data = map.__data__;
- return _isKeyable(key)
- ? data[typeof key == 'string' ? 'string' : 'hash']
- : data.map;
- }
-
- var _getMapData = getMapData;
-
-
- function mapCacheDelete(key) {
- var result = _getMapData(this, key)['delete'](key);
- this.size -= result ? 1 : 0;
- return result;
- }
-
- var _mapCacheDelete = mapCacheDelete;
-
-
- function mapCacheGet(key) {
- return _getMapData(this, key).get(key);
- }
-
- var _mapCacheGet = mapCacheGet;
-
-
- function mapCacheHas(key) {
- return _getMapData(this, key).has(key);
- }
-
- var _mapCacheHas = mapCacheHas;
-
-
- function mapCacheSet(key, value) {
- var data = _getMapData(this, key),
- size = data.size;
-
- data.set(key, value);
- this.size += data.size == size ? 0 : 1;
- return this;
- }
-
- var _mapCacheSet = mapCacheSet;
-
-
- function MapCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
-
-
- MapCache.prototype.clear = _mapCacheClear;
- MapCache.prototype['delete'] = _mapCacheDelete;
- MapCache.prototype.get = _mapCacheGet;
- MapCache.prototype.has = _mapCacheHas;
- MapCache.prototype.set = _mapCacheSet;
-
- var _MapCache = MapCache;
-
-
- var LARGE_ARRAY_SIZE = 200;
-
-
- function stackSet(key, value) {
- var data = this.__data__;
- if (data instanceof _ListCache) {
- var pairs = data.__data__;
- if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
- pairs.push([key, value]);
- this.size = ++data.size;
- return this;
- }
- data = this.__data__ = new _MapCache(pairs);
- }
- data.set(key, value);
- this.size = data.size;
- return this;
- }
-
- var _stackSet = stackSet;
-
-
- function Stack(entries) {
- var data = this.__data__ = new _ListCache(entries);
- this.size = data.size;
- }
-
-
- Stack.prototype.clear = _stackClear;
- Stack.prototype['delete'] = _stackDelete;
- Stack.prototype.get = _stackGet;
- Stack.prototype.has = _stackHas;
- Stack.prototype.set = _stackSet;
-
- var _Stack = Stack;
-
-
- function nativeKeysIn(object) {
- var result = [];
- if (object != null) {
- for (var key in Object(object)) {
- result.push(key);
- }
- }
- return result;
- }
-
- var _nativeKeysIn = nativeKeysIn;
-
-
- var objectProto$5 = Object.prototype;
-
-
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
-
-
- function baseKeysIn(object) {
- if (!isObject_1(object)) {
- return _nativeKeysIn(object);
- }
- var isProto = _isPrototype(object),
- result = [];
-
- for (var key in object) {
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$4.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
- }
-
- var _baseKeysIn = baseKeysIn;
-
-
- function keysIn(object) {
- return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
- }
-
- var keysIn_1 = keysIn;
-
-
- function baseAssignIn(object, source) {
- return object && _copyObject(source, keysIn_1(source), object);
- }
-
- var _baseAssignIn = baseAssignIn;
-
- var _cloneBuffer = createCommonjsModule(function (module, exports) {
-
- var freeExports = exports && !exports.nodeType && exports;
-
-
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
-
-
- var moduleExports = freeModule && freeModule.exports === freeExports;
-
-
- var Buffer = moduleExports ? _root.Buffer : undefined,
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
-
-
- function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
- }
- var length = buffer.length,
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
-
- buffer.copy(result);
- return result;
- }
-
- module.exports = cloneBuffer;
- }, "/$$rollup_base$$/node_modules/lodash");
-
-
- function arrayFilter(array, predicate) {
- var index = -1,
- length = array == null ? 0 : array.length,
- resIndex = 0,
- result = [];
-
- while (++index < length) {
- var value = array[index];
- if (predicate(value, index, array)) {
- result[resIndex++] = value;
- }
- }
- return result;
- }
-
- var _arrayFilter = arrayFilter;
-
-
- function stubArray() {
- return [];
- }
-
- var stubArray_1 = stubArray;
-
-
- var objectProto$4 = Object.prototype;
-
-
- var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
-
-
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
-
-
- var getSymbols = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
- if (object == null) {
- return [];
- }
- object = Object(object);
- return _arrayFilter(nativeGetSymbols$1(object), function(symbol) {
- return propertyIsEnumerable.call(object, symbol);
- });
- };
-
- var _getSymbols = getSymbols;
-
-
- function copySymbols(source, object) {
- return _copyObject(source, _getSymbols(source), object);
- }
-
- var _copySymbols = copySymbols;
-
-
- function arrayPush(array, values) {
- var index = -1,
- length = values.length,
- offset = array.length;
-
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
- }
-
- var _arrayPush = arrayPush;
-
-
- var getPrototype = _overArg(Object.getPrototypeOf, Object);
-
- var _getPrototype = getPrototype;
-
-
- var nativeGetSymbols = Object.getOwnPropertySymbols;
-
-
- var getSymbolsIn = !nativeGetSymbols ? stubArray_1 : function(object) {
- var result = [];
- while (object) {
- _arrayPush(result, _getSymbols(object));
- object = _getPrototype(object);
- }
- return result;
- };
-
- var _getSymbolsIn = getSymbolsIn;
-
-
- function copySymbolsIn(source, object) {
- return _copyObject(source, _getSymbolsIn(source), object);
- }
-
- var _copySymbolsIn = copySymbolsIn;
-
-
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
- var result = keysFunc(object);
- return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
- }
-
- var _baseGetAllKeys = baseGetAllKeys;
-
-
- function getAllKeys(object) {
- return _baseGetAllKeys(object, keys_1, _getSymbols);
- }
-
- var _getAllKeys = getAllKeys;
-
-
- function getAllKeysIn(object) {
- return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
- }
-
- var _getAllKeysIn = getAllKeysIn;
-
-
- var DataView = _getNative(_root, 'DataView');
-
- var _DataView = DataView;
-
-
- var Promise$1 = _getNative(_root, 'Promise');
-
- var _Promise = Promise$1;
-
-
- var Set$1 = _getNative(_root, 'Set');
-
- var _Set = Set$1;
-
-
- var mapTag$4 = '[object Map]',
- objectTag$3 = '[object Object]',
- promiseTag = '[object Promise]',
- setTag$4 = '[object Set]',
- weakMapTag$2 = '[object WeakMap]';
-
- var dataViewTag$3 = '[object DataView]';
-
-
- var dataViewCtorString = _toSource(_DataView),
- mapCtorString = _toSource(_Map),
- promiseCtorString = _toSource(_Promise),
- setCtorString = _toSource(_Set),
- weakMapCtorString = _toSource(_WeakMap);
-
-
- var getTag = _baseGetTag;
-
-
- if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$3) ||
- (_Map && getTag(new _Map) != mapTag$4) ||
- (_Promise && getTag(_Promise.resolve()) != promiseTag) ||
- (_Set && getTag(new _Set) != setTag$4) ||
- (_WeakMap && getTag(new _WeakMap) != weakMapTag$2)) {
- getTag = function(value) {
- var result = _baseGetTag(value),
- Ctor = result == objectTag$3 ? value.constructor : undefined,
- ctorString = Ctor ? _toSource(Ctor) : '';
-
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag$3;
- case mapCtorString: return mapTag$4;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag$4;
- case weakMapCtorString: return weakMapTag$2;
- }
- }
- return result;
- };
- }
-
- var _getTag = getTag;
-
-
- var objectProto$3 = Object.prototype;
-
-
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
-
-
- function initCloneArray(array) {
- var length = array.length,
- result = new array.constructor(length);
-
-
- if (length && typeof array[0] == 'string' && hasOwnProperty$3.call(array, 'index')) {
- result.index = array.index;
- result.input = array.input;
- }
- return result;
- }
-
- var _initCloneArray = initCloneArray;
-
-
- var Uint8Array$1 = _root.Uint8Array;
-
- var _Uint8Array = Uint8Array$1;
-
-
- function cloneArrayBuffer(arrayBuffer) {
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
- new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
- return result;
- }
-
- var _cloneArrayBuffer = cloneArrayBuffer;
-
-
- function cloneDataView(dataView, isDeep) {
- var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
- }
-
- var _cloneDataView = cloneDataView;
-
-
- var reFlags = /\w*$/;
-
-
- function cloneRegExp(regexp) {
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
- result.lastIndex = regexp.lastIndex;
- return result;
- }
-
- var _cloneRegExp = cloneRegExp;
-
-
- var symbolProto$2 = _Symbol ? _Symbol.prototype : undefined,
- symbolValueOf$1 = symbolProto$2 ? symbolProto$2.valueOf : undefined;
-
-
- function cloneSymbol(symbol) {
- return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
- }
-
- var _cloneSymbol = cloneSymbol;
-
-
- function cloneTypedArray(typedArray, isDeep) {
- var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
- }
-
- var _cloneTypedArray = cloneTypedArray;
-
-
- var boolTag$2 = '[object Boolean]',
- dateTag$2 = '[object Date]',
- mapTag$3 = '[object Map]',
- numberTag$2 = '[object Number]',
- regexpTag$2 = '[object RegExp]',
- setTag$3 = '[object Set]',
- stringTag$2 = '[object String]',
- symbolTag$2 = '[object Symbol]';
-
- var arrayBufferTag$2 = '[object ArrayBuffer]',
- dataViewTag$2 = '[object DataView]',
- float32Tag$1 = '[object Float32Array]',
- float64Tag$1 = '[object Float64Array]',
- int8Tag$1 = '[object Int8Array]',
- int16Tag$1 = '[object Int16Array]',
- int32Tag$1 = '[object Int32Array]',
- uint8Tag$1 = '[object Uint8Array]',
- uint8ClampedTag$1 = '[object Uint8ClampedArray]',
- uint16Tag$1 = '[object Uint16Array]',
- uint32Tag$1 = '[object Uint32Array]';
-
-
- function initCloneByTag(object, tag, isDeep) {
- var Ctor = object.constructor;
- switch (tag) {
- case arrayBufferTag$2:
- return _cloneArrayBuffer(object);
-
- case boolTag$2:
- case dateTag$2:
- return new Ctor(+object);
-
- case dataViewTag$2:
- return _cloneDataView(object, isDeep);
-
- case float32Tag$1: case float64Tag$1:
- case int8Tag$1: case int16Tag$1: case int32Tag$1:
- case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
- return _cloneTypedArray(object, isDeep);
-
- case mapTag$3:
- return new Ctor;
-
- case numberTag$2:
- case stringTag$2:
- return new Ctor(object);
-
- case regexpTag$2:
- return _cloneRegExp(object);
-
- case setTag$3:
- return new Ctor;
-
- case symbolTag$2:
- return _cloneSymbol(object);
- }
- }
-
- var _initCloneByTag = initCloneByTag;
-
-
- function initCloneObject(object) {
- return (typeof object.constructor == 'function' && !_isPrototype(object))
- ? _baseCreate(_getPrototype(object))
- : {};
- }
-
- var _initCloneObject = initCloneObject;
-
-
- var mapTag$2 = '[object Map]';
-
-
- function baseIsMap(value) {
- return isObjectLike_1(value) && _getTag(value) == mapTag$2;
- }
-
- var _baseIsMap = baseIsMap;
-
-
- var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
-
-
- var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
-
- var isMap_1 = isMap;
-
-
- var setTag$2 = '[object Set]';
-
-
- function baseIsSet(value) {
- return isObjectLike_1(value) && _getTag(value) == setTag$2;
- }
-
- var _baseIsSet = baseIsSet;
-
-
- var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
-
-
- var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
-
- var isSet_1 = isSet;
-
-
- var CLONE_DEEP_FLAG$1 = 1,
- CLONE_FLAT_FLAG = 2,
- CLONE_SYMBOLS_FLAG$1 = 4;
-
-
- var argsTag$1 = '[object Arguments]',
- arrayTag$1 = '[object Array]',
- boolTag$1 = '[object Boolean]',
- dateTag$1 = '[object Date]',
- errorTag$2 = '[object Error]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- mapTag$1 = '[object Map]',
- numberTag$1 = '[object Number]',
- objectTag$2 = '[object Object]',
- regexpTag$1 = '[object RegExp]',
- setTag$1 = '[object Set]',
- stringTag$1 = '[object String]',
- symbolTag$1 = '[object Symbol]',
- weakMapTag$1 = '[object WeakMap]';
-
- var arrayBufferTag$1 = '[object ArrayBuffer]',
- dataViewTag$1 = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
-
-
- var cloneableTags = {};
- cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] =
- cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] =
- cloneableTags[boolTag$1] = cloneableTags[dateTag$1] =
- cloneableTags[float32Tag] = cloneableTags[float64Tag] =
- cloneableTags[int8Tag] = cloneableTags[int16Tag] =
- cloneableTags[int32Tag] = cloneableTags[mapTag$1] =
- cloneableTags[numberTag$1] = cloneableTags[objectTag$2] =
- cloneableTags[regexpTag$1] = cloneableTags[setTag$1] =
- cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] =
- cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
- cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
- cloneableTags[errorTag$2] = cloneableTags[funcTag] =
- cloneableTags[weakMapTag$1] = false;
-
-
- function baseClone(value, bitmask, customizer, key, object, stack) {
- var result,
- isDeep = bitmask & CLONE_DEEP_FLAG$1,
- isFlat = bitmask & CLONE_FLAT_FLAG,
- isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
-
- if (customizer) {
- result = object ? customizer(value, key, object, stack) : customizer(value);
- }
- if (result !== undefined) {
- return result;
- }
- if (!isObject_1(value)) {
- return value;
- }
- var isArr = isArray_1(value);
- if (isArr) {
- result = _initCloneArray(value);
- if (!isDeep) {
- return _copyArray(value, result);
- }
- } else {
- var tag = _getTag(value),
- isFunc = tag == funcTag || tag == genTag;
-
- if (isBuffer_1(value)) {
- return _cloneBuffer(value, isDeep);
- }
- if (tag == objectTag$2 || tag == argsTag$1 || (isFunc && !object)) {
- result = (isFlat || isFunc) ? {} : _initCloneObject(value);
- if (!isDeep) {
- return isFlat
- ? _copySymbolsIn(value, _baseAssignIn(result, value))
- : _copySymbols(value, _baseAssign(result, value));
- }
- } else {
- if (!cloneableTags[tag]) {
- return object ? value : {};
- }
- result = _initCloneByTag(value, tag, isDeep);
- }
- }
-
- stack || (stack = new _Stack);
- var stacked = stack.get(value);
- if (stacked) {
- return stacked;
- }
- stack.set(value, result);
-
- if (isSet_1(value)) {
- value.forEach(function(subValue) {
- result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
- });
- } else if (isMap_1(value)) {
- value.forEach(function(subValue, key) {
- result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
- });
- }
-
- var keysFunc = isFull
- ? (isFlat ? _getAllKeysIn : _getAllKeys)
- : (isFlat ? keysIn_1 : keys_1);
-
- var props = isArr ? undefined : keysFunc(value);
- _arrayEach(props || value, function(subValue, key) {
- if (props) {
- key = subValue;
- subValue = value[key];
- }
-
- _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
- });
- return result;
- }
-
- var _baseClone = baseClone;
-
-
- var CLONE_SYMBOLS_FLAG = 4;
-
-
- function clone(value) {
- return _baseClone(value, CLONE_SYMBOLS_FLAG);
- }
-
- var clone_1 = clone;
-
-
- var objectTag$1 = '[object Object]';
-
-
- var funcProto = Function.prototype,
- objectProto$2 = Object.prototype;
-
-
- var funcToString = funcProto.toString;
-
-
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
-
-
- var objectCtorString = funcToString.call(Object);
-
-
- function isPlainObject(value) {
- if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$1) {
- return false;
- }
- var proto = _getPrototype(value);
- if (proto === null) {
- return true;
- }
- var Ctor = hasOwnProperty$2.call(proto, 'constructor') && proto.constructor;
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
- funcToString.call(Ctor) == objectCtorString;
- }
-
- var isPlainObject_1 = isPlainObject;
-
-
- var domExcTag = '[object DOMException]',
- errorTag$1 = '[object Error]';
-
-
- function isError(value) {
- if (!isObjectLike_1(value)) {
- return false;
- }
- var tag = _baseGetTag(value);
- return tag == errorTag$1 || tag == domExcTag ||
- (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject_1(value));
- }
-
- var isError_1 = isError;
-
-
- var weakMapTag = '[object WeakMap]';
-
-
- function isWeakMap(value) {
- return isObjectLike_1(value) && _getTag(value) == weakMapTag;
- }
-
- var isWeakMap_1 = isWeakMap;
-
-
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
-
-
- function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
- }
-
- var _setCacheAdd = setCacheAdd;
-
-
- function setCacheHas(value) {
- return this.__data__.has(value);
- }
-
- var _setCacheHas = setCacheHas;
-
-
- function SetCache(values) {
- var index = -1,
- length = values == null ? 0 : values.length;
-
- this.__data__ = new _MapCache;
- while (++index < length) {
- this.add(values[index]);
- }
- }
-
-
- SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
- SetCache.prototype.has = _setCacheHas;
-
- var _SetCache = SetCache;
-
-
- function arraySome(array, predicate) {
- var index = -1,
- length = array == null ? 0 : array.length;
-
- while (++index < length) {
- if (predicate(array[index], index, array)) {
- return true;
- }
- }
- return false;
- }
-
- var _arraySome = arraySome;
-
-
- function cacheHas(cache, key) {
- return cache.has(key);
- }
-
- var _cacheHas = cacheHas;
-
-
- var COMPARE_PARTIAL_FLAG$5 = 1,
- COMPARE_UNORDERED_FLAG$3 = 2;
-
-
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
- arrLength = array.length,
- othLength = other.length;
-
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
- return false;
- }
-
- var arrStacked = stack.get(array);
- var othStacked = stack.get(other);
- if (arrStacked && othStacked) {
- return arrStacked == other && othStacked == array;
- }
- var index = -1,
- result = true,
- seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;
-
- stack.set(array, other);
- stack.set(other, array);
-
-
- while (++index < arrLength) {
- var arrValue = array[index],
- othValue = other[index];
-
- if (customizer) {
- var compared = isPartial
- ? customizer(othValue, arrValue, index, other, array, stack)
- : customizer(arrValue, othValue, index, array, other, stack);
- }
- if (compared !== undefined) {
- if (compared) {
- continue;
- }
- result = false;
- break;
- }
-
- if (seen) {
- if (!_arraySome(other, function(othValue, othIndex) {
- if (!_cacheHas(seen, othIndex) &&
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
- return seen.push(othIndex);
- }
- })) {
- result = false;
- break;
- }
- } else if (!(
- arrValue === othValue ||
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
- )) {
- result = false;
- break;
- }
- }
- stack['delete'](array);
- stack['delete'](other);
- return result;
- }
-
- var _equalArrays = equalArrays;
-
-
- function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
-
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
-
- var _mapToArray = mapToArray;
-
-
- function setToArray(set) {
- var index = -1,
- result = Array(set.size);
-
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
-
- var _setToArray = setToArray;
-
-
- var COMPARE_PARTIAL_FLAG$4 = 1,
- COMPARE_UNORDERED_FLAG$2 = 2;
-
-
- var boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- symbolTag = '[object Symbol]';
-
- var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]';
-
-
- var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
- symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
-
-
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
- switch (tag) {
- case dataViewTag:
- if ((object.byteLength != other.byteLength) ||
- (object.byteOffset != other.byteOffset)) {
- return false;
- }
- object = object.buffer;
- other = other.buffer;
-
- case arrayBufferTag:
- if ((object.byteLength != other.byteLength) ||
- !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
- return false;
- }
- return true;
-
- case boolTag:
- case dateTag:
- case numberTag:
-
-
- return eq_1(+object, +other);
-
- case errorTag:
- return object.name == other.name && object.message == other.message;
-
- case regexpTag:
- case stringTag:
-
-
-
- return object == (other + '');
-
- case mapTag:
- var convert = _mapToArray;
-
- case setTag:
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
- convert || (convert = _setToArray);
-
- if (object.size != other.size && !isPartial) {
- return false;
- }
-
- var stacked = stack.get(object);
- if (stacked) {
- return stacked == other;
- }
- bitmask |= COMPARE_UNORDERED_FLAG$2;
-
-
- stack.set(object, other);
- var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
- stack['delete'](object);
- return result;
-
- case symbolTag:
- if (symbolValueOf) {
- return symbolValueOf.call(object) == symbolValueOf.call(other);
- }
- }
- return false;
- }
-
- var _equalByTag = equalByTag;
-
-
- var COMPARE_PARTIAL_FLAG$3 = 1;
-
-
- var objectProto$1 = Object.prototype;
-
-
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
-
-
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
- objProps = _getAllKeys(object),
- objLength = objProps.length,
- othProps = _getAllKeys(other),
- othLength = othProps.length;
-
- if (objLength != othLength && !isPartial) {
- return false;
- }
- var index = objLength;
- while (index--) {
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
- return false;
- }
- }
-
- var objStacked = stack.get(object);
- var othStacked = stack.get(other);
- if (objStacked && othStacked) {
- return objStacked == other && othStacked == object;
- }
- var result = true;
- stack.set(object, other);
- stack.set(other, object);
-
- var skipCtor = isPartial;
- while (++index < objLength) {
- key = objProps[index];
- var objValue = object[key],
- othValue = other[key];
-
- if (customizer) {
- var compared = isPartial
- ? customizer(othValue, objValue, key, other, object, stack)
- : customizer(objValue, othValue, key, object, other, stack);
- }
-
- if (!(compared === undefined
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
- : compared
- )) {
- result = false;
- break;
- }
- skipCtor || (skipCtor = key == 'constructor');
- }
- if (result && !skipCtor) {
- var objCtor = object.constructor,
- othCtor = other.constructor;
-
-
- if (objCtor != othCtor &&
- ('constructor' in object && 'constructor' in other) &&
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
- result = false;
- }
- }
- stack['delete'](object);
- stack['delete'](other);
- return result;
- }
-
- var _equalObjects = equalObjects;
-
-
- var COMPARE_PARTIAL_FLAG$2 = 1;
-
-
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- objectTag = '[object Object]';
-
-
- var objectProto = Object.prototype;
-
-
- var hasOwnProperty = objectProto.hasOwnProperty;
-
-
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
- var objIsArr = isArray_1(object),
- othIsArr = isArray_1(other),
- objTag = objIsArr ? arrayTag : _getTag(object),
- othTag = othIsArr ? arrayTag : _getTag(other);
-
- objTag = objTag == argsTag ? objectTag : objTag;
- othTag = othTag == argsTag ? objectTag : othTag;
-
- var objIsObj = objTag == objectTag,
- othIsObj = othTag == objectTag,
- isSameTag = objTag == othTag;
-
- if (isSameTag && isBuffer_1(object)) {
- if (!isBuffer_1(other)) {
- return false;
- }
- objIsArr = true;
- objIsObj = false;
- }
- if (isSameTag && !objIsObj) {
- stack || (stack = new _Stack);
- return (objIsArr || isTypedArray_1(object))
- ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
- : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
- }
- if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
-
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object.value() : object,
- othUnwrapped = othIsWrapped ? other.value() : other;
-
- stack || (stack = new _Stack);
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
- }
- }
- if (!isSameTag) {
- return false;
- }
- stack || (stack = new _Stack);
- return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
- }
-
- var _baseIsEqualDeep = baseIsEqualDeep;
-
-
- function baseIsEqual(value, other, bitmask, customizer, stack) {
- if (value === other) {
- return true;
- }
- if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {
- return value !== value && other !== other;
- }
- return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
- }
-
- var _baseIsEqual = baseIsEqual;
-
-
- var COMPARE_PARTIAL_FLAG$1 = 1,
- COMPARE_UNORDERED_FLAG$1 = 2;
-
-
- function baseIsMatch(object, source, matchData, customizer) {
- var index = matchData.length,
- length = index,
- noCustomizer = !customizer;
-
- if (object == null) {
- return !length;
- }
- object = Object(object);
- while (index--) {
- var data = matchData[index];
- if ((noCustomizer && data[2])
- ? data[1] !== object[data[0]]
- : !(data[0] in object)
- ) {
- return false;
- }
- }
- while (++index < length) {
- data = matchData[index];
- var key = data[0],
- objValue = object[key],
- srcValue = data[1];
-
- if (noCustomizer && data[2]) {
- if (objValue === undefined && !(key in object)) {
- return false;
- }
- } else {
- var stack = new _Stack;
- if (customizer) {
- var result = customizer(objValue, srcValue, key, object, source, stack);
- }
- if (!(result === undefined
- ? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
- : result
- )) {
- return false;
- }
- }
- }
- return true;
- }
-
- var _baseIsMatch = baseIsMatch;
-
-
- function isStrictComparable(value) {
- return value === value && !isObject_1(value);
- }
-
- var _isStrictComparable = isStrictComparable;
-
-
- function getMatchData(object) {
- var result = keys_1(object),
- length = result.length;
-
- while (length--) {
- var key = result[length],
- value = object[key];
-
- result[length] = [key, value, _isStrictComparable(value)];
- }
- return result;
- }
-
- var _getMatchData = getMatchData;
-
-
- function matchesStrictComparable(key, srcValue) {
- return function(object) {
- if (object == null) {
- return false;
- }
- return object[key] === srcValue &&
- (srcValue !== undefined || (key in Object(object)));
- };
- }
-
- var _matchesStrictComparable = matchesStrictComparable;
-
-
- function baseMatches(source) {
- var matchData = _getMatchData(source);
- if (matchData.length == 1 && matchData[0][2]) {
- return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
- }
- return function(object) {
- return object === source || _baseIsMatch(object, source, matchData);
- };
- }
-
- var _baseMatches = baseMatches;
-
-
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
- reIsPlainProp = /^\w*$/;
-
-
- function isKey(value, object) {
- if (isArray_1(value)) {
- return false;
- }
- var type = typeof value;
- if (type == 'number' || type == 'symbol' || type == 'boolean' ||
- value == null || isSymbol_1(value)) {
- return true;
- }
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
- (object != null && value in Object(object));
- }
-
- var _isKey = isKey;
-
-
- var FUNC_ERROR_TEXT = 'Expected a function';
-
-
- function memoize(func, resolver) {
- if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- var memoized = function() {
- var args = arguments,
- key = resolver ? resolver.apply(this, args) : args[0],
- cache = memoized.cache;
-
- if (cache.has(key)) {
- return cache.get(key);
- }
- var result = func.apply(this, args);
- memoized.cache = cache.set(key, result) || cache;
- return result;
- };
- memoized.cache = new (memoize.Cache || _MapCache);
- return memoized;
- }
-
-
- memoize.Cache = _MapCache;
-
- var memoize_1 = memoize;
-
-
- var MAX_MEMOIZE_SIZE = 500;
-
-
- function memoizeCapped(func) {
- var result = memoize_1(func, function(key) {
- if (cache.size === MAX_MEMOIZE_SIZE) {
- cache.clear();
- }
- return key;
- });
-
- var cache = result.cache;
- return result;
- }
-
- var _memoizeCapped = memoizeCapped;
-
-
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
-
-
- var reEscapeChar = /\\(\\)?/g;
-
-
- var stringToPath = _memoizeCapped(function(string) {
- var result = [];
- if (string.charCodeAt(0) === 46 ) {
- result.push('');
- }
- string.replace(rePropName, function(match, number, quote, subString) {
- result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
- });
- return result;
- });
-
- var _stringToPath = stringToPath;
-
-
- function arrayMap(array, iteratee) {
- var index = -1,
- length = array == null ? 0 : array.length,
- result = Array(length);
-
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
-
- var _arrayMap = arrayMap;
-
-
- var INFINITY$1 = 1 / 0;
-
-
- var symbolProto = _Symbol ? _Symbol.prototype : undefined,
- symbolToString = symbolProto ? symbolProto.toString : undefined;
-
-
- function baseToString(value) {
-
- if (typeof value == 'string') {
- return value;
- }
- if (isArray_1(value)) {
-
- return _arrayMap(value, baseToString) + '';
- }
- if (isSymbol_1(value)) {
- return symbolToString ? symbolToString.call(value) : '';
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
- }
-
- var _baseToString = baseToString;
-
-
- function toString(value) {
- return value == null ? '' : _baseToString(value);
- }
-
- var toString_1 = toString;
-
-
- function castPath(value, object) {
- if (isArray_1(value)) {
- return value;
- }
- return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
- }
-
- var _castPath = castPath;
-
-
- var INFINITY = 1 / 0;
-
-
- function toKey(value) {
- if (typeof value == 'string' || isSymbol_1(value)) {
- return value;
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
- }
-
- var _toKey = toKey;
-
-
- function baseGet(object, path) {
- path = _castPath(path, object);
-
- var index = 0,
- length = path.length;
-
- while (object != null && index < length) {
- object = object[_toKey(path[index++])];
- }
- return (index && index == length) ? object : undefined;
- }
-
- var _baseGet = baseGet;
-
-
- function get$1(object, path, defaultValue) {
- var result = object == null ? undefined : _baseGet(object, path);
- return result === undefined ? defaultValue : result;
- }
-
- var get_1 = get$1;
-
- /**
- * The base implementation of `_.hasIn` without support for deep paths.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */
- function baseHasIn(object, key) {
- return object != null && key in Object(object);
- }
-
- var _baseHasIn = baseHasIn;
-
- /**
- * Checks if `path` exists on `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @param {Function} hasFunc The function to check properties.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- */
- function hasPath(object, path, hasFunc) {
- path = _castPath(path, object);
-
- var index = -1,
- length = path.length,
- result = false;
-
- while (++index < length) {
- var key = _toKey(path[index]);
- if (!(result = object != null && hasFunc(object, key))) {
- break;
- }
- object = object[key];
- }
- if (result || ++index != length) {
- return result;
- }
- length = object == null ? 0 : object.length;
- return !!length && isLength_1(length) && _isIndex(key, length) &&
- (isArray_1(object) || isArguments_1(object));
- }
-
- var _hasPath = hasPath;
-
- /**
- * Checks if `path` is a direct or inherited property of `object`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = _.create({ 'a': _.create({ 'b': 2 }) });
- *
- * _.hasIn(object, 'a');
- *
- *
- * _.hasIn(object, 'a.b');
- *
- *
- * _.hasIn(object, ['a', 'b']);
- *
- *
- * _.hasIn(object, 'b');
- *
- */
- function hasIn(object, path) {
- return object != null && _hasPath(object, path, _baseHasIn);
- }
-
- var hasIn_1 = hasIn;
-
- /** Used to compose bitmasks for value comparisons. */
- var COMPARE_PARTIAL_FLAG = 1,
- COMPARE_UNORDERED_FLAG = 2;
-
- /**
- * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
- *
- * @private
- * @param {string} path The path of the property to get.
- * @param {*} srcValue The value to match.
- * @returns {Function} Returns the new spec function.
- */
- function baseMatchesProperty(path, srcValue) {
- if (_isKey(path) && _isStrictComparable(srcValue)) {
- return _matchesStrictComparable(_toKey(path), srcValue);
- }
- return function(object) {
- var objValue = get_1(object, path);
- return (objValue === undefined && objValue === srcValue)
- ? hasIn_1(object, path)
- : _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
- };
- }
-
- var _baseMatchesProperty = baseMatchesProperty;
-
- /**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
- }
-
- var _baseProperty = baseProperty;
-
- /**
- * A specialized version of `baseProperty` which supports deep paths.
- *
- * @private
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- */
- function basePropertyDeep(path) {
- return function(object) {
- return _baseGet(object, path);
- };
- }
-
- var _basePropertyDeep = basePropertyDeep;
-
- /**
- * Creates a function that returns the value at `path` of a given object.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new accessor function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': 2 } },
- * { 'a': { 'b': 1 } }
- * ];
- *
- * _.map(objects, _.property('a.b'));
- * // => [2, 1]
- *
- * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
- * // => [1, 2]
- */
- function property(path) {
- return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
- }
-
- var property_1 = property;
-
- /**
- * The base implementation of `_.iteratee`.
- *
- * @private
- * @param {*} [value=_.identity] The value to convert to an iteratee.
- * @returns {Function} Returns the iteratee.
- */
- function baseIteratee(value) {
- // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
-
- if (typeof value == 'function') {
- return value;
- }
- if (value == null) {
- return identity_1;
- }
- if (typeof value == 'object') {
- return isArray_1(value)
- ? _baseMatchesProperty(value[0], value[1])
- : _baseMatches(value);
- }
- return property_1(value);
- }
-
- var _baseIteratee = baseIteratee;
-
-
- var CLONE_DEEP_FLAG = 1;
-
-
- function iteratee(func) {
- return _baseIteratee(typeof func == 'function' ? func : _baseClone(func, CLONE_DEEP_FLAG));
- }
-
- var iteratee_1 = iteratee;
-
-
- var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
-
-
- function isFlattenable(value) {
- return isArray_1(value) || isArguments_1(value) ||
- !!(spreadableSymbol && value && value[spreadableSymbol]);
- }
-
- var _isFlattenable = isFlattenable;
-
-
- function baseFlatten(array, depth, predicate, isStrict, result) {
- var index = -1,
- length = array.length;
-
- predicate || (predicate = _isFlattenable);
- result || (result = []);
-
- while (++index < length) {
- var value = array[index];
- if (depth > 0 && predicate(value)) {
- if (depth > 1) {
-
- baseFlatten(value, depth - 1, predicate, isStrict, result);
- } else {
- _arrayPush(result, value);
- }
- } else if (!isStrict) {
- result[result.length] = value;
- }
- }
- return result;
- }
-
- var _baseFlatten = baseFlatten;
-
-
- function flatten(array) {
- var length = array == null ? 0 : array.length;
- return length ? _baseFlatten(array, 1) : [];
- }
-
- var flatten_1 = flatten;
-
-
- var nativeMax = Math.max;
-
-
- function overRest(func, start, transform) {
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
-
- while (++index < length) {
- array[index] = args[start + index];
- }
- index = -1;
- var otherArgs = Array(start + 1);
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = transform(array);
- return _apply(func, this, otherArgs);
- };
- }
-
- var _overRest = overRest;
-
-
- function flatRest(func) {
- return _setToString(_overRest(func, undefined, flatten_1), func + '');
- }
-
- var _flatRest = flatRest;
-
-
- var WRAP_REARG_FLAG = 256;
-
-
- var rearg = _flatRest(function(func, indexes) {
- return _createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
- });
-
- var rearg_1 = rearg;
-
-
- function toPath(value) {
- if (isArray_1(value)) {
- return _arrayMap(value, _toKey);
- }
- return isSymbol_1(value) ? [value] : _copyArray(_stringToPath(toString_1(value)));
- }
-
- var toPath_1 = toPath;
-
- var _util = {
- 'ary': ary_1,
- 'assign': _baseAssign,
- 'clone': clone_1,
- 'curry': commonjsRequire("../curry", "/$$rollup_base$$/node_modules/lodash/fp"),
- 'forEach': _arrayEach,
- 'isArray': isArray_1,
- 'isError': isError_1,
- 'isFunction': isFunction_1,
- 'isWeakMap': isWeakMap_1,
- 'iteratee': iteratee_1,
- 'keys': _baseKeys,
- 'rearg': rearg_1,
- 'toInteger': toInteger_1,
- 'toPath': toPath_1
- };
-
-
- function convert$2(name, func, options) {
- return _baseConvert(_util, name, func, options);
- }
-
- var convert_1 = convert$2;
-
- commonjsRegister("/$$rollup_base$$/node_modules/lodash/fp/curry.js", function (module, exports) {
- var convert = convert_1,
- func = convert('curry', commonjsRequire("../curry", "/$$rollup_base$$/node_modules/lodash/fp"));
-
- func.placeholder = placeholder;
- module.exports = func;
-
- });
-
- commonjsRegister("/$$rollup_base$$/node_modules/lodash/fp/curryN.js", function (module, exports) {
- var convert = convert_1,
- func = convert('curryN', commonjsRequire("../curry", "/$$rollup_base$$/node_modules/lodash/fp"));
-
- func.placeholder = placeholder;
- module.exports = func;
-
- });
-
- commonjsRegister("/$$rollup_base$$/node_modules/lodash/fp/curryRight.js", function (module, exports) {
- var convert = convert_1,
- func = convert('curryRight', commonjsRequire("../curryRight", "/$$rollup_base$$/node_modules/lodash/fp"));
-
- func.placeholder = placeholder;
- module.exports = func;
-
- });
-
- commonjsRegister("/$$rollup_base$$/node_modules/lodash/fp/curryRightN.js", function (module, exports) {
- var convert = convert_1,
- func = convert('curryRightN', commonjsRequire("../curryRight", "/$$rollup_base$$/node_modules/lodash/fp"));
-
- func.placeholder = placeholder;
- module.exports = func;
-
- });
-
- var moment = createCommonjsModule(function (module, exports) {
- (function (global, factory) {
- module.exports = factory() ;
- }(commonjsGlobal, (function () {
- var hookCallback;
-
- function hooks() {
- return hookCallback.apply(null, arguments);
- }
-
-
-
- function setHookCallback(callback) {
- hookCallback = callback;
- }
-
- function isArray(input) {
- return (
- input instanceof Array ||
- Object.prototype.toString.call(input) === '[object Array]'
- );
- }
-
- function isObject(input) {
-
-
- return (
- input != null &&
- Object.prototype.toString.call(input) === '[object Object]'
- );
- }
-
- function hasOwnProp(a, b) {
- return Object.prototype.hasOwnProperty.call(a, b);
- }
-
- function isObjectEmpty(obj) {
- if (Object.getOwnPropertyNames) {
- return Object.getOwnPropertyNames(obj).length === 0;
- } else {
- var k;
- for (k in obj) {
- if (hasOwnProp(obj, k)) {
- return false;
- }
- }
- return true;
- }
- }
-
- function isUndefined(input) {
- return input === void 0;
- }
-
- function isNumber(input) {
- return (
- typeof input === 'number' ||
- Object.prototype.toString.call(input) === '[object Number]'
- );
- }
-
- function isDate(input) {
- return (
- input instanceof Date ||
- Object.prototype.toString.call(input) === '[object Date]'
- );
- }
-
- function map(arr, fn) {
- var res = [],
- i;
- for (i = 0; i < arr.length; ++i) {
- res.push(fn(arr[i], i));
- }
- return res;
- }
-
- function extend(a, b) {
- for (var i in b) {
- if (hasOwnProp(b, i)) {
- a[i] = b[i];
- }
- }
-
- if (hasOwnProp(b, 'toString')) {
- a.toString = b.toString;
- }
-
- if (hasOwnProp(b, 'valueOf')) {
- a.valueOf = b.valueOf;
- }
-
- return a;
- }
-
- function createUTC(input, format, locale, strict) {
- return createLocalOrUTC(input, format, locale, strict, true).utc();
- }
-
- function defaultParsingFlags() {
-
- return {
- empty: false,
- unusedTokens: [],
- unusedInput: [],
- overflow: -2,
- charsLeftOver: 0,
- nullInput: false,
- invalidEra: null,
- invalidMonth: null,
- invalidFormat: false,
- userInvalidated: false,
- iso: false,
- parsedDateParts: [],
- era: null,
- meridiem: null,
- rfc2822: false,
- weekdayMismatch: false,
- };
- }
-
- function getParsingFlags(m) {
- if (m._pf == null) {
- m._pf = defaultParsingFlags();
- }
- return m._pf;
- }
-
- var some;
- if (Array.prototype.some) {
- some = Array.prototype.some;
- } else {
- some = function (fun) {
- var t = Object(this),
- len = t.length >>> 0,
- i;
-
- for (i = 0; i < len; i++) {
- if (i in t && fun.call(this, t[i], i, t)) {
- return true;
- }
- }
-
- return false;
- };
- }
-
- function isValid(m) {
- if (m._isValid == null) {
- var flags = getParsingFlags(m),
- parsedParts = some.call(flags.parsedDateParts, function (i) {
- return i != null;
- }),
- isNowValid =
- !isNaN(m._d.getTime()) &&
- flags.overflow < 0 &&
- !flags.empty &&
- !flags.invalidEra &&
- !flags.invalidMonth &&
- !flags.invalidWeekday &&
- !flags.weekdayMismatch &&
- !flags.nullInput &&
- !flags.invalidFormat &&
- !flags.userInvalidated &&
- (!flags.meridiem || (flags.meridiem && parsedParts));
-
- if (m._strict) {
- isNowValid =
- isNowValid &&
- flags.charsLeftOver === 0 &&
- flags.unusedTokens.length === 0 &&
- flags.bigHour === undefined;
- }
-
- if (Object.isFrozen == null || !Object.isFrozen(m)) {
- m._isValid = isNowValid;
- } else {
- return isNowValid;
- }
- }
- return m._isValid;
- }
-
- function createInvalid(flags) {
- var m = createUTC(NaN);
- if (flags != null) {
- extend(getParsingFlags(m), flags);
- } else {
- getParsingFlags(m).userInvalidated = true;
- }
-
- return m;
- }
-
-
-
- var momentProperties = (hooks.momentProperties = []),
- updateInProgress = false;
-
- function copyConfig(to, from) {
- var i, prop, val;
-
- if (!isUndefined(from._isAMomentObject)) {
- to._isAMomentObject = from._isAMomentObject;
- }
- if (!isUndefined(from._i)) {
- to._i = from._i;
- }
- if (!isUndefined(from._f)) {
- to._f = from._f;
- }
- if (!isUndefined(from._l)) {
- to._l = from._l;
- }
- if (!isUndefined(from._strict)) {
- to._strict = from._strict;
- }
- if (!isUndefined(from._tzm)) {
- to._tzm = from._tzm;
- }
- if (!isUndefined(from._isUTC)) {
- to._isUTC = from._isUTC;
- }
- if (!isUndefined(from._offset)) {
- to._offset = from._offset;
- }
- if (!isUndefined(from._pf)) {
- to._pf = getParsingFlags(from);
- }
- if (!isUndefined(from._locale)) {
- to._locale = from._locale;
- }
-
- if (momentProperties.length > 0) {
- for (i = 0; i < momentProperties.length; i++) {
- prop = momentProperties[i];
- val = from[prop];
- if (!isUndefined(val)) {
- to[prop] = val;
- }
- }
- }
-
- return to;
- }
-
-
- function Moment(config) {
- copyConfig(this, config);
- this._d = new Date(config._d != null ? config._d.getTime() : NaN);
- if (!this.isValid()) {
- this._d = new Date(NaN);
- }
-
-
- if (updateInProgress === false) {
- updateInProgress = true;
- hooks.updateOffset(this);
- updateInProgress = false;
- }
- }
-
- function isMoment(obj) {
- return (
- obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
- );
- }
-
- function warn(msg) {
- if (
- hooks.suppressDeprecationWarnings === false &&
- typeof console !== 'undefined' &&
- console.warn
- ) {
- console.warn('Deprecation warning: ' + msg);
- }
- }
-
- function deprecate(msg, fn) {
- var firstTime = true;
-
- return extend(function () {
- if (hooks.deprecationHandler != null) {
- hooks.deprecationHandler(null, msg);
- }
- if (firstTime) {
- var args = [],
- arg,
- i,
- key;
- for (i = 0; i < arguments.length; i++) {
- arg = '';
- if (typeof arguments[i] === 'object') {
- arg += '\n[' + i + '] ';
- for (key in arguments[0]) {
- if (hasOwnProp(arguments[0], key)) {
- arg += key + ': ' + arguments[0][key] + ', ';
- }
- }
- arg = arg.slice(0, -2);
- } else {
- arg = arguments[i];
- }
- args.push(arg);
- }
- warn(
- msg +
- '\nArguments: ' +
- Array.prototype.slice.call(args).join('') +
- '\n' +
- new Error().stack
- );
- firstTime = false;
- }
- return fn.apply(this, arguments);
- }, fn);
- }
-
- var deprecations = {};
-
- function deprecateSimple(name, msg) {
- if (hooks.deprecationHandler != null) {
- hooks.deprecationHandler(name, msg);
- }
- if (!deprecations[name]) {
- warn(msg);
- deprecations[name] = true;
- }
- }
-
- hooks.suppressDeprecationWarnings = false;
- hooks.deprecationHandler = null;
-
- function isFunction(input) {
- return (
- (typeof Function !== 'undefined' && input instanceof Function) ||
- Object.prototype.toString.call(input) === '[object Function]'
- );
- }
-
- function set(config) {
- var prop, i;
- for (i in config) {
- if (hasOwnProp(config, i)) {
- prop = config[i];
- if (isFunction(prop)) {
- this[i] = prop;
- } else {
- this['_' + i] = prop;
- }
- }
- }
- this._config = config;
-
-
-
- this._dayOfMonthOrdinalParseLenient = new RegExp(
- (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
- '|' +
- /\d{1,2}/.source
- );
- }
-
- function mergeConfigs(parentConfig, childConfig) {
- var res = extend({}, parentConfig),
- prop;
- for (prop in childConfig) {
- if (hasOwnProp(childConfig, prop)) {
- if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
- res[prop] = {};
- extend(res[prop], parentConfig[prop]);
- extend(res[prop], childConfig[prop]);
- } else if (childConfig[prop] != null) {
- res[prop] = childConfig[prop];
- } else {
- delete res[prop];
- }
- }
- }
- for (prop in parentConfig) {
- if (
- hasOwnProp(parentConfig, prop) &&
- !hasOwnProp(childConfig, prop) &&
- isObject(parentConfig[prop])
- ) {
-
- res[prop] = extend({}, res[prop]);
- }
- }
- return res;
- }
-
- function Locale(config) {
- if (config != null) {
- this.set(config);
- }
- }
-
- var keys;
-
- if (Object.keys) {
- keys = Object.keys;
- } else {
- keys = function (obj) {
- var i,
- res = [];
- for (i in obj) {
- if (hasOwnProp(obj, i)) {
- res.push(i);
- }
- }
- return res;
- };
- }
-
- var defaultCalendar = {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- };
-
- function calendar(key, mom, now) {
- var output = this._calendar[key] || this._calendar['sameElse'];
- return isFunction(output) ? output.call(mom, now) : output;
- }
-
- function zeroFill(number, targetLength, forceSign) {
- var absNumber = '' + Math.abs(number),
- zerosToFill = targetLength - absNumber.length,
- sign = number >= 0;
- return (
- (sign ? (forceSign ? '+' : '') : '-') +
- Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
- absNumber
- );
- }
-
- var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
- localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
- formatFunctions = {},
- formatTokenFunctions = {};
-
-
-
-
-
- function addFormatToken(token, padded, ordinal, callback) {
- var func = callback;
- if (typeof callback === 'string') {
- func = function () {
- return this[callback]();
- };
- }
- if (token) {
- formatTokenFunctions[token] = func;
- }
- if (padded) {
- formatTokenFunctions[padded[0]] = function () {
- return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
- };
- }
- if (ordinal) {
- formatTokenFunctions[ordinal] = function () {
- return this.localeData().ordinal(
- func.apply(this, arguments),
- token
- );
- };
- }
- }
-
- function removeFormattingTokens(input) {
- if (input.match(/\[[\s\S]/)) {
- return input.replace(/^\[|\]$/g, '');
- }
- return input.replace(/\\/g, '');
- }
-
- function makeFormatFunction(format) {
- var array = format.match(formattingTokens),
- i,
- length;
-
- for (i = 0, length = array.length; i < length; i++) {
- if (formatTokenFunctions[array[i]]) {
- array[i] = formatTokenFunctions[array[i]];
- } else {
- array[i] = removeFormattingTokens(array[i]);
- }
- }
-
- return function (mom) {
- var output = '',
- i;
- for (i = 0; i < length; i++) {
- output += isFunction(array[i])
- ? array[i].call(mom, format)
- : array[i];
- }
- return output;
- };
- }
-
-
- function formatMoment(m, format) {
- if (!m.isValid()) {
- return m.localeData().invalidDate();
- }
-
- format = expandFormat(format, m.localeData());
- formatFunctions[format] =
- formatFunctions[format] || makeFormatFunction(format);
-
- return formatFunctions[format](m);
- }
-
- function expandFormat(format, locale) {
- var i = 5;
-
- function replaceLongDateFormatTokens(input) {
- return locale.longDateFormat(input) || input;
- }
-
- localFormattingTokens.lastIndex = 0;
- while (i >= 0 && localFormattingTokens.test(format)) {
- format = format.replace(
- localFormattingTokens,
- replaceLongDateFormatTokens
- );
- localFormattingTokens.lastIndex = 0;
- i -= 1;
- }
-
- return format;
- }
-
- var defaultLongDateFormat = {
- LTS: 'h:mm:ss A',
- LT: 'h:mm A',
- L: 'MM/DD/YYYY',
- LL: 'MMMM D, YYYY',
- LLL: 'MMMM D, YYYY h:mm A',
- LLLL: 'dddd, MMMM D, YYYY h:mm A',
- };
-
- function longDateFormat(key) {
- var format = this._longDateFormat[key],
- formatUpper = this._longDateFormat[key.toUpperCase()];
-
- if (format || !formatUpper) {
- return format;
- }
-
- this._longDateFormat[key] = formatUpper
- .match(formattingTokens)
- .map(function (tok) {
- if (
- tok === 'MMMM' ||
- tok === 'MM' ||
- tok === 'DD' ||
- tok === 'dddd'
- ) {
- return tok.slice(1);
- }
- return tok;
- })
- .join('');
-
- return this._longDateFormat[key];
- }
-
- var defaultInvalidDate = 'Invalid date';
-
- function invalidDate() {
- return this._invalidDate;
- }
-
- var defaultOrdinal = '%d',
- defaultDayOfMonthOrdinalParse = /\d{1,2}/;
-
- function ordinal(number) {
- return this._ordinal.replace('%d', number);
- }
-
- var defaultRelativeTime = {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- w: 'a week',
- ww: '%d weeks',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- };
-
- function relativeTime(number, withoutSuffix, string, isFuture) {
- var output = this._relativeTime[string];
- return isFunction(output)
- ? output(number, withoutSuffix, string, isFuture)
- : output.replace(/%d/i, number);
- }
-
- function pastFuture(diff, output) {
- var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
- return isFunction(format) ? format(output) : format.replace(/%s/i, output);
- }
-
- var aliases = {};
-
- function addUnitAlias(unit, shorthand) {
- var lowerCase = unit.toLowerCase();
- aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
- }
-
- function normalizeUnits(units) {
- return typeof units === 'string'
- ? aliases[units] || aliases[units.toLowerCase()]
- : undefined;
- }
-
- function normalizeObjectUnits(inputObject) {
- var normalizedInput = {},
- normalizedProp,
- prop;
-
- for (prop in inputObject) {
- if (hasOwnProp(inputObject, prop)) {
- normalizedProp = normalizeUnits(prop);
- if (normalizedProp) {
- normalizedInput[normalizedProp] = inputObject[prop];
- }
- }
- }
-
- return normalizedInput;
- }
-
- var priorities = {};
-
- function addUnitPriority(unit, priority) {
- priorities[unit] = priority;
- }
-
- function getPrioritizedUnits(unitsObj) {
- var units = [],
- u;
- for (u in unitsObj) {
- if (hasOwnProp(unitsObj, u)) {
- units.push({ unit: u, priority: priorities[u] });
- }
- }
- units.sort(function (a, b) {
- return a.priority - b.priority;
- });
- return units;
- }
-
- function isLeapYear(year) {
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
- }
-
- function absFloor(number) {
- if (number < 0) {
-
- return Math.ceil(number) || 0;
- } else {
- return Math.floor(number);
- }
- }
-
- function toInt(argumentForCoercion) {
- var coercedNumber = +argumentForCoercion,
- value = 0;
-
- if (coercedNumber !== 0 && isFinite(coercedNumber)) {
- value = absFloor(coercedNumber);
- }
-
- return value;
- }
-
- function makeGetSet(unit, keepTime) {
- return function (value) {
- if (value != null) {
- set$1(this, unit, value);
- hooks.updateOffset(this, keepTime);
- return this;
- } else {
- return get(this, unit);
- }
- };
- }
-
- function get(mom, unit) {
- return mom.isValid()
- ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
- : NaN;
- }
-
- function set$1(mom, unit, value) {
- if (mom.isValid() && !isNaN(value)) {
- if (
- unit === 'FullYear' &&
- isLeapYear(mom.year()) &&
- mom.month() === 1 &&
- mom.date() === 29
- ) {
- value = toInt(value);
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
- value,
- mom.month(),
- daysInMonth(value, mom.month())
- );
- } else {
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
- }
- }
- }
-
-
-
- function stringGet(units) {
- units = normalizeUnits(units);
- if (isFunction(this[units])) {
- return this[units]();
- }
- return this;
- }
-
- function stringSet(units, value) {
- if (typeof units === 'object') {
- units = normalizeObjectUnits(units);
- var prioritized = getPrioritizedUnits(units),
- i;
- for (i = 0; i < prioritized.length; i++) {
- this[prioritized[i].unit](units[prioritized[i].unit]);
- }
- } else {
- units = normalizeUnits(units);
- if (isFunction(this[units])) {
- return this[units](value);
- }
- }
- return this;
- }
-
- var match1 = /\d/,
- match2 = /\d\d/,
- match3 = /\d{3}/,
- match4 = /\d{4}/,
- match6 = /[+-]?\d{6}/,
- match1to2 = /\d\d?/,
- match3to4 = /\d\d\d\d?/,
- match5to6 = /\d\d\d\d\d\d?/,
- match1to3 = /\d{1,3}/,
- match1to4 = /\d{1,4}/,
- match1to6 = /[+-]?\d{1,6}/,
- matchUnsigned = /\d+/,
- matchSigned = /[+-]?\d+/,
- matchOffset = /Z|[+-]\d\d:?\d\d/gi,
- matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi,
- matchTimestamp = /[+-]?\d+(\.\d{1,3})?/,
-
-
- matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
- regexes;
-
- regexes = {};
-
- function addRegexToken(token, regex, strictRegex) {
- regexes[token] = isFunction(regex)
- ? regex
- : function (isStrict, localeData) {
- return isStrict && strictRegex ? strictRegex : regex;
- };
- }
-
- function getParseRegexForToken(token, config) {
- if (!hasOwnProp(regexes, token)) {
- return new RegExp(unescapeFormat(token));
- }
-
- return regexes[token](config._strict, config._locale);
- }
-
-
- function unescapeFormat(s) {
- return regexEscape(
- s
- .replace('\\', '')
- .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
- matched,
- p1,
- p2,
- p3,
- p4
- ) {
- return p1 || p2 || p3 || p4;
- })
- );
- }
-
- function regexEscape(s) {
- return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
- }
-
- var tokens = {};
-
- function addParseToken(token, callback) {
- var i,
- func = callback;
- if (typeof token === 'string') {
- token = [token];
- }
- if (isNumber(callback)) {
- func = function (input, array) {
- array[callback] = toInt(input);
- };
- }
- for (i = 0; i < token.length; i++) {
- tokens[token[i]] = func;
- }
- }
-
- function addWeekParseToken(token, callback) {
- addParseToken(token, function (input, array, config, token) {
- config._w = config._w || {};
- callback(input, config._w, config, token);
- });
- }
-
- function addTimeToArrayFromToken(token, input, config) {
- if (input != null && hasOwnProp(tokens, token)) {
- tokens[token](input, config._a, config, token);
- }
- }
-
- var YEAR = 0,
- MONTH = 1,
- DATE = 2,
- HOUR = 3,
- MINUTE = 4,
- SECOND = 5,
- MILLISECOND = 6,
- WEEK = 7,
- WEEKDAY = 8;
-
- function mod(n, x) {
- return ((n % x) + x) % x;
- }
-
- var indexOf;
-
- if (Array.prototype.indexOf) {
- indexOf = Array.prototype.indexOf;
- } else {
- indexOf = function (o) {
-
- var i;
- for (i = 0; i < this.length; ++i) {
- if (this[i] === o) {
- return i;
- }
- }
- return -1;
- };
- }
-
- function daysInMonth(year, month) {
- if (isNaN(year) || isNaN(month)) {
- return NaN;
- }
- var modMonth = mod(month, 12);
- year += (month - modMonth) / 12;
- return modMonth === 1
- ? isLeapYear(year)
- ? 29
- : 28
- : 31 - ((modMonth % 7) % 2);
- }
-
-
-
- addFormatToken('M', ['MM', 2], 'Mo', function () {
- return this.month() + 1;
- });
-
- addFormatToken('MMM', 0, 0, function (format) {
- return this.localeData().monthsShort(this, format);
- });
-
- addFormatToken('MMMM', 0, 0, function (format) {
- return this.localeData().months(this, format);
- });
-
-
-
- addUnitAlias('month', 'M');
-
-
-
- addUnitPriority('month', 8);
-
-
-
- addRegexToken('M', match1to2);
- addRegexToken('MM', match1to2, match2);
- addRegexToken('MMM', function (isStrict, locale) {
- return locale.monthsShortRegex(isStrict);
- });
- addRegexToken('MMMM', function (isStrict, locale) {
- return locale.monthsRegex(isStrict);
- });
-
- addParseToken(['M', 'MM'], function (input, array) {
- array[MONTH] = toInt(input) - 1;
- });
-
- addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
- var month = config._locale.monthsParse(input, token, config._strict);
-
- if (month != null) {
- array[MONTH] = month;
- } else {
- getParsingFlags(config).invalidMonth = input;
- }
- });
-
-
-
- var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
- '_'
- ),
- MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
- defaultMonthsShortRegex = matchWord,
- defaultMonthsRegex = matchWord;
-
- function localeMonths(m, format) {
- if (!m) {
- return isArray(this._months)
- ? this._months
- : this._months['standalone'];
- }
- return isArray(this._months)
- ? this._months[m.month()]
- : this._months[
- (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
- ? 'format'
- : 'standalone'
- ][m.month()];
- }
-
- function localeMonthsShort(m, format) {
- if (!m) {
- return isArray(this._monthsShort)
- ? this._monthsShort
- : this._monthsShort['standalone'];
- }
- return isArray(this._monthsShort)
- ? this._monthsShort[m.month()]
- : this._monthsShort[
- MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
- ][m.month()];
- }
-
- function handleStrictParse(monthName, format, strict) {
- var i,
- ii,
- mom,
- llc = monthName.toLocaleLowerCase();
- if (!this._monthsParse) {
-
- this._monthsParse = [];
- this._longMonthsParse = [];
- this._shortMonthsParse = [];
- for (i = 0; i < 12; ++i) {
- mom = createUTC([2000, i]);
- this._shortMonthsParse[i] = this.monthsShort(
- mom,
- ''
- ).toLocaleLowerCase();
- this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
- }
- }
-
- if (strict) {
- if (format === 'MMM') {
- ii = indexOf.call(this._shortMonthsParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._longMonthsParse, llc);
- return ii !== -1 ? ii : null;
- }
- } else {
- if (format === 'MMM') {
- ii = indexOf.call(this._shortMonthsParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._longMonthsParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._longMonthsParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._shortMonthsParse, llc);
- return ii !== -1 ? ii : null;
- }
- }
- }
-
- function localeMonthsParse(monthName, format, strict) {
- var i, mom, regex;
-
- if (this._monthsParseExact) {
- return handleStrictParse.call(this, monthName, format, strict);
- }
-
- if (!this._monthsParse) {
- this._monthsParse = [];
- this._longMonthsParse = [];
- this._shortMonthsParse = [];
- }
-
-
-
-
- for (i = 0; i < 12; i++) {
-
- mom = createUTC([2000, i]);
- if (strict && !this._longMonthsParse[i]) {
- this._longMonthsParse[i] = new RegExp(
- '^' + this.months(mom, '').replace('.', '') + '$',
- 'i'
- );
- this._shortMonthsParse[i] = new RegExp(
- '^' + this.monthsShort(mom, '').replace('.', '') + '$',
- 'i'
- );
- }
- if (!strict && !this._monthsParse[i]) {
- regex =
- '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
- this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
- }
-
- if (
- strict &&
- format === 'MMMM' &&
- this._longMonthsParse[i].test(monthName)
- ) {
- return i;
- } else if (
- strict &&
- format === 'MMM' &&
- this._shortMonthsParse[i].test(monthName)
- ) {
- return i;
- } else if (!strict && this._monthsParse[i].test(monthName)) {
- return i;
- }
- }
- }
-
-
-
- function setMonth(mom, value) {
- var dayOfMonth;
-
- if (!mom.isValid()) {
-
- return mom;
- }
-
- if (typeof value === 'string') {
- if (/^\d+$/.test(value)) {
- value = toInt(value);
- } else {
- value = mom.localeData().monthsParse(value);
-
- if (!isNumber(value)) {
- return mom;
- }
- }
- }
-
- dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
- return mom;
- }
-
- function getSetMonth(value) {
- if (value != null) {
- setMonth(this, value);
- hooks.updateOffset(this, true);
- return this;
- } else {
- return get(this, 'Month');
- }
- }
-
- function getDaysInMonth() {
- return daysInMonth(this.year(), this.month());
- }
-
- function monthsShortRegex(isStrict) {
- if (this._monthsParseExact) {
- if (!hasOwnProp(this, '_monthsRegex')) {
- computeMonthsParse.call(this);
- }
- if (isStrict) {
- return this._monthsShortStrictRegex;
- } else {
- return this._monthsShortRegex;
- }
- } else {
- if (!hasOwnProp(this, '_monthsShortRegex')) {
- this._monthsShortRegex = defaultMonthsShortRegex;
- }
- return this._monthsShortStrictRegex && isStrict
- ? this._monthsShortStrictRegex
- : this._monthsShortRegex;
- }
- }
-
- function monthsRegex(isStrict) {
- if (this._monthsParseExact) {
- if (!hasOwnProp(this, '_monthsRegex')) {
- computeMonthsParse.call(this);
- }
- if (isStrict) {
- return this._monthsStrictRegex;
- } else {
- return this._monthsRegex;
- }
- } else {
- if (!hasOwnProp(this, '_monthsRegex')) {
- this._monthsRegex = defaultMonthsRegex;
- }
- return this._monthsStrictRegex && isStrict
- ? this._monthsStrictRegex
- : this._monthsRegex;
- }
- }
-
- function computeMonthsParse() {
- function cmpLenRev(a, b) {
- return b.length - a.length;
- }
-
- var shortPieces = [],
- longPieces = [],
- mixedPieces = [],
- i,
- mom;
- for (i = 0; i < 12; i++) {
-
- mom = createUTC([2000, i]);
- shortPieces.push(this.monthsShort(mom, ''));
- longPieces.push(this.months(mom, ''));
- mixedPieces.push(this.months(mom, ''));
- mixedPieces.push(this.monthsShort(mom, ''));
- }
-
-
- shortPieces.sort(cmpLenRev);
- longPieces.sort(cmpLenRev);
- mixedPieces.sort(cmpLenRev);
- for (i = 0; i < 12; i++) {
- shortPieces[i] = regexEscape(shortPieces[i]);
- longPieces[i] = regexEscape(longPieces[i]);
- }
- for (i = 0; i < 24; i++) {
- mixedPieces[i] = regexEscape(mixedPieces[i]);
- }
-
- this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
- this._monthsShortRegex = this._monthsRegex;
- this._monthsStrictRegex = new RegExp(
- '^(' + longPieces.join('|') + ')',
- 'i'
- );
- this._monthsShortStrictRegex = new RegExp(
- '^(' + shortPieces.join('|') + ')',
- 'i'
- );
- }
-
-
-
- addFormatToken('Y', 0, 0, function () {
- var y = this.year();
- return y <= 9999 ? zeroFill(y, 4) : '+' + y;
- });
-
- addFormatToken(0, ['YY', 2], 0, function () {
- return this.year() % 100;
- });
-
- addFormatToken(0, ['YYYY', 4], 0, 'year');
- addFormatToken(0, ['YYYYY', 5], 0, 'year');
- addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
-
-
-
- addUnitAlias('year', 'y');
-
-
-
- addUnitPriority('year', 1);
-
-
-
- addRegexToken('Y', matchSigned);
- addRegexToken('YY', match1to2, match2);
- addRegexToken('YYYY', match1to4, match4);
- addRegexToken('YYYYY', match1to6, match6);
- addRegexToken('YYYYYY', match1to6, match6);
-
- addParseToken(['YYYYY', 'YYYYYY'], YEAR);
- addParseToken('YYYY', function (input, array) {
- array[YEAR] =
- input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
- });
- addParseToken('YY', function (input, array) {
- array[YEAR] = hooks.parseTwoDigitYear(input);
- });
- addParseToken('Y', function (input, array) {
- array[YEAR] = parseInt(input, 10);
- });
-
-
-
- function daysInYear(year) {
- return isLeapYear(year) ? 366 : 365;
- }
-
-
-
- hooks.parseTwoDigitYear = function (input) {
- return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
- };
-
-
-
- var getSetYear = makeGetSet('FullYear', true);
-
- function getIsLeapYear() {
- return isLeapYear(this.year());
- }
-
- function createDate(y, m, d, h, M, s, ms) {
-
-
- var date;
-
- if (y < 100 && y >= 0) {
-
- date = new Date(y + 400, m, d, h, M, s, ms);
- if (isFinite(date.getFullYear())) {
- date.setFullYear(y);
- }
- } else {
- date = new Date(y, m, d, h, M, s, ms);
- }
-
- return date;
- }
-
- function createUTCDate(y) {
- var date, args;
-
- if (y < 100 && y >= 0) {
- args = Array.prototype.slice.call(arguments);
-
- args[0] = y + 400;
- date = new Date(Date.UTC.apply(null, args));
- if (isFinite(date.getUTCFullYear())) {
- date.setUTCFullYear(y);
- }
- } else {
- date = new Date(Date.UTC.apply(null, arguments));
- }
-
- return date;
- }
-
-
- function firstWeekOffset(year, dow, doy) {
- var
- fwd = 7 + dow - doy,
-
- fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
-
- return -fwdlw + fwd - 1;
- }
-
-
- function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
- var localWeekday = (7 + weekday - dow) % 7,
- weekOffset = firstWeekOffset(year, dow, doy),
- dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
- resYear,
- resDayOfYear;
-
- if (dayOfYear <= 0) {
- resYear = year - 1;
- resDayOfYear = daysInYear(resYear) + dayOfYear;
- } else if (dayOfYear > daysInYear(year)) {
- resYear = year + 1;
- resDayOfYear = dayOfYear - daysInYear(year);
- } else {
- resYear = year;
- resDayOfYear = dayOfYear;
- }
-
- return {
- year: resYear,
- dayOfYear: resDayOfYear,
- };
- }
-
- function weekOfYear(mom, dow, doy) {
- var weekOffset = firstWeekOffset(mom.year(), dow, doy),
- week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
- resWeek,
- resYear;
-
- if (week < 1) {
- resYear = mom.year() - 1;
- resWeek = week + weeksInYear(resYear, dow, doy);
- } else if (week > weeksInYear(mom.year(), dow, doy)) {
- resWeek = week - weeksInYear(mom.year(), dow, doy);
- resYear = mom.year() + 1;
- } else {
- resYear = mom.year();
- resWeek = week;
- }
-
- return {
- week: resWeek,
- year: resYear,
- };
- }
-
- function weeksInYear(year, dow, doy) {
- var weekOffset = firstWeekOffset(year, dow, doy),
- weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
- return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
- }
-
-
-
- addFormatToken('w', ['ww', 2], 'wo', 'week');
- addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
-
-
-
- addUnitAlias('week', 'w');
- addUnitAlias('isoWeek', 'W');
-
-
-
- addUnitPriority('week', 5);
- addUnitPriority('isoWeek', 5);
-
-
-
- addRegexToken('w', match1to2);
- addRegexToken('ww', match1to2, match2);
- addRegexToken('W', match1to2);
- addRegexToken('WW', match1to2, match2);
-
- addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
- input,
- week,
- config,
- token
- ) {
- week[token.substr(0, 1)] = toInt(input);
- });
-
-
-
-
-
- function localeWeek(mom) {
- return weekOfYear(mom, this._week.dow, this._week.doy).week;
- }
-
- var defaultLocaleWeek = {
- dow: 0,
- doy: 6,
- };
-
- function localeFirstDayOfWeek() {
- return this._week.dow;
- }
-
- function localeFirstDayOfYear() {
- return this._week.doy;
- }
-
-
-
- function getSetWeek(input) {
- var week = this.localeData().week(this);
- return input == null ? week : this.add((input - week) * 7, 'd');
- }
-
- function getSetISOWeek(input) {
- var week = weekOfYear(this, 1, 4).week;
- return input == null ? week : this.add((input - week) * 7, 'd');
- }
-
-
-
- addFormatToken('d', 0, 'do', 'day');
-
- addFormatToken('dd', 0, 0, function (format) {
- return this.localeData().weekdaysMin(this, format);
- });
-
- addFormatToken('ddd', 0, 0, function (format) {
- return this.localeData().weekdaysShort(this, format);
- });
-
- addFormatToken('dddd', 0, 0, function (format) {
- return this.localeData().weekdays(this, format);
- });
-
- addFormatToken('e', 0, 0, 'weekday');
- addFormatToken('E', 0, 0, 'isoWeekday');
-
-
-
- addUnitAlias('day', 'd');
- addUnitAlias('weekday', 'e');
- addUnitAlias('isoWeekday', 'E');
-
-
- addUnitPriority('day', 11);
- addUnitPriority('weekday', 11);
- addUnitPriority('isoWeekday', 11);
-
-
-
- addRegexToken('d', match1to2);
- addRegexToken('e', match1to2);
- addRegexToken('E', match1to2);
- addRegexToken('dd', function (isStrict, locale) {
- return locale.weekdaysMinRegex(isStrict);
- });
- addRegexToken('ddd', function (isStrict, locale) {
- return locale.weekdaysShortRegex(isStrict);
- });
- addRegexToken('dddd', function (isStrict, locale) {
- return locale.weekdaysRegex(isStrict);
- });
-
- addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
- var weekday = config._locale.weekdaysParse(input, token, config._strict);
-
- if (weekday != null) {
- week.d = weekday;
- } else {
- getParsingFlags(config).invalidWeekday = input;
- }
- });
-
- addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
- week[token] = toInt(input);
- });
-
-
-
- function parseWeekday(input, locale) {
- if (typeof input !== 'string') {
- return input;
- }
-
- if (!isNaN(input)) {
- return parseInt(input, 10);
- }
-
- input = locale.weekdaysParse(input);
- if (typeof input === 'number') {
- return input;
- }
-
- return null;
- }
-
- function parseIsoWeekday(input, locale) {
- if (typeof input === 'string') {
- return locale.weekdaysParse(input) % 7 || 7;
- }
- return isNaN(input) ? null : input;
- }
-
-
- function shiftWeekdays(ws, n) {
- return ws.slice(n, 7).concat(ws.slice(0, n));
- }
-
- var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- defaultWeekdaysRegex = matchWord,
- defaultWeekdaysShortRegex = matchWord,
- defaultWeekdaysMinRegex = matchWord;
-
- function localeWeekdays(m, format) {
- var weekdays = isArray(this._weekdays)
- ? this._weekdays
- : this._weekdays[
- m && m !== true && this._weekdays.isFormat.test(format)
- ? 'format'
- : 'standalone'
- ];
- return m === true
- ? shiftWeekdays(weekdays, this._week.dow)
- : m
- ? weekdays[m.day()]
- : weekdays;
- }
-
- function localeWeekdaysShort(m) {
- return m === true
- ? shiftWeekdays(this._weekdaysShort, this._week.dow)
- : m
- ? this._weekdaysShort[m.day()]
- : this._weekdaysShort;
- }
-
- function localeWeekdaysMin(m) {
- return m === true
- ? shiftWeekdays(this._weekdaysMin, this._week.dow)
- : m
- ? this._weekdaysMin[m.day()]
- : this._weekdaysMin;
- }
-
- function handleStrictParse$1(weekdayName, format, strict) {
- var i,
- ii,
- mom,
- llc = weekdayName.toLocaleLowerCase();
- if (!this._weekdaysParse) {
- this._weekdaysParse = [];
- this._shortWeekdaysParse = [];
- this._minWeekdaysParse = [];
-
- for (i = 0; i < 7; ++i) {
- mom = createUTC([2000, 1]).day(i);
- this._minWeekdaysParse[i] = this.weekdaysMin(
- mom,
- ''
- ).toLocaleLowerCase();
- this._shortWeekdaysParse[i] = this.weekdaysShort(
- mom,
- ''
- ).toLocaleLowerCase();
- this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
- }
- }
-
- if (strict) {
- if (format === 'dddd') {
- ii = indexOf.call(this._weekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else if (format === 'ddd') {
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._minWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- }
- } else {
- if (format === 'dddd') {
- ii = indexOf.call(this._weekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._minWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else if (format === 'ddd') {
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._weekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._minWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._minWeekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._weekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- }
- }
- }
-
- function localeWeekdaysParse(weekdayName, format, strict) {
- var i, mom, regex;
-
- if (this._weekdaysParseExact) {
- return handleStrictParse$1.call(this, weekdayName, format, strict);
- }
-
- if (!this._weekdaysParse) {
- this._weekdaysParse = [];
- this._minWeekdaysParse = [];
- this._shortWeekdaysParse = [];
- this._fullWeekdaysParse = [];
- }
-
- for (i = 0; i < 7; i++) {
-
-
- mom = createUTC([2000, 1]).day(i);
- if (strict && !this._fullWeekdaysParse[i]) {
- this._fullWeekdaysParse[i] = new RegExp(
- '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
- 'i'
- );
- this._shortWeekdaysParse[i] = new RegExp(
- '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
- 'i'
- );
- this._minWeekdaysParse[i] = new RegExp(
- '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
- 'i'
- );
- }
- if (!this._weekdaysParse[i]) {
- regex =
- '^' +
- this.weekdays(mom, '') +
- '|^' +
- this.weekdaysShort(mom, '') +
- '|^' +
- this.weekdaysMin(mom, '');
- this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
- }
-
- if (
- strict &&
- format === 'dddd' &&
- this._fullWeekdaysParse[i].test(weekdayName)
- ) {
- return i;
- } else if (
- strict &&
- format === 'ddd' &&
- this._shortWeekdaysParse[i].test(weekdayName)
- ) {
- return i;
- } else if (
- strict &&
- format === 'dd' &&
- this._minWeekdaysParse[i].test(weekdayName)
- ) {
- return i;
- } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
- return i;
- }
- }
- }
-
-
-
- function getSetDayOfWeek(input) {
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
- if (input != null) {
- input = parseWeekday(input, this.localeData());
- return this.add(input - day, 'd');
- } else {
- return day;
- }
- }
-
- function getSetLocaleDayOfWeek(input) {
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
- return input == null ? weekday : this.add(input - weekday, 'd');
- }
-
- function getSetISODayOfWeek(input) {
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
-
-
-
-
-
- if (input != null) {
- var weekday = parseIsoWeekday(input, this.localeData());
- return this.day(this.day() % 7 ? weekday : weekday - 7);
- } else {
- return this.day() || 7;
- }
- }
-
- function weekdaysRegex(isStrict) {
- if (this._weekdaysParseExact) {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- computeWeekdaysParse.call(this);
- }
- if (isStrict) {
- return this._weekdaysStrictRegex;
- } else {
- return this._weekdaysRegex;
- }
- } else {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- this._weekdaysRegex = defaultWeekdaysRegex;
- }
- return this._weekdaysStrictRegex && isStrict
- ? this._weekdaysStrictRegex
- : this._weekdaysRegex;
- }
- }
-
- function weekdaysShortRegex(isStrict) {
- if (this._weekdaysParseExact) {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- computeWeekdaysParse.call(this);
- }
- if (isStrict) {
- return this._weekdaysShortStrictRegex;
- } else {
- return this._weekdaysShortRegex;
- }
- } else {
- if (!hasOwnProp(this, '_weekdaysShortRegex')) {
- this._weekdaysShortRegex = defaultWeekdaysShortRegex;
- }
- return this._weekdaysShortStrictRegex && isStrict
- ? this._weekdaysShortStrictRegex
- : this._weekdaysShortRegex;
- }
- }
-
- function weekdaysMinRegex(isStrict) {
- if (this._weekdaysParseExact) {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- computeWeekdaysParse.call(this);
- }
- if (isStrict) {
- return this._weekdaysMinStrictRegex;
- } else {
- return this._weekdaysMinRegex;
- }
- } else {
- if (!hasOwnProp(this, '_weekdaysMinRegex')) {
- this._weekdaysMinRegex = defaultWeekdaysMinRegex;
- }
- return this._weekdaysMinStrictRegex && isStrict
- ? this._weekdaysMinStrictRegex
- : this._weekdaysMinRegex;
- }
- }
-
- function computeWeekdaysParse() {
- function cmpLenRev(a, b) {
- return b.length - a.length;
- }
-
- var minPieces = [],
- shortPieces = [],
- longPieces = [],
- mixedPieces = [],
- i,
- mom,
- minp,
- shortp,
- longp;
- for (i = 0; i < 7; i++) {
-
- mom = createUTC([2000, 1]).day(i);
- minp = regexEscape(this.weekdaysMin(mom, ''));
- shortp = regexEscape(this.weekdaysShort(mom, ''));
- longp = regexEscape(this.weekdays(mom, ''));
- minPieces.push(minp);
- shortPieces.push(shortp);
- longPieces.push(longp);
- mixedPieces.push(minp);
- mixedPieces.push(shortp);
- mixedPieces.push(longp);
- }
-
-
- minPieces.sort(cmpLenRev);
- shortPieces.sort(cmpLenRev);
- longPieces.sort(cmpLenRev);
- mixedPieces.sort(cmpLenRev);
-
- this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
- this._weekdaysShortRegex = this._weekdaysRegex;
- this._weekdaysMinRegex = this._weekdaysRegex;
-
- this._weekdaysStrictRegex = new RegExp(
- '^(' + longPieces.join('|') + ')',
- 'i'
- );
- this._weekdaysShortStrictRegex = new RegExp(
- '^(' + shortPieces.join('|') + ')',
- 'i'
- );
- this._weekdaysMinStrictRegex = new RegExp(
- '^(' + minPieces.join('|') + ')',
- 'i'
- );
- }
-
-
-
- function hFormat() {
- return this.hours() % 12 || 12;
- }
-
- function kFormat() {
- return this.hours() || 24;
- }
-
- addFormatToken('H', ['HH', 2], 0, 'hour');
- addFormatToken('h', ['hh', 2], 0, hFormat);
- addFormatToken('k', ['kk', 2], 0, kFormat);
-
- addFormatToken('hmm', 0, 0, function () {
- return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
- });
-
- addFormatToken('hmmss', 0, 0, function () {
- return (
- '' +
- hFormat.apply(this) +
- zeroFill(this.minutes(), 2) +
- zeroFill(this.seconds(), 2)
- );
- });
-
- addFormatToken('Hmm', 0, 0, function () {
- return '' + this.hours() + zeroFill(this.minutes(), 2);
- });
-
- addFormatToken('Hmmss', 0, 0, function () {
- return (
- '' +
- this.hours() +
- zeroFill(this.minutes(), 2) +
- zeroFill(this.seconds(), 2)
- );
- });
-
- function meridiem(token, lowercase) {
- addFormatToken(token, 0, 0, function () {
- return this.localeData().meridiem(
- this.hours(),
- this.minutes(),
- lowercase
- );
- });
- }
-
- meridiem('a', true);
- meridiem('A', false);
-
-
-
- addUnitAlias('hour', 'h');
-
-
- addUnitPriority('hour', 13);
-
-
-
- function matchMeridiem(isStrict, locale) {
- return locale._meridiemParse;
- }
-
- addRegexToken('a', matchMeridiem);
- addRegexToken('A', matchMeridiem);
- addRegexToken('H', match1to2);
- addRegexToken('h', match1to2);
- addRegexToken('k', match1to2);
- addRegexToken('HH', match1to2, match2);
- addRegexToken('hh', match1to2, match2);
- addRegexToken('kk', match1to2, match2);
-
- addRegexToken('hmm', match3to4);
- addRegexToken('hmmss', match5to6);
- addRegexToken('Hmm', match3to4);
- addRegexToken('Hmmss', match5to6);
-
- addParseToken(['H', 'HH'], HOUR);
- addParseToken(['k', 'kk'], function (input, array, config) {
- var kInput = toInt(input);
- array[HOUR] = kInput === 24 ? 0 : kInput;
- });
- addParseToken(['a', 'A'], function (input, array, config) {
- config._isPm = config._locale.isPM(input);
- config._meridiem = input;
- });
- addParseToken(['h', 'hh'], function (input, array, config) {
- array[HOUR] = toInt(input);
- getParsingFlags(config).bigHour = true;
- });
- addParseToken('hmm', function (input, array, config) {
- var pos = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos));
- array[MINUTE] = toInt(input.substr(pos));
- getParsingFlags(config).bigHour = true;
- });
- addParseToken('hmmss', function (input, array, config) {
- var pos1 = input.length - 4,
- pos2 = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos1));
- array[MINUTE] = toInt(input.substr(pos1, 2));
- array[SECOND] = toInt(input.substr(pos2));
- getParsingFlags(config).bigHour = true;
- });
- addParseToken('Hmm', function (input, array, config) {
- var pos = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos));
- array[MINUTE] = toInt(input.substr(pos));
- });
- addParseToken('Hmmss', function (input, array, config) {
- var pos1 = input.length - 4,
- pos2 = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos1));
- array[MINUTE] = toInt(input.substr(pos1, 2));
- array[SECOND] = toInt(input.substr(pos2));
- });
-
-
-
- function localeIsPM(input) {
-
-
- return (input + '').toLowerCase().charAt(0) === 'p';
- }
-
- var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
-
-
-
-
- getSetHour = makeGetSet('Hours', true);
-
- function localeMeridiem(hours, minutes, isLower) {
- if (hours > 11) {
- return isLower ? 'pm' : 'PM';
- } else {
- return isLower ? 'am' : 'AM';
- }
- }
-
- var baseConfig = {
- calendar: defaultCalendar,
- longDateFormat: defaultLongDateFormat,
- invalidDate: defaultInvalidDate,
- ordinal: defaultOrdinal,
- dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
- relativeTime: defaultRelativeTime,
-
- months: defaultLocaleMonths,
- monthsShort: defaultLocaleMonthsShort,
-
- week: defaultLocaleWeek,
-
- weekdays: defaultLocaleWeekdays,
- weekdaysMin: defaultLocaleWeekdaysMin,
- weekdaysShort: defaultLocaleWeekdaysShort,
-
- meridiemParse: defaultLocaleMeridiemParse,
- };
-
-
- var locales = {},
- localeFamilies = {},
- globalLocale;
-
- function commonPrefix(arr1, arr2) {
- var i,
- minl = Math.min(arr1.length, arr2.length);
- for (i = 0; i < minl; i += 1) {
- if (arr1[i] !== arr2[i]) {
- return i;
- }
- }
- return minl;
- }
-
- function normalizeLocale(key) {
- return key ? key.toLowerCase().replace('_', '-') : key;
- }
-
-
-
-
- function chooseLocale(names) {
- var i = 0,
- j,
- next,
- locale,
- split;
-
- while (i < names.length) {
- split = normalizeLocale(names[i]).split('-');
- j = split.length;
- next = normalizeLocale(names[i + 1]);
- next = next ? next.split('-') : null;
- while (j > 0) {
- locale = loadLocale(split.slice(0, j).join('-'));
- if (locale) {
- return locale;
- }
- if (
- next &&
- next.length >= j &&
- commonPrefix(split, next) >= j - 1
- ) {
-
- break;
- }
- j--;
- }
- i++;
- }
- return globalLocale;
- }
-
- function loadLocale(name) {
- var oldLocale = null,
- aliasedRequire;
-
- if (
- locales[name] === undefined &&
- 'object' !== 'undefined' &&
- module &&
- module.exports
- ) {
- try {
- oldLocale = globalLocale._abbr;
- aliasedRequire = commonjsRequire;
- aliasedRequire('./locale/' + name);
- getSetGlobalLocale(oldLocale);
- } catch (e) {
-
-
- locales[name] = null;
- }
- }
- return locales[name];
- }
-
-
-
-
- function getSetGlobalLocale(key, values) {
- var data;
- if (key) {
- if (isUndefined(values)) {
- data = getLocale(key);
- } else {
- data = defineLocale(key, values);
- }
-
- if (data) {
-
- globalLocale = data;
- } else {
- if (typeof console !== 'undefined' && console.warn) {
-
- console.warn(
- 'Locale ' + key + ' not found. Did you forget to load it?'
- );
- }
- }
- }
-
- return globalLocale._abbr;
- }
-
- function defineLocale(name, config) {
- if (config !== null) {
- var locale,
- parentConfig = baseConfig;
- config.abbr = name;
- if (locales[name] != null) {
- deprecateSimple(
- 'defineLocaleOverride',
- 'use moment.updateLocale(localeName, config) to change ' +
- 'an existing locale. moment.defineLocale(localeName, ' +
- 'config) should only be used for creating a new locale ' +
- 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
- );
- parentConfig = locales[name]._config;
- } else if (config.parentLocale != null) {
- if (locales[config.parentLocale] != null) {
- parentConfig = locales[config.parentLocale]._config;
- } else {
- locale = loadLocale(config.parentLocale);
- if (locale != null) {
- parentConfig = locale._config;
- } else {
- if (!localeFamilies[config.parentLocale]) {
- localeFamilies[config.parentLocale] = [];
- }
- localeFamilies[config.parentLocale].push({
- name: name,
- config: config,
- });
- return null;
- }
- }
- }
- locales[name] = new Locale(mergeConfigs(parentConfig, config));
-
- if (localeFamilies[name]) {
- localeFamilies[name].forEach(function (x) {
- defineLocale(x.name, x.config);
- });
- }
-
-
-
-
- getSetGlobalLocale(name);
-
- return locales[name];
- } else {
-
- delete locales[name];
- return null;
- }
- }
-
- function updateLocale(name, config) {
- if (config != null) {
- var locale,
- tmpLocale,
- parentConfig = baseConfig;
-
- if (locales[name] != null && locales[name].parentLocale != null) {
-
- locales[name].set(mergeConfigs(locales[name]._config, config));
- } else {
-
- tmpLocale = loadLocale(name);
- if (tmpLocale != null) {
- parentConfig = tmpLocale._config;
- }
- config = mergeConfigs(parentConfig, config);
- if (tmpLocale == null) {
-
-
-
- config.abbr = name;
- }
- locale = new Locale(config);
- locale.parentLocale = locales[name];
- locales[name] = locale;
- }
-
-
- getSetGlobalLocale(name);
- } else {
-
- if (locales[name] != null) {
- if (locales[name].parentLocale != null) {
- locales[name] = locales[name].parentLocale;
- if (name === getSetGlobalLocale()) {
- getSetGlobalLocale(name);
- }
- } else if (locales[name] != null) {
- delete locales[name];
- }
- }
- }
- return locales[name];
- }
-
-
- function getLocale(key) {
- var locale;
-
- if (key && key._locale && key._locale._abbr) {
- key = key._locale._abbr;
- }
-
- if (!key) {
- return globalLocale;
- }
-
- if (!isArray(key)) {
-
- locale = loadLocale(key);
- if (locale) {
- return locale;
- }
- key = [key];
- }
-
- return chooseLocale(key);
- }
-
- function listLocales() {
- return keys(locales);
- }
-
- function checkOverflow(m) {
- var overflow,
- a = m._a;
-
- if (a && getParsingFlags(m).overflow === -2) {
- overflow =
- a[MONTH] < 0 || a[MONTH] > 11
- ? MONTH
- : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
- ? DATE
- : a[HOUR] < 0 ||
- a[HOUR] > 24 ||
- (a[HOUR] === 24 &&
- (a[MINUTE] !== 0 ||
- a[SECOND] !== 0 ||
- a[MILLISECOND] !== 0))
- ? HOUR
- : a[MINUTE] < 0 || a[MINUTE] > 59
- ? MINUTE
- : a[SECOND] < 0 || a[SECOND] > 59
- ? SECOND
- : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
- ? MILLISECOND
- : -1;
-
- if (
- getParsingFlags(m)._overflowDayOfYear &&
- (overflow < YEAR || overflow > DATE)
- ) {
- overflow = DATE;
- }
- if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
- overflow = WEEK;
- }
- if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
- overflow = WEEKDAY;
- }
-
- getParsingFlags(m).overflow = overflow;
- }
-
- return m;
- }
-
-
-
- var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
- basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
- tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
- isoDates = [
- ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
- ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
- ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
- ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
- ['YYYY-DDD', /\d{4}-\d{3}/],
- ['YYYY-MM', /\d{4}-\d\d/, false],
- ['YYYYYYMMDD', /[+-]\d{10}/],
- ['YYYYMMDD', /\d{8}/],
- ['GGGG[W]WWE', /\d{4}W\d{3}/],
- ['GGGG[W]WW', /\d{4}W\d{2}/, false],
- ['YYYYDDD', /\d{7}/],
- ['YYYYMM', /\d{6}/, false],
- ['YYYY', /\d{4}/, false],
- ],
-
- isoTimes = [
- ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
- ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
- ['HH:mm:ss', /\d\d:\d\d:\d\d/],
- ['HH:mm', /\d\d:\d\d/],
- ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
- ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
- ['HHmmss', /\d\d\d\d\d\d/],
- ['HHmm', /\d\d\d\d/],
- ['HH', /\d\d/],
- ],
- aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
-
- rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
- obsOffsets = {
- UT: 0,
- GMT: 0,
- EDT: -4 * 60,
- EST: -5 * 60,
- CDT: -5 * 60,
- CST: -6 * 60,
- MDT: -6 * 60,
- MST: -7 * 60,
- PDT: -7 * 60,
- PST: -8 * 60,
- };
-
-
- function configFromISO(config) {
- var i,
- l,
- string = config._i,
- match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
- allowTime,
- dateFormat,
- timeFormat,
- tzFormat;
-
- if (match) {
- getParsingFlags(config).iso = true;
-
- for (i = 0, l = isoDates.length; i < l; i++) {
- if (isoDates[i][1].exec(match[1])) {
- dateFormat = isoDates[i][0];
- allowTime = isoDates[i][2] !== false;
- break;
- }
- }
- if (dateFormat == null) {
- config._isValid = false;
- return;
- }
- if (match[3]) {
- for (i = 0, l = isoTimes.length; i < l; i++) {
- if (isoTimes[i][1].exec(match[3])) {
-
- timeFormat = (match[2] || ' ') + isoTimes[i][0];
- break;
- }
- }
- if (timeFormat == null) {
- config._isValid = false;
- return;
- }
- }
- if (!allowTime && timeFormat != null) {
- config._isValid = false;
- return;
- }
- if (match[4]) {
- if (tzRegex.exec(match[4])) {
- tzFormat = 'Z';
- } else {
- config._isValid = false;
- return;
- }
- }
- config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
- configFromStringAndFormat(config);
- } else {
- config._isValid = false;
- }
- }
-
- function extractFromRFC2822Strings(
- yearStr,
- monthStr,
- dayStr,
- hourStr,
- minuteStr,
- secondStr
- ) {
- var result = [
- untruncateYear(yearStr),
- defaultLocaleMonthsShort.indexOf(monthStr),
- parseInt(dayStr, 10),
- parseInt(hourStr, 10),
- parseInt(minuteStr, 10),
- ];
-
- if (secondStr) {
- result.push(parseInt(secondStr, 10));
- }
-
- return result;
- }
-
- function untruncateYear(yearStr) {
- var year = parseInt(yearStr, 10);
- if (year <= 49) {
- return 2000 + year;
- } else if (year <= 999) {
- return 1900 + year;
- }
- return year;
- }
-
- function preprocessRFC2822(s) {
-
- return s
- .replace(/\([^)]*\)|[\n\t]/g, ' ')
- .replace(/(\s\s+)/g, ' ')
- .replace(/^\s\s*/, '')
- .replace(/\s\s*$/, '');
- }
-
- function checkWeekday(weekdayStr, parsedInput, config) {
- if (weekdayStr) {
-
- var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
- weekdayActual = new Date(
- parsedInput[0],
- parsedInput[1],
- parsedInput[2]
- ).getDay();
- if (weekdayProvided !== weekdayActual) {
- getParsingFlags(config).weekdayMismatch = true;
- config._isValid = false;
- return false;
- }
- }
- return true;
- }
-
- function calculateOffset(obsOffset, militaryOffset, numOffset) {
- if (obsOffset) {
- return obsOffsets[obsOffset];
- } else if (militaryOffset) {
-
- return 0;
- } else {
- var hm = parseInt(numOffset, 10),
- m = hm % 100,
- h = (hm - m) / 100;
- return h * 60 + m;
- }
- }
-
-
- function configFromRFC2822(config) {
- var match = rfc2822.exec(preprocessRFC2822(config._i)),
- parsedArray;
- if (match) {
- parsedArray = extractFromRFC2822Strings(
- match[4],
- match[3],
- match[2],
- match[5],
- match[6],
- match[7]
- );
- if (!checkWeekday(match[1], parsedArray, config)) {
- return;
- }
-
- config._a = parsedArray;
- config._tzm = calculateOffset(match[8], match[9], match[10]);
-
- config._d = createUTCDate.apply(null, config._a);
- config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
-
- getParsingFlags(config).rfc2822 = true;
- } else {
- config._isValid = false;
- }
- }
-
-
- function configFromString(config) {
- var matched = aspNetJsonRegex.exec(config._i);
- if (matched !== null) {
- config._d = new Date(+matched[1]);
- return;
- }
-
- configFromISO(config);
- if (config._isValid === false) {
- delete config._isValid;
- } else {
- return;
- }
-
- configFromRFC2822(config);
- if (config._isValid === false) {
- delete config._isValid;
- } else {
- return;
- }
-
- if (config._strict) {
- config._isValid = false;
- } else {
-
- hooks.createFromInputFallback(config);
- }
- }
-
- hooks.createFromInputFallback = deprecate(
- 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
- 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
- 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
- function (config) {
- config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
- }
- );
-
-
- function defaults(a, b, c) {
- if (a != null) {
- return a;
- }
- if (b != null) {
- return b;
- }
- return c;
- }
-
- function currentDateArray(config) {
-
- var nowValue = new Date(hooks.now());
- if (config._useUTC) {
- return [
- nowValue.getUTCFullYear(),
- nowValue.getUTCMonth(),
- nowValue.getUTCDate(),
- ];
- }
- return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
- }
-
-
-
-
-
- function configFromArray(config) {
- var i,
- date,
- input = [],
- currentDate,
- expectedWeekday,
- yearToUse;
-
- if (config._d) {
- return;
- }
-
- currentDate = currentDateArray(config);
-
-
- if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
- dayOfYearFromWeekInfo(config);
- }
-
-
- if (config._dayOfYear != null) {
- yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
-
- if (
- config._dayOfYear > daysInYear(yearToUse) ||
- config._dayOfYear === 0
- ) {
- getParsingFlags(config)._overflowDayOfYear = true;
- }
-
- date = createUTCDate(yearToUse, 0, config._dayOfYear);
- config._a[MONTH] = date.getUTCMonth();
- config._a[DATE] = date.getUTCDate();
- }
-
-
-
-
-
-
- for (i = 0; i < 3 && config._a[i] == null; ++i) {
- config._a[i] = input[i] = currentDate[i];
- }
-
-
- for (; i < 7; i++) {
- config._a[i] = input[i] =
- config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
- }
-
-
- if (
- config._a[HOUR] === 24 &&
- config._a[MINUTE] === 0 &&
- config._a[SECOND] === 0 &&
- config._a[MILLISECOND] === 0
- ) {
- config._nextDay = true;
- config._a[HOUR] = 0;
- }
-
- config._d = (config._useUTC ? createUTCDate : createDate).apply(
- null,
- input
- );
- expectedWeekday = config._useUTC
- ? config._d.getUTCDay()
- : config._d.getDay();
-
-
-
- if (config._tzm != null) {
- config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
- }
-
- if (config._nextDay) {
- config._a[HOUR] = 24;
- }
-
-
- if (
- config._w &&
- typeof config._w.d !== 'undefined' &&
- config._w.d !== expectedWeekday
- ) {
- getParsingFlags(config).weekdayMismatch = true;
- }
- }
-
- function dayOfYearFromWeekInfo(config) {
- var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
-
- w = config._w;
- if (w.GG != null || w.W != null || w.E != null) {
- dow = 1;
- doy = 4;
-
-
-
-
-
- weekYear = defaults(
- w.GG,
- config._a[YEAR],
- weekOfYear(createLocal(), 1, 4).year
- );
- week = defaults(w.W, 1);
- weekday = defaults(w.E, 1);
- if (weekday < 1 || weekday > 7) {
- weekdayOverflow = true;
- }
- } else {
- dow = config._locale._week.dow;
- doy = config._locale._week.doy;
-
- curWeek = weekOfYear(createLocal(), dow, doy);
-
- weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
-
-
- week = defaults(w.w, curWeek.week);
-
- if (w.d != null) {
-
- weekday = w.d;
- if (weekday < 0 || weekday > 6) {
- weekdayOverflow = true;
- }
- } else if (w.e != null) {
-
- weekday = w.e + dow;
- if (w.e < 0 || w.e > 6) {
- weekdayOverflow = true;
- }
- } else {
-
- weekday = dow;
- }
- }
- if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
- getParsingFlags(config)._overflowWeeks = true;
- } else if (weekdayOverflow != null) {
- getParsingFlags(config)._overflowWeekday = true;
- } else {
- temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
- config._a[YEAR] = temp.year;
- config._dayOfYear = temp.dayOfYear;
- }
- }
-
-
- hooks.ISO_8601 = function () {};
-
-
- hooks.RFC_2822 = function () {};
-
-
- function configFromStringAndFormat(config) {
-
- if (config._f === hooks.ISO_8601) {
- configFromISO(config);
- return;
- }
- if (config._f === hooks.RFC_2822) {
- configFromRFC2822(config);
- return;
- }
- config._a = [];
- getParsingFlags(config).empty = true;
-
-
- var string = '' + config._i,
- i,
- parsedInput,
- tokens,
- token,
- skipped,
- stringLength = string.length,
- totalParsedInputLength = 0,
- era;
-
- tokens =
- expandFormat(config._f, config._locale).match(formattingTokens) || [];
-
- for (i = 0; i < tokens.length; i++) {
- token = tokens[i];
- parsedInput = (string.match(getParseRegexForToken(token, config)) ||
- [])[0];
- if (parsedInput) {
- skipped = string.substr(0, string.indexOf(parsedInput));
- if (skipped.length > 0) {
- getParsingFlags(config).unusedInput.push(skipped);
- }
- string = string.slice(
- string.indexOf(parsedInput) + parsedInput.length
- );
- totalParsedInputLength += parsedInput.length;
- }
-
- if (formatTokenFunctions[token]) {
- if (parsedInput) {
- getParsingFlags(config).empty = false;
- } else {
- getParsingFlags(config).unusedTokens.push(token);
- }
- addTimeToArrayFromToken(token, parsedInput, config);
- } else if (config._strict && !parsedInput) {
- getParsingFlags(config).unusedTokens.push(token);
- }
- }
-
-
- getParsingFlags(config).charsLeftOver =
- stringLength - totalParsedInputLength;
- if (string.length > 0) {
- getParsingFlags(config).unusedInput.push(string);
- }
-
-
- if (
- config._a[HOUR] <= 12 &&
- getParsingFlags(config).bigHour === true &&
- config._a[HOUR] > 0
- ) {
- getParsingFlags(config).bigHour = undefined;
- }
-
- getParsingFlags(config).parsedDateParts = config._a.slice(0);
- getParsingFlags(config).meridiem = config._meridiem;
-
- config._a[HOUR] = meridiemFixWrap(
- config._locale,
- config._a[HOUR],
- config._meridiem
- );
-
-
- era = getParsingFlags(config).era;
- if (era !== null) {
- config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
- }
-
- configFromArray(config);
- checkOverflow(config);
- }
-
- function meridiemFixWrap(locale, hour, meridiem) {
- var isPm;
-
- if (meridiem == null) {
-
- return hour;
- }
- if (locale.meridiemHour != null) {
- return locale.meridiemHour(hour, meridiem);
- } else if (locale.isPM != null) {
-
- isPm = locale.isPM(meridiem);
- if (isPm && hour < 12) {
- hour += 12;
- }
- if (!isPm && hour === 12) {
- hour = 0;
- }
- return hour;
- } else {
-
- return hour;
- }
- }
-
-
- function configFromStringAndArray(config) {
- var tempConfig,
- bestMoment,
- scoreToBeat,
- i,
- currentScore,
- validFormatFound,
- bestFormatIsValid = false;
-
- if (config._f.length === 0) {
- getParsingFlags(config).invalidFormat = true;
- config._d = new Date(NaN);
- return;
- }
-
- for (i = 0; i < config._f.length; i++) {
- currentScore = 0;
- validFormatFound = false;
- tempConfig = copyConfig({}, config);
- if (config._useUTC != null) {
- tempConfig._useUTC = config._useUTC;
- }
- tempConfig._f = config._f[i];
- configFromStringAndFormat(tempConfig);
-
- if (isValid(tempConfig)) {
- validFormatFound = true;
- }
-
-
- currentScore += getParsingFlags(tempConfig).charsLeftOver;
-
-
- currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
-
- getParsingFlags(tempConfig).score = currentScore;
-
- if (!bestFormatIsValid) {
- if (
- scoreToBeat == null ||
- currentScore < scoreToBeat ||
- validFormatFound
- ) {
- scoreToBeat = currentScore;
- bestMoment = tempConfig;
- if (validFormatFound) {
- bestFormatIsValid = true;
- }
- }
- } else {
- if (currentScore < scoreToBeat) {
- scoreToBeat = currentScore;
- bestMoment = tempConfig;
- }
- }
- }
-
- extend(config, bestMoment || tempConfig);
- }
-
- function configFromObject(config) {
- if (config._d) {
- return;
- }
-
- var i = normalizeObjectUnits(config._i),
- dayOrDate = i.day === undefined ? i.date : i.day;
- config._a = map(
- [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
- function (obj) {
- return obj && parseInt(obj, 10);
- }
- );
-
- configFromArray(config);
- }
-
- function createFromConfig(config) {
- var res = new Moment(checkOverflow(prepareConfig(config)));
- if (res._nextDay) {
-
- res.add(1, 'd');
- res._nextDay = undefined;
- }
-
- return res;
- }
-
- function prepareConfig(config) {
- var input = config._i,
- format = config._f;
-
- config._locale = config._locale || getLocale(config._l);
-
- if (input === null || (format === undefined && input === '')) {
- return createInvalid({ nullInput: true });
- }
-
- if (typeof input === 'string') {
- config._i = input = config._locale.preparse(input);
- }
-
- if (isMoment(input)) {
- return new Moment(checkOverflow(input));
- } else if (isDate(input)) {
- config._d = input;
- } else if (isArray(format)) {
- configFromStringAndArray(config);
- } else if (format) {
- configFromStringAndFormat(config);
- } else {
- configFromInput(config);
- }
-
- if (!isValid(config)) {
- config._d = null;
- }
-
- return config;
- }
-
- function configFromInput(config) {
- var input = config._i;
- if (isUndefined(input)) {
- config._d = new Date(hooks.now());
- } else if (isDate(input)) {
- config._d = new Date(input.valueOf());
- } else if (typeof input === 'string') {
- configFromString(config);
- } else if (isArray(input)) {
- config._a = map(input.slice(0), function (obj) {
- return parseInt(obj, 10);
- });
- configFromArray(config);
- } else if (isObject(input)) {
- configFromObject(config);
- } else if (isNumber(input)) {
-
- config._d = new Date(input);
- } else {
- hooks.createFromInputFallback(config);
- }
- }
-
- function createLocalOrUTC(input, format, locale, strict, isUTC) {
- var c = {};
-
- if (format === true || format === false) {
- strict = format;
- format = undefined;
- }
-
- if (locale === true || locale === false) {
- strict = locale;
- locale = undefined;
- }
-
- if (
- (isObject(input) && isObjectEmpty(input)) ||
- (isArray(input) && input.length === 0)
- ) {
- input = undefined;
- }
-
-
- c._isAMomentObject = true;
- c._useUTC = c._isUTC = isUTC;
- c._l = locale;
- c._i = input;
- c._f = format;
- c._strict = strict;
-
- return createFromConfig(c);
- }
-
- function createLocal(input, format, locale, strict) {
- return createLocalOrUTC(input, format, locale, strict, false);
- }
-
- var prototypeMin = deprecate(
- 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
- function () {
- var other = createLocal.apply(null, arguments);
- if (this.isValid() && other.isValid()) {
- return other < this ? this : other;
- } else {
- return createInvalid();
- }
- }
- ),
- prototypeMax = deprecate(
- 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
- function () {
- var other = createLocal.apply(null, arguments);
- if (this.isValid() && other.isValid()) {
- return other > this ? this : other;
- } else {
- return createInvalid();
- }
- }
- );
-
-
-
-
-
-
- function pickBy(fn, moments) {
- var res, i;
- if (moments.length === 1 && isArray(moments[0])) {
- moments = moments[0];
- }
- if (!moments.length) {
- return createLocal();
- }
- res = moments[0];
- for (i = 1; i < moments.length; ++i) {
- if (!moments[i].isValid() || moments[i][fn](res)) {
- res = moments[i];
- }
- }
- return res;
- }
-
-
- function min() {
- var args = [].slice.call(arguments, 0);
-
- return pickBy('isBefore', args);
- }
-
- function max() {
- var args = [].slice.call(arguments, 0);
-
- return pickBy('isAfter', args);
- }
-
- var now = function () {
- return Date.now ? Date.now() : +new Date();
- };
-
- var ordering = [
- 'year',
- 'quarter',
- 'month',
- 'week',
- 'day',
- 'hour',
- 'minute',
- 'second',
- 'millisecond',
- ];
-
- function isDurationValid(m) {
- var key,
- unitHasDecimal = false,
- i;
- for (key in m) {
- if (
- hasOwnProp(m, key) &&
- !(
- indexOf.call(ordering, key) !== -1 &&
- (m[key] == null || !isNaN(m[key]))
- )
- ) {
- return false;
- }
- }
-
- for (i = 0; i < ordering.length; ++i) {
- if (m[ordering[i]]) {
- if (unitHasDecimal) {
- return false;
- }
- if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
- unitHasDecimal = true;
- }
- }
- }
-
- return true;
- }
-
- function isValid$1() {
- return this._isValid;
- }
-
- function createInvalid$1() {
- return createDuration(NaN);
- }
-
- function Duration(duration) {
- var normalizedInput = normalizeObjectUnits(duration),
- years = normalizedInput.year || 0,
- quarters = normalizedInput.quarter || 0,
- months = normalizedInput.month || 0,
- weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
- days = normalizedInput.day || 0,
- hours = normalizedInput.hour || 0,
- minutes = normalizedInput.minute || 0,
- seconds = normalizedInput.second || 0,
- milliseconds = normalizedInput.millisecond || 0;
-
- this._isValid = isDurationValid(normalizedInput);
-
-
- this._milliseconds =
- +milliseconds +
- seconds * 1e3 +
- minutes * 6e4 +
- hours * 1000 * 60 * 60;
-
-
- this._days = +days + weeks * 7;
-
-
-
- this._months = +months + quarters * 3 + years * 12;
-
- this._data = {};
-
- this._locale = getLocale();
-
- this._bubble();
- }
-
- function isDuration(obj) {
- return obj instanceof Duration;
- }
-
- function absRound(number) {
- if (number < 0) {
- return Math.round(-1 * number) * -1;
- } else {
- return Math.round(number);
- }
- }
-
-
- function compareArrays(array1, array2, dontConvert) {
- var len = Math.min(array1.length, array2.length),
- lengthDiff = Math.abs(array1.length - array2.length),
- diffs = 0,
- i;
- for (i = 0; i < len; i++) {
- if (
- (dontConvert && array1[i] !== array2[i]) ||
- (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
- ) {
- diffs++;
- }
- }
- return diffs + lengthDiff;
- }
-
-
-
- function offset(token, separator) {
- addFormatToken(token, 0, 0, function () {
- var offset = this.utcOffset(),
- sign = '+';
- if (offset < 0) {
- offset = -offset;
- sign = '-';
- }
- return (
- sign +
- zeroFill(~~(offset / 60), 2) +
- separator +
- zeroFill(~~offset % 60, 2)
- );
- });
- }
-
- offset('Z', ':');
- offset('ZZ', '');
-
-
-
- addRegexToken('Z', matchShortOffset);
- addRegexToken('ZZ', matchShortOffset);
- addParseToken(['Z', 'ZZ'], function (input, array, config) {
- config._useUTC = true;
- config._tzm = offsetFromString(matchShortOffset, input);
- });
-
-
-
-
-
-
- var chunkOffset = /([\+\-]|\d\d)/gi;
-
- function offsetFromString(matcher, string) {
- var matches = (string || '').match(matcher),
- chunk,
- parts,
- minutes;
-
- if (matches === null) {
- return null;
- }
-
- chunk = matches[matches.length - 1] || [];
- parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
- minutes = +(parts[1] * 60) + toInt(parts[2]);
-
- return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
- }
-
-
- function cloneWithOffset(input, model) {
- var res, diff;
- if (model._isUTC) {
- res = model.clone();
- diff =
- (isMoment(input) || isDate(input)
- ? input.valueOf()
- : createLocal(input).valueOf()) - res.valueOf();
-
- res._d.setTime(res._d.valueOf() + diff);
- hooks.updateOffset(res, false);
- return res;
- } else {
- return createLocal(input).local();
- }
- }
-
- function getDateOffset(m) {
-
-
- return -Math.round(m._d.getTimezoneOffset());
- }
-
-
-
-
-
- hooks.updateOffset = function () {};
-
-
-
-
-
-
-
-
-
-
-
-
-
- function getSetOffset(input, keepLocalTime, keepMinutes) {
- var offset = this._offset || 0,
- localAdjust;
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- if (input != null) {
- if (typeof input === 'string') {
- input = offsetFromString(matchShortOffset, input);
- if (input === null) {
- return this;
- }
- } else if (Math.abs(input) < 16 && !keepMinutes) {
- input = input * 60;
- }
- if (!this._isUTC && keepLocalTime) {
- localAdjust = getDateOffset(this);
- }
- this._offset = input;
- this._isUTC = true;
- if (localAdjust != null) {
- this.add(localAdjust, 'm');
- }
- if (offset !== input) {
- if (!keepLocalTime || this._changeInProgress) {
- addSubtract(
- this,
- createDuration(input - offset, 'm'),
- 1,
- false
- );
- } else if (!this._changeInProgress) {
- this._changeInProgress = true;
- hooks.updateOffset(this, true);
- this._changeInProgress = null;
- }
- }
- return this;
- } else {
- return this._isUTC ? offset : getDateOffset(this);
- }
- }
-
- function getSetZone(input, keepLocalTime) {
- if (input != null) {
- if (typeof input !== 'string') {
- input = -input;
- }
-
- this.utcOffset(input, keepLocalTime);
-
- return this;
- } else {
- return -this.utcOffset();
- }
- }
-
- function setOffsetToUTC(keepLocalTime) {
- return this.utcOffset(0, keepLocalTime);
- }
-
- function setOffsetToLocal(keepLocalTime) {
- if (this._isUTC) {
- this.utcOffset(0, keepLocalTime);
- this._isUTC = false;
-
- if (keepLocalTime) {
- this.subtract(getDateOffset(this), 'm');
- }
- }
- return this;
- }
-
- function setOffsetToParsedOffset() {
- if (this._tzm != null) {
- this.utcOffset(this._tzm, false, true);
- } else if (typeof this._i === 'string') {
- var tZone = offsetFromString(matchOffset, this._i);
- if (tZone != null) {
- this.utcOffset(tZone);
- } else {
- this.utcOffset(0, true);
- }
- }
- return this;
- }
-
- function hasAlignedHourOffset(input) {
- if (!this.isValid()) {
- return false;
- }
- input = input ? createLocal(input).utcOffset() : 0;
-
- return (this.utcOffset() - input) % 60 === 0;
- }
-
- function isDaylightSavingTime() {
- return (
- this.utcOffset() > this.clone().month(0).utcOffset() ||
- this.utcOffset() > this.clone().month(5).utcOffset()
- );
- }
-
- function isDaylightSavingTimeShifted() {
- if (!isUndefined(this._isDSTShifted)) {
- return this._isDSTShifted;
- }
-
- var c = {},
- other;
-
- copyConfig(c, this);
- c = prepareConfig(c);
-
- if (c._a) {
- other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
- this._isDSTShifted =
- this.isValid() && compareArrays(c._a, other.toArray()) > 0;
- } else {
- this._isDSTShifted = false;
- }
-
- return this._isDSTShifted;
- }
-
- function isLocal() {
- return this.isValid() ? !this._isUTC : false;
- }
-
- function isUtcOffset() {
- return this.isValid() ? this._isUTC : false;
- }
-
- function isUtc() {
- return this.isValid() ? this._isUTC && this._offset === 0 : false;
- }
-
-
- var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
-
-
-
- isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
-
- function createDuration(input, key) {
- var duration = input,
-
- match = null,
- sign,
- ret,
- diffRes;
-
- if (isDuration(input)) {
- duration = {
- ms: input._milliseconds,
- d: input._days,
- M: input._months,
- };
- } else if (isNumber(input) || !isNaN(+input)) {
- duration = {};
- if (key) {
- duration[key] = +input;
- } else {
- duration.milliseconds = +input;
- }
- } else if ((match = aspNetRegex.exec(input))) {
- sign = match[1] === '-' ? -1 : 1;
- duration = {
- y: 0,
- d: toInt(match[DATE]) * sign,
- h: toInt(match[HOUR]) * sign,
- m: toInt(match[MINUTE]) * sign,
- s: toInt(match[SECOND]) * sign,
- ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign,
- };
- } else if ((match = isoRegex.exec(input))) {
- sign = match[1] === '-' ? -1 : 1;
- duration = {
- y: parseIso(match[2], sign),
- M: parseIso(match[3], sign),
- w: parseIso(match[4], sign),
- d: parseIso(match[5], sign),
- h: parseIso(match[6], sign),
- m: parseIso(match[7], sign),
- s: parseIso(match[8], sign),
- };
- } else if (duration == null) {
-
- duration = {};
- } else if (
- typeof duration === 'object' &&
- ('from' in duration || 'to' in duration)
- ) {
- diffRes = momentsDifference(
- createLocal(duration.from),
- createLocal(duration.to)
- );
-
- duration = {};
- duration.ms = diffRes.milliseconds;
- duration.M = diffRes.months;
- }
-
- ret = new Duration(duration);
-
- if (isDuration(input) && hasOwnProp(input, '_locale')) {
- ret._locale = input._locale;
- }
-
- if (isDuration(input) && hasOwnProp(input, '_isValid')) {
- ret._isValid = input._isValid;
- }
-
- return ret;
- }
-
- createDuration.fn = Duration.prototype;
- createDuration.invalid = createInvalid$1;
-
- function parseIso(inp, sign) {
-
-
-
- var res = inp && parseFloat(inp.replace(',', '.'));
-
- return (isNaN(res) ? 0 : res) * sign;
- }
-
- function positiveMomentsDifference(base, other) {
- var res = {};
-
- res.months =
- other.month() - base.month() + (other.year() - base.year()) * 12;
- if (base.clone().add(res.months, 'M').isAfter(other)) {
- --res.months;
- }
-
- res.milliseconds = +other - +base.clone().add(res.months, 'M');
-
- return res;
- }
-
- function momentsDifference(base, other) {
- var res;
- if (!(base.isValid() && other.isValid())) {
- return { milliseconds: 0, months: 0 };
- }
-
- other = cloneWithOffset(other, base);
- if (base.isBefore(other)) {
- res = positiveMomentsDifference(base, other);
- } else {
- res = positiveMomentsDifference(other, base);
- res.milliseconds = -res.milliseconds;
- res.months = -res.months;
- }
-
- return res;
- }
-
-
- function createAdder(direction, name) {
- return function (val, period) {
- var dur, tmp;
-
- if (period !== null && !isNaN(+period)) {
- deprecateSimple(
- name,
- 'moment().' +
- name +
- '(period, number) is deprecated. Please use moment().' +
- name +
- '(number, period). ' +
- 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
- );
- tmp = val;
- val = period;
- period = tmp;
- }
-
- dur = createDuration(val, period);
- addSubtract(this, dur, direction);
- return this;
- };
- }
-
- function addSubtract(mom, duration, isAdding, updateOffset) {
- var milliseconds = duration._milliseconds,
- days = absRound(duration._days),
- months = absRound(duration._months);
-
- if (!mom.isValid()) {
-
- return;
- }
-
- updateOffset = updateOffset == null ? true : updateOffset;
-
- if (months) {
- setMonth(mom, get(mom, 'Month') + months * isAdding);
- }
- if (days) {
- set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
- }
- if (milliseconds) {
- mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
- }
- if (updateOffset) {
- hooks.updateOffset(mom, days || months);
- }
- }
-
- var add = createAdder(1, 'add'),
- subtract = createAdder(-1, 'subtract');
-
- function isString(input) {
- return typeof input === 'string' || input instanceof String;
- }
-
-
- function isMomentInput(input) {
- return (
- isMoment(input) ||
- isDate(input) ||
- isString(input) ||
- isNumber(input) ||
- isNumberOrStringArray(input) ||
- isMomentInputObject(input) ||
- input === null ||
- input === undefined
- );
- }
-
- function isMomentInputObject(input) {
- var objectTest = isObject(input) && !isObjectEmpty(input),
- propertyTest = false,
- properties = [
- 'years',
- 'year',
- 'y',
- 'months',
- 'month',
- 'M',
- 'days',
- 'day',
- 'd',
- 'dates',
- 'date',
- 'D',
- 'hours',
- 'hour',
- 'h',
- 'minutes',
- 'minute',
- 'm',
- 'seconds',
- 'second',
- 's',
- 'milliseconds',
- 'millisecond',
- 'ms',
- ],
- i,
- property;
-
- for (i = 0; i < properties.length; i += 1) {
- property = properties[i];
- propertyTest = propertyTest || hasOwnProp(input, property);
- }
-
- return objectTest && propertyTest;
- }
-
- function isNumberOrStringArray(input) {
- var arrayTest = isArray(input),
- dataTypeTest = false;
- if (arrayTest) {
- dataTypeTest =
- input.filter(function (item) {
- return !isNumber(item) && isString(input);
- }).length === 0;
- }
- return arrayTest && dataTypeTest;
- }
-
- function isCalendarSpec(input) {
- var objectTest = isObject(input) && !isObjectEmpty(input),
- propertyTest = false,
- properties = [
- 'sameDay',
- 'nextDay',
- 'lastDay',
- 'nextWeek',
- 'lastWeek',
- 'sameElse',
- ],
- i,
- property;
-
- for (i = 0; i < properties.length; i += 1) {
- property = properties[i];
- propertyTest = propertyTest || hasOwnProp(input, property);
- }
-
- return objectTest && propertyTest;
- }
-
- function getCalendarFormat(myMoment, now) {
- var diff = myMoment.diff(now, 'days', true);
- return diff < -6
- ? 'sameElse'
- : diff < -1
- ? 'lastWeek'
- : diff < 0
- ? 'lastDay'
- : diff < 1
- ? 'sameDay'
- : diff < 2
- ? 'nextDay'
- : diff < 7
- ? 'nextWeek'
- : 'sameElse';
- }
-
- function calendar$1(time, formats) {
-
- if (arguments.length === 1) {
- if (!arguments[0]) {
- time = undefined;
- formats = undefined;
- } else if (isMomentInput(arguments[0])) {
- time = arguments[0];
- formats = undefined;
- } else if (isCalendarSpec(arguments[0])) {
- formats = arguments[0];
- time = undefined;
- }
- }
-
-
- var now = time || createLocal(),
- sod = cloneWithOffset(now, this).startOf('day'),
- format = hooks.calendarFormat(this, sod) || 'sameElse',
- output =
- formats &&
- (isFunction(formats[format])
- ? formats[format].call(this, now)
- : formats[format]);
-
- return this.format(
- output || this.localeData().calendar(format, this, createLocal(now))
- );
- }
-
- function clone() {
- return new Moment(this);
- }
-
- function isAfter(input, units) {
- var localInput = isMoment(input) ? input : createLocal(input);
- if (!(this.isValid() && localInput.isValid())) {
- return false;
- }
- units = normalizeUnits(units) || 'millisecond';
- if (units === 'millisecond') {
- return this.valueOf() > localInput.valueOf();
- } else {
- return localInput.valueOf() < this.clone().startOf(units).valueOf();
- }
- }
-
- function isBefore(input, units) {
- var localInput = isMoment(input) ? input : createLocal(input);
- if (!(this.isValid() && localInput.isValid())) {
- return false;
- }
- units = normalizeUnits(units) || 'millisecond';
- if (units === 'millisecond') {
- return this.valueOf() < localInput.valueOf();
- } else {
- return this.clone().endOf(units).valueOf() < localInput.valueOf();
- }
- }
-
- function isBetween(from, to, units, inclusivity) {
- var localFrom = isMoment(from) ? from : createLocal(from),
- localTo = isMoment(to) ? to : createLocal(to);
- if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
- return false;
- }
- inclusivity = inclusivity || '()';
- return (
- (inclusivity[0] === '('
- ? this.isAfter(localFrom, units)
- : !this.isBefore(localFrom, units)) &&
- (inclusivity[1] === ')'
- ? this.isBefore(localTo, units)
- : !this.isAfter(localTo, units))
- );
- }
-
- function isSame(input, units) {
- var localInput = isMoment(input) ? input : createLocal(input),
- inputMs;
- if (!(this.isValid() && localInput.isValid())) {
- return false;
- }
- units = normalizeUnits(units) || 'millisecond';
- if (units === 'millisecond') {
- return this.valueOf() === localInput.valueOf();
- } else {
- inputMs = localInput.valueOf();
- return (
- this.clone().startOf(units).valueOf() <= inputMs &&
- inputMs <= this.clone().endOf(units).valueOf()
- );
- }
- }
-
- function isSameOrAfter(input, units) {
- return this.isSame(input, units) || this.isAfter(input, units);
- }
-
- function isSameOrBefore(input, units) {
- return this.isSame(input, units) || this.isBefore(input, units);
- }
-
- function diff(input, units, asFloat) {
- var that, zoneDelta, output;
-
- if (!this.isValid()) {
- return NaN;
- }
-
- that = cloneWithOffset(input, this);
-
- if (!that.isValid()) {
- return NaN;
- }
-
- zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
-
- units = normalizeUnits(units);
-
- switch (units) {
- case 'year':
- output = monthDiff(this, that) / 12;
- break;
- case 'month':
- output = monthDiff(this, that);
- break;
- case 'quarter':
- output = monthDiff(this, that) / 3;
- break;
- case 'second':
- output = (this - that) / 1e3;
- break;
- case 'minute':
- output = (this - that) / 6e4;
- break;
- case 'hour':
- output = (this - that) / 36e5;
- break;
- case 'day':
- output = (this - that - zoneDelta) / 864e5;
- break;
- case 'week':
- output = (this - that - zoneDelta) / 6048e5;
- break;
- default:
- output = this - that;
- }
-
- return asFloat ? output : absFloor(output);
- }
-
- function monthDiff(a, b) {
- if (a.date() < b.date()) {
-
-
- return -monthDiff(b, a);
- }
-
- var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
-
- anchor = a.clone().add(wholeMonthDiff, 'months'),
- anchor2,
- adjust;
-
- if (b - anchor < 0) {
- anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
-
- adjust = (b - anchor) / (anchor - anchor2);
- } else {
- anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
-
- adjust = (b - anchor) / (anchor2 - anchor);
- }
-
-
- return -(wholeMonthDiff + adjust) || 0;
- }
-
- hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
- hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
-
- function toString() {
- return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
- }
-
- function toISOString(keepOffset) {
- if (!this.isValid()) {
- return null;
- }
- var utc = keepOffset !== true,
- m = utc ? this.clone().utc() : this;
- if (m.year() < 0 || m.year() > 9999) {
- return formatMoment(
- m,
- utc
- ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
- : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
- );
- }
- if (isFunction(Date.prototype.toISOString)) {
-
- if (utc) {
- return this.toDate().toISOString();
- } else {
- return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
- .toISOString()
- .replace('Z', formatMoment(m, 'Z'));
- }
- }
- return formatMoment(
- m,
- utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
- );
- }
-
-
-
- function inspect() {
- if (!this.isValid()) {
- return 'moment.invalid(/* ' + this._i + ' */)';
- }
- var func = 'moment',
- zone = '',
- prefix,
- year,
- datetime,
- suffix;
- if (!this.isLocal()) {
- func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
- zone = 'Z';
- }
- prefix = '[' + func + '("]';
- year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
- datetime = '-MM-DD[T]HH:mm:ss.SSS';
- suffix = zone + '[")]';
-
- return this.format(prefix + year + datetime + suffix);
- }
-
- function format(inputString) {
- if (!inputString) {
- inputString = this.isUtc()
- ? hooks.defaultFormatUtc
- : hooks.defaultFormat;
- }
- var output = formatMoment(this, inputString);
- return this.localeData().postformat(output);
- }
-
- function from(time, withoutSuffix) {
- if (
- this.isValid() &&
- ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
- ) {
- return createDuration({ to: this, from: time })
- .locale(this.locale())
- .humanize(!withoutSuffix);
- } else {
- return this.localeData().invalidDate();
- }
- }
-
- function fromNow(withoutSuffix) {
- return this.from(createLocal(), withoutSuffix);
- }
-
- function to(time, withoutSuffix) {
- if (
- this.isValid() &&
- ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
- ) {
- return createDuration({ from: this, to: time })
- .locale(this.locale())
- .humanize(!withoutSuffix);
- } else {
- return this.localeData().invalidDate();
- }
- }
-
- function toNow(withoutSuffix) {
- return this.to(createLocal(), withoutSuffix);
- }
-
-
-
-
- function locale(key) {
- var newLocaleData;
-
- if (key === undefined) {
- return this._locale._abbr;
- } else {
- newLocaleData = getLocale(key);
- if (newLocaleData != null) {
- this._locale = newLocaleData;
- }
- return this;
- }
- }
-
- var lang = deprecate(
- 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
- function (key) {
- if (key === undefined) {
- return this.localeData();
- } else {
- return this.locale(key);
- }
- }
- );
-
- function localeData() {
- return this._locale;
- }
-
- var MS_PER_SECOND = 1000,
- MS_PER_MINUTE = 60 * MS_PER_SECOND,
- MS_PER_HOUR = 60 * MS_PER_MINUTE,
- MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
-
-
- function mod$1(dividend, divisor) {
- return ((dividend % divisor) + divisor) % divisor;
- }
-
- function localStartOfDate(y, m, d) {
-
- if (y < 100 && y >= 0) {
-
- return new Date(y + 400, m, d) - MS_PER_400_YEARS;
- } else {
- return new Date(y, m, d).valueOf();
- }
- }
-
- function utcStartOfDate(y, m, d) {
-
- if (y < 100 && y >= 0) {
-
- return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
- } else {
- return Date.UTC(y, m, d);
- }
- }
-
- function startOf(units) {
- var time, startOfDate;
- units = normalizeUnits(units);
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
- return this;
- }
-
- startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
-
- switch (units) {
- case 'year':
- time = startOfDate(this.year(), 0, 1);
- break;
- case 'quarter':
- time = startOfDate(
- this.year(),
- this.month() - (this.month() % 3),
- 1
- );
- break;
- case 'month':
- time = startOfDate(this.year(), this.month(), 1);
- break;
- case 'week':
- time = startOfDate(
- this.year(),
- this.month(),
- this.date() - this.weekday()
- );
- break;
- case 'isoWeek':
- time = startOfDate(
- this.year(),
- this.month(),
- this.date() - (this.isoWeekday() - 1)
- );
- break;
- case 'day':
- case 'date':
- time = startOfDate(this.year(), this.month(), this.date());
- break;
- case 'hour':
- time = this._d.valueOf();
- time -= mod$1(
- time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
- MS_PER_HOUR
- );
- break;
- case 'minute':
- time = this._d.valueOf();
- time -= mod$1(time, MS_PER_MINUTE);
- break;
- case 'second':
- time = this._d.valueOf();
- time -= mod$1(time, MS_PER_SECOND);
- break;
- }
-
- this._d.setTime(time);
- hooks.updateOffset(this, true);
- return this;
- }
-
- function endOf(units) {
- var time, startOfDate;
- units = normalizeUnits(units);
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
- return this;
- }
-
- startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
-
- switch (units) {
- case 'year':
- time = startOfDate(this.year() + 1, 0, 1) - 1;
- break;
- case 'quarter':
- time =
- startOfDate(
- this.year(),
- this.month() - (this.month() % 3) + 3,
- 1
- ) - 1;
- break;
- case 'month':
- time = startOfDate(this.year(), this.month() + 1, 1) - 1;
- break;
- case 'week':
- time =
- startOfDate(
- this.year(),
- this.month(),
- this.date() - this.weekday() + 7
- ) - 1;
- break;
- case 'isoWeek':
- time =
- startOfDate(
- this.year(),
- this.month(),
- this.date() - (this.isoWeekday() - 1) + 7
- ) - 1;
- break;
- case 'day':
- case 'date':
- time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
- break;
- case 'hour':
- time = this._d.valueOf();
- time +=
- MS_PER_HOUR -
- mod$1(
- time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
- MS_PER_HOUR
- ) -
- 1;
- break;
- case 'minute':
- time = this._d.valueOf();
- time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
- break;
- case 'second':
- time = this._d.valueOf();
- time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
- break;
- }
-
- this._d.setTime(time);
- hooks.updateOffset(this, true);
- return this;
- }
-
- function valueOf() {
- return this._d.valueOf() - (this._offset || 0) * 60000;
- }
-
- function unix() {
- return Math.floor(this.valueOf() / 1000);
- }
-
- function toDate() {
- return new Date(this.valueOf());
- }
-
- function toArray() {
- var m = this;
- return [
- m.year(),
- m.month(),
- m.date(),
- m.hour(),
- m.minute(),
- m.second(),
- m.millisecond(),
- ];
- }
-
- function toObject() {
- var m = this;
- return {
- years: m.year(),
- months: m.month(),
- date: m.date(),
- hours: m.hours(),
- minutes: m.minutes(),
- seconds: m.seconds(),
- milliseconds: m.milliseconds(),
- };
- }
-
- function toJSON() {
-
- return this.isValid() ? this.toISOString() : null;
- }
-
- function isValid$2() {
- return isValid(this);
- }
-
- function parsingFlags() {
- return extend({}, getParsingFlags(this));
- }
-
- function invalidAt() {
- return getParsingFlags(this).overflow;
- }
-
- function creationData() {
- return {
- input: this._i,
- format: this._f,
- locale: this._locale,
- isUTC: this._isUTC,
- strict: this._strict,
- };
- }
-
- addFormatToken('N', 0, 0, 'eraAbbr');
- addFormatToken('NN', 0, 0, 'eraAbbr');
- addFormatToken('NNN', 0, 0, 'eraAbbr');
- addFormatToken('NNNN', 0, 0, 'eraName');
- addFormatToken('NNNNN', 0, 0, 'eraNarrow');
-
- addFormatToken('y', ['y', 1], 'yo', 'eraYear');
- addFormatToken('y', ['yy', 2], 0, 'eraYear');
- addFormatToken('y', ['yyy', 3], 0, 'eraYear');
- addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
-
- addRegexToken('N', matchEraAbbr);
- addRegexToken('NN', matchEraAbbr);
- addRegexToken('NNN', matchEraAbbr);
- addRegexToken('NNNN', matchEraName);
- addRegexToken('NNNNN', matchEraNarrow);
-
- addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
- input,
- array,
- config,
- token
- ) {
- var era = config._locale.erasParse(input, token, config._strict);
- if (era) {
- getParsingFlags(config).era = era;
- } else {
- getParsingFlags(config).invalidEra = input;
- }
- });
-
- addRegexToken('y', matchUnsigned);
- addRegexToken('yy', matchUnsigned);
- addRegexToken('yyy', matchUnsigned);
- addRegexToken('yyyy', matchUnsigned);
- addRegexToken('yo', matchEraYearOrdinal);
-
- addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
- addParseToken(['yo'], function (input, array, config, token) {
- var match;
- if (config._locale._eraYearOrdinalRegex) {
- match = input.match(config._locale._eraYearOrdinalRegex);
- }
-
- if (config._locale.eraYearOrdinalParse) {
- array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
- } else {
- array[YEAR] = parseInt(input, 10);
- }
- });
-
- function localeEras(m, format) {
- var i,
- l,
- date,
- eras = this._eras || getLocale('en')._eras;
- for (i = 0, l = eras.length; i < l; ++i) {
- switch (typeof eras[i].since) {
- case 'string':
-
- date = hooks(eras[i].since).startOf('day');
- eras[i].since = date.valueOf();
- break;
- }
-
- switch (typeof eras[i].until) {
- case 'undefined':
- eras[i].until = +Infinity;
- break;
- case 'string':
-
- date = hooks(eras[i].until).startOf('day').valueOf();
- eras[i].until = date.valueOf();
- break;
- }
- }
- return eras;
- }
-
- function localeErasParse(eraName, format, strict) {
- var i,
- l,
- eras = this.eras(),
- name,
- abbr,
- narrow;
- eraName = eraName.toUpperCase();
-
- for (i = 0, l = eras.length; i < l; ++i) {
- name = eras[i].name.toUpperCase();
- abbr = eras[i].abbr.toUpperCase();
- narrow = eras[i].narrow.toUpperCase();
-
- if (strict) {
- switch (format) {
- case 'N':
- case 'NN':
- case 'NNN':
- if (abbr === eraName) {
- return eras[i];
- }
- break;
-
- case 'NNNN':
- if (name === eraName) {
- return eras[i];
- }
- break;
-
- case 'NNNNN':
- if (narrow === eraName) {
- return eras[i];
- }
- break;
- }
- } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
- return eras[i];
- }
- }
- }
-
- function localeErasConvertYear(era, year) {
- var dir = era.since <= era.until ? +1 : -1;
- if (year === undefined) {
- return hooks(era.since).year();
- } else {
- return hooks(era.since).year() + (year - era.offset) * dir;
- }
- }
-
- function getEraName() {
- var i,
- l,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
-
- val = this.clone().startOf('day').valueOf();
-
- if (eras[i].since <= val && val <= eras[i].until) {
- return eras[i].name;
- }
- if (eras[i].until <= val && val <= eras[i].since) {
- return eras[i].name;
- }
- }
-
- return '';
- }
-
- function getEraNarrow() {
- var i,
- l,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
-
- val = this.clone().startOf('day').valueOf();
-
- if (eras[i].since <= val && val <= eras[i].until) {
- return eras[i].narrow;
- }
- if (eras[i].until <= val && val <= eras[i].since) {
- return eras[i].narrow;
- }
- }
-
- return '';
- }
-
- function getEraAbbr() {
- var i,
- l,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
-
- val = this.clone().startOf('day').valueOf();
-
- if (eras[i].since <= val && val <= eras[i].until) {
- return eras[i].abbr;
- }
- if (eras[i].until <= val && val <= eras[i].since) {
- return eras[i].abbr;
- }
- }
-
- return '';
- }
-
- function getEraYear() {
- var i,
- l,
- dir,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
- dir = eras[i].since <= eras[i].until ? +1 : -1;
-
-
- val = this.clone().startOf('day').valueOf();
-
- if (
- (eras[i].since <= val && val <= eras[i].until) ||
- (eras[i].until <= val && val <= eras[i].since)
- ) {
- return (
- (this.year() - hooks(eras[i].since).year()) * dir +
- eras[i].offset
- );
- }
- }
-
- return this.year();
- }
-
- function erasNameRegex(isStrict) {
- if (!hasOwnProp(this, '_erasNameRegex')) {
- computeErasParse.call(this);
- }
- return isStrict ? this._erasNameRegex : this._erasRegex;
- }
-
- function erasAbbrRegex(isStrict) {
- if (!hasOwnProp(this, '_erasAbbrRegex')) {
- computeErasParse.call(this);
- }
- return isStrict ? this._erasAbbrRegex : this._erasRegex;
- }
-
- function erasNarrowRegex(isStrict) {
- if (!hasOwnProp(this, '_erasNarrowRegex')) {
- computeErasParse.call(this);
- }
- return isStrict ? this._erasNarrowRegex : this._erasRegex;
- }
-
- function matchEraAbbr(isStrict, locale) {
- return locale.erasAbbrRegex(isStrict);
- }
-
- function matchEraName(isStrict, locale) {
- return locale.erasNameRegex(isStrict);
- }
-
- function matchEraNarrow(isStrict, locale) {
- return locale.erasNarrowRegex(isStrict);
- }
-
- function matchEraYearOrdinal(isStrict, locale) {
- return locale._eraYearOrdinalRegex || matchUnsigned;
- }
-
- function computeErasParse() {
- var abbrPieces = [],
- namePieces = [],
- narrowPieces = [],
- mixedPieces = [],
- i,
- l,
- eras = this.eras();
-
- for (i = 0, l = eras.length; i < l; ++i) {
- namePieces.push(regexEscape(eras[i].name));
- abbrPieces.push(regexEscape(eras[i].abbr));
- narrowPieces.push(regexEscape(eras[i].narrow));
-
- mixedPieces.push(regexEscape(eras[i].name));
- mixedPieces.push(regexEscape(eras[i].abbr));
- mixedPieces.push(regexEscape(eras[i].narrow));
- }
-
- this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
- this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
- this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
- this._erasNarrowRegex = new RegExp(
- '^(' + narrowPieces.join('|') + ')',
- 'i'
- );
- }
-
-
-
- addFormatToken(0, ['gg', 2], 0, function () {
- return this.weekYear() % 100;
- });
-
- addFormatToken(0, ['GG', 2], 0, function () {
- return this.isoWeekYear() % 100;
- });
-
- function addWeekYearFormatToken(token, getter) {
- addFormatToken(0, [token, token.length], 0, getter);
- }
-
- addWeekYearFormatToken('gggg', 'weekYear');
- addWeekYearFormatToken('ggggg', 'weekYear');
- addWeekYearFormatToken('GGGG', 'isoWeekYear');
- addWeekYearFormatToken('GGGGG', 'isoWeekYear');
-
-
-
- addUnitAlias('weekYear', 'gg');
- addUnitAlias('isoWeekYear', 'GG');
-
-
-
- addUnitPriority('weekYear', 1);
- addUnitPriority('isoWeekYear', 1);
-
-
-
- addRegexToken('G', matchSigned);
- addRegexToken('g', matchSigned);
- addRegexToken('GG', match1to2, match2);
- addRegexToken('gg', match1to2, match2);
- addRegexToken('GGGG', match1to4, match4);
- addRegexToken('gggg', match1to4, match4);
- addRegexToken('GGGGG', match1to6, match6);
- addRegexToken('ggggg', match1to6, match6);
-
- addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
- input,
- week,
- config,
- token
- ) {
- week[token.substr(0, 2)] = toInt(input);
- });
-
- addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
- week[token] = hooks.parseTwoDigitYear(input);
- });
-
-
-
- function getSetWeekYear(input) {
- return getSetWeekYearHelper.call(
- this,
- input,
- this.week(),
- this.weekday(),
- this.localeData()._week.dow,
- this.localeData()._week.doy
- );
- }
-
- function getSetISOWeekYear(input) {
- return getSetWeekYearHelper.call(
- this,
- input,
- this.isoWeek(),
- this.isoWeekday(),
- 1,
- 4
- );
- }
-
- function getISOWeeksInYear() {
- return weeksInYear(this.year(), 1, 4);
- }
-
- function getISOWeeksInISOWeekYear() {
- return weeksInYear(this.isoWeekYear(), 1, 4);
- }
-
- function getWeeksInYear() {
- var weekInfo = this.localeData()._week;
- return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
- }
-
- function getWeeksInWeekYear() {
- var weekInfo = this.localeData()._week;
- return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
- }
-
- function getSetWeekYearHelper(input, week, weekday, dow, doy) {
- var weeksTarget;
- if (input == null) {
- return weekOfYear(this, dow, doy).year;
- } else {
- weeksTarget = weeksInYear(input, dow, doy);
- if (week > weeksTarget) {
- week = weeksTarget;
- }
- return setWeekAll.call(this, input, week, weekday, dow, doy);
- }
- }
-
- function setWeekAll(weekYear, week, weekday, dow, doy) {
- var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
- date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
-
- this.year(date.getUTCFullYear());
- this.month(date.getUTCMonth());
- this.date(date.getUTCDate());
- return this;
- }
-
-
-
- addFormatToken('Q', 0, 'Qo', 'quarter');
-
-
-
- addUnitAlias('quarter', 'Q');
-
-
-
- addUnitPriority('quarter', 7);
-
-
-
- addRegexToken('Q', match1);
- addParseToken('Q', function (input, array) {
- array[MONTH] = (toInt(input) - 1) * 3;
- });
-
-
-
- function getSetQuarter(input) {
- return input == null
- ? Math.ceil((this.month() + 1) / 3)
- : this.month((input - 1) * 3 + (this.month() % 3));
- }
-
-
-
- addFormatToken('D', ['DD', 2], 'Do', 'date');
-
-
-
- addUnitAlias('date', 'D');
-
-
- addUnitPriority('date', 9);
-
-
-
- addRegexToken('D', match1to2);
- addRegexToken('DD', match1to2, match2);
- addRegexToken('Do', function (isStrict, locale) {
-
- return isStrict
- ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
- : locale._dayOfMonthOrdinalParseLenient;
- });
-
- addParseToken(['D', 'DD'], DATE);
- addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0]);
- });
-
-
-
- var getSetDayOfMonth = makeGetSet('Date', true);
-
-
-
- addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
-
-
-
- addUnitAlias('dayOfYear', 'DDD');
-
-
- addUnitPriority('dayOfYear', 4);
-
-
-
- addRegexToken('DDD', match1to3);
- addRegexToken('DDDD', match3);
- addParseToken(['DDD', 'DDDD'], function (input, array, config) {
- config._dayOfYear = toInt(input);
- });
-
-
-
-
-
- function getSetDayOfYear(input) {
- var dayOfYear =
- Math.round(
- (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
- ) + 1;
- return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
- }
-
-
-
- addFormatToken('m', ['mm', 2], 0, 'minute');
-
-
-
- addUnitAlias('minute', 'm');
-
-
-
- addUnitPriority('minute', 14);
-
-
-
- addRegexToken('m', match1to2);
- addRegexToken('mm', match1to2, match2);
- addParseToken(['m', 'mm'], MINUTE);
-
-
-
- var getSetMinute = makeGetSet('Minutes', false);
-
-
-
- addFormatToken('s', ['ss', 2], 0, 'second');
-
-
-
- addUnitAlias('second', 's');
-
-
-
- addUnitPriority('second', 15);
-
-
-
- addRegexToken('s', match1to2);
- addRegexToken('ss', match1to2, match2);
- addParseToken(['s', 'ss'], SECOND);
-
-
-
- var getSetSecond = makeGetSet('Seconds', false);
-
-
-
- addFormatToken('S', 0, 0, function () {
- return ~~(this.millisecond() / 100);
- });
-
- addFormatToken(0, ['SS', 2], 0, function () {
- return ~~(this.millisecond() / 10);
- });
-
- addFormatToken(0, ['SSS', 3], 0, 'millisecond');
- addFormatToken(0, ['SSSS', 4], 0, function () {
- return this.millisecond() * 10;
- });
- addFormatToken(0, ['SSSSS', 5], 0, function () {
- return this.millisecond() * 100;
- });
- addFormatToken(0, ['SSSSSS', 6], 0, function () {
- return this.millisecond() * 1000;
- });
- addFormatToken(0, ['SSSSSSS', 7], 0, function () {
- return this.millisecond() * 10000;
- });
- addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
- return this.millisecond() * 100000;
- });
- addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
- return this.millisecond() * 1000000;
- });
-
-
-
- addUnitAlias('millisecond', 'ms');
-
-
-
- addUnitPriority('millisecond', 16);
-
-
-
- addRegexToken('S', match1to3, match1);
- addRegexToken('SS', match1to3, match2);
- addRegexToken('SSS', match1to3, match3);
-
- var token, getSetMillisecond;
- for (token = 'SSSS'; token.length <= 9; token += 'S') {
- addRegexToken(token, matchUnsigned);
- }
-
- function parseMs(input, array) {
- array[MILLISECOND] = toInt(('0.' + input) * 1000);
- }
-
- for (token = 'S'; token.length <= 9; token += 'S') {
- addParseToken(token, parseMs);
- }
-
- getSetMillisecond = makeGetSet('Milliseconds', false);
-
-
-
- addFormatToken('z', 0, 0, 'zoneAbbr');
- addFormatToken('zz', 0, 0, 'zoneName');
-
-
-
- function getZoneAbbr() {
- return this._isUTC ? 'UTC' : '';
- }
-
- function getZoneName() {
- return this._isUTC ? 'Coordinated Universal Time' : '';
- }
-
- var proto = Moment.prototype;
-
- proto.add = add;
- proto.calendar = calendar$1;
- proto.clone = clone;
- proto.diff = diff;
- proto.endOf = endOf;
- proto.format = format;
- proto.from = from;
- proto.fromNow = fromNow;
- proto.to = to;
- proto.toNow = toNow;
- proto.get = stringGet;
- proto.invalidAt = invalidAt;
- proto.isAfter = isAfter;
- proto.isBefore = isBefore;
- proto.isBetween = isBetween;
- proto.isSame = isSame;
- proto.isSameOrAfter = isSameOrAfter;
- proto.isSameOrBefore = isSameOrBefore;
- proto.isValid = isValid$2;
- proto.lang = lang;
- proto.locale = locale;
- proto.localeData = localeData;
- proto.max = prototypeMax;
- proto.min = prototypeMin;
- proto.parsingFlags = parsingFlags;
- proto.set = stringSet;
- proto.startOf = startOf;
- proto.subtract = subtract;
- proto.toArray = toArray;
- proto.toObject = toObject;
- proto.toDate = toDate;
- proto.toISOString = toISOString;
- proto.inspect = inspect;
- if (typeof Symbol !== 'undefined' && Symbol.for != null) {
- proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
- return 'Moment<' + this.format() + '>';
- };
- }
- proto.toJSON = toJSON;
- proto.toString = toString;
- proto.unix = unix;
- proto.valueOf = valueOf;
- proto.creationData = creationData;
- proto.eraName = getEraName;
- proto.eraNarrow = getEraNarrow;
- proto.eraAbbr = getEraAbbr;
- proto.eraYear = getEraYear;
- proto.year = getSetYear;
- proto.isLeapYear = getIsLeapYear;
- proto.weekYear = getSetWeekYear;
- proto.isoWeekYear = getSetISOWeekYear;
- proto.quarter = proto.quarters = getSetQuarter;
- proto.month = getSetMonth;
- proto.daysInMonth = getDaysInMonth;
- proto.week = proto.weeks = getSetWeek;
- proto.isoWeek = proto.isoWeeks = getSetISOWeek;
- proto.weeksInYear = getWeeksInYear;
- proto.weeksInWeekYear = getWeeksInWeekYear;
- proto.isoWeeksInYear = getISOWeeksInYear;
- proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
- proto.date = getSetDayOfMonth;
- proto.day = proto.days = getSetDayOfWeek;
- proto.weekday = getSetLocaleDayOfWeek;
- proto.isoWeekday = getSetISODayOfWeek;
- proto.dayOfYear = getSetDayOfYear;
- proto.hour = proto.hours = getSetHour;
- proto.minute = proto.minutes = getSetMinute;
- proto.second = proto.seconds = getSetSecond;
- proto.millisecond = proto.milliseconds = getSetMillisecond;
- proto.utcOffset = getSetOffset;
- proto.utc = setOffsetToUTC;
- proto.local = setOffsetToLocal;
- proto.parseZone = setOffsetToParsedOffset;
- proto.hasAlignedHourOffset = hasAlignedHourOffset;
- proto.isDST = isDaylightSavingTime;
- proto.isLocal = isLocal;
- proto.isUtcOffset = isUtcOffset;
- proto.isUtc = isUtc;
- proto.isUTC = isUtc;
- proto.zoneAbbr = getZoneAbbr;
- proto.zoneName = getZoneName;
- proto.dates = deprecate(
- 'dates accessor is deprecated. Use date instead.',
- getSetDayOfMonth
- );
- proto.months = deprecate(
- 'months accessor is deprecated. Use month instead',
- getSetMonth
- );
- proto.years = deprecate(
- 'years accessor is deprecated. Use year instead',
- getSetYear
- );
- proto.zone = deprecate(
- 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
- getSetZone
- );
- proto.isDSTShifted = deprecate(
- 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
- isDaylightSavingTimeShifted
- );
-
- function createUnix(input) {
- return createLocal(input * 1000);
- }
-
- function createInZone() {
- return createLocal.apply(null, arguments).parseZone();
- }
-
- function preParsePostFormat(string) {
- return string;
- }
-
- var proto$1 = Locale.prototype;
-
- proto$1.calendar = calendar;
- proto$1.longDateFormat = longDateFormat;
- proto$1.invalidDate = invalidDate;
- proto$1.ordinal = ordinal;
- proto$1.preparse = preParsePostFormat;
- proto$1.postformat = preParsePostFormat;
- proto$1.relativeTime = relativeTime;
- proto$1.pastFuture = pastFuture;
- proto$1.set = set;
- proto$1.eras = localeEras;
- proto$1.erasParse = localeErasParse;
- proto$1.erasConvertYear = localeErasConvertYear;
- proto$1.erasAbbrRegex = erasAbbrRegex;
- proto$1.erasNameRegex = erasNameRegex;
- proto$1.erasNarrowRegex = erasNarrowRegex;
-
- proto$1.months = localeMonths;
- proto$1.monthsShort = localeMonthsShort;
- proto$1.monthsParse = localeMonthsParse;
- proto$1.monthsRegex = monthsRegex;
- proto$1.monthsShortRegex = monthsShortRegex;
- proto$1.week = localeWeek;
- proto$1.firstDayOfYear = localeFirstDayOfYear;
- proto$1.firstDayOfWeek = localeFirstDayOfWeek;
-
- proto$1.weekdays = localeWeekdays;
- proto$1.weekdaysMin = localeWeekdaysMin;
- proto$1.weekdaysShort = localeWeekdaysShort;
- proto$1.weekdaysParse = localeWeekdaysParse;
-
- proto$1.weekdaysRegex = weekdaysRegex;
- proto$1.weekdaysShortRegex = weekdaysShortRegex;
- proto$1.weekdaysMinRegex = weekdaysMinRegex;
-
- proto$1.isPM = localeIsPM;
- proto$1.meridiem = localeMeridiem;
-
- function get$1(format, index, field, setter) {
- var locale = getLocale(),
- utc = createUTC().set(setter, index);
- return locale[field](utc, format);
- }
-
- function listMonthsImpl(format, index, field) {
- if (isNumber(format)) {
- index = format;
- format = undefined;
- }
-
- format = format || '';
-
- if (index != null) {
- return get$1(format, index, field, 'month');
- }
-
- var i,
- out = [];
- for (i = 0; i < 12; i++) {
- out[i] = get$1(format, i, field, 'month');
- }
- return out;
- }
-
- // ()
- // (5)
- // (fmt, 5)
- // (fmt)
- // (true)
- // (true, 5)
- // (true, fmt, 5)
- // (true, fmt)
- function listWeekdaysImpl(localeSorted, format, index, field) {
- if (typeof localeSorted === 'boolean') {
- if (isNumber(format)) {
- index = format;
- format = undefined;
- }
-
- format = format || '';
- } else {
- format = localeSorted;
- index = format;
- localeSorted = false;
-
- if (isNumber(format)) {
- index = format;
- format = undefined;
- }
-
- format = format || '';
- }
-
- var locale = getLocale(),
- shift = localeSorted ? locale._week.dow : 0,
- i,
- out = [];
-
- if (index != null) {
- return get$1(format, (index + shift) % 7, field, 'day');
- }
-
- for (i = 0; i < 7; i++) {
- out[i] = get$1(format, (i + shift) % 7, field, 'day');
- }
- return out;
- }
-
- function listMonths(format, index) {
- return listMonthsImpl(format, index, 'months');
- }
-
- function listMonthsShort(format, index) {
- return listMonthsImpl(format, index, 'monthsShort');
- }
-
- function listWeekdays(localeSorted, format, index) {
- return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
- }
-
- function listWeekdaysShort(localeSorted, format, index) {
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
- }
-
- function listWeekdaysMin(localeSorted, format, index) {
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
- }
-
- getSetGlobalLocale('en', {
- eras: [
- {
- since: '0001-01-01',
- until: +Infinity,
- offset: 1,
- name: 'Anno Domini',
- narrow: 'AD',
- abbr: 'AD',
- },
- {
- since: '0000-12-31',
- until: -Infinity,
- offset: 1,
- name: 'Before Christ',
- narrow: 'BC',
- abbr: 'BC',
- },
- ],
- dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- toInt((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- });
-
-
-
- hooks.lang = deprecate(
- 'moment.lang is deprecated. Use moment.locale instead.',
- getSetGlobalLocale
- );
- hooks.langData = deprecate(
- 'moment.langData is deprecated. Use moment.localeData instead.',
- getLocale
- );
-
- var mathAbs = Math.abs;
-
- function abs() {
- var data = this._data;
-
- this._milliseconds = mathAbs(this._milliseconds);
- this._days = mathAbs(this._days);
- this._months = mathAbs(this._months);
-
- data.milliseconds = mathAbs(data.milliseconds);
- data.seconds = mathAbs(data.seconds);
- data.minutes = mathAbs(data.minutes);
- data.hours = mathAbs(data.hours);
- data.months = mathAbs(data.months);
- data.years = mathAbs(data.years);
-
- return this;
- }
-
- function addSubtract$1(duration, input, value, direction) {
- var other = createDuration(input, value);
-
- duration._milliseconds += direction * other._milliseconds;
- duration._days += direction * other._days;
- duration._months += direction * other._months;
-
- return duration._bubble();
- }
-
-
- function add$1(input, value) {
- return addSubtract$1(this, input, value, 1);
- }
-
-
- function subtract$1(input, value) {
- return addSubtract$1(this, input, value, -1);
- }
-
- function absCeil(number) {
- if (number < 0) {
- return Math.floor(number);
- } else {
- return Math.ceil(number);
- }
- }
-
- function bubble() {
- var milliseconds = this._milliseconds,
- days = this._days,
- months = this._months,
- data = this._data,
- seconds,
- minutes,
- hours,
- years,
- monthsFromDays;
-
-
-
- if (
- !(
- (milliseconds >= 0 && days >= 0 && months >= 0) ||
- (milliseconds <= 0 && days <= 0 && months <= 0)
- )
- ) {
- milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
- days = 0;
- months = 0;
- }
-
-
-
- data.milliseconds = milliseconds % 1000;
-
- seconds = absFloor(milliseconds / 1000);
- data.seconds = seconds % 60;
-
- minutes = absFloor(seconds / 60);
- data.minutes = minutes % 60;
-
- hours = absFloor(minutes / 60);
- data.hours = hours % 24;
-
- days += absFloor(hours / 24);
-
-
- monthsFromDays = absFloor(daysToMonths(days));
- months += monthsFromDays;
- days -= absCeil(monthsToDays(monthsFromDays));
-
-
- years = absFloor(months / 12);
- months %= 12;
-
- data.days = days;
- data.months = months;
- data.years = years;
-
- return this;
- }
-
- function daysToMonths(days) {
-
-
- return (days * 4800) / 146097;
- }
-
- function monthsToDays(months) {
-
- return (months * 146097) / 4800;
- }
-
- function as(units) {
- if (!this.isValid()) {
- return NaN;
- }
- var days,
- months,
- milliseconds = this._milliseconds;
-
- units = normalizeUnits(units);
-
- if (units === 'month' || units === 'quarter' || units === 'year') {
- days = this._days + milliseconds / 864e5;
- months = this._months + daysToMonths(days);
- switch (units) {
- case 'month':
- return months;
- case 'quarter':
- return months / 3;
- case 'year':
- return months / 12;
- }
- } else {
-
- days = this._days + Math.round(monthsToDays(this._months));
- switch (units) {
- case 'week':
- return days / 7 + milliseconds / 6048e5;
- case 'day':
- return days + milliseconds / 864e5;
- case 'hour':
- return days * 24 + milliseconds / 36e5;
- case 'minute':
- return days * 1440 + milliseconds / 6e4;
- case 'second':
- return days * 86400 + milliseconds / 1000;
-
- case 'millisecond':
- return Math.floor(days * 864e5) + milliseconds;
- default:
- throw new Error('Unknown unit ' + units);
- }
- }
- }
-
-
- function valueOf$1() {
- if (!this.isValid()) {
- return NaN;
- }
- return (
- this._milliseconds +
- this._days * 864e5 +
- (this._months % 12) * 2592e6 +
- toInt(this._months / 12) * 31536e6
- );
- }
-
- function makeAs(alias) {
- return function () {
- return this.as(alias);
- };
- }
-
- var asMilliseconds = makeAs('ms'),
- asSeconds = makeAs('s'),
- asMinutes = makeAs('m'),
- asHours = makeAs('h'),
- asDays = makeAs('d'),
- asWeeks = makeAs('w'),
- asMonths = makeAs('M'),
- asQuarters = makeAs('Q'),
- asYears = makeAs('y');
-
- function clone$1() {
- return createDuration(this);
- }
-
- function get$2(units) {
- units = normalizeUnits(units);
- return this.isValid() ? this[units + 's']() : NaN;
- }
-
- function makeGetter(name) {
- return function () {
- return this.isValid() ? this._data[name] : NaN;
- };
- }
-
- var milliseconds = makeGetter('milliseconds'),
- seconds = makeGetter('seconds'),
- minutes = makeGetter('minutes'),
- hours = makeGetter('hours'),
- days = makeGetter('days'),
- months = makeGetter('months'),
- years = makeGetter('years');
-
- function weeks() {
- return absFloor(this.days() / 7);
- }
-
- var round = Math.round,
- thresholds = {
- ss: 44,
- s: 45,
- m: 45,
- h: 22,
- d: 26,
- w: null,
- M: 11,
- };
-
-
- function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
- return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
- }
-
- function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
- var duration = createDuration(posNegDuration).abs(),
- seconds = round(duration.as('s')),
- minutes = round(duration.as('m')),
- hours = round(duration.as('h')),
- days = round(duration.as('d')),
- months = round(duration.as('M')),
- weeks = round(duration.as('w')),
- years = round(duration.as('y')),
- a =
- (seconds <= thresholds.ss && ['s', seconds]) ||
- (seconds < thresholds.s && ['ss', seconds]) ||
- (minutes <= 1 && ['m']) ||
- (minutes < thresholds.m && ['mm', minutes]) ||
- (hours <= 1 && ['h']) ||
- (hours < thresholds.h && ['hh', hours]) ||
- (days <= 1 && ['d']) ||
- (days < thresholds.d && ['dd', days]);
-
- if (thresholds.w != null) {
- a =
- a ||
- (weeks <= 1 && ['w']) ||
- (weeks < thresholds.w && ['ww', weeks]);
- }
- a = a ||
- (months <= 1 && ['M']) ||
- (months < thresholds.M && ['MM', months]) ||
- (years <= 1 && ['y']) || ['yy', years];
-
- a[2] = withoutSuffix;
- a[3] = +posNegDuration > 0;
- a[4] = locale;
- return substituteTimeAgo.apply(null, a);
- }
-
-
- function getSetRelativeTimeRounding(roundingFunction) {
- if (roundingFunction === undefined) {
- return round;
- }
- if (typeof roundingFunction === 'function') {
- round = roundingFunction;
- return true;
- }
- return false;
- }
-
-
- function getSetRelativeTimeThreshold(threshold, limit) {
- if (thresholds[threshold] === undefined) {
- return false;
- }
- if (limit === undefined) {
- return thresholds[threshold];
- }
- thresholds[threshold] = limit;
- if (threshold === 's') {
- thresholds.ss = limit - 1;
- }
- return true;
- }
-
- function humanize(argWithSuffix, argThresholds) {
- if (!this.isValid()) {
- return this.localeData().invalidDate();
- }
-
- var withSuffix = false,
- th = thresholds,
- locale,
- output;
-
- if (typeof argWithSuffix === 'object') {
- argThresholds = argWithSuffix;
- argWithSuffix = false;
- }
- if (typeof argWithSuffix === 'boolean') {
- withSuffix = argWithSuffix;
- }
- if (typeof argThresholds === 'object') {
- th = Object.assign({}, thresholds, argThresholds);
- if (argThresholds.s != null && argThresholds.ss == null) {
- th.ss = argThresholds.s - 1;
- }
- }
-
- locale = this.localeData();
- output = relativeTime$1(this, !withSuffix, th, locale);
-
- if (withSuffix) {
- output = locale.pastFuture(+this, output);
- }
-
- return locale.postformat(output);
- }
-
- var abs$1 = Math.abs;
-
- function sign(x) {
- return (x > 0) - (x < 0) || +x;
- }
-
- function toISOString$1() {
-
-
-
-
-
-
-
- if (!this.isValid()) {
- return this.localeData().invalidDate();
- }
-
- var seconds = abs$1(this._milliseconds) / 1000,
- days = abs$1(this._days),
- months = abs$1(this._months),
- minutes,
- hours,
- years,
- s,
- total = this.asSeconds(),
- totalSign,
- ymSign,
- daysSign,
- hmsSign;
-
- if (!total) {
-
-
- return 'P0D';
- }
-
-
- minutes = absFloor(seconds / 60);
- hours = absFloor(minutes / 60);
- seconds %= 60;
- minutes %= 60;
-
-
- years = absFloor(months / 12);
- months %= 12;
-
-
- s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
-
- totalSign = total < 0 ? '-' : '';
- ymSign = sign(this._months) !== sign(total) ? '-' : '';
- daysSign = sign(this._days) !== sign(total) ? '-' : '';
- hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
-
- return (
- totalSign +
- 'P' +
- (years ? ymSign + years + 'Y' : '') +
- (months ? ymSign + months + 'M' : '') +
- (days ? daysSign + days + 'D' : '') +
- (hours || minutes || seconds ? 'T' : '') +
- (hours ? hmsSign + hours + 'H' : '') +
- (minutes ? hmsSign + minutes + 'M' : '') +
- (seconds ? hmsSign + s + 'S' : '')
- );
- }
-
- var proto$2 = Duration.prototype;
-
- proto$2.isValid = isValid$1;
- proto$2.abs = abs;
- proto$2.add = add$1;
- proto$2.subtract = subtract$1;
- proto$2.as = as;
- proto$2.asMilliseconds = asMilliseconds;
- proto$2.asSeconds = asSeconds;
- proto$2.asMinutes = asMinutes;
- proto$2.asHours = asHours;
- proto$2.asDays = asDays;
- proto$2.asWeeks = asWeeks;
- proto$2.asMonths = asMonths;
- proto$2.asQuarters = asQuarters;
- proto$2.asYears = asYears;
- proto$2.valueOf = valueOf$1;
- proto$2._bubble = bubble;
- proto$2.clone = clone$1;
- proto$2.get = get$2;
- proto$2.milliseconds = milliseconds;
- proto$2.seconds = seconds;
- proto$2.minutes = minutes;
- proto$2.hours = hours;
- proto$2.days = days;
- proto$2.weeks = weeks;
- proto$2.months = months;
- proto$2.years = years;
- proto$2.humanize = humanize;
- proto$2.toISOString = toISOString$1;
- proto$2.toString = toISOString$1;
- proto$2.toJSON = toISOString$1;
- proto$2.locale = locale;
- proto$2.localeData = localeData;
-
- proto$2.toIsoString = deprecate(
- 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
- toISOString$1
- );
- proto$2.lang = lang;
-
- // FORMATTING
-
- addFormatToken('X', 0, 0, 'unix');
- addFormatToken('x', 0, 0, 'valueOf');
-
- // PARSING
-
- addRegexToken('x', matchSigned);
- addRegexToken('X', matchTimestamp);
- addParseToken('X', function (input, array, config) {
- config._d = new Date(parseFloat(input) * 1000);
- });
- addParseToken('x', function (input, array, config) {
- config._d = new Date(toInt(input));
- });
-
-
-
- hooks.version = '2.29.1';
-
- setHookCallback(createLocal);
-
- hooks.fn = proto;
- hooks.min = min;
- hooks.max = max;
- hooks.now = now;
- hooks.utc = createUTC;
- hooks.unix = createUnix;
- hooks.months = listMonths;
- hooks.isDate = isDate;
- hooks.locale = getSetGlobalLocale;
- hooks.invalid = createInvalid;
- hooks.duration = createDuration;
- hooks.isMoment = isMoment;
- hooks.weekdays = listWeekdays;
- hooks.parseZone = createInZone;
- hooks.localeData = getLocale;
- hooks.isDuration = isDuration;
- hooks.monthsShort = listMonthsShort;
- hooks.weekdaysMin = listWeekdaysMin;
- hooks.defineLocale = defineLocale;
- hooks.updateLocale = updateLocale;
- hooks.locales = listLocales;
- hooks.weekdaysShort = listWeekdaysShort;
- hooks.normalizeUnits = normalizeUnits;
- hooks.relativeTimeRounding = getSetRelativeTimeRounding;
- hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
- hooks.calendarFormat = getCalendarFormat;
- hooks.prototype = proto;
-
-
- hooks.HTML5_FMT = {
- DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',
- DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',
- DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',
- DATE: 'YYYY-MM-DD',
- TIME: 'HH:mm',
- TIME_SECONDS: 'HH:mm:ss',
- TIME_MS: 'HH:mm:ss.SSS',
- WEEK: 'GGGG-[W]WW',
- MONTH: 'YYYY-MM',
- };
-
- return hooks;
-
- })));
- }, "E:/elixir/production_A/bbhverse/node_modules/moment");
-
- let array8 = arrayUntyped,
- array16 = arrayUntyped,
- array32 = arrayUntyped,
- arrayLengthen = arrayLengthenUntyped,
- arrayWiden = arrayWidenUntyped;
- if (typeof Uint8Array !== "undefined") {
- array8 = function(n) { return new Uint8Array(n); };
- array16 = function(n) { return new Uint16Array(n); };
- array32 = function(n) { return new Uint32Array(n); };
-
- arrayLengthen = function(array, length) {
- if (array.length >= length) return array;
- var copy = new array.constructor(length);
- copy.set(array);
- return copy;
- };
-
- arrayWiden = function(array, width) {
- var copy;
- switch (width) {
- case 16: copy = array16(array.length); break;
- case 32: copy = array32(array.length); break;
- default: throw new Error("invalid array width!");
- }
- copy.set(array);
- return copy;
- };
- }
-
- function arrayUntyped(n) {
- var array = new Array(n), i = -1;
- while (++i < n) array[i] = 0;
- return array;
- }
-
- function arrayLengthenUntyped(array, length) {
- var n = array.length;
- while (n < length) array[n++] = 0;
- return array;
- }
-
- function arrayWidenUntyped(array, width) {
- if (width > 32) throw new Error("invalid array width!");
- return array;
- }
-
-
- function bitarray(n) {
- this.length = n;
- this.subarrays = 1;
- this.width = 8;
- this.masks = {
- 0: 0
- };
-
- this[0] = array8(n);
- }
-
- bitarray.prototype.lengthen = function(n) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- this[i] = arrayLengthen(this[i], n);
- }
- this.length = n;
- };
-
-
- bitarray.prototype.add = function() {
- var m, w, one, i, len;
-
- for (i = 0, len = this.subarrays; i < len; ++i) {
- m = this.masks[i];
- w = this.width - (32 * i);
-
- one = (~m & (m + 1)) >>> 0;
-
- if (w >= 32 && !one) {
- continue;
- }
-
- if (w < 32 && (one & (1 << w))) {
-
- this[i] = arrayWiden(this[i], w <<= 1);
- this.width = 32 * i + w;
- }
-
- this.masks[i] |= one;
-
- return {
- offset: i,
- one: one
- };
- }
-
-
- this[this.subarrays] = array8(this.length);
- this.masks[this.subarrays] = 1;
- this.width += 8;
- return {
- offset: this.subarrays++,
- one: 1
- };
- };
-
-
- bitarray.prototype.copy = function(dest, src) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- this[i][dest] = this[i][src];
- }
- };
-
-
- bitarray.prototype.truncate = function(n) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- for (var j = this.length - 1; j >= n; j--) {
- this[i][j] = 0;
- }
- }
- this.length = n;
- };
-
-
- bitarray.prototype.zero = function(n) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- if (this[i][n]) {
- return false;
- }
- }
- return true;
- };
-
-
- bitarray.prototype.zeroExcept = function(n, offset, zero) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- if (i === offset ? this[i][n] & zero : this[i][n]) {
- return false;
- }
- }
- return true;
- };
-
-
-
- bitarray.prototype.zeroExceptMask = function(n, mask) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- if (this[i][n] & mask[i]) {
- return false;
- }
- }
- return true;
- };
-
-
- bitarray.prototype.only = function(n, offset, one) {
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- if (this[i][n] != (i === offset ? one : 0)) {
- return false;
- }
- }
- return true;
- };
-
-
- bitarray.prototype.onlyExcept = function(n, offset, zero, onlyOffset, onlyOne) {
- var mask;
- var i, len;
- for (i = 0, len = this.subarrays; i < len; ++i) {
- mask = this[i][n];
- if (i === offset)
- mask = (mask & zero) >>> 0;
- if (mask != (i === onlyOffset ? onlyOne : 0)) {
- return false;
- }
- }
- return true;
- };
-
- var xfilterArray = {
- array8: arrayUntyped,
- array16: arrayUntyped,
- array32: arrayUntyped,
- arrayLengthen: arrayLengthenUntyped,
- arrayWiden: arrayWidenUntyped,
- bitarray: bitarray
- };
-
- const filterExact = (bisect, value) => {
- return function(values) {
- var n = values.length;
- return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
- };
- };
-
- const filterRange = (bisect, range) => {
- var min = range[0],
- max = range[1];
- return function(values) {
- var n = values.length;
- return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
- };
- };
-
- const filterAll = values => {
- return [0, values.length];
- };
-
- var xfilterFilter = {
- filterExact,
- filterRange,
- filterAll
- };
-
- var cr_identity = d => {
- return d;
- };
-
- var cr_null = () => {
- return null;
- };
-
- var cr_zero = () => {
- return 0;
- };
-
- function heap_by(f) {
-
-
-
-
- function heap(a, lo, hi) {
- var n = hi - lo,
- i = (n >>> 1) + 1;
- while (--i > 0) sift(a, i, n, lo);
- return a;
- }
-
-
-
- function sort(a, lo, hi) {
- var n = hi - lo,
- t;
- while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
- return a;
- }
-
-
-
-
- function sift(a, i, n, lo) {
- var d = a[--lo + i],
- x = f(d),
- child;
- while ((child = i << 1) <= n) {
- if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
- if (x <= f(a[lo + child])) break;
- a[lo + i] = a[lo + child];
- i = child;
- }
- a[lo + i] = d;
- }
-
- heap.sort = sort;
- return heap;
- }
-
- const h$1 = heap_by(cr_identity);
- h$1.by = heap_by;
-
- function heapselect_by(f) {
- var heap = h$1.by(f);
-
-
-
-
-
- function heapselect(a, lo, hi, k) {
- var queue = new Array(k = Math.min(hi - lo, k)),
- min,
- i,
- d;
-
- for (i = 0; i < k; ++i) queue[i] = a[lo++];
- heap(queue, 0, k);
-
- if (lo < hi) {
- min = f(queue[0]);
- do {
- if (f(d = a[lo]) > min) {
- queue[0] = d;
- min = f(heap(queue, 0, k)[0]);
- }
- } while (++lo < hi);
- }
-
- return queue;
- }
-
- return heapselect;
- }
-
-
- const h = heapselect_by(cr_identity);
- h.by = heapselect_by;
-
- function bisect_by(f) {
-
-
-
-
-
-
-
-
-
-
-
- function bisectLeft(a, x, lo, hi) {
- while (lo < hi) {
- var mid = lo + hi >>> 1;
- if (f(a[mid]) < x) lo = mid + 1;
- else hi = mid;
- }
- return lo;
- }
-
-
-
-
-
-
-
- function bisectRight(a, x, lo, hi) {
- while (lo < hi) {
- var mid = lo + hi >>> 1;
- if (x < f(a[mid])) hi = mid;
- else lo = mid + 1;
- }
- return lo;
- }
-
- bisectRight.right = bisectRight;
- bisectRight.left = bisectLeft;
- return bisectRight;
- }
-
- const bisect = bisect_by(cr_identity);
- bisect.by = bisect_by;
-
- var permute = (array, index, deep) => {
- for (var i = 0, n = index.length, copy = deep ? JSON.parse(JSON.stringify(array)) : new Array(n); i < n; ++i) {
- copy[i] = array[index[i]];
- }
- return copy;
- };
-
- const reduceIncrement = p => {
- return p + 1;
- };
-
- const reduceDecrement = p => {
- return p - 1;
- };
-
- const reduceAdd = f => {
- return function(p, v) {
- return p + +f(v);
- };
- };
-
- const reduceSubtract = f => {
- return function(p, v) {
- return p - f(v);
- };
- };
-
- var xfilterReduce = {
- reduceIncrement,
- reduceDecrement,
- reduceAdd,
- reduceSubtract
- };
-
- function deep(t,e,i,n,r){for(r in n=(i=i.split(".")).splice(-1,1),i)e=e[i[r]]=e[i[r]]||{};return t(e,n)}
-
-
-
- const get = (obj, prop) => {
- const value = obj[prop];
- return (typeof value === 'function') ? value.call(obj) : value;
- };
-
-
- const reg = /\[([\w\d]+)\]/g;
- var result = (obj, path) => {
- return deep(get, obj, path.replace(reg, '.$1'))
- };
-
- // constants
- var REMOVED_INDEX = -1;
-
- crossfilter$1.heap = h$1;
- crossfilter$1.heapselect = h;
- crossfilter$1.bisect = bisect;
- crossfilter$1.permute = permute;
-
- function crossfilter$1() {
- var crossfilter = {
- add: add,
- remove: removeData,
- dimension: dimension,
- groupAll: groupAll,
- size: size,
- all: all,
- allFiltered: allFiltered,
- onChange: onChange,
- isElementFiltered: isElementFiltered
- };
-
- var data = [],
- n = 0,
- filters,
- filterListeners = [],
- dataListeners = [],
- removeDataListeners = [],
- callbacks = [];
-
- filters = new xfilterArray.bitarray(0);
-
-
- function add(newData) {
- var n0 = n,
- n1 = newData.length;
-
-
-
-
-
- if (n1) {
- data = data.concat(newData);
- filters.lengthen(n += n1);
- dataListeners.forEach(function(l) { l(newData, n0, n1); });
- triggerOnChange('dataAdded');
- }
-
- return crossfilter;
- }
-
-
-
- function removeData(predicate) {
- var
- newIndex = new Array(n),
- removed = [],
- usePred = typeof predicate === 'function',
- shouldRemove = function (i) {
- return usePred ? predicate(data[i], i) : filters.zero(i)
- };
-
- for (var index1 = 0, index2 = 0; index1 < n; ++index1) {
- if ( shouldRemove(index1) ) {
- removed.push(index1);
- newIndex[index1] = REMOVED_INDEX;
- } else {
- newIndex[index1] = index2++;
- }
- }
-
-
- filterListeners.forEach(function(l) { l(-1, -1, [], removed, true); });
-
-
- removeDataListeners.forEach(function(l) { l(newIndex); });
-
-
- for (var index3 = 0, index4 = 0; index3 < n; ++index3) {
- if ( newIndex[index3] !== REMOVED_INDEX ) {
- if (index3 !== index4) filters.copy(index4, index3), data[index4] = data[index3];
- ++index4;
- }
- }
-
- data.length = n = index4;
- filters.truncate(index4);
- triggerOnChange('dataRemoved');
- }
-
- function maskForDimensions(dimensions) {
- var n,
- d,
- len,
- id,
- mask = Array(filters.subarrays);
- for (n = 0; n < filters.subarrays; n++) { mask[n] = ~0; }
- for (d = 0, len = dimensions.length; d < len; d++) {
-
-
- id = dimensions[d].id();
- mask[id >> 7] &= ~(0x1 << (id & 0x3f));
- }
- return mask;
- }
-
-
-
- function isElementFiltered(i, ignore_dimensions) {
- var mask = maskForDimensions(ignore_dimensions || []);
- return filters.zeroExceptMask(i,mask);
- }
-
-
- function dimension(value, iterable) {
-
- if (typeof value === 'string') {
- var accessorPath = value;
- value = function(d) { return result(d, accessorPath); };
- }
-
- var dimension = {
- filter: filter,
- filterExact: filterExact,
- filterRange: filterRange,
- filterFunction: filterFunction,
- filterAll: filterAll,
- currentFilter: currentFilter,
- hasCurrentFilter: hasCurrentFilter,
- top: top,
- bottom: bottom,
- group: group,
- groupAll: groupAll,
- dispose: dispose,
- remove: dispose,
- accessor: value,
- id: function() { return id; }
- };
-
- var one,
- zero,
- offset,
- id,
- values,
- index,
- newValues,
- newIndex,
- iterablesIndexCount,
- iterablesIndexFilterStatus,
- iterablesEmptyRows = [],
- sortRange = function(n) {
- return cr_range(n).sort(function(A, B) {
- var a = newValues[A], b = newValues[B];
- return a < b ? -1 : a > b ? 1 : A - B;
- });
- },
- refilter = xfilterFilter.filterAll,
- refilterFunction,
- filterValue,
- filterValuePresent,
- indexListeners = [],
- dimensionGroups = [],
- lo0 = 0,
- hi0 = 0,
- t = 0,
- k;
-
-
-
-
- dataListeners.unshift(preAdd);
- dataListeners.push(postAdd);
-
- removeDataListeners.push(removeData);
-
-
- var tmp = filters.add();
- offset = tmp.offset;
- one = tmp.one;
- zero = ~one;
-
-
-
-
-
- id = (offset << 7) | (Math.log(one) / Math.log(2));
-
- preAdd(data, 0, n);
- postAdd(data, 0, n);
-
-
-
- function preAdd(newData, n0, n1) {
- var newIterablesIndexCount,
- newIterablesIndexFilterStatus;
-
- if (iterable){
-
- t = 0;
- j = 0;
- k = [];
-
- for (var i0 = 0; i0 < newData.length; i0++) {
- for(j = 0, k = value(newData[i0]); j < k.length; j++) {
- t++;
- }
- }
-
- newValues = [];
- newIterablesIndexCount = cr_range(newData.length);
- newIterablesIndexFilterStatus = cr_index(t,1);
- var unsortedIndex = cr_range(t);
-
- for (var l = 0, index1 = 0; index1 < newData.length; index1++) {
- k = value(newData[index1]);
-
- if(!k.length){
- newIterablesIndexCount[index1] = 0;
- iterablesEmptyRows.push(index1 + n0);
- continue;
- }
- newIterablesIndexCount[index1] = k.length;
- for (j = 0; j < k.length; j++) {
- newValues.push(k[j]);
- unsortedIndex[l] = index1;
- l++;
- }
- }
-
-
- var sortMap = sortRange(t);
-
-
- newValues = permute(newValues, sortMap);
-
-
-
-
- newIndex = permute(unsortedIndex, sortMap);
-
- } else {
-
- newValues = newData.map(value);
- newIndex = sortRange(n1);
- newValues = permute(newValues, newIndex);
- }
-
-
- var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1];
-
- var index2, index3, index4;
- if(iterable) {
- n1 = t;
- if (refilterFunction) {
- for (index2 = 0; index2 < n1; ++index2) {
- if (!refilterFunction(newValues[index2], index2)) {
- if(--newIterablesIndexCount[newIndex[index2]] === 0) {
- filters[offset][newIndex[index2] + n0] |= one;
- }
- newIterablesIndexFilterStatus[index2] = 1;
- }
- }
- } else {
- for (index3 = 0; index3 < lo1; ++index3) {
- if(--newIterablesIndexCount[newIndex[index3]] === 0) {
- filters[offset][newIndex[index3] + n0] |= one;
- }
- newIterablesIndexFilterStatus[index3] = 1;
- }
- for (index4 = hi1; index4 < n1; ++index4) {
- if(--newIterablesIndexCount[newIndex[index4]] === 0) {
- filters[offset][newIndex[index4] + n0] |= one;
- }
- newIterablesIndexFilterStatus[index4] = 1;
- }
- }
- } else {
- if (refilterFunction) {
- for (index2 = 0; index2 < n1; ++index2) {
- if (!refilterFunction(newValues[index2], index2)) {
- filters[offset][newIndex[index2] + n0] |= one;
- }
- }
- } else {
- for (index3 = 0; index3 < lo1; ++index3) {
- filters[offset][newIndex[index3] + n0] |= one;
- }
- for (index4 = hi1; index4 < n1; ++index4) {
- filters[offset][newIndex[index4] + n0] |= one;
- }
- }
- }
-
-
-
- if (!n0) {
- values = newValues;
- index = newIndex;
- iterablesIndexCount = newIterablesIndexCount;
- iterablesIndexFilterStatus = newIterablesIndexFilterStatus;
- lo0 = lo1;
- hi0 = hi1;
- return;
- }
-
-
-
- var oldValues = values,
- oldIndex = index,
- oldIterablesIndexFilterStatus = iterablesIndexFilterStatus,
- old_n0,
- i1 = 0;
-
- i0 = 0;
-
- if(iterable){
- old_n0 = n0;
- n0 = oldValues.length;
- n1 = t;
- }
-
-
- values = iterable ? new Array(n0 + n1) : new Array(n);
- index = iterable ? new Array(n0 + n1) : cr_index(n, n);
- if(iterable) iterablesIndexFilterStatus = cr_index(n0 + n1, 1);
-
-
- if(iterable) {
- var oldiiclength = iterablesIndexCount.length;
- iterablesIndexCount = xfilterArray.arrayLengthen(iterablesIndexCount, n);
- for(var j=0; j+oldiiclength < n; j++) {
- iterablesIndexCount[j+oldiiclength] = newIterablesIndexCount[j];
- }
- }
-
-
- var index5 = 0;
- for (; i0 < n0 && i1 < n1; ++index5) {
- if (oldValues[i0] < newValues[i1]) {
- values[index5] = oldValues[i0];
- if(iterable) iterablesIndexFilterStatus[index5] = oldIterablesIndexFilterStatus[i0];
- index[index5] = oldIndex[i0++];
- } else {
- values[index5] = newValues[i1];
- if(iterable) iterablesIndexFilterStatus[index5] = newIterablesIndexFilterStatus[i1];
- index[index5] = newIndex[i1++] + (iterable ? old_n0 : n0);
- }
- }
-
-
- for (; i0 < n0; ++i0, ++index5) {
- values[index5] = oldValues[i0];
- if(iterable) iterablesIndexFilterStatus[index5] = oldIterablesIndexFilterStatus[i0];
- index[index5] = oldIndex[i0];
- }
-
-
- for (; i1 < n1; ++i1, ++index5) {
- values[index5] = newValues[i1];
- if(iterable) iterablesIndexFilterStatus[index5] = newIterablesIndexFilterStatus[i1];
- index[index5] = newIndex[i1] + (iterable ? old_n0 : n0);
- }
-
-
- bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
- }
-
-
- function postAdd(newData, n0, n1) {
- indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
- newValues = newIndex = null;
- }
-
- function removeData(reIndex) {
- if (iterable) {
- for (var i0 = 0, i1 = 0; i0 < iterablesEmptyRows.length; i0++) {
- if (reIndex[iterablesEmptyRows[i0]] !== REMOVED_INDEX) {
- iterablesEmptyRows[i1] = reIndex[iterablesEmptyRows[i0]];
- i1++;
- }
- }
- iterablesEmptyRows.length = i1;
- for (i0 = 0, i1 = 0; i0 < n; i0++) {
- if (reIndex[i0] !== REMOVED_INDEX) {
- if (i1 !== i0) iterablesIndexCount[i1] = iterablesIndexCount[i0];
- i1++;
- }
- }
- iterablesIndexCount = iterablesIndexCount.slice(0, i1);
- }
-
- var n0 = values.length;
- for (var i = 0, j = 0, oldDataIndex; i < n0; ++i) {
- oldDataIndex = index[i];
- if (reIndex[oldDataIndex] !== REMOVED_INDEX) {
- if (i !== j) values[j] = values[i];
- index[j] = reIndex[oldDataIndex];
- if (iterable) {
- iterablesIndexFilterStatus[j] = iterablesIndexFilterStatus[i];
- }
- ++j;
- }
- }
- values.length = j;
- if (iterable) iterablesIndexFilterStatus = iterablesIndexFilterStatus.slice(0, j);
- while (j < n0) index[j++] = 0;
-
-
- var bounds = refilter(values);
- lo0 = bounds[0], hi0 = bounds[1];
- }
-
-
-
- function filterIndexBounds(bounds) {
-
- var lo1 = bounds[0],
- hi1 = bounds[1];
-
- if (refilterFunction) {
- refilterFunction = null;
- filterIndexFunction(function(d, i) { return lo1 <= i && i < hi1; }, bounds[0] === 0 && bounds[1] === values.length);
- lo0 = lo1;
- hi0 = hi1;
- return dimension;
- }
-
- var i,
- j,
- k,
- added = [],
- removed = [],
- valueIndexAdded = [],
- valueIndexRemoved = [];
-
-
-
- if (lo1 < lo0) {
- for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
- added.push(index[i]);
- valueIndexAdded.push(i);
- }
- } else if (lo1 > lo0) {
- for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
- removed.push(index[i]);
- valueIndexRemoved.push(i);
- }
- }
-
-
- if (hi1 > hi0) {
- for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
- added.push(index[i]);
- valueIndexAdded.push(i);
- }
- } else if (hi1 < hi0) {
- for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
- removed.push(index[i]);
- valueIndexRemoved.push(i);
- }
- }
-
- if(!iterable) {
-
-
- for(i=0; i<added.length; i++) {
- filters[offset][added[i]] ^= one;
- }
-
- for(i=0; i<removed.length; i++) {
- filters[offset][removed[i]] ^= one;
- }
-
- } else {
-
-
-
-
- var newAdded = [];
- var newRemoved = [];
- for (i = 0; i < added.length; i++) {
- iterablesIndexCount[added[i]]++;
- iterablesIndexFilterStatus[valueIndexAdded[i]] = 0;
- if(iterablesIndexCount[added[i]] === 1) {
- filters[offset][added[i]] ^= one;
- newAdded.push(added[i]);
- }
- }
- for (i = 0; i < removed.length; i++) {
- iterablesIndexCount[removed[i]]--;
- iterablesIndexFilterStatus[valueIndexRemoved[i]] = 1;
- if(iterablesIndexCount[removed[i]] === 0) {
- filters[offset][removed[i]] ^= one;
- newRemoved.push(removed[i]);
- }
- }
-
- added = newAdded;
- removed = newRemoved;
-
-
- if(refilter === xfilterFilter.filterAll) {
- for(i = 0; i < iterablesEmptyRows.length; i++) {
- if((filters[offset][k = iterablesEmptyRows[i]] & one)) {
-
- filters[offset][k] ^= one;
- added.push(k);
- }
- }
- } else {
-
- for(i = 0; i < iterablesEmptyRows.length; i++) {
- if(!(filters[offset][k = iterablesEmptyRows[i]] & one)) {
-
- filters[offset][k] ^= one;
- removed.push(k);
- }
- }
- }
- }
-
- lo0 = lo1;
- hi0 = hi1;
- filterListeners.forEach(function(l) { l(one, offset, added, removed); });
- triggerOnChange('filtered');
- return dimension;
- }
-
-
-
-
-
- function filter(range) {
- return range == null
- ? filterAll() : Array.isArray(range)
- ? filterRange(range) : typeof range === "function"
- ? filterFunction(range)
- : filterExact(range);
- }
-
-
- function filterExact(value) {
- filterValue = value;
- filterValuePresent = true;
- return filterIndexBounds((refilter = xfilterFilter.filterExact(bisect, value))(values));
- }
-
-
-
- function filterRange(range) {
- filterValue = range;
- filterValuePresent = true;
- return filterIndexBounds((refilter = xfilterFilter.filterRange(bisect, range))(values));
- }
-
-
- function filterAll() {
- filterValue = undefined;
- filterValuePresent = false;
- return filterIndexBounds((refilter = xfilterFilter.filterAll)(values));
- }
-
-
- function filterFunction(f) {
- filterValue = f;
- filterValuePresent = true;
-
- refilterFunction = f;
- refilter = xfilterFilter.filterAll;
-
- filterIndexFunction(f, false);
-
- var bounds = refilter(values);
- lo0 = bounds[0], hi0 = bounds[1];
-
- return dimension;
- }
-
- function filterIndexFunction(f, filterAll) {
- var i,
- k,
- x,
- added = [],
- removed = [],
- valueIndexAdded = [],
- valueIndexRemoved = [],
- indexLength = values.length;
-
- if(!iterable) {
- for (i = 0; i < indexLength; ++i) {
- if (!(filters[offset][k = index[i]] & one) ^ !!(x = f(values[i], i))) {
- if (x) added.push(k);
- else removed.push(k);
- }
- }
- }
-
- if(iterable) {
- for(i=0; i < indexLength; ++i) {
- if(f(values[i], i)) {
- added.push(index[i]);
- valueIndexAdded.push(i);
- } else {
- removed.push(index[i]);
- valueIndexRemoved.push(i);
- }
- }
- }
-
- if(!iterable) {
- for(i=0; i<added.length; i++) {
- if(filters[offset][added[i]] & one) filters[offset][added[i]] &= zero;
- }
-
- for(i=0; i<removed.length; i++) {
- if(!(filters[offset][removed[i]] & one)) filters[offset][removed[i]] |= one;
- }
- } else {
-
- var newAdded = [];
- var newRemoved = [];
- for (i = 0; i < added.length; i++) {
-
- if(iterablesIndexFilterStatus[valueIndexAdded[i]] === 1) {
- iterablesIndexCount[added[i]]++;
- iterablesIndexFilterStatus[valueIndexAdded[i]] = 0;
- if(iterablesIndexCount[added[i]] === 1) {
- filters[offset][added[i]] ^= one;
- newAdded.push(added[i]);
- }
- }
- }
- for (i = 0; i < removed.length; i++) {
-
- if(iterablesIndexFilterStatus[valueIndexRemoved[i]] === 0) {
- iterablesIndexCount[removed[i]]--;
- iterablesIndexFilterStatus[valueIndexRemoved[i]] = 1;
- if(iterablesIndexCount[removed[i]] === 0) {
- filters[offset][removed[i]] ^= one;
- newRemoved.push(removed[i]);
- }
- }
- }
-
- added = newAdded;
- removed = newRemoved;
-
-
- if(filterAll) {
- for(i = 0; i < iterablesEmptyRows.length; i++) {
- if((filters[offset][k = iterablesEmptyRows[i]] & one)) {
-
- filters[offset][k] ^= one;
- added.push(k);
- }
- }
- } else {
-
- for(i = 0; i < iterablesEmptyRows.length; i++) {
- if(!(filters[offset][k = iterablesEmptyRows[i]] & one)) {
-
- filters[offset][k] ^= one;
- removed.push(k);
- }
- }
- }
- }
-
- filterListeners.forEach(function(l) { l(one, offset, added, removed); });
- triggerOnChange('filtered');
- }
-
- function currentFilter() {
- return filterValue;
- }
-
- function hasCurrentFilter() {
- return filterValuePresent;
- }
-
-
-
- function top(k, top_offset) {
- var array = [],
- i = hi0,
- j,
- toSkip = 0;
-
- if(top_offset && top_offset > 0) toSkip = top_offset;
-
- while (--i >= lo0 && k > 0) {
- if (filters.zero(j = index[i])) {
- if(toSkip > 0) {
-
- --toSkip;
- } else {
- array.push(data[j]);
- --k;
- }
- }
- }
-
- if(iterable){
- for(i = 0; i < iterablesEmptyRows.length && k > 0; i++) {
-
- if(filters.zero(j = iterablesEmptyRows[i])) {
- if(toSkip > 0) {
-
- --toSkip;
- } else {
- array.push(data[j]);
- --k;
- }
- }
- }
- }
-
- return array;
- }
-
-
-
- function bottom(k, bottom_offset) {
- var array = [],
- i,
- j,
- toSkip = 0;
-
- if(bottom_offset && bottom_offset > 0) toSkip = bottom_offset;
-
- if(iterable) {
-
- for(i = 0; i < iterablesEmptyRows.length && k > 0; i++) {
- if(filters.zero(j = iterablesEmptyRows[i])) {
- if(toSkip > 0) {
-
- --toSkip;
- } else {
- array.push(data[j]);
- --k;
- }
- }
- }
- }
-
- i = lo0;
-
- while (i < hi0 && k > 0) {
- if (filters.zero(j = index[i])) {
- if(toSkip > 0) {
-
- --toSkip;
- } else {
- array.push(data[j]);
- --k;
- }
- }
- i++;
- }
-
- return array;
- }
-
-
- function group(key) {
- var group = {
- top: top,
- all: all,
- reduce: reduce,
- reduceCount: reduceCount,
- reduceSum: reduceSum,
- order: order,
- orderNatural: orderNatural,
- size: size,
- dispose: dispose,
- remove: dispose
- };
-
-
- dimensionGroups.push(group);
-
- var groups,
- groupIndex,
- groupWidth = 8,
- groupCapacity = capacity(groupWidth),
- k = 0,
- select,
- heap,
- reduceAdd,
- reduceRemove,
- reduceInitial,
- update = cr_null,
- reset = cr_null,
- resetNeeded = true,
- groupAll = key === cr_null,
- n0old;
-
- if (arguments.length < 1) key = cr_identity;
-
-
-
-
- filterListeners.push(update);
- indexListeners.push(add);
- removeDataListeners.push(removeData);
-
-
- add(values, index, 0, n);
-
-
-
- function add(newValues, newIndex, n0, n1) {
-
- if(iterable) {
- n0old = n0;
- n0 = values.length - newValues.length;
- n1 = newValues.length;
- }
-
- var oldGroups = groups,
- reIndex = iterable ? [] : cr_index(k, groupCapacity),
- add = reduceAdd,
- remove = reduceRemove,
- initial = reduceInitial,
- k0 = k,
- i0 = 0,
- i1 = 0,
- j,
- g0,
- x0,
- x1,
- g,
- x;
-
-
- if (resetNeeded) add = initial = cr_null;
- if (resetNeeded) remove = initial = cr_null;
-
-
-
- groups = new Array(k), k = 0;
- if(iterable){
- groupIndex = k0 ? groupIndex : [];
- }
- else {
- groupIndex = k0 > 1 ? xfilterArray.arrayLengthen(groupIndex, n) : cr_index(n, groupCapacity);
- }
-
-
-
- if (k0) x0 = (g0 = oldGroups[0]).key;
-
-
- while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
-
-
- while (i1 < n1) {
-
-
-
- if (g0 && x0 <= x1) {
- g = g0, x = x0;
-
-
- reIndex[i0] = k;
-
-
- g0 = oldGroups[++i0];
- if (g0) x0 = g0.key;
- } else {
- g = {key: x1, value: initial()}, x = x1;
- }
-
-
- groups[k] = g;
-
-
-
-
- while (x1 <= x) {
- j = newIndex[i1] + (iterable ? n0old : n0);
-
-
- if(iterable){
- if(groupIndex[j]){
- groupIndex[j].push(k);
- }
- else {
- groupIndex[j] = [k];
- }
- }
- else {
- groupIndex[j] = k;
- }
-
-
-
- g.value = add(g.value, data[j], true);
- if (!filters.zeroExcept(j, offset, zero)) g.value = remove(g.value, data[j], false);
- if (++i1 >= n1) break;
- x1 = key(newValues[i1]);
- }
-
- groupIncrement();
- }
-
-
-
-
- while (i0 < k0) {
- groups[reIndex[i0] = k] = oldGroups[i0++];
- groupIncrement();
- }
-
-
-
- if(iterable){
- for (var index1 = 0; index1 < n; index1++) {
- if(!groupIndex[index1]){
- groupIndex[index1] = [];
- }
- }
- }
-
-
-
- if(k > i0){
- if(iterable){
- for (i0 = 0; i0 < n0old; ++i0) {
- for (index1 = 0; index1 < groupIndex[i0].length; index1++) {
- groupIndex[i0][index1] = reIndex[groupIndex[i0][index1]];
- }
- }
- }
- else {
- for (i0 = 0; i0 < n0; ++i0) {
- groupIndex[i0] = reIndex[groupIndex[i0]];
- }
- }
- }
-
-
-
-
-
-
- j = filterListeners.indexOf(update);
- if (k > 1 || iterable) {
- update = updateMany;
- reset = resetMany;
- } else {
- if (!k && groupAll) {
- k = 1;
- groups = [{key: null, value: initial()}];
- }
- if (k === 1) {
- update = updateOne;
- reset = resetOne;
- } else {
- update = cr_null;
- reset = cr_null;
- }
- groupIndex = null;
- }
- filterListeners[j] = update;
-
-
-
- function groupIncrement() {
- if(iterable){
- k++;
- return
- }
- if (++k === groupCapacity) {
- reIndex = xfilterArray.arrayWiden(reIndex, groupWidth <<= 1);
- groupIndex = xfilterArray.arrayWiden(groupIndex, groupWidth);
- groupCapacity = capacity(groupWidth);
- }
- }
- }
-
- function removeData(reIndex) {
- if (k > 1 || iterable) {
- var oldK = k,
- oldGroups = groups,
- seenGroups = cr_index(oldK, oldK),
- i,
- i0,
- j;
-
-
-
- if (!iterable) {
- for (i = 0, j = 0; i < n; ++i) {
- if (reIndex[i] !== REMOVED_INDEX) {
- seenGroups[groupIndex[j] = groupIndex[i]] = 1;
- ++j;
- }
- }
- } else {
- for (i = 0, j = 0; i < n; ++i) {
- if (reIndex[i] !== REMOVED_INDEX) {
- groupIndex[j] = groupIndex[i];
- for (i0 = 0; i0 < groupIndex[j].length; i0++) {
- seenGroups[groupIndex[j][i0]] = 1;
- }
- ++j;
- }
- }
- groupIndex = groupIndex.slice(0, j);
- }
-
-
-
-
- groups = [], k = 0;
- for (i = 0; i < oldK; ++i) {
- if (seenGroups[i]) {
- seenGroups[i] = k++;
- groups.push(oldGroups[i]);
- }
- }
-
- if (k > 1 || iterable) {
-
- if (!iterable) {
- for (i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];
- } else {
- for (i = 0; i < j; ++i) {
- for (i0 = 0; i0 < groupIndex[i].length; ++i0) {
- groupIndex[i][i0] = seenGroups[groupIndex[i][i0]];
- }
- }
- }
- } else {
- groupIndex = null;
- }
- filterListeners[filterListeners.indexOf(update)] = k > 1 || iterable
- ? (reset = resetMany, update = updateMany)
- : k === 1 ? (reset = resetOne, update = updateOne)
- : reset = update = cr_null;
- } else if (k === 1) {
- if (groupAll) return;
- for (var index3 = 0; index3 < n; ++index3) if (reIndex[index3] !== REMOVED_INDEX) return;
- groups = [], k = 0;
- filterListeners[filterListeners.indexOf(update)] =
- update = reset = cr_null;
- }
- }
-
-
-
-
- function updateMany(filterOne, filterOffset, added, removed, notFilter) {
-
- if ((filterOne === one && filterOffset === offset) || resetNeeded) return;
-
- var i,
- j,
- k,
- n,
- g;
-
- if(iterable){
-
- for (i = 0, n = added.length; i < n; ++i) {
- if (filters.zeroExcept(k = added[i], offset, zero)) {
- for (j = 0; j < groupIndex[k].length; j++) {
- g = groups[groupIndex[k][j]];
- g.value = reduceAdd(g.value, data[k], false, j);
- }
- }
- }
-
-
- for (i = 0, n = removed.length; i < n; ++i) {
- if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {
- for (j = 0; j < groupIndex[k].length; j++) {
- g = groups[groupIndex[k][j]];
- g.value = reduceRemove(g.value, data[k], notFilter, j);
- }
- }
- }
- return;
- }
-
-
- for (i = 0, n = added.length; i < n; ++i) {
- if (filters.zeroExcept(k = added[i], offset, zero)) {
- g = groups[groupIndex[k]];
- g.value = reduceAdd(g.value, data[k], false);
- }
- }
-
-
- for (i = 0, n = removed.length; i < n; ++i) {
- if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {
- g = groups[groupIndex[k]];
- g.value = reduceRemove(g.value, data[k], notFilter);
- }
- }
- }
-
-
-
-
- function updateOne(filterOne, filterOffset, added, removed, notFilter) {
- if ((filterOne === one && filterOffset === offset) || resetNeeded) return;
-
- var i,
- k,
- n,
- g = groups[0];
-
-
- for (i = 0, n = added.length; i < n; ++i) {
- if (filters.zeroExcept(k = added[i], offset, zero)) {
- g.value = reduceAdd(g.value, data[k], false);
- }
- }
-
-
- for (i = 0, n = removed.length; i < n; ++i) {
- if (filters.onlyExcept(k = removed[i], offset, zero, filterOffset, filterOne)) {
- g.value = reduceRemove(g.value, data[k], notFilter);
- }
- }
- }
-
-
-
- function resetMany() {
- var i,
- j,
- g;
-
-
- for (i = 0; i < k; ++i) {
- groups[i].value = reduceInitial();
- }
-
-
-
-
- if(iterable){
- for (i = 0; i < n; ++i) {
- for (j = 0; j < groupIndex[i].length; j++) {
- g = groups[groupIndex[i][j]];
- g.value = reduceAdd(g.value, data[i], true, j);
- }
- }
- for (i = 0; i < n; ++i) {
- if (!filters.zeroExcept(i, offset, zero)) {
- for (j = 0; j < groupIndex[i].length; j++) {
- g = groups[groupIndex[i][j]];
- g.value = reduceRemove(g.value, data[i], false, j);
- }
- }
- }
- return;
- }
-
- for (i = 0; i < n; ++i) {
- g = groups[groupIndex[i]];
- g.value = reduceAdd(g.value, data[i], true);
- }
- for (i = 0; i < n; ++i) {
- if (!filters.zeroExcept(i, offset, zero)) {
- g = groups[groupIndex[i]];
- g.value = reduceRemove(g.value, data[i], false);
- }
- }
- }
-
-
-
- function resetOne() {
- var i,
- g = groups[0];
-
-
- g.value = reduceInitial();
-
-
-
-
- for (i = 0; i < n; ++i) {
- g.value = reduceAdd(g.value, data[i], true);
- }
-
- for (i = 0; i < n; ++i) {
- if (!filters.zeroExcept(i, offset, zero)) {
- g.value = reduceRemove(g.value, data[i], false);
- }
- }
- }
-
-
- function all() {
- if (resetNeeded) reset(), resetNeeded = false;
- return groups;
- }
-
-
- function top(k) {
- var top = select(all(), 0, groups.length, k);
- return heap.sort(top, 0, top.length);
- }
-
-
-
- function reduce(add, remove, initial) {
- reduceAdd = add;
- reduceRemove = remove;
- reduceInitial = initial;
- resetNeeded = true;
- return group;
- }
-
-
- function reduceCount() {
- return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, cr_zero);
- }
-
-
- function reduceSum(value) {
- return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), cr_zero);
- }
-
-
- function order(value) {
- select = h.by(valueOf);
- heap = h$1.by(valueOf);
- function valueOf(d) { return value(d.value); }
- return group;
- }
-
-
- function orderNatural() {
- return order(cr_identity);
- }
-
-
- function size() {
- return k;
- }
-
-
- function dispose() {
- var i = filterListeners.indexOf(update);
- if (i >= 0) filterListeners.splice(i, 1);
- i = indexListeners.indexOf(add);
- if (i >= 0) indexListeners.splice(i, 1);
- i = removeDataListeners.indexOf(removeData);
- if (i >= 0) removeDataListeners.splice(i, 1);
- i = dimensionGroups.indexOf(group);
- if (i >= 0) dimensionGroups.splice(i, 1);
- return group;
- }
-
- return reduceCount().orderNatural();
- }
-
-
- function groupAll() {
- var g = group(cr_null), all = g.all;
- delete g.all;
- delete g.top;
- delete g.order;
- delete g.orderNatural;
- delete g.size;
- g.value = function() { return all()[0].value; };
- return g;
- }
-
-
- function dispose() {
- dimensionGroups.forEach(function(group) { group.dispose(); });
- var i = dataListeners.indexOf(preAdd);
- if (i >= 0) dataListeners.splice(i, 1);
- i = dataListeners.indexOf(postAdd);
- if (i >= 0) dataListeners.splice(i, 1);
- i = removeDataListeners.indexOf(removeData);
- if (i >= 0) removeDataListeners.splice(i, 1);
- filters.masks[offset] &= zero;
- return filterAll();
- }
-
- return dimension;
- }
-
-
-
- function groupAll() {
- var group = {
- reduce: reduce,
- reduceCount: reduceCount,
- reduceSum: reduceSum,
- value: value,
- dispose: dispose,
- remove: dispose
- };
-
- var reduceValue,
- reduceAdd,
- reduceRemove,
- reduceInitial,
- resetNeeded = true;
-
-
-
-
- filterListeners.push(update);
- dataListeners.push(add);
-
-
- add(data, 0);
-
-
- function add(newData, n0) {
- var i;
-
- if (resetNeeded) return;
-
-
- for (i = n0; i < n; ++i) {
-
-
- reduceValue = reduceAdd(reduceValue, data[i], true);
-
-
- if (!filters.zero(i)) {
- reduceValue = reduceRemove(reduceValue, data[i], false);
- }
- }
- }
-
-
- function update(filterOne, filterOffset, added, removed, notFilter) {
- var i,
- k,
- n;
-
- if (resetNeeded) return;
-
-
- for (i = 0, n = added.length; i < n; ++i) {
- if (filters.zero(k = added[i])) {
- reduceValue = reduceAdd(reduceValue, data[k], notFilter);
- }
- }
-
-
- for (i = 0, n = removed.length; i < n; ++i) {
- if (filters.only(k = removed[i], filterOffset, filterOne)) {
- reduceValue = reduceRemove(reduceValue, data[k], notFilter);
- }
- }
- }
-
-
- function reset() {
- var i;
-
- reduceValue = reduceInitial();
-
-
- for (i = 0; i < n; ++i) {
-
-
- reduceValue = reduceAdd(reduceValue, data[i], true);
-
-
- if (!filters.zero(i)) {
- reduceValue = reduceRemove(reduceValue, data[i], false);
- }
- }
- }
-
-
-
- function reduce(add, remove, initial) {
- reduceAdd = add;
- reduceRemove = remove;
- reduceInitial = initial;
- resetNeeded = true;
- return group;
- }
-
-
- function reduceCount() {
- return reduce(xfilterReduce.reduceIncrement, xfilterReduce.reduceDecrement, cr_zero);
- }
-
-
- function reduceSum(value) {
- return reduce(xfilterReduce.reduceAdd(value), xfilterReduce.reduceSubtract(value), cr_zero);
- }
-
-
- function value() {
- if (resetNeeded) reset(), resetNeeded = false;
- return reduceValue;
- }
-
-
- function dispose() {
- var i = filterListeners.indexOf(update);
- if (i >= 0) filterListeners.splice(i, 1);
- i = dataListeners.indexOf(add);
- if (i >= 0) dataListeners.splice(i, 1);
- return group;
- }
-
- return reduceCount();
- }
-
-
- function size() {
- return n;
- }
-
-
- function all(){
- return data;
- }
-
-
- function allFiltered(ignore_dimensions) {
- var array = [],
- i = 0,
- mask = maskForDimensions(ignore_dimensions || []);
-
- for (i = 0; i < n; i++) {
- if (filters.zeroExceptMask(i, mask)) {
- array.push(data[i]);
- }
- }
-
- return array;
- }
-
- function onChange(cb){
- if(typeof cb !== 'function'){
-
- console.warn('onChange callback parameter must be a function!');
- return;
- }
- callbacks.push(cb);
- return function(){
- callbacks.splice(callbacks.indexOf(cb), 1);
- };
- }
-
- function triggerOnChange(eventName){
- for (var i = 0; i < callbacks.length; i++) {
- callbacks[i](eventName);
- }
- }
-
- return arguments.length
- ? add(arguments[0])
- : crossfilter;
- }
-
-
- function cr_index(n, m) {
- return (m < 0x101
- ? xfilterArray.array8 : m < 0x10001
- ? xfilterArray.array16
- : xfilterArray.array32)(n);
- }
-
-
- function cr_range(n) {
- var range = cr_index(n, n);
- for (var i = -1; ++i < n;) range[i] = i;
- return range;
- }
-
- function capacity(w) {
- return w === 8
- ? 0x100 : w === 16
- ? 0x10000
- : 0x100000000;
- }
-
- var main = Object.freeze({
- __proto__: null,
- 'default': crossfilter$1
- });
-
- var crossfilterreq = getAugmentedNamespace(main);
-
- const crossfilter = crossfilterreq.default ? crossfilterreq.default : crossfilterreq;
-
-
- var dx = {
- indexFns : { id : function (d) { return d.id || "" } }
- , createIndexFn : function(indexFn, dim){
-
- var indexFns = {
- dim : function(d) { return d[dim] || "" }
- , dimId : function(d) { return d[dim + 'Id'] || "" }
- };
- if(Object.prototype.toString.call(indexFn) === '[object Function]' ) return indexFn;
- if(indexFn) return function(d) { return d[indexFn] || "" }
-
- indexFn = function(d){
-
-
- console.error('default generated indexFn on non existence of model property is dangerous.');
- indexFn = d[dim] ? indexFns['dim'] : d[dim + 'Id'] ? indexFns['dimId'] : dx.indexFns['id'];
- dx.indexFns['id'] === indexFn ? console.error('Warning : dimension name not found. Using id as default is not recommended.') : null;
-
-
- return indexFn(d);
- };
-
- return function(d){ return indexFn(d) }
- }
-
- , filter : function(filter, dim){
-
- if(!filter) { console.warn('Useless call to filter without a real filter.'); return;}
-
- var filterable = dim ? this.dims[dim] : this;
-
- if(!filterable.wkFilters.get(filter)) {
- filterable.wkFilters.set(filter, true);
- filterable.filters.push(filter);
- }
-
-
- if(filterable.dxFd){
-
- filterable.dxFd.filter( filterable.__filter );
- }
- filterable.dxF.filter(filterable.__filter);
-
-
-
-
-
-
-
-
-
-
-
-
- }
- , filterAll : function(dim){
-
- var filterable = dim ? this.dims[dim] : this;
-
- if(filterable.dxFd){
-
- filterable.dxFd.filterAll();
- }
- filterable.dxF.filterAll( );
-
-
-
-
-
-
- }
- , addFilter : function(filter, dim) {
- dim = dim || 'id';
- this.dims[dim].filters.push(filter);
- }
- , __initDim : function(oDim){
- var __filter = function(d){
- for(var f=0; f < oDim.filters.length; f++) {
-
-
- if(!oDim.filters[f].call(oDim, d)) return false;
- }
- return true;
- };
- return oDim ? (()=>{
- oDim.wkFilters = new(WeakMap);
- oDim.filters = []; oDim.__filter = __filter;
- return oDim
- })()
- : { wkFilters : new(WeakMap), filters : [], __filter : __filter }
- }
- , __createPairedDx : function(specs, dim, idxFn){
- var oDim = dim === 'id' ? specs : specs.dims[dim];
- idxFn = idxFn || dx.createIndexFn(oDim.indexFn, dim);
-
- oDim.dxU = specs.ndxU.dimension( idxFn );
- oDim.dxF = specs.ndxF.dimension( idxFn );
- }
- , create : function( specs ){
-
- specs.ndxF = crossfilter(specs.data);
- specs.ndxU = crossfilter(specs.data);
-
-
-
- dx.__initDim(specs);
- dx.__createPairedDx(specs, 'id', dx.indexFns.id);
-
- specs.dims ? Object.keys(specs.dims).forEach((dim)=>{
- specs.dims[dim].data ? (()=>{
-
- dx.create( specs.dims[dim] );
-
-
-
-
- })()
- : dx.__initDim(specs.dims[dim]);
-
- var idxFn = dx.createIndexFn(specs.dims[dim].indexFn, dim);
- specs.dims[dim].dxFd = specs.ndxF.dimension( idxFn );
- specs.dims[dim].dxUd = specs.ndxU.dimension( idxFn );
-
- }) : null;
-
- specs.filter = this.filter;
- specs.filterAll = this.filterAll;
- return specs;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- };
-
- var dx_1 = dx;
-
- try {
- var x$1 = BigInt(0);
- }
- catch(e){
- console.warn('BigInt check failed. Falling back to Number');
-
-
-
- BigInt = Number;
- }
-
-
-
-
- function cliargs$1(args, opts) {
- if (!opts) opts = {};
-
- var flags = { bools : {}, strings : {}, unknownFn: null };
-
- if (typeof opts['unknown'] === 'function') {
- flags.unknownFn = opts['unknown'];
- }
-
- if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
- flags.allBools = true;
- } else {
- [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
- flags.bools[key] = true;
- });
- }
-
- var aliases = {};
- Object.keys(opts.alias || {}).forEach(function (key) {
- aliases[key] = [].concat(opts.alias[key]);
- aliases[key].forEach(function (x) {
- aliases[x] = [key].concat(aliases[key].filter(function (y) {
- return x !== y;
- }));
- });
- });
-
- [].concat(opts.string).filter(Boolean).forEach(function (key) {
- flags.strings[key] = true;
- if (aliases[key]) {
- flags.strings[aliases[key]] = true;
- }
- });
-
- var defaults = opts['default'] || {};
-
- var argv = { _ : [] };
- Object.keys(flags.bools).forEach(function (key) {
- setArg(key, defaults[key] === undefined ? false : defaults[key]);
- });
-
- var notFlags = [];
-
- if (args.indexOf('--') !== -1) {
- notFlags = args.slice(args.indexOf('--')+1);
- args = args.slice(0, args.indexOf('--'));
- }
-
- function argDefined(key, arg) {
- return (flags.allBools && /^--[^=]+$/.test(arg)) ||
- flags.strings[key] || flags.bools[key] || aliases[key];
- }
-
- function setArg (key, val, arg) {
- if (arg && flags.unknownFn && !argDefined(key, arg)) {
- if (flags.unknownFn(arg) === false) return;
- }
-
- var value = !flags.strings[key] && isNumber(val)
- ? Number(val) : val
- ;
- setKey(argv, key.split('.'), value);
-
- (aliases[key] || []).forEach(function (x) {
- setKey(argv, x.split('.'), value);
- });
- }
-
- function setKey (obj, keys, value) {
- var o = obj;
- keys.slice(0,-1).forEach(function (key) {
- if (o[key] === undefined) o[key] = {};
- o = o[key];
- });
-
- var key = keys[keys.length - 1];
- if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
- o[key] = value;
- }
- else if (Array.isArray(o[key])) {
- o[key].push(value);
- }
- else {
- o[key] = [ o[key], value ];
- }
- }
-
- function aliasIsBoolean(key) {
- return aliases[key].some(function (x) {
- return flags.bools[x];
- });
- }
-
- for (var i = 0; i < args.length; i++) {
- var arg = args[i];
-
- if (/^--.+=/.test(arg)) {
-
-
-
- var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
- var key = m[1];
- var value = m[2];
- if (flags.bools[key]) {
- value = value !== 'false';
- }
- setArg(key, value, arg);
- }
- else if (/^--no-.+/.test(arg)) {
- var key = arg.match(/^--no-(.+)/)[1];
- setArg(key, false, arg);
- }
- else if (/^--.+/.test(arg)) {
- var key = arg.match(/^--(.+)/)[1];
- var next = args[i + 1];
- if (next !== undefined && !/^-/.test(next)
- && !flags.bools[key]
- && !flags.allBools
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, next, arg);
- i++;
- }
- else if (/^(true|false)$/.test(next)) {
- setArg(key, next === 'true', arg);
- i++;
- }
- else {
- setArg(key, flags.strings[key] ? '' : true, arg);
- }
- }
- else if (/^-[^-]+/.test(arg)) {
- var letters = arg.slice(1,-1).split('');
-
- var broken = false;
- for (var j = 0; j < letters.length; j++) {
- var next = arg.slice(j+2);
-
- if (next === '-') {
- setArg(letters[j], next, arg);
- continue;
- }
-
- if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
- setArg(letters[j], next.split('=')[1], arg);
- broken = true;
- break;
- }
-
- if (/[A-Za-z]/.test(letters[j])
- && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next, arg);
- broken = true;
- break;
- }
-
- if (letters[j+1] && letters[j+1].match(/\W/)) {
- setArg(letters[j], arg.slice(j+2), arg);
- broken = true;
- break;
- }
- else {
- setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
- }
- }
-
- var key = arg.slice(-1)[0];
- if (!broken && key !== '-') {
- if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
- && !flags.bools[key]
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, args[i+1], arg);
- i++;
- }
- else if (args[i+1] && /true|false/.test(args[i+1])) {
- setArg(key, args[i+1] === 'true', arg);
- i++;
- }
- else {
- setArg(key, flags.strings[key] ? '' : true, arg);
- }
- }
- }
- else {
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
- argv._.push(
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
- );
- }
- if (opts.stopEarly) {
- argv._.push.apply(argv._, args.slice(i + 1));
- break;
- }
- }
- }
-
- Object.keys(defaults).forEach(function (key) {
- if (!hasKey(argv, key.split('.'))) {
- setKey(argv, key.split('.'), defaults[key]);
-
- (aliases[key] || []).forEach(function (x) {
- setKey(argv, x.split('.'), defaults[key]);
- });
- }
- });
-
- if (opts['--']) {
- argv['--'] = new Array();
- notFlags.forEach(function(key) {
- argv['--'].push(key);
- });
- }
- else {
- notFlags.forEach(function(key) {
- argv._.push(key);
- });
- }
-
- return argv;
- }
-
- function any$1(iterable, continueOnFailure) {
- var cancelsignal = Symbol();
- return iterable.reduce(
- (p, tasq, i ,a) => {
- var handleError = (err, pVal)=>{
- if(err !== cancelsignal) {
-
- console.log('Failed : ' + err.message + ' ' + JSON.stringify(pVal));
- console.dir(p);
- console.warn('Possible failure for task with result : ' + JSON.stringify(pVal));
- if(i>0 && a[i-1].info) console.dir(a[i-1].info);
- console.error('Error : ' + err.stack);
- console.error(a[i-1]);
- a[i-1] ? console.log("tasq : " + a[i-1].toString()) : null;
- if(!continueOnFailure) {console.log("Cancelling remaining on any one failure ..."); throw cancelsignal}
- else return pVal;
-
- }
- };
-
- if(Promise.resolve(p) === p ) {
- if(i>0 && a[i-1].info) p.info = a[i-1].info;
- return p.then((pVal) => {
-
-
-
-
-
-
-
-
- if(pVal && pVal.error) handleError(pVal, pVal);
-
- var trycall = function(tasq){
- try {
- var result = tasq();
- if(tasq.resultHandler) return tasq.resultHandler(result)
-
- return result
- } catch (error) {
- console.error(error);
- console.error('Error : ' + error ? error.stack : 'No stack');
- if(!continueOnFailure) throw error;
- }
- };
-
- var handleNext = ()=>{
- console.log('Task finished with result : ' + JSON.stringify(pVal));
- if(i>0 && a[i-1].info) console.dir(a[i-1].info);
- if(!tasq && !continueOnFailure) { console.log('Error : No task specified.'); throw false;}
- else if(!tasq) { console.log('Error : No task specified.'); return false;}
- return (Promise.resolve(tasq) === tasq ) ? tasq : trycall(tasq) ;
- };
-
- if(Promise.resolve(pVal) === pVal) {
-
- pVal.then((pVal)=>{ return handleNext(); });
- }
- else return handleNext()
-
- }).catch((error) => {
- if(error !== cancelsignal) {
- console.log(`E3 : i = ${i} `);
- console.error('Error : ' + error.message);
- console.error('Error : ' + error.stack);
- tasq ? console.log("tasq : " + tasq.toString()) : null;
- console.log('debugData 3-------------------------');
-
- throw error
- }
- else throw cancelsignal;
- })
- }
- else if(!p) {
- handleError({ error : true, message : 'Failed without result' }, pVal);
- console.log("Bypass remaining on prior failure");
- return false;
- }
- else return p;
- }
- , Promise.resolve(true)
- );
- }
-
- function hasKey (obj, keys) {
- var o = obj;
- keys.slice(0,-1).forEach(function (key) {
- o = (o[key] || {});
- });
-
- var key = keys[keys.length - 1];
- return key in o;
- }
-
- function isNumber (x) {
- if (typeof x === 'number') return true;
- if (/^0x[0-9a-f]+$/i.test(x)) return true;
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
- }
-
-
-
-
-
-
-
-
- const daysbits = 7;
- const datesbits = 31;
- const monthsbits = 12;
-
-
-
- const datebitOffset = daysbits;
- const monthbitOffset = datesbits + daysbits;
-
- const monthsMask = 0b111111111111 * 2** (monthbitOffset);
- const datesMask = 0b1111111111111111111111111111111 * 2 ** (datebitOffset);
- const daysMask = 0b1111111;
-
- var timeUtils = {
-
- toRecurringPattern( event ){
- var dayBitToSet = event.from.getDay();
- var dateBitToSet = event.from.getDate() + datebitOffset - 1;
- var monthBitToSet = event.from.getMonth() + monthbitOffset;
-
- var recurring = 2**dayBitToSet + 2**dateBitToSet + 2**monthBitToSet;
-
- return {
- from : event.from, to : event.to, recurring: recurring
- , start: new Date ( event.from - new Date( moment(event.from).startOf('day') ) )
- , end: new Date ( event.to - new Date( moment(event.to).startOf('day') ) )
- }
- }
- , getSkipFunction(r, boundedRange){
- var areMonthsSelected = monthsMask & r.recurring;
- var areDatesSelected = datesMask & r.recurring;
- var areDaysSelected = daysMask & r.recurring;
-
- if(!areMonthsSelected && !areDatesSelected && !areDaysSelected) {
- console.error("Null patterns are useless for selection. This is probably not a recurring pattern");
- return null;
- }
-
- var filter = { from : boundedRange && boundedRange.from || new Date(moment().startOf('day')), to : boundedRange && boundedRange.to };
-
-
- var reset = Symbol('reset');
- var stop = Symbol('stop');
- var skipFn = {
- create : (options)=>{
- var startFrom = options.startFrom;
- options.nBits;
- return {
- originOffset : null
- , getSkipGenerator : (selected)=>{
- var startOffset = null;
-
-
- var nextCycleIndex = 0;
- var incrementCycle = [];
- var previous = 0;
-
- for(var b = 0; b < nBits; b++) {
- if(selected & 1) {
- if(utils.js.isNull(originOffset)) this.originOffset = b;
- if(utils.js.isNull(startOffset) && (startFrom - b) <= 0){
-
- startOffset = b - startFrom;
-
- nextCycleIndex = incrementCycle.length-1;
- }
- incrementCycle.push(1 + b - previous);
- previous = 1 + b;
- }
- }
-
-
- incrementCycle.push(incrementCycle.splice(0,1));
- if(nextCycleIndex < 0) nextCycleIndex = 0;
- return function*(){
- var signal = false;
- signal = yield startOffset;
- var i = nextCycleIndex;
- for(;;){
- for(; i < incrementCycle.length; i++ ) {
- signal = yield incrementCycle[i];
- if(reset === signal) { signal = yield this.originOffset; break; }
- if(signal === stop || signal.done) return null;
- }
- i = 0;
- }
- }
- }
-
-
- , getNextDateGenerator(selection){
- var iterator = this.getSkipGenerator(selection);
-
- return function*(){
- var nextPotentialDate = moment(potentialDate).add(iterator.next(), 'd');
- if(nextPotentialDate.month() != potentialDate.getMonth()) {
-
- nextPotentialDate.startOf('month').add(dateIterator.next(reset), 'm');
- }
- var potentialDate = nextPotentialDate;
- yield nextPotentialDate;
- }
- }
-
- , getNextGenerator(options, selection){
- this.getSkipGenerator(selection);
- var next = filter.from;
-
- return function*(){
- yield next = moment(next).add(dayIterator.next(), 'd');
- }
- }
- }
- }
- };
- var monthSkipper = skipFn.create({ nBits : monthsbits, startFrom : filter.from.getMonth() });
- var daySkipper = skipFn.create({ nBits : daysbits, startFrom : filter.from.getDay() });
- var dateSkipper = skipFn.create({ nBits : datebits, startFrom : filter.from.getDate()-1 });
-
- if(!areMonthsSelected && !areDatesSelected) return daySkipper(areDaysSelected)
- else if(!areDatesSelected && !areDaysSelected) return monthSkipper(areMonthsSelected/2**(datesbits + daysbits))
- else if(!areMonthsSelected && !areDaysSelected) return dateSkipper(areDatesSelected/2**(daysbits))
- else {
- if(!areMonthsSelected) {
-
- return function*(){
-
- var dateIterator = dateSkipper.getNextDateGenerator({ nBits : datebits, startFrom : filter.from.getDate()-1 }, areDatesSelected/2**(daysbits));
- var dayIterator = daySkipper.getNextGenerator({ nBits : daysbits, startFrom : filter.from.getDay() }, areDaysSelected);
-
- var potentialDay = null;
- var potentialDate = dateIterator.next();
- if(isAnd) {
-
- for(;;){
-
- for(; (potentialDay = dayIterator.next()) < potentialDate ;);
-
-
-
-
-
-
- if(potentialDay == potentialDate) {
- yield potentialDay;
- potentialDate = dateIterator.next();
- continue;
- }
- for(; (potentialDate = dateIterator.next()) < potentialDay;);
- }
- }
- else {
-
- for(;;){
-
- for(; (potentialDay = dayIterator.next()) < potentialDate ;) {
- if(stop === (yield potentialDay)) return null;
- }
- if(potentialDay == potentialDate) {
- potentialDate = dateIterator.next();
- continue;
- }
- for(; (potentialDate = dateIterator.next()) < potentialDay;) {
- if(stop === (yield potentialDate)) return null;
- }
- }
- }
- }
- }
-
- }
- }
- , skipThisRecurrable : Symbol('skipThisRecurrable')
- , stopThisIterator : Symbol('stopThisIterator')
- , toEvents( r, boundedRange){
- if(!boundedRange.to) throw 'toEvents requires a bounded Range with an end to terminate. Use generater for unbounded operations'
- ({ from : boundedRange.from || new Date(moment(new Date()).startOf('day')), to : boundedRange.to });
- }
- , jsstart : function(){
- return new Date(moment(new Date(0)).startOf('day'))
- }
-
- , getEventGenerator : function* (objOrArray, boundedRange, getEvent) {
-
-
- getEvent = getEvent || function(r, startOfDayFrom, start, end) {
- var event = Object.assign( {}, r);
- delete event.recurring;
-
-
- event.from = new Date (startOfDayFrom.getTime() + start.getTime() + utils.getTZOffsetMilliseconds() );
- event.to = new Date ( startOfDayFrom.getTime() + end.getTime() + utils.getTZOffsetMilliseconds());
-
- return event
- };
-
- var recurrables = utils.js.isObject(objOrArray) ? [objOrArray] : objOrArray;
-
-
- var filter = { from : boundedRange && boundedRange.from || new Date(moment().startOf('day')), to : boundedRange && boundedRange.to };
- for(var gIdx=0; gIdx < recurrables.length; gIdx++){
-
- var eachRecurrable = recurrables[gIdx];
- if( eachRecurrable.to && eachRecurrable.to <= filter.from ) continue;
-
- var startFrom = filter.from;
-
- if( eachRecurrable.from) {
- if(filter.to && filter.to <= eachRecurrable.from ) continue;
- if(eachRecurrable.from >= filter.from) startFrom = eachRecurrable.from;
- }
-
- var startOfDayFrom = new Date( moment(startFrom).startOf('day') );
- var next = null;
-
- var stopAt = eachRecurrable.to ? filter.to ? Math.min(filter.to, eachRecurrable.to) : eachRecurrable.to : filter.to ? filter.to : false;
- var shouldStop = stopAt ? ()=>{ return option === this.skipThisRecurrable || next.from >= stopAt } : ()=>{ return option === this.skipThisRecurrable || false };
-
-
-
- if(filter.to && eachRecurrable.to) {
- var stopAt = new Date(Min(filter.to, eachRecurrable.to));
- shouldStop = ()=>{ return option === this.skipThisRecurrable || (stopAt <= next.to ? stopAt : false) };
- }
-
- var start = eachRecurrable.start || this.jsstart();
- var end = eachRecurrable.end || new Date(moment(start).add(1, "d"));
-
- var option = true;
- next = getEvent(eachRecurrable, startOfDayFrom, start, end);
-
- while( !shouldStop() ) {
-
- var patternMatched = this.__hasPatternIntersection(next, eachRecurrable);
- if(patternMatched) option = yield next;
- if(option === this.stopThisIterator) return null;
-
- startOfDayFrom = new Date( moment(startOfDayFrom).add(1, 'd') );
- next = getEvent(eachRecurrable, startOfDayFrom, start, end);
- }
- }
- }
-
-
-
-
- , isEvent : function(obj){
- return !obj.recurring
- }
- , isRecurringPattern : function(obj){
- return obj.recurring
- }
- , hasEventIntersection( e1Orr1, e2Orr2 ){
- return utils.timeUtils.isEvent(e1Orr1) && utils.timeUtils.isRecurringPattern( e2Orr2 ) ? utils.timeUtils.__recurringHasIntersection( e1Orr1, e2Orr2 )
- : utils.timeUtils.isEvent(e2Orr2 ) && utils.timeUtils.isRecurringPattern( e1Orr1 ) ? utils.timeUtils.__recurringHasIntersection( e2Orr2, e1Orr1 )
- : utils.timeUtils.isEvent(e1Orr1) && utils.timeUtils.isEvent(e2Orr2) ? utils.timeUtils.__hasEventIntersection( e1Orr1, e2Orr2 )
- : utils.timeUtils.__willPatternsIntersect( e1Orr1, e2Orr2 )
- }
-
- , __hasPatternIntersection( e1, p2 ){
-
- var areMonthsSelected = monthsMask & p2.recurring;
- var areDatesSelected = datesMask & p2.recurring;
- var areDaysSelected = daysMask & p2.recurring;
-
-
-
- if(!areMonthsSelected && !areDatesSelected && !areDaysSelected) {
- console.error("Null patterns are useless for selection. This is probably not a recurring pattern");
- return null;
- }
-
- var isAnd = false;
- if(!areMonthsSelected && !areDatesSelected || !areMonthsSelected && !areDaysSelected || !areDatesSelected && !areDaysSelected ) ;
- else {
- isAnd = p2.isAnd;
- }
-
- var p1 = this.toRecurringPattern(e1);
- var patternMatched = p1.recurring & p2.recurring;
-
-
- return ( isAnd ? p1.recurring === patternMatched : patternMatched );
-
- }
-
- , __willPatternsIntersect( p1, p2 ){
-
- if(p1.from && p2.to && p2.to <= p1.from) return false;
- if(p2.from && p1.to && p1.to <= p2.from) return false;
-
- var areMonthsSelected = monthsMask & p2.recurring;
- var areDatesSelected = datesMask & p2.recurring;
- var areDaysSelected = daysMask & p2.recurring;
-
-
-
- if(!areMonthsSelected && !areDatesSelected && !areDaysSelected) {
- console.error("Null patterns are useless for selection. This is probably not a recurring pattern");
- return null;
- }
-
- var isAnd = false;
- if(!areMonthsSelected && !areDatesSelected || !areMonthsSelected && !areDaysSelected || !areDatesSelected && !areDaysSelected ) ;
- else {
- isAnd = p2.isAnd;
- }
-
- var areP1MonthsSelected = monthsMask & p1.recurring;
- var areP1DatesSelected = datesMask & p1.recurring;
- var areP1DaysSelected = daysMask & p1.recurring;
-
-
-
- if(!areP1MonthsSelected && !areP1DatesSelected && !areP1DaysSelected) {
- console.error("Null patterns are useless for selection. This is probably not a recurring pattern");
- return null;
- }
-
- var isP1And = false;
- if(!areP1MonthsSelected && !areP1DatesSelected || !areP1MonthsSelected && !areP1DaysSelected || !areP1DatesSelected && !areP1DaysSelected ) ;
- else {
- isP1And = p1.isAnd;
- }
-
-
- if(isAnd && isP1And === isAnd ) {
- return p1.recurring === p2.recurring;
- }
- else if(isAnd) {
- matchtarget = p2.recurring ;
- }
- else if(isP1And ) {
- matchtarget = p1.recurring ;
- }
-
- var patternMatched = p1.recurring & p2.recurring;
-
-
-
- var __patternMatched = ( isAnd || isP1And ? matchtarget === patternMatched : patternMatched );
-
- if(__patternMatched) {
- if(p1.start && p2.end && p2.end <= p1.start) return false;
- if(p2.start && p1.end && p1.end <= p2.start) return false;
-
- return true;
-
- }
- else {
- return false
- }
-
- }
- , __recurringHasIntersection(e1, r1){
-
-
-
- if(e1.from && r1.to && r1.to <= e1.from) return false;
- if(r1.from && e1.to && e1.to <= r1.from) return false;
-
- return ( utils.timeUtils.__hasPatternIntersection(e1, r1) ) ? (()=>{
-
-
- var startOfe1 = new Date( moment(e1.from).startOf('day') );
- var r1E = {
- from: new Date(startOfe1.getTime() + r1.start.getTime() + utils.getTZOffsetMilliseconds() )
- , to: new Date(startOfe1.getTime() + r1.end.getTime() + utils.getTZOffsetMilliseconds() )
- };
- return utils.timeUtils.__hasEventIntersection(e1, r1E)
- })()
- : false
- }
-
-
- , __hasEventIntersection(e1, e2){
-
-
- if(!e1.from && !e1.to) return e2;
- if(!e2.from && !e2.to) return e1;
-
- var e1FromAnde2To = e1.from && e2.to;
- var e2FromAnde1To = e2.from && e1.to;
-
- var __aFrombTo = (a, b)=>{
-
- return (a.from >= b.to ? false
- : a.to && a.to > b.to || !a.to ?
- { from : b.from && b.from > a.from ? b.from : a.from, to : b.to }
- : b.from && b.from >= a.to ? false : { from : b.from && b.from > a.from ? b.from : a.from, to : a.to }
- )
- };
-
- var result = e1FromAnde2To ? __aFrombTo(e1, e2)
- :( e2FromAnde1To ? __aFrombTo(e2, e1)
- :
- e1.from ? { from: new Date(Math.max(e1.from, e2.from)) } : { to: new Date(Math.min(e1.to, e2.to)) });
-
- return result
- }
-
- , exludeIntersection(freeTimes, e) {
-
- for(var i =0; i < freeTimes.length; i++) {
- var intersection = timeUtils.hasEventIntersection(freeTimes[i], e);
- if(intersection) {
-
- if(freeTimes[i].from >= intersection.from && freeTimes[i].to <= intersection.to) {
- freeTimes.splice(i,1); i = i--;
- }
- else {
- var right = Object.assign({}, freeTimes[i]);
- right.from = intersection.to;
- freeTimes[i].to = intersection.from;
- if( right.from < right.to ) {
- freeTimes.splice(++i,0, right);
- }
- }
- }
- }
- }
-
- , getFreeTimes( tRange, events, dimensions) {
- var freeTimes = [tRange];
- for(var eIdx = 0; eIdx < events.length; eIdx++) {
- var e = events[eIdx];
- timeUtils.exludeIntersection(freeTimes, e);
- if(freeTimes.length === 0) break;
- }
-
- return freeTimes;
- }
-
-
- , testAll(){
-
-
-
-
-
- expected = 2**4 + 2**(6+21) + 2**(5+31+6);
- actual = this.toRecurringPattern(
- { from : new Date('5/21/2020, 11:45:00 PM'), to : new Date('5/22/2020, 00:15:00 AM') } ).recurring;
- if(expected !== actual ) throw (' TEST FAILED toRecurringPattern : expected = ' + expected + ' actual = ' + actual)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var r1 = {
- end: new Date("1970-01-01T11:00:00.000Z")
- , every: null
- , from: new Date("2020-06-04T06:30:00.000Z")
- , id: "DC664060-A0A8-11EA-8B3D-7771F3D49CC1"
- , migrationstate: 1
- , practitionerId: "5FDF1790-8288-11E9-9044-91D8D8658887"
- , purpose: "Meeting"
- , recurring: 106
- , start: new Date("1970-01-01T06:30:00.000Z")
- , status: "SCHEDULED"
- , to: null
- };
- var e1 = {
- availability: false
- , end: null
- , every: null
- , for: null
- , from: new Date("2020-06-08T11:00:00.000Z")
- , id: "AEC5A7E1-A96D-11EA-8DE7-19E354C126F4"
- , migrationstate: 8
- , patientId: "271F4970-F173-4530-A894-68F520BF7945"
- , patientmob: "9944715969"
- , patientname: "SAMUEL RAJA DURAI J"
- , practitionerId: "5FDF1790-8288-11E9-9044-91D8D8658887"
- , purpose: "Appointment"
- , start: null
- , status: "SCHEDULED"
- , to: new Date("2020-06-08T11:15:00.000Z")
- };
-
- this.hasEventIntersection(e1, r1);
- debugger
-
- var eventIterator = this.getEventGenerator({ recurring : 2**1 });
- for(var i=0, e; i<10 && !(e=eventIterator.next()).done; i++) {
- console.dir(e);
- }
-
- }
- };
-
- function promisify(ctx, asyncoperation, arraylikearguments) {
- var originalcallback = arraylikearguments.splice(arraylikearguments.length-1, 1)[0];
- return new Promise(function(resolve, reject) {
- asyncoperation.call(ctx, ...arraylikearguments, function(err, result) {
- if (err) return reject(arguments);
- resolve(arguments);
- });
- }).then((aArr)=>{
- originalcallback(...aArr);
- return aArr[1]
- }).catch(function(aArr){
- originalcallback(...aArr);
- throw aArr[0];
- });
- }
-
-
-
- var Tasq$1 = (function(){
-
- var __proto__ = {
- };
-
- var listeners = [];
-
- function Tasq(first, ...rest){
- first.info = utils.assign({ args : rest }, __proto__);
- return first
- }
- Tasq.create = Tasq;
- Tasq.addlistener = (l)=>{ listeners.push(l); };
- Tasq.catch = (e)=>{ console.error(e); console.error(e.messages.join(' ')); listeners.forEach(l => { l(e); } );};
- Tasq.then = (d)=>{ listeners.forEach(l => { l(null, d); } ); return d};
- return Tasq
- })();
-
-
-
- var Traq$1 = (function(){
- var __proto__ = {};
-
- var log = {
- SUCCESS : []
- , FAILURE : []
- , SKIPPED : []
- };
-
- Traq$1 = function(){ return utils.assign({}, __proto__) };
- Traq$1.create = Traq$1;
- Traq$1.statuslog = statuslog;
- function statuslog(err, data){
- if(err) log.FAILURE.push( {err, data} );
- else log.SUCCESS.push(data);
- }
- Traq$1.notify = (event)=>{
- if(event.error) log.FAILURE.push( event );
- else log.SUCCESS.push(event);
- };
- Traq$1.finally = ()=>{
- console.log('Total : ' + (log.SKIPPED.length + log.SUCCESS.length + log.FAILURE.length));
- console.log('Pass : ' + log.SUCCESS.length );
- console.log('Fail : ' + log.FAILURE.length);
- console.log('Skipped : ' + log.SKIPPED.length);
-
- console.log('FAILURES');
- console.log([JSON.stringify(log.FAILURE)]);
- };
- return Traq$1
- })();
-
-
- var tzoffset = 0;
- var utils = {
-
- escapeRegExp(string) {
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- }
-
- , getTZOffsetMilliseconds : (()=>{
- var d = new Date();
- var t1 = d.toISOString().replace('Z','');
- var t2 = d.toISOString();
- tzoffset = ( new Date(t2) - (new Date(t1)));
- return ()=>{ return tzoffset}
- })()
-
- , getLocalDateYYYYMMDD(date){
- var d = new Date();
- d.setTime(tzoffset + new Date(date).getTime());
- return d.toISOString().slice(0,10).replace(/-/g,"")
- }
-
- , assign(target ) {
- return utils.assign_core(false, ...arguments)
- }
-
- , assign_caseless(target ) {
- return utils.assign_core(true, ...arguments)
- }
-
-
- , assign_core(ignorecase, target ) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var cpi = {};
- var getNormalizedKey = ignorecase ? (key)=>key : (key)=> key.toLowerCase();
-
-
-
-
-
- var alreadyScanned = (key)=>{
-
- Object.keys(target).forEach(k => {
- cpi[k.toLowerCase()] = k;
-
- if(cpi[k.toLowerCase()] !== k){
- Object.defineProperty( target, cpi[k.toLowerCase()], Object.getOwnPropertyDescriptor(target, k) );
- delete target[tkeys[tkidx]];
- }
- });
- alreadyScanned = ()=>{ return true; };
-
- cpi[key.toLowerCase()] ? null : cpi[key.toLowerCase()] = key;
- return false;
- };
-
-
- var findEqualKey = (key) => {
-
-
- {
-
- if(alreadyScanned(key)) { cpi[key.toLowerCase()] ? null : cpi[key.toLowerCase()] = key; } }
- var targetKey = cpi[key.toLowerCase()];
- return { targetKey, propertyDescriptor : Object.getOwnPropertyDescriptor(target, targetKey) }
- };
-
- var hOP = Object.prototype.hasOwnProperty;
-
- var __assign = function(ignorecase, target /** , ...sources */) {
-
- if(utils.js.isUndefined(target)) return;
-
-
-
- var undef = 0;
- for(; undef < arguments.length-1 && utils.js.isUndefined(arguments[arguments.length-undef-1]); undef++);
- if(undef === arguments.length-1) return target;
-
- if(utils.js.isPrimitive(arguments[arguments.length-1-undef])) return arguments[arguments.length-1-undef];
- else {
-
-
-
-
-
- if(utils.js.isPrimitive(target)) {
- target = {};
- } }
-
- for(var
- finalized = {}
- , overrideOrMerge = function (originalkey) {
-
-
-
-
-
-
-
-
-
-
-
- var { targetKey, dL } = findEqualKey(originalkey);
- var dR = Object.getOwnPropertyDescriptor(this, originalkey);
-
- if(!dL) {
-
- dL = Object.getOwnPropertyDescriptor(target, originalkey);
- if(!dL) { Object.defineProperty( target, targetKey, dR ); finalized[targetKey] = true; return; }
- }
-
- if(!utils.js.isUndefined( dR.writable )) {
- var valR = this[originalkey];
- if(utils.js.isPrimitive( valR )) {
- finalized[targetKey] = true;
-
-
-
- Object.defineProperty( target, targetKey, dR );
- return
- }
-
- }
-
-
- if(utils.js.isUndefined( dR.writable ) || utils.js.isUndefined( dL.writable ) ){
-
-
-
- var dChosen = !utils.js.isUndefined( dL.writable ) ? dR : dL;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var ctx = this;
- var dRGetter = !utils.js.isUndefined( dR.writable ) ? function(){ return dR.value} : dR.get;
- var dLGetter = !utils.js.isUndefined( dL.writable ) ? function(){ return dL.value} : dL.get;
- var valForSetter = null;
- dR.configurable;
-
- if(!utils.js.isUndefined( dL.writable )) {
-
-
-
-
- var valL = target[targetKey];
- if(utils.js.isPrimitive(valL)) { dChosen.get = function(){ return dRGetter.call(ctx) }; }
- else { dChosen.get = function(){
-
- return utils.assign_core(ignorecase, valL, dRGetter.call(ctx))
- };
- }
- }
- else {
-
- dChosen.get = function(){ return utils.assign_core(ignorecase, dLGetter.call(target), dRGetter.call(ctx)) };
- }
-
-
-
-
- dChosen.set = function(val) {
-
- dChosen.get = function() { return valForSetter};
- dChosen.set = function(val) { return valForSetter = val };
- dChosen.configurable = true;
- Object.defineProperty( target, targetKey, dChosen );
- return valForSetter = val
- };
- dChosen.configurable = true;
- Object.defineProperty( target, targetKey, dChosen );
- finalized[targetKey] = true;
- return
- }
-
-
-
- var valL = target[targetKey];
- if(utils.js.isPrimitive( valL )) {
- if(!utils.js.isNull( valR ) && !utils.js.isUndefined( valR )) {
- finalized[targetKey] = true;
- Object.defineProperty( target, targetKey, dR );
- }
- return
- }
- else {
-
-
- if(valL === valR) { finalized[targetKey] = true; return true;}
- if(utils.js.isObject( valL ) && utils.js.isObject( valR )) { utils.assign_core(ignorecase, valL, valR ); finalized[targetKey] = true; return;}
- if(utils.js.isArray( valL ) && utils.js.isArray( valR )) { target[targetKey] = valL.concat(valR); finalized[targetKey] = true; return;}
- if(utils.js.isNull( valL ) || utils.js.isNull( valR )) { target[targetKey] = valR; finalized[targetKey] = true; return;}
- if(utils.js.isUndefined( valL ) && utils.js.isUndefined( valR )) { target[targetKey] = valR; finalized[targetKey] = true; return;}
-
-
-
- if(utils.js.isFunction( valL ) && utils.js.isFunction( valR )) { target[targetKey] = valR; return;}
-
-
-
-
-
-
- var msg = `Unsupported assign / merge for property ${targetKey} data types ` + valL + ' , ' + valR;
- console.error(msg);
- throw msg;
- }
- }
- , appendmissing = function (originalkey) {
- var standardizedKey = getNormalizedKey(originalkey);
- if (!hOP.call(finalized, standardizedKey)) overrideOrMerge.call(this, originalkey);
- }
-
- , _junkvar = Object.keys(arguments[arguments.length-1-undef]).forEach(overrideOrMerge, arguments[arguments.length-1-undef])
- , i = arguments.length-1-undef;
- 2 < i--;
- utils.js.isUndefined(arguments[i]) ? null :
-
- utils.js.isPrimitive(arguments[i]) ? null
- : Object.keys(arguments[i]).forEach(appendmissing, arguments[i])
- ){}
-
-
- return target;
- };
-
- return __assign(...arguments)
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- , js : {
-
- typeInstances : [
- ""
- , 0
- , true
- , null
- ,
- , []
- , {}
- , Symbol()
- , new Date()
- , /.*/
- , Promise.resolve(true)
- , function() {}
- , BigInt(0)
- ]
- , proxyable : []
- , nonproxyable : []
-
- , isString(x) {
- return Object.prototype.toString.call(x) === "[object String]"
- }
- , isNumber(x) {
- return Object.prototype.toString.call(x) === '[object Number]'
- }
- , isBoolean(x) {
- return Object.prototype.toString.call(x) === '[object Boolean]'
- }
- , isNull(x) {
- return Object.prototype.toString.call(x) === '[object Null]'
- }
- , isUndefined(x) {
- return Object.prototype.toString.call(x) === '[object Undefined]'
- }
- , isArray(x) {
- return Object.prototype.toString.call(x) === '[object Array]'
- }
- , isObject(x) {
- return Object.prototype.toString.call(x) === '[object Object]'
- }
- , isSymbol(x) {
- return Object.prototype.toString.call(x) === '[object Symbol]'
- }
- , isDate(x) {
- return Object.prototype.toString.call(x) === '[object Date]'
- }
- , isRegExp(x) {
- return Object.prototype.toString.call(x) === '[object RegExp]'
- }
- , isPromise(x) {
- return Promise.resolve(x) === x
- }
- , isPromiseOrFunction(o) {
- if(utils.js.isPromise( o ) || utils.js.isFunction(o)) return true;
- return false;
- }
- , isFunction(x) {
- return Object.prototype.toString.call(x) === '[object Function]'
- }
- , isBigInt(x) {
- return Object.prototype.toString.call(x) === '[object BigInt]'
- }
-
- , isDataDescriptor(d) { return (utils.js.isUndefined(d.set) && utils.js.isUndefined(d.get)) ? d : false }
-
- // Grouping JS Types into 4 Groups
- // Primitives
- // -- boolean, String, Number
- // Arrays
- // Objects
- // Special
- // -- date, regexp, function ... and other unkown types
- , typeGroups() {
- return [
- '[Primitive]'
- , '[Null]'
- , '[Undefined]'
- , '[Symbol]'
- , '[Array]'
- , '[Object]'
- , '[Special]'
- ]
- }
-
- , typeGroup(x) {
- var tgMap = {
- '[object String]' : '[Primitive]'
- , '[object Number]' : '[Primitive]'
- , '[object Boolean]' : '[Primitive]'
- , '[object Null]' : '[Null]'
- , '[object Undefined]' : '[Undefined]'
- , '[object Symbol]' : '[Symbol]'
- , '[object BigInt]' : '[BigInt]'
-
- , '[object Array]' : '[Array]'
- , '[object Object]' : '[Object]'
- , '[object Date]' : '[Special]'
- , '[object RegExp]' : '[Special]'
- , '[object Function]' : '[Special]'
- , '[object Promise]' : '[Special]'
- };
- return tgMap[Object.prototype.toString.call(x)]
- }
-
- , getTypeInfo(x) {
-
- var typeMap = {
- '[object String]' : //__assign(typeInfo,
- { typeGroup : '[Primitive]', isString : true, isPrimitive : true
- , create : ()=>{return ""} }
- //)
- , '[object Number]' : { typeGroup : '[Primitive]', isNumber : true, isNumeric : true, isPrimitive : true
- , create : ()=>{return 1}}
- , '[object Boolean]' : { typeGroup : '[Primitive]', isBoolean : true, isPrimitive : true
- , create : ()=>{return true}}
- , '[object Null]' : { typeGroup : '[Null]', isNull : true
- , create : ()=>{return null}}
- , '[object Undefined]' : { typeGroup : '[Undefined]', isUndefined : true
- , create : ()=>{return }}
- , '[object Symbol]' : { typeGroup : '[Symbol]', isSymbol : true
- , create : ()=>{return new Symbol()}}
- , '[object BigInt]' : { typeGroup : '[BigInt]', isNumeric : true, isPrimitive : true
- , create : ()=>{return new BigInt()}}
-
- , '[object Array]' : { typeGroup : '[Array]', isArray : true
- , create : ()=>{return []}}
- , '[object Object]' : { typeGroup : '[Object]', isObject : true
- , create : ()=>{return {}}}
- , '[object Date]' : { typeGroup : '[Special]', isDate : true
- , create : ()=>{return new Date}}
- , '[object RegExp]' : { typeGroup : '[Special]', isRegExp : true
- , create : ()=>{return new RegExp}}
- , '[object Function]' : { typeGroup : '[Special]', isFunction : true
- , create : ()=>{return new Function}}
- , '[object Promise]' : { typeGroup : '[Special]', isPromise : true
- , create : ()=>{ throw "Blank promise cannot be created."}}
- };
- return typeMap[Object.prototype.toString.call(x)]
- }
-
- , isPrimitive(x) {
- var xType = this.nativeType(x);
- return xType === '[object Boolean]' || xType === '[object String]' || xType === '[object Number]' || xType === '[object Symbol]' ||
- xType === '[object BigInt]'
- }
-
- , isSpecial(x) {
- return !isArray(x) && !isObject(x) && !isPrimitive(x)
- }
-
- , nativeTypes() {
- return [
- // Primitives
- '[object String]'
- , '[object Number]'
- , '[object Boolean]'
- , '[object Null]'
- , '[object Undefined]'
- , '[object Symbol]'
- , '[object BigInt]'
-
- // Non Primitives.
- , '[object Array]'
- , '[object Object]'
- , '[object Date]'
- , '[object RegExp]'
- , '[object Function]'
- , '[object Promise]'
- ]
- }
-
- , nativeType(x) { return Object.prototype.toString.call(x) }
-
- }
-
- // Upsert for a hash ??
- , hashupsert : function(oA, oB){
- Object.keys(oA).forEach(( oAKey )=>{
- if(oB[oAKey]) {
- var distinct = new Set(oA[oAKey]);
- oB[oAKey].forEach((each)=>{
- distinct.add(each);
- });
- oA[oAKey] = Array.from(distinct);
- }
- });
- }
-
- // Upsert for an array.
- // Also the same as pushdistinct. Target is expected to have only one instance.
- , upsert(arr, val) {
- // 0 -- did nothing
- // 2 -- inserted
- // 3 -- updated
- // PB: TODO -- We can use (new Set(arr)).add ???. But is this more expensive ?
- var found = arr.find((element)=>{ return element === val});
- return found ? utils.js.isObject(val) && utils.js.isObject(val) ? (Object.assign( found, val), 3) : 0
- : (arr.push(val), 2) ;
- }
-
- // accumulate
- // o[toVectorPropName] which is an array
- // and o[propName] which is a string
- // into vectorTarget which is an array
- // already previously accumulated in a similar manner probably already attached as oTarget[toVectorPropName]
-
- // 0 or undefined or null -- didnt do anything. ( val doesn't exist )
- // 1 -- created target and inserted val
- // 2 -- didn't create target but inserted val
- // 3 -- didn't create target but updated val and also handled o[propName].
- , accumulate : function(val, o, propName, toVectorPropName, vectorTargetCreator,
- identityEvaluator
- ){
- var created = 0;
-
- if(utils.js.isUndefined(val)) return; // Nothing to do i.e. nothing was provided to accumulate. We don't accumulate undefined.
- if(val === o[propName]) return; // Nothing to do.
-
- var vectorTargetContainer = o[toVectorPropName] || (o[toVectorPropName] = {});
- if(!vectorTargetCreator) vectorTargetCreator = { create : (val)=>{
- return val ? vectorTargetContainer[o["id"]] = [val] : [] } };
-
- var vectorTarget = vectorTargetContainer[o["id"]];
-
- if(!vectorTarget) {
- created = 1;
- vectorTarget = vectorTargetContainer[o["id"]] = vectorTargetCreator.create(o[propName]);
- }
-
- if(!identityEvaluator) identityEvaluator = (a, b)=>{ return a === b };
-
- var upsertResult = 0;
- if(!created && !utils.js.isUndefined(o[propName])) {
- if(!vectorTargetContainer[o["id"]].find((element)=>{ return identityEvaluator(element, o[propName]) })) {
- upsertResult = utils.upsert(vectorTarget, o[propName]);
- }
- }
- upsertResult = utils.upsert(vectorTarget, val);
- return created ? created : upsertResult;
- }
-
- // async Utils
- , async : {
- all(list, task){
- var queueditems=[];
- list.forEach(function(v, i, a) {
- queueditems.push(task(v, i, a));
- });
- return Promise.all(queueditems)
- }
- }
-
-
- // PB : TODO -- Remove these.
- // , fsdb : require('./fsdb/fsdb')
- // , xlsx : require('./fsdb/xlsx')
- // , xlsxvalidator : require('./fsdb/xlsxvalidator')
-
- , timeUtils
- , dx: dx_1
- , cliargs: cliargs$1
- , any: any$1
- , promisify
- , moment
- , Tasq: Tasq$1
- , Traq: Traq$1
- };
-
- var utils_1 = utils;
-
- var naiveFallback = function () {
- if (typeof self === "object" && self) return self;
- if (typeof window === "object" && window) return window;
- throw new Error("Unable to resolve global `this`");
- };
-
-
- // https://mathiasbynens.be/notes/globalthis
- var globalThis_1 = (function () {
- if (this) return this;
-
- // Unexpected strict mode (may happen if e.g. bundled into ESM module)
-
- // Fallback to standard globalThis if available
- if (typeof globalThis === "object" && globalThis) return globalThis;
-
- // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
- // In all ES5+ engines global object inherits from Object.prototype
- // (if you approached one that doesn't please report)
- try {
-
- Object.prototype.__defineGetter__('__global__', function() {
- return this;
- });
- __global__.globalThis = __global__;
-
- } catch (error) {
-
-
- return naiveFallback();
- }
- try {
-
- if (!__global__) return naiveFallback();
- return __global__;
- } finally {
- delete Object.prototype.__global__;
- }
- })();
-
-
- var channelMixin = (function() {
-
-
- function getSubscriptions(selector) {
- console.dir(this.__channels);
- var filtered = this.__channels;
-
- for(var select in selector) {
- if(!filtered[selector[select]]) {
-
- return [];
- }
- filtered = filtered[selector[select]];
- }
-
- return filtered['__data'];
- }
-
- function addSubscription(selector, func, context) {
-
- var unfulfilled = selector.splice(0);
- var filtered = this.__channels;
- console.log(filtered);
- for(var select in unfulfilled) {
- if(!filtered[unfulfilled[select]]) {
- filtered[unfulfilled[select]] = { __data : [] };
- }
- filtered = filtered[unfulfilled[select]];
- unfulfilled = unfulfilled.splice(0,1);
- }
-
-
-
- filtered.__data.push({context: context, callback: func});
- }
-
- return function(){
- this.__channels = {};
- this.getSubscriptions = getSubscriptions;
- this.addSubscription = addSubscription;
- return this;
- }
- })();
-
-
- var mediator = (function() {
-
- var __subscribe = function(selector, func, context) {
- var subscriptions = this.channels.getSubscriptions(selector);
-
- if(subscriptions.length < 1){
- this.channels.addSubscription(selector, func, context);
- }
-
- return this;
- };
-
- var __publish = function(selector) {
- console.log('publishing for selector ' + selector);
- var subscriptions = this.channels.getSubscriptions(selector);
- console.log(subscriptions);
- if(subscriptions.length < 1){ return; }
- var args = Array.prototype.slice.call(arguments, 1);
- for(i=0; i < subscriptions.length; i++) {
- subscription = subscriptions[i];
- subscription.callback.apply(subscription.context, args);
- }
- return this;
- };
-
- return function mediator() {
- var thisObj = this ? this : {};
- Object.defineProperty(thisObj, 'channels', { value : channelMixin.apply({}), writable: false, enumerable : false});
- thisObj.publish = __publish;
- thisObj.subscribe = __subscribe;
- return thisObj;
- };
- })();
-
-
-
-
-
-
- var rng = function nodeRNG() {
- return crypto__default['default'].randomBytes(16);
- };
-
-
- var byteToHex = [];
- for (var i$1 = 0; i$1 < 256; ++i$1) {
- byteToHex[i$1] = (i$1 + 0x100).toString(16).substr(1);
- }
-
- function bytesToUuid(buf, offset) {
- var i = offset || 0;
- var bth = byteToHex;
-
- return ([
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]]
- ]).join('');
- }
-
- var bytesToUuid_1 = bytesToUuid;
-
-
-
-
-
-
- var _nodeId;
- var _clockseq;
-
-
- var _lastMSecs = 0;
- var _lastNSecs = 0;
-
-
- function v1(options, buf, offset) {
- var i = buf && offset || 0;
- var b = buf || [];
-
- options = options || {};
- var node = options.node || _nodeId;
- var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
-
-
-
-
- if (node == null || clockseq == null) {
- var seedBytes = rng();
- if (node == null) {
-
- node = _nodeId = [
- seedBytes[0] | 0x01,
- seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
- ];
- }
- if (clockseq == null) {
-
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
- }
- }
-
-
-
-
-
- var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
-
-
-
- var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
-
-
- var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
-
-
- if (dt < 0 && options.clockseq === undefined) {
- clockseq = clockseq + 1 & 0x3fff;
- }
-
-
-
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
- nsecs = 0;
- }
-
-
- if (nsecs >= 10000) {
- throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
- }
-
- _lastMSecs = msecs;
- _lastNSecs = nsecs;
- _clockseq = clockseq;
-
-
- msecs += 12219292800000;
-
-
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
- b[i++] = tl >>> 24 & 0xff;
- b[i++] = tl >>> 16 & 0xff;
- b[i++] = tl >>> 8 & 0xff;
- b[i++] = tl & 0xff;
-
-
- var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
- b[i++] = tmh >>> 8 & 0xff;
- b[i++] = tmh & 0xff;
-
-
- b[i++] = tmh >>> 24 & 0xf | 0x10;
- b[i++] = tmh >>> 16 & 0xff;
-
-
- b[i++] = clockseq >>> 8 | 0x80;
-
-
- b[i++] = clockseq & 0xff;
-
-
- for (var n = 0; n < 6; ++n) {
- b[i + n] = node[n];
- }
-
- return buf ? buf : bytesToUuid_1(b);
- }
-
- var v1_1 = v1;
-
-
- globalThis_1.mediator = mediator.apply({});
-
- console.dir(globalThis_1.mediator);
-
-
- const indexHelper = (function(){
-
- var getPermutations = function(array){
- var permutations = {};
-
- for(var i in array) {
-
- var aclone = array.slice(0);
- aclone.splice(i, 1);
- permutations[array[i]] = getPermutations(aclone );
- }
- return permutations
- };
-
- var getCombinations = function(array){
-
-
- var set = [];
- var alen = array.length;
- var combinations = 1 << alen; // Math.pow(2, array.length);
-
- for (var i = 1; i < combinations ; i++){
- var combination= [];
- for (var j=0;j<alen;j++) {
- if ((i & (1 << j))){
- combination.push(array[j]);
- }
- }
- set.push(combination);
- }
-
- return set;
- };
-
- return function(obj) {
- obj.getPermutations = getPermutations;
-
- obj.getCombinations = getCombinations;
-
- return obj;
- };
- })();
-
- const AnyStore = (function(){
-
-
-
-
-
- const getForPrimitive = function(primitive, target) { return target.storeForPrmitives[primitive] };
- const getForObject = function(obj, target) { return target.storeForObjects.get(obj) };
- const getForSymbol = function(symbol, target) { return target.storeForObjects.get(target.__symbolToObj[symbol]) };
-
- const setForPrimitive = function(primitive, content, target) {
-
- target.storeForPrmitives[primitive] = content;
- return content;
- };
-
- const setForObject = function(obj, content, target) {
-
- target.storeForObjects.set(obj, content);
- return content;
- };
- const setForSymbol = function(symbol, content, target) {
-
- target.storeForObjects.set(target.__symbolToObj[symbol], content);
- return content;
- };
-
- const getFor = {
- '[object String]' : getForPrimitive
- , '[object Object]' : getForObject
- , '[object Symbol]' : getForSymbol
- };
- getFor['[object Number]'] = getFor['[object String]'];
- getFor['[object Array]'] = getFor['[object Object]'];
-
- const setFor = {
- '[object String]' : setForPrimitive
- , '[object Object]' : setForObject
- , '[object Symbol]' : setForSymbol
- };
- setFor['[object Number]'] = setFor['[object String]'];
- setFor['[object Array]'] = setFor['[object Object]'];
-
- function IndexFactory(__symbolFromObj, __symbolToObj, valuecompare) {
-
-
-
-
-
-
-
- if(valuecompare) throw "Not yet implemented."
- return function Index(anyThing, bDontCreate){ return utils_1.js.isPrimitive(anyThing) ? anyThing : (__symbolFromObj.get(anyThing) ? __symbolFromObj.get(anyThing) :
- (()=>{
- if(bDontCreate) return
- var newSymbol = Symbol();
- __symbolFromObj.set(anyThing, newSymbol);
- __symbolToObj[newSymbol] = anyThing;
- return newSymbol })()
- ) }
- }
- function AnyStore(){
-
-
- var targ = { storeForPrmitives : {}, storeForObjects : new WeakMap(), __symbolToObj : {}, __symbolFromObj : new WeakMap() };
- var p = new Proxy( targ
- , {
-
- get: function (target, prop) { return getFor[utils_1.js.nativeType(prop)](prop, target); }
- , set: function (target, prop, content) { return setFor[utils_1.js.nativeType(prop)](prop, content, target); }
- });
- p.Index = IndexFactory(targ.__symbolFromObj, targ.__symbolToObj);
- p.get = (what)=>{ return p[p.Index(what, true)] };
- p.set = (what, content)=>{ return p[p.Index(what)] = content};
- return p
- }
- AnyStore.create = AnyStore;
- return AnyStore
- })();
-
-
- function expandUint32Array(arr, data) {
- const newArray = new Uint32Array(arr.length + data.length);
- newArray.set(arr);
- newArray.set(data, arr.length);
- return newArray;
- }
-
- const HEX_FFFFFFFF = 0xFFFFFFFF;
- const HEX_FFFF0000 = 0xFFFF0000;
- const HEX_FF00 = 0xFF00;
- const HEX_F0 = 0xF0;
- const HEX_0C = 0x0C;
-
- const MAX_32BITS = HEX_FFFFFFFF;
- const MAX_53BITS = Number.MAX_SAFE_INTEGER;
-
- const BIGINT_HEX_FFFFFFFF = BigInt(HEX_FFFFFFFF);
- BigInt(HEX_FFFF0000);
- BigInt(HEX_FF00);
- BigInt(HEX_F0);
- BigInt(HEX_0C);
-
- const BIGINT_MAX_32BITS = BIGINT_HEX_FFFFFFFF;
-
- const BIGINT_0 = BigInt(0);
- const BIGINT_1 = BigInt(1);
- BigInt(2);
- BigInt(4);
- BigInt(8);
- BigInt(16);
- const BIGINT_32 = BigInt(32);
-
-
- function *bigIntBufferGenerator(bn){
-
- var signal = {};
- var stop = Symbol();
- var i = 0;
- for(;;){
- var bits32 = new Uint32Array(1);
- if(bn > MAX_32BITS){
- bits32[0]= Number((bn & BIGINT_MAX_32BITS));
- signal = (yield {i, bits32}) || {};
- if(signal === stop || signal.done) return {i, bits32};
- bn >>= BIGINT_32;
- i++;
- }
- else {
- bits32[0] = Number(bn);
- return {i, bits32};
- }
- }
- }
-
- function bigIntToBuffer(bn) {
-
- if(!utils_1.js.isBigInt(bn)) throw 'bigIntToBuffer suported only for BigInts...'
-
- var buffer = null;
- var iterator = bigIntBufferGenerator(bn);
- var next = iterator.next();
- if(next && !next.done) buffer = next.value.bits32;
- else return next.value.bits32;
- while(!(next = iterator.next()).done) {
-
-
- buffer = expandUint32Array(buffer, next.value.bits32);
- }
- buffer = expandUint32Array(buffer, next.value.bits32);
- return buffer;
- }
-
- function bufferToBigInt(buffer) {
-
- var bn = BIGINT_0;
- for(var i=buffer.length; --i > -1;){ bn <<= BIGINT_32; bn |= BigInt(buffer[i]); }
- return bn;
- }
-
-
-
-
- const BitIndex = (function() { function BitIndex(){ return this }
-
-
- function __is__(t){ if(t === BitIndex) return true; }
- function __is(type){ return typeof this === type ? true : __is__(type) }
-
- function __create(n){
-
- return BitIndex.apply({
- value : n
- , is : __is
- })
- }
-
- __create.create = __create;
- return __create
- })();
-
-
- function leftshift_Number(m){ return m << 1 }
- function leftshift_BigInt(m){ return m << BIGINT_1 }
-
-
- function indexOfLSB32(x, gptwo){
-
-
-
- if(x === 0) return null;
-
- var i = 0;
- x & 0xFFFF0000 && (i += 16, x >>= 16),
- x & 0xFF00 && (i += 8, x >>= 8),
- x & 0xF0 && (i += 4, x >>= 4),
- x & 0x0C && (i += 2, x>>= 2),
- x & 2 && (i += 1);
-
- return i;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- const BitArrayUpto32Bits = (function(){
- function validateBitLength(length){ if(length > 32) throw 'BitArrayUpto32Bits doesnt accept BitLength > 32' }
-
- function __createA(arr){
- validateBitLength(arr.length);
- var created = __create();
-
-
- var iterateUpto = [
- ()=>{for(var i =0 ; i < 1; i++) { console.log(i); created.assignMask(arr[i], { title : arr[i]}); }}
- , ()=>{for(var i =1 ; i < Math.min(31, arr.length); i++) { console.log(i); created.assignMask(arr[i], { title : arr[i]}, leftshift_Number ); }}
- , ()=>{for(var i =31; i < Math.min(32, arr.length); i++) { console.log(i); created.assignMask(arr[i], { title : arr[i]}, (m)=>{ return leftshift_Number(m)>>>0 } ); }}
- ];
- arr.length > 31 ? iterateUpto.forEach(f=>f()) :
- arr.length > 1 ? iterateUpto.slice(0,2).forEach(f=>f()) :
- iterateUpto[0]();
- return created;
- }
-
- function __createO(o){
- var arr = Object.keys(o);
- validateBitLength(arr.length);
-
- var created = __create();
-
- var iterateUpto = [
- ()=>{for(var i =0 ; i < 1; i++) { console.log(i); created.assignMask(arr[i], o[arr[i]]); }}
- , ()=>{for(var i =1 ; i < Math.min(31, arr.length); i++) { console.log(i); created.assignMask(arr[i], o[arr[i]], leftshift_Number ); }}
- , ()=>{for(var i =31; i < Math.min(32, arr.length); i++) { console.log(i); created.assignMask(arr[i], o[arr[i]], (m)=>{ return leftshift_Number(m)>>>0 } ); }}
- ];
- arr.length > 31 ? iterateUpto.forEach(f=>f()) :
- arr.length > 1 ? iterateUpto.slice(0,2).forEach(f=>f()) :
- iterateUpto[0]();
-
- return created;
- }
-
- function __create(){
- var labels = {};
- var masks = {};
-
- var currentMaxMask;
- function __nextMask(){ __nextMask = leftshift_Number;
- return currentMaxMask = 1; }
-
-
- utils_1.assign(mxn,
- {
- validateMask(m){
- if(__is(m, BitIndex)) {
- if(m > 32) throw 'BitArrayUpto32Bits doesnt accept BitIndex > 32'
- return { BitIndex, labels : [masks[indexToMask(m.value)]]
-
- }
- }
- if(m > MAX_32BITS) throw "BitArrayUpto32Bits only supports numbers upto MAX_32BITS "
- if(!utils_1.js.isNumber(+m)) throw "BitArrayUpto32Bits requires Numbers upto MAX_32BITS "
- return true;
- }
- , labelsToMask : (__labels)=>{
- var result = 0; __labels.forEach(l=>{ result |= labels[l]; });
- return result >>> 0;
- }
- , hasMask : function(label) { return labels[label] ? labels[label].mask : null ; }
- , maskToLabels(m, transformEach){
- var valid = this.validateMask(m);
- if(!valid) throw "Invalid Mask"
- if(valid.BitIndex) return valid.labels;
-
- var __labels = [];
- for(var gptwo;gptwo=m&-m;m^=gptwo) {
- if(!masks[gptwo]) { console.log('Error : Invalid mask passed in.'); }
- else __labels.push( transformEach(masks[Number(gptwo)], labels[masks[Number(gptwo)]]) );
- }
- return __labels;
- }
- , labelToMask : (l)=>{ return labels[l] }
- , bit_or : (a, b)=>a | b
- , bit_and : (a, b)=>a & b
- , bit_xor : (a, b)=>a ^ b
- , bit_not : (a)=> ~a
-
- , assignMask : function(label, entity, incrementFn) {
- var lmask = this.hasMask(label); if(lmask) return lmask;
- labels[label] = entity;
- labels[label].mask = currentMaxMask = incrementFn ? incrementFn(currentMaxMask) : __nextMask();
- masks[labels[label].mask] = label;
- return labels[label];
- }
- , msbIndex : function(v) { throw "msb Not yet implemented" }
- , indexToMask : function(index) {
- if(index > 31) throw 'Not supported beyond 32 bits.'
- return (1 << index) >>> 0;
- }
- , indicesToMask : function(indices){
- var mask = 0;
- indices.forEach(index=>{
- if(index > 31) throw 'Not supported beyond 32 bits.'
- mask |= (1 << index);
- });
- return mask >>> 0;
- }
- , maskToIndices : function(m) {
- var valid = this.validateMask(m);
- if(!valid) throw "Invalid Mask"
- if(valid.BitIndex) return [m.value];
- var indices = [];
- var gptwo;
- for (;gptwo=m&-m;m^=gptwo) indices.push(indexOfLSB32(gptwo));
- return indices;
- }
- , bit_shiftl : (a, s)=>{ return a << s }
- , bit_shiftr : (a, s)=>{ return a >> s }
- , bit_shiftr_uz : (a)=>{ return a >>> 0}
-
-
- , toJSON(radix, eachFn){
- var transFormed = {};
- if(!eachFn) return labels;
- Object.keys(labels).forEach(label =>{
- transFormed[label] = eachFn(labels[label]);
- });
- return transFormed;
- }
- , test(){
- Object.keys(masks).forEach((v, i)=> {
- console.log( v );
- console.log( i + ' : ' + v.toString(2) );
- console.log( this.maskToIndices(v));
- });
- console.log( (173).toString(2) );
- this.maskToIndices(173).map( (i)=>{ console.log( i ); });
- console.log('indicesToMask :' + this.indicesToMask([1,4,31]).toString(2));
- }
- });
- }
-
- var creatorFor = {
- '[object Array]' : __createA
- , '[object Object]' : __createO
- , 'undefined' : function(){ return __create() }
- };
-
-
- function BitArrayUpto32Bits(){
- return arguments.length ? creatorFor[utils_1.js.nativeType(arguments[0])](...arguments) :
- creatorFor['undefined'](...arguments)}
-
- BitArrayUpto32Bits.create = BitArrayUpto32Bits;
- return BitArrayUpto32Bits
- })();
-
- const Mixin = (function(){
-
- function create(){
-
- var __mixins = new WeakMap();
- __mixins.set(Mixin, true);
-
- function __is__(t, type){
- if(utils_1.js.isPrimitive(t)) return false;
- if(!t || !t.mixins) return false;
- return t.mixins().get(type) ? true : false ; }
- function __is(v, type){ return typeof v === type ? true : __is__(v, type) }
-
- return { addMixin : (clazz)=>{ __mixins.set(clazz, true);}
- , is : __is
- }
- }
-
- return {create}
- })();
-
- const BitArrayBigInt = (function(){
-
-
- function __createA(arr){
- var created = __create();
-
- for(var i =0 ; i < 1; i++) { created.assignMask(arr[i], { title : arr[i]}); }
- for(var i =1 ; i < arr.length; i++) { created.assignMask(arr[i], { title : arr[i]}, leftshift_BigInt ); }
- return created;
- }
-
- function __createO(o){
- var arr = Object.keys(o);
- var created = __create();
-
- for(var i =0 ; i < 1; i++) { created.assignMask(arr[i], o[arr[i]]); }
- for(var i =1 ; i < arr.length; i++) { created.assignMask(arr[i], o[arr[i]], leftshift_BigInt ); }
-
- return created;
- }
-
- function __create(){
- var labels = {};
- var masks = {};
-
- var currentMaxMask;
- function __nextMask(){ __nextMask = leftshift_BigInt;
- return currentMaxMask = BIGINT_1; }
-
-
- var mxn = Mixin.create();
- var created = utils_1.assign(mxn,
- {
- validateMask(m){
- if(mxn.is(m, BitIndex)) {
- return { BitIndex, labels : [masks[indexToMask(m.value)]] }
- }
- if(!utils_1.js.isBigInt(BigInt(m))) throw "BitArrayBigInt requires BigInt Mask "
- return true;
- }
- , labelsToMask : (__labels)=>{
- var result = BIGINT_0; __labels.forEach(l=>{ result |= labels[l]; });
- return result ;
- }
- , hasMask : function(label) { return labels[label] ? labels[label].mask : null ; }
- , maskToLabels(m, transformEach){
- m = BigInt(m);
- var valid = this.validateMask(m);
- if(!valid) throw "Invalid Mask"
- if(valid.BitIndex) return valid.labels;
-
- var __labels = [];
- for(var gptwo;gptwo=m&-m;m^=gptwo) {
- if(!masks[gptwo]) { console.log('Error : Invalid mask passed in.'); }
- else __labels.push( transformEach(masks[Number(gptwo)], labels[masks[Number(gptwo)]]) );
- }
- return __labels;
- }
- , labelToMask : (l)=>{ return labels[l] }
- , bit_or : (a, b)=>a | b
- , bit_and : (a, b)=>a & b
- , bit_xor : (a, b)=>a ^ b
- , bit_not : (a)=> ~a
-
- , assignMask : function(label, entity, incrementFn) {
- var lmask = this.hasMask(label); if(lmask) throw `Duplicate assignment for same label ${label} not allowed : mask (${lmask}) `
- labels[label] = entity;
- labels[label].mask = currentMaxMask = incrementFn ? incrementFn(currentMaxMask) : __nextMask();
- masks[labels[label].mask] = label;
- return labels[label];
- }
- , msbIndex : function(v) { throw "msb Not yet implemented" }
- , indexToMask : function(index) {
- return BIGINT_1 << index;
- }
- , indicesToMask : function(indices){
- var mask = 0;
- indices.forEach(index=>{
- mask |= (1 << index);
- });
- return mask;
- }
- , maskToIndices : function(m) {
- var valid = this.validateMask(m);
- if(!valid) throw "Invalid Mask"
- if(valid.BitIndex) return [m.value];
- var indices = [];
- var gptwo;
-
- var iterator = bigIntBufferGenerator(BigInt(m));
-
- var next;
-
-
- var i = 0;
- while(!(next = iterator.next()).done) {
- next.value.bits32 > 0 ?
- ( ()=> { for(;gptwo=(next.value.bits32& -next.value.bits32) ;next.value.bits32^=gptwo) indices.push(32 * i + indexOfLSB32(gptwo)); } )
- : null;
- i++;
- }
- for(;gptwo=(next.value.bits32&-next.value.bits32);next.value.bits32^=gptwo) indices.push(32 * i + indexOfLSB32(gptwo));
-
- return indices;
- }
- , bit_shiftl : (a, s)=>{ return a << s }
- , bit_shiftr : (a, s)=>{ return a >> s }
- , bit_shiftr_uz : (a)=>{ throw "BigInt doesnt suppored unsigned right shift."}
-
- , toJSON(radix, eachFn){
- var transFormed = {};
- if(!eachFn) return labels;
- Object.keys(labels).forEach(label =>{
- transFormed[label] = eachFn(labels[label]);
- });
- return transFormed;
- }
- , tosqlcte() {
-
- var select = '';
-
- Object.keys(labels).forEach((label, index, array) =>{
- var labelObject = labels[label];
- var rowselect = 'select ';
- Object.keys(labelObject).forEach((key, index, array) =>{
- rowselect = rowselect + ` '${labelObject[key]}' ${key}`;
- if(array.length !== index+1) rowselect = rowselect + ',';
- });
- select = select + rowselect;
- if(array.length !== index+1) select = select + '\n union all \n';
- });
-
- console.log(select);
- return labels
-
-
- }
- , test(){
- Object.keys(masks).forEach((v, i)=> {
- console.log( v );
- console.log( i + ' : ' + v.toString(2) );
- console.log( this.maskToIndices(v));
- });
- console.log( (173).toString(2) );
- this.maskToIndices(173).map( (i)=>{ console.log( i ); });
- console.log('indicesToMask :' + this.indicesToMask([1,4,31]).toString(2));
- console.log(BigInt(2535301200456458802993406410752));
- console.log('bigIntToBuffer : ' + bigIntToBuffer(BigInt(2535301200456458802993406410752) ));
- console.log('bufferToBigInt : ' + bufferToBigInt( bigIntToBuffer(BigInt(2535301200456458802993406410752)) ));
- }
- }
- );
- created.addMixin(BitArrayBigInt);
- return created;
- }
-
- var creatorFor = {
- '[object Array]' : __createA
- , '[object Object]' : __createO
- , 'undefined' : function(){ return __create() }
- };
-
-
- function BitArrayBigInt(){
- return arguments.length ? creatorFor[utils_1.js.nativeType(arguments[0])](...arguments) :
- creatorFor['undefined'](...arguments)}
-
- BitArrayBigInt.create = BitArrayBigInt;
- return BitArrayBigInt
- })();
-
-
- const BitArrayUpto53Bits = (function(){
-
- function validateBitLength(length){ if(length > 53) throw 'BitArrayUpto53Bits doesnt accept BitLength > 53' }
-
- function __createO(o, options){
- var arr = Object.keys(o);
- validateBitLength(arr.length);
-
- var created = __create();
-
- var iterateUpto = [
- ()=>{for(var i =0 ; i < 1; i++) { console.log(i); created.assignMask(arr[i], o[arr[i]]); }}
- , ()=>{for(var i =1 ; i < Math.min(31, arr.length); i++) { console.log(i); created.assignMask(arr[i], o[arr[i]], leftshift_Number ); }}
- , ()=>{for(var i =31; i < Math.min(32, arr.length); i++) { console.log(i); created.assignMask(arr[i], o[arr[i]], (m)=>{ return leftshift_Number(m)>>>0 } ); }}
- , ()=>{for(var i =32; i < Math.min(53, arr.length); i++) { console.log(i); created.assignMask(arr[i], o[arr[i]], (m)=>{ return Number(BigInt(m) << BIGINT_1) } ); }}
- ];
- arr.length > 32 ? iterateUpto.forEach(f=>f()) :
- arr.length > 31 ? iterateUpto.slice(0,3).forEach(f=>f()) :
- arr.length > 1 ? iterateUpto.slice(0,2).forEach(f=>f()) :
- iterateUpto[0]();
-
- return created;
- }
-
- function __createA(arrInp, options){
- validateBitLength(arrInp.length);
-
- var created = __create();
-
- var arr = [];
- var pregencache = [];
-
- var iterateUpto = [
- (prelen)=>{for(var i =Math.max(0, prelen) ; i < 1; i++) { console.log(i); created.assignMask(arr[i-prelen], pregencache[arr[i-prelen]] || { title : arr[i-prelen]} ); }}
- , (prelen)=>{for(var i =Math.max(1, prelen) ; i < Math.min(31, arr.length + prelen); i++) { console.log(i); created.assignMask(arr[i-prelen], pregencache[arr[i-prelen]] || { title : arr[i-prelen]}, leftshift_Number ); }}
- , (prelen)=>{for(var i =Math.max(31, prelen); i < Math.min(32, arr.length + prelen); i++) { console.log(i); created.assignMask(arr[i-prelen], pregencache[arr[i-prelen]] || { title : arr[i-prelen]}, (m)=>{ return leftshift_Number(m)>>>0 } ); }}
- , (prelen)=>{for(var i =Math.max(32, prelen); i < Math.min(53, arr.length + prelen); i++) { console.log(i); created.assignMask(arr[i-prelen], pregencache[arr[i-prelen]] || { title : arr[i-prelen]}, (m)=>{ return Number(BigInt(m) << BIGINT_1) } ); }}
- ];
-
- if(options && options.pregenerated) {
- arrInp.forEach((inp=>{
- if(!options.pregenerated[inp] || !options.pregenerated[inp].mask) {
-
- arr.push(inp);
- pregencache[inp] = options.pregenerated[inp];
- }
- else if(!options.pregenerated[inp]) arr.push(inp);
- }));
-
- Object.keys(options.pregenerated).forEach(p=>{
- if(pregencache[p]) return;
- created.assignMask(p, options.pregenerated[p], created.assignMaxAsNextIncrement );
- });
- var prelen = Object.keys(created.toJSON()).length;
- prelen > 31 ? iterateUpto.slice(3).forEach(f=>f(prelen)) :
- prelen > 30 ?
- (prelen + arr.length) > 32 ? iterateUpto.slice(2).forEach(f=>f(prelen))
- : iterateUpto.slice(2, 3).forEach(f=>f(prelen))
- :
- prelen > 0 ?
- (prelen + arr.length) > 32 ? iterateUpto.slice(1).forEach(f=>f(prelen))
- : (prelen + arr.length) > 31 ? iterateUpto.slice(1,3).forEach(f=>f(prelen)) :
- iterateUpto.slice(1,2).forEach(f=>f(prelen))
- :
- arr.length > 32 ? iterateUpto.forEach(f=>f(prelen)) :
- arr.length > 31 ? iterateUpto.slice(0,3).forEach(f=>f(prelen)) :
- arr.length > 1 ? iterateUpto.slice(0,2).forEach(f=>f(prelen)) :
- iterateUpto[0](prelen);
- }
- else {
- arr = arrInp;
- arr.length > 32 ? iterateUpto.forEach(f=>f(0)) :
- arr.length > 31 ? iterateUpto.slice(0,3).forEach(f=>f(0)) :
- arr.length > 1 ? iterateUpto.slice(0,2).forEach(f=>f(0)) :
- iterateUpto[0](0);
- }
-
- return created;
- }
-
- function __create(){
- var labels = {};
- var masks = {};
-
- var currentMaxMask;
- function __nextMask(){ __nextMask = leftshift_Number;
- return currentMaxMask = 1; }
-
-
-
-
- var mxn = Mixin.create();
- var created = utils_1.assign(mxn,
- {
-
- assignMaxAsNextIncrement(possibleMax) {
- if(currentMaxMask && currentMaxMask < possibleMax) currentMaxMask = possibleMax;
- else currentMaxMask = possibleMax;
- }
- , validateMask(m){
- if(mxn.is(m, BitIndex)) {
- return { BitIndex, labels : [masks[indexToMask(m.value)]] }
- }
- if(m > MAX_53BITS) throw "BitArrayUpto53Bits only supports numbers upto MAX_53BITS "
- if(!utils_1.js.isNumber(+m)) throw "BitArrayUpto53Bits requires Numbers upto MAX_53BITS "
- return true;
- }
- , labelsToMask : (__labels)=>{
- var result = 0; __labels.forEach(l=>{ result |= labels[l]; });
- return result >>> 0;
- }
- , hasMask : function(label) { return labels[label] ? labels[label].mask : null ; }
- , maskToLabels(m, transformEach){
-
- var valid = this.validateMask(m);
- if(!valid) throw "Invalid Mask"
- if(valid.BitIndex) return valid.labels;
-
- var __labels = [];
- var m = BigInt(m);
-
- for(var gptwo;gptwo=m&-m;m^=gptwo) {
- if(!masks[Number(gptwo)]) { console.log('Error : Invalid mask passed in.'); }
- else __labels.push( transformEach(masks[Number(gptwo)], labels[masks[Number(gptwo)]]) );
- }
- return __labels;
- }
- , labelToMask : (l)=>{ return labels[l] }
- , bit_or : (a, b) => {
- return bit_opFn_Upto53(a,b, (a, b)=>a | b)
- }
- , bit_and : (a, b) => bit_opFn_Upto53(a,b, (a, b)=>a & b)
- , bit_xor : (a, b) => bit_opFn_Upto53(a,b, (a, b)=>a ^ b)
- , bit_not : (a) => Number(~BigInt(a))
- , assignMask : function(label, entity, onassignment) {
-
- if(entity && entity.mask && masks[entity.mask]) {
- throw 'Mask collision. Cannot assign requested mask. ' + entity
- }
- var pregenerated = labels[label] || entity;
-
-
- if(pregenerated && pregenerated.mask) {
- onassignment = (onassignment || created.assignMaxAsNextIncrement);
-
- labels[label] = utils_1.assign(pregenerated, entity, {mask : pregenerated.mask});
- onassignment(pregenerated.mask);
- }
- else {
- onassignment = (onassignment || __nextMask);
-
- labels[label] = entity;
- labels[label].mask = currentMaxMask = onassignment ? onassignment(currentMaxMask) : __nextMask();
- }
- masks[labels[label].mask] = label;
- return labels[label];
- }
- , msbIndex : function(v) { throw "msb Not yet implemented" }
- , indexToMask : function(index) {
- if(index > 52) throw 'Not supported beyond 53 bits.'
- return Number(BigInt(1) << BigInt(index));
- }
- , indicesToMask : function(indices){
- var mask = BigInt(0);
- indices.forEach(index=>{
- if(index > 52) throw 'Not supported beyond 53 bits.'
- mask |= (BIGINT_1 << BigInt(index));
- });
- return Number(mask);
- }
- , maskToIndices : function(m) {
- var valid = this.validateMask(m);
- if(!valid) throw "Invalid Mask"
- if(valid.BitIndex) return [m.value];
- var indices = [];
- var gptwo;
- if(m > MAX_32BITS) {
- var iterator = bigIntBufferGenerator(BigInt(m));
-
- var next;
-
-
- var i = 0;
- while(!(next = iterator.next()).done) {
- next.value.bits32 > 0 ?
- ( ()=> { for(;gptwo=(next.value.bits32& -next.value.bits32) ;next.value.bits32^=gptwo) indices.push(32 * i + indexOfLSB32(gptwo)); } )
- : null;
- i++;
- }
- for(;gptwo=(next.value.bits32&-next.value.bits32);next.value.bits32^=gptwo) indices.push(32 * i + indexOfLSB32(gptwo));
- }
- else {
- m = Number(m);
- for (;gptwo=m&-m;m^=gptwo) indices.push(indexOfLSB32(gptwo)); }
-
-
- return indices;
- }
- , bit_shiftl : (a, s)=>{ return a << s }
- , bit_shiftr : (a, s)=>{ return a >> s }
- , bit_shiftr_uz : (a)=>{ return a >>> 0}
-
- , toJSON(radix, eachFn){
- var transFormed = {};
- if(!eachFn) return labels;
- Object.keys(labels).forEach(label =>{
- transFormed[label] = eachFn(labels[label]);
- });
- return transFormed;
- }
- , tosqlcte() {
-
- var select = '';
-
- Object.keys(labels).forEach((label, index, array) =>{
- var labelObject = labels[label];
- var rowselect = 'select ';
- Object.keys(labelObject).forEach((key, index, array) =>{
- rowselect = rowselect + ` '${labelObject[key]}' ${key}`;
- if(array.length !== index+1) rowselect = rowselect + ',';
- });
- select = select + rowselect;
- if(array.length !== index+1) select = select + '\n union all \n';
- });
-
- console.log(select);
- return labels
-
-
- }
- , test(){
- Object.keys(masks).forEach((v, i)=> {
- console.log( v );
- console.log( i + ' : ' + v.toString(2) );
- console.log( this.maskToIndices(v));
- });
- console.log( (173).toString(2) );
- this.maskToIndices(173).map( (i)=>{ console.log( i ); });
- console.log('indicesToMask :' + this.indicesToMask([1,4,31]).toString(2));
- }
- });
-
- return created;
- }
-
- var creatorFor = {
- '[object Array]' : __createA
- , '[object Object]' : __createO
- , 'undefined' : function(){ return __create() }
-
- };
-
-
- function BitArrayUpto53Bits(){
- return arguments.length ? creatorFor[utils_1.js.nativeType(arguments[0])](...arguments) :
- creatorFor['undefined'](...arguments)}
-
- BitArrayUpto53Bits.create = BitArrayUpto53Bits;
- return BitArrayUpto53Bits
- })();
- function bit_opFn_Upto53(a, b, opFn){
-
- return Number(opFn(BigInt(a), BigInt(b) ))
-
-
-
-
- }
-
-
- const BitArray = (function(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function __createA(arr){
-
-
- arr.length % 32;
- arr.length/32 >>> 0;
- var created = arr.length > 53 ?
- BitArrayBigInt.create(...arguments) : arr.length > 32 ?
- BitArrayUpto53Bits.create(...arguments) :
- BitArrayUpto32Bits.create(...arguments);
- return created;
- }
-
- function __createO(o){
-
-
- var arr = Object.keys(o);
-
- arr.length % 32;
- arr.length/32 >>> 0;
- var created = arr.length > 53 ?
- BitArrayBigInt.create(...arguments) : arr.length > 32 ?
- BitArrayUpto53Bits.create(...arguments) :
- BitArrayUpto32Bits.create(...arguments);
- return created;
- }
-
- function __create(){
-
-
-
- Mixin.create();
- var created = BitArrayBigInt.create();
- created.addMixin(BitArray);
- return created;
- }
-
- var creatorFor = {
- '[object Array]' : __createA
- , '[object Object]' : __createO
- , 'undefined' : function(){ return __create() }
- };
-
-
- function BitArray(){
- return arguments.length ? creatorFor[utils_1.js.nativeType(arguments[0])](...arguments) :
- creatorFor['undefined'](...arguments)}
- BitArray.create = BitArray;
- return BitArray
- })();
-
-
-
-
-
- const mixs = {
-
-
-
-
-
-
-
-
-
-
- kernelMixin : (function() {
-
-
-
- function __getuuid() {
- return v1_1();
- }
-
-
- function __get() {
- return this.kernel.uuidv1;
- }
-
-
- function __firstGet() {
- this.kernel.uuidv1 = __getuuid();
-
- __finalize.apply(this);
- return this.uuid;
- }
-
- function __finalize(){
- Object.defineProperty(this.kernel, 'uuidv1', { writable : false, configurable : false});
- Object.defineProperty(this, 'uuid', {
-
- get : __get
- , enumerable : true
- , configurable : false
- });
-
- Object.defineProperty(this, 'kernel', {
-
- enumerable : false
- , configurable : false
- , writable : false
- });
- }
-
- function __defineKernel(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Object.defineProperty(this, 'kernel', { value :{}, writable : true });
-
-
-
- Object.defineProperty(this.kernel, 'uuidv1', { writable : true, configurable : true});
-
-
-
-
-
-
- }
-
- function __loadKernel() {
-
- this.kernel.uuidv1 = this.uuid;
- __finalize.apply(this);
- }
-
- function __attachKernel() {
-
-
- if(this.hasOwnProperty('kernel')) {
- l('Already has kernel');
- return this;
- }
-
- __defineKernel.apply(this);
-
- if(this.hasOwnProperty('uuid')) {
- l('Already has uuid');
- __loadKernel.apply(this);
-
- return this;
- }
- Object.defineProperty(this, 'uuid', { get : __firstGet, configurable : true});
- return this;
- }
-
- var __kernelInstanceMixin = function() {
- return __attachKernel.apply(this);
- };
- __kernelInstanceMixin.getuuid = __getuuid;
- return __kernelInstanceMixin;
- })()
-
-
- , publisherMixin : (function() {
- function __publish() {
-
- }
- return function() {
- this.publish = __publish;
- return this;
- };
- })()
- };
-
-
- const helpers = {
- indexHelper : indexHelper
- , meta : (function() {
-
-
-
- function spy(obj, prop, action) {
- action = action || 'set';
- if(action != 'set') {
- throw 'Currently only set actions can be observed on properties';
- }
-
-
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
- var value = obj[prop];
-
- if(descriptor && descriptor.get && descriptor.get.$meta){
- var originalset = descriptor.set;
- descriptor.set = function(newValue) {
- globalThis_1.mediator.publish(obj.uuid + '.' + prop, 'willchange', {from : value, to : newValue});
- originalset(newValue);
- globalThis_1.mediator.publish(obj.uuid + '.' + prop, 'haschanged', {from : value, to : newValue});
- };
- return this;
- }
-
- descriptor = {
- get: function() {
- return value;
- },
- set: function(newValue) {
- globalThis_1.mediator.publish([obj.uuid, prop, 'willchange'], {from : value, to : newValue});
- value = newValue;
- globalThis_1.mediator.publish([obj.uuid, prop, 'haschanged' ], {from : value, to : newValue});
- }
- };
- descriptor.get.$meta = {};
- Object.defineProperty(obj, prop, descriptor);
- return this;
- }
-
- function getCustomPropertyDescriptor(obj, prop) {
- var actualDescriptor = Object.getOwnPropertyDescriptor(obj, prop);
- if (actualDescriptor && actualDescriptor.get && actualDescriptor.get.$meta) {
- return actualDescriptor;
- }
-
- var value = obj[prop];
- var descriptor = {
- get: function() {
- return value;
- },
- set: function(newValue) {
- value = newValue;
- }
- };
- descriptor.get.$meta = {};
-
- Object.defineProperty(obj, prop, descriptor);
- return Object.getOwnPropertyDescriptor(obj, prop);
- }
-
- function setPropertyAttribute(obj, propertyName, attributeName, attributeValue) {
- var descriptor = getCustomPropertyDescriptor(obj, propertyName);
-
- descriptor.get.$meta[attributeName] = attributeValue;
- }
-
- function getPropertyAttributes(obj, propertyName) {
- var descriptor = getCustomPropertyDescriptor(obj, propertyName);
-
- return descriptor.get.$meta;
- }
-
- function getPropertyAttribute(obj, propertyName, attributeName) {
- return getPropertyAttributes(obj, propertyName)[attributeName];
- }
-
- return function(obj) {
- obj.getPropertyAttribute = getPropertyAttribute;
- obj.getPropertyAttributes = getPropertyAttributes;
- obj.setPropertyAttribute = setPropertyAttribute;
- obj.spy = spy;
-
- return obj;
- };
- })()
- };
-
- var core = function(object){
-
- return {
- mixs
- , helpers
- , AnyStore
- , BitArray
- , BitArrayUpto32Bits
- , BitArrayUpto53Bits
- , BitArrayBigInt
-
- , uuidv1: v1_1
- , Rule
- }
- };
-
-
- var core_1 = core;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function *bigIntBitGenerator(){
- var signal = {};
- var stop = Symbol();
- var iId = 0;
- var bit = BIGINT_1;
- for(;;){
- signal = (yield { iId, bit }) || {};
- if(signal === stop || signal.done) return { iId, bit };
- bit = bit << BIGINT_1;
- iId++;
- }
- }
-
- var Rule = (function(){
-
-
-
- var __Rule = {};
-
-
-
-
-
- var _XRule = { assignbit, getParticipating };
-
-
-
-
- var _Rule = {
-
- extend : function(extension){
-
- function __create(){ return init.call({}) }
- function __createO(o){ return init.call(o) }
- function __createA(a){ a.forEach(r=> __createO(r)); return a }
- var creatorFor = {
- '[object Array]' : __createA
- , '[object Object]' : __createO
- , 'undefined' : function(){ return __create() }
- };
-
- function Rule(){ return arguments.length ? creatorFor[utils_1.js.nativeType(arguments[0])](...arguments) : creatorFor['undefined'](...arguments) }
-
-
- var _extension = utils_1.assign({}, _XRule, extension);
- function init() { return utils_1.assign(this, rProto, _extension, __newInstance(this), this) } _extension.init = init;
- utils_1.assign(Rule, _Rule, _extension, __Rule);
-
-
- Rule.create = Rule;
- Rule.build = buildRules;
- Rule.match = match;
- Rule.connect = connectRules;
- Rule.branch = function(as, ...rest){
-
-
-
- console.error('Not yet implemented.');
- };
-
-
-
-
-
-
-
-
-
- function buildRules(where, data, fullResult, parentRule) {
- let columnValue;
- if (!where) return Promise.resolve(fullResult) ;
-
- if (typeof where !== 'object' || Array.isArray(where)) {
- debug('Invalid value for where: %j', where);
- return Promise.resolve(fullResult);
- }
-
- var ruleset = [];
-
- var id = data ? data.id : null;
- fullResult = fullResult || [];
- var createIntermediate = createIntermediateParentLess;
- var immediateParentP = null;
- if(parentRule) {
- immediateParentP = parentRule;
- createIntermediate = createIntermediateWithParent;
- }
-
- if(Object.keys(where).length > 1) {
- immediateParentP = createIntermediate({operator : AND}, ()=>{ return [] }, parentRule);
- ruleset.push(immediateParentP);
- fullResult.push(immediateParentP);
- createIntermediate = createIntermediateWithParent;
- }
-
- for (const key in where) {
-
- if (key === AND || key === OR) {
- const clauses = where[key];
- if (Array.isArray(clauses)) {
- if(clauses.length > 1) {
- var rp = createIntermediate({operator : key}, (rParent)=>{
- var list = [];
- for (let i = 0, n = clauses.length; i < n; i++) {
- list.push(buildRules(clauses[i], null, fullResult).then( ruleForClause => {
- connectRules(operators[rParent.operator].bit, ruleForClause, rParent);
- return ruleForClause;
- }));
- }
- return list;
- }, immediateParentP);
- ruleset.push(rp);
- fullResult.push(rp);
- }
- else {
-
-
- var rP = buildRules(clauses[0], null, fullResult, immediateParentP);
-
- ruleset.push(rP);
- }
- continue;
- }
- else {
- throw 'Invalid filter '
- }
- }
-
- let expression = where[key];
- let p = key;
- var op ='eq;';
- const columnName = columnEscaped( where, key);
-
- if (expression === null || expression === undefined) {
-
- expression = null;
-
- var rpromise = assignbit(Rule.create(rChild, { key : columnName, value : toColumnValue(p, expression)})).then((rChild)=>{
- if(immediateParentP) {
- return immediateParentP.then((immediateParent)=> {
- connectRules(operators[immediateParent.operator].bit, rChild, immediateParent);
- return rChild
- })
- }
-
-
- return rChild
- }).catch(e=>{ console.error('null expression : ' + e); });
-
- fullResult.push(rpromise);
- ruleset.push(rpromise);
- } else if (expression && expression.constructor === Object) {
- const operator = Object.keys(expression)[0];
- expression = expression[operator];
- if (operator === INQ || operator === NIN || operator === BETWEEN) {
- columnValue = [];
- op = operator === INQ ? (EQ) : operator === NIN ? (NEQ) : (LTE);
- if (Array.isArray(expression)) {
-
- for (let j = 0, m = expression.length; j < m; j++) {
- columnValue.push(toColumnValue(p, expression[j]));
- }
- } else {
- columnValue.push(toColumnValue(p, expression[j]));
- }
-
- if (operator === BETWEEN) {
- var rp = createIntermediate({operator : AND}, (rParent)=>{
-
- columnValue[0] === undefined ? null : columnValue[0];
- columnValue[1] === undefined ? null : columnValue[1];
- if(expression.length !== 2) console.error('Invalid between operator parameter length');
-
- var list = [];
- list.push(assignbit(Rule.create({key : columnName, value : columnValue[0], operator : GTE})).then((rChild)=>{
- connectRules(operators[rParent.operator].bit, rChild, rParent);
- return rChild
- }));
- list.push(assignbit(Rule.create({key : columnName, value : columnValue[1], operator : LTE})).then((rChild)=>{
- connectRules(operators[rParent.operator].bit, rChild, rParent);
- return rChild
- }));
- fullResult.push.apply(fullResult, list);
- return list;
- }, immediateParentP);
- ruleset.push(rp);
- fullResult.push(rp);
-
- } else {
- var rp = createIntermediate({operator : OR}, (rParent)=>{
-
-
- if (columnValue.length === 0) {
- if (operator === INQ) {
- columnValue = [null];
- } else {
-
-
- return [];
- }
- }
- var list = [];
- for (let j = 0, m = columnValue.length; j < m; j++) {
- list.push(
- assignbit(Rule.create({key : columnName, value : toColumnValue(p, columnValue[j]), operator : op})).then((rChild)=>{
- connectRules(operators[rParent.operator].bit, rChild, rParent);
- return rChild
- })
- );
- }
- fullResult.push.apply(fullResult, list);
- return list
- }, immediateParentP);
- ruleset.push(rp);
- fullResult.push(rp);
- }
- } else if (operator === 'regexp' && expression instanceof RegExp) {
-
-
- var rpromise = assignbit(Rule.create({key : columnName, value : toColumnValue(p, expression), operator})).then((rChild)=>{
- if(immediateParentP) {
- return immediateParentP.then((immediateParent)=> {
- connectRules(operators[immediateParent.operator].bit, rChild, immediateParent);
- return rChild
- })
- }
-
-
- return rChild
- }).catch(e=>{ console.error('Regexp expression : ' + e); });
-
- fullResult.push(rpromise);
- ruleset.push(rpromise);
-
- } else {
- var rpromise = assignbit(Rule.create({key : columnName, value : toColumnValue(p, expression), operator})).then((rChild)=>{
- if(immediateParentP) {
- return immediateParentP.then((immediateParent)=> {
- connectRules(operators[immediateParent.operator].bit, rChild, immediateParent);
- return rChild
- })
- }
-
-
- return rChild
- }).catch(e=>{ console.error('other expression : ' + e); });
- fullResult.push(rpromise);
- ruleset.push(rpromise);
-
-
- }
-
- } else {
-
- if(utils_1.js.isArray(expression)) throw 'Invalid array value for filter. Implicit INQ not supported. '
-
-
- var rpromise = assignbit(Rule.create({key : columnName, value : toColumnValue(p, expression), operator : EQ})).then((rChild)=>{
- if(immediateParentP) {
- return immediateParentP.then((immediateParent)=> {
- connectRules(operators[immediateParent.operator].bit, rChild, immediateParent);
- return rChild
- })
- }
-
-
- return rChild
- }).catch(e=>{ console.error('other expression : ' + e); });
-
- fullResult.push(rpromise);
- ruleset.push(rpromise);
- }
- }
-
- return Promise.all(ruleset).then(()=>{
-
- if(immediateParentP){
- return immediateParentP;
- }
- if(ruleset.length > 1) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return ruleset[ruleset.length-1].then((r)=>{ r.id = id || r.id; return r});
- }
- else if(ruleset.length > 0) {
- return ruleset[0].then((r)=>{ r.id = id || r.id; return r});
- }
- else {
- return fullResult[fullResult.length-1].then((r)=>{ r.id = id || r.id; return r});
- }
- })
-
- }
- return Rule
- }
- };
- var createIntermediateParentLess = (interMediatGroupParent, createChildren)=>{
- var interMediatGroupParentP = assignbit(Rule.create(interMediatGroupParent)).then((rIntermediate)=>{
- return rIntermediate
- });
-
- var grpromise = interMediatGroupParentP.then((rParent)=>{
-
-
-
-
-
-
-
-
-
-
-
- return Promise.all(createChildren(rParent)).then( (list)=>{
-
-
- rParent.list = list;
- return rParent
- });
- });
- return grpromise;
- };
-
- var createIntermediateWithParent = (interMediatGroupParent, createChildren, immediateParentP)=>{
-
- var interMediatGroupParentP = assignbit(Rule.create(interMediatGroupParent)).then((rIntermediate)=>{
- return immediateParentP.then((immediateParent)=>{
- connectRules(operators[immediateParent.operator].bit, rIntermediate, immediateParent);
- return rIntermediate
- })
- });
-
- var grpromise = interMediatGroupParentP.then((rParent)=>{
-
-
-
-
-
-
-
-
-
-
-
- return Promise.all(createChildren(rParent)).then( (list)=>{
-
-
- rParent.list = list;
- return rParent
- });
- });
- return grpromise;
- };
-
-
- const EQ = 'eq';
- const LTE = 'lte';
- const GTE = 'gte';
- const LT = 'lt';
- const GT = 'gt';
- const AND = 'and';
- const OR = 'or';
- const INQ = 'inq';
- const BETWEEN = 'between';
- const NIN = 'nin';
- const NEQ = 'neq';
- __Rule.EQ = 1;
- __Rule.LTE = 2;
- __Rule.GTE = 4;
- __Rule.LT = 8;
- __Rule.GT = 16;
- __Rule.AND = 32;
- __Rule.OR = 64;
-
- var operators = {
- eq : { operator : '=', bit : __Rule.EQ}
- , lte : { operator : '<=', bit : __Rule.LTE}
- , gte : { operator : '>=', bit : __Rule.GTE}
- , lt : { operator : '<', bit : __Rule.LT}
- , gt : { operator : '>', bit : __Rule.GT}
- , and : { operator : AND, bit : __Rule.AND}
- , or : { operator : OR, bit : __Rule.OR}
- };
-
- var operatorsIndex = {};
- Object.keys(operators).forEach(op => operatorsIndex[operators[op].bit] = operators[op] );
-
- function __newInstance(o){
- var d = new Date();
- var id = o.id || v1_1();
- return { v1ruleId : id, id, datecreated : d, datemodified : d
- , permissive : BIGINT_0, restrictive : BIGINT_0, descendents : BIGINT_0, ancestors : BIGINT_0, list :[] }
- }
-
- var globalBitIterator = bigIntBitGenerator();
- function assignbit(rule){ var g = globalBitIterator.next().value; rule.bit = g.bit; rule.ruleiId = g.iId;
- return Promise.resolve(rule);
- }
-
- function getParticipating(iRule, rList, cb){
- return Promise.all(iRule.results).then((iRules)=>{
- var SUCCESS = BIGINT_0;
- var FAILURE = BIGINT_0;
- var mask = BIGINT_0;
- var results = rList.filter(rule => {
- var found = iRules.find( iR => {
- if(iR === rule || iR.id === rule.id ||
- iR.key === rule.key &&
- ( rule.operator == GT && (
- rule.value <= iR.value && iR.operator == GT
- || rule.value < iR.value && ( iR.operator == GTE || iR.operator == EQ )
- )
- || rule.operator == GTE && (
- rule.value <= iR.value && (iR.operator == GTE || iR.operator == EQ)
- || (iR.value - rule.value) >= 0 && iR.operator == GT
- )
- || rule.operator == LT && (
- rule.value >= iR.value && iR.operator == LT
- || rule.value > iR.value && ( iR.operator == LTE || iR.operator == EQ )
- )
- || rule.operator == LTE && (
- rule.value >= iR.value && (iR.operator == LTE || iR.operator == EQ)
- || (rule.value - iR.value) >= 0 && iR.operator == LT
- )
- || rule.operator == EQ && (
- rule.value == iR.value && iR.operator == EQ
- )
- )
- ) {
-
- SUCCESS |= rule.bit;
- mask |= rule.mask;
- return true;
- }
- });
-
- if(!found) {
- if(rule.isleaf) { FAILURE |= rule.bit; }
- else {
-
-
-
-
-
-
-
-
- if(rule.permissive & SUCCESS ) { SUCCESS |= rule.bit; mask |= rule.mask; return true; }
- if(rule.restrictive & FAILURE) {FAILURE |= rule.bit; }
- if(rule.restrictive && (rule.restrictive & SUCCESS) === rule.restrictive) { SUCCESS |= rule.bit; mask |= rule.mask; return true; }
- if(rule.permissive && (rule.permissive & FAILURE) === rule.permissive) {FAILURE |= rule.bit; }
-
-
-
-
-
-
- }
- }
-
- return found;
- });
-
- if(utils_1.js.isFunction(arguments[arguments.length-1])) { return cb(null, { SUCCESS, FAILURE, mask, results} ) }
- else return { mask, list : found};
- });
- }
-
- function getParticipatingRoots(participating, rList, cb){
- var qualifiedRoots = [];
- rList.forEach((r)=>{
- if(r.isRoot && evaluate(r, participating)){ qualifiedRoots.push(r); }
- });
- cb(null, qualifiedRoots);
- }
-
- function toColumnValue(p, v) { return v; }
- function columnEscaped(inst, p) { return p; }
-
- function getsql_cond_group(){
- if(!this.list) { console.warn(`${this.operator} condition without list is moot`); return ''}
- if(this.list.length < 2) {
- this.list.push( this.list[0] );
- }
- var slqexprs = [];
- this.list.forEach(r => slqexprs.push(r.sql) );
- return '( ' + slqexprs.join( ` ${this.operator} `) + ' )'
- }
-
- function getfilter_cond_group(){
- if(!this.list) { console.warn(`${this.operator} condition without list is moot`); return ''}
- if(this.list.length < 2) {
- this.list.push( this.list[0] );
- }
- var filterexprs = [];
- this.list.forEach(r => filterexprs.push(r.filter) );
- return filterexprs;
- }
-
-
-
-
-
-
-
-
- var evaluate = function(rule, participating){
-
- if(rule.bit & participating.SUCCESS ) return true;
- if(rule.bit & participating.FAILURE) return false
- if(rule.permissive & participating.SUCCESS ) { participating.SUCCESS |= rule.bit; return true }
- if(rule.restrictive & participating.FAILURE) {participating.FAILURE |= rule.bit; return false;}
- if(rule.restrictive && (rule.restrictive & participating.SUCCESS) === rule.restrictive) { participating.SUCCESS |= rule.bit; return true }
- if(rule.permissive && (rule.permissive & participating.FAILURE) === rule.permissive) {participating.FAILURE |= rule.bit; return false;}
-
-
-
- if(rule.isleaf) {
- if(participating.results.find( pp => pp === rule )) { participating.SUCCESS |= rule.bit; return true }
- else { participating.FAILURE |= rule.bit; return false; }
- }
-
-
-
-
-
-
-
-
-
-
-
- var permissive = rule.permissive & (BigInt(-1)-participating.SUCCESS) & (BigInt(-1)-participating.FAILURE);
- for(var rc in rule.list){
- var r = rule.list[rc];
- if(r.bit & permissive) {
- if(evaluate(r, participating)) { participating.SUCCESS |= r.bit; participating.SUCCESS |= rule.bit; return true }
- else participating.FAILURE |= r.bit;
- }
- }
- if(rule.permissive){ participating.FAILURE |= rule.bit; return false; }
-
-
- var restrictive = rule.restrictive & (BigInt(-1)-participating.SUCCESS) & (BigInt(-1)-participating.FAILURE);
- for(var rc in rule.list){
- var r = rule.list[rc];
- if(r.bit & restrictive) {
- if(!evaluate(r, participating)) { participating.FAILURE |= r.bit; participating.FAILURE |= rule.bit; return false}
- participating.SUCCESS |= r.bit;
- }
- }
- if(rule.restrictive){ participating.SUCCESS |= rule.bit; return true; }
-
- throw 'Error : A group rule should either be permissive or restrictive...'
-
- };
-
- var match = function (inputs, rList, cb) {
- var results = [];
- Rule.build(inputs, clause, results).then((inputRule)=>{
- inputRule.results = results;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getParticipating(inputRule, rList, (err, participating)=>{
- getParticipatingRoots(participating, rList, (err, participatingRoots)=>{
- cb(null, participatingRoots);
- });
- });
- });
- };
-
-
-
-
-
-
-
- var connectRules = function(as, ...rest){ return branch[as](...rest) };
-
- var branch = {};
- branch[__Rule.AND] = function(rChild, rParent, refresh){
- rChild.ancestors |= rParent.ancestors | rParent.bit;
-
- if(rParent.permissive || rParent.operator === OR) throw 'Error Invalid rule addition to parent'
-
- if(rParent.restrictive & rChild.bit) return;
- rParent.list.push(rChild);
-
-
-
-
-
-
-
-
-
-
-
-
-
- rParent.restrictive |= rChild.restrictive | rChild.bit;
-
-
-
-
- rParent.descendents |= rChild.descendents | rChild.permissive | rChild.restrictive ;
-
-
-
- if(refresh){
-
- rChild.refreshDescendents(rChild.ancestors);
- rParent.refreshAncestors(rParent.descendents);
- }
- };
-
- branch[__Rule.OR] = function(rChild, rParent, refresh){
- rChild.ancestors |= rParent.ancestors | rParent.bit;
-
- if(rParent.restrictive || rParent.operator !== OR) throw 'Error Invalid rule addition to parent'
- if(rParent.permissive & rChild.bit) return
- rParent.list.push(rChild);
-
- rParent.permissive |= rChild.permissive | rChild.bit;
-
- rParent.descendents |= rChild.descendents | rChild.permissive | rChild.restrictive ;
- if(refresh){
- rChild.refreshDescendents(rChild.ancestors);
- rParent.refreshAncestors(rParent.descendents);
- }
- };
-
- var rProto = { migrationstate : 8, operator : EQ
- , evaluate
- , connect : function(parent){
- connectRules(operators[parent.operator].bit, this, parent);
- }
-
- , get sql(){
- var getSql = this.operator === AND ? getsql_cond_group : this.operator === OR ? getsql_cond_group
- : ()=>this.key + ' ' + operators[this.operator].operator + ` '${this.value}' `;
- return getSql.call(this)
- }
- , get filter(){
- var getFilter = this.operator === AND ? getfilter_cond_group : this.operator === OR ? getgetfilter_cond_group
- : ()=>{
- var f = {};
- f[this.key] = {};
- f[this.key][this.operator] = this.value; return f;};
- return getFilter.call(this)
- }
-
- , get mask(){ return this.permissive | this.restrictive | this.descendents | this.ancestors | this.bit }
- , get isIndependent() { return this.bit === this.mask }
- , get isRoot() { return !this.ancestors }
- , get isChild() { return this.ancestors }
- , get isParent() { return (this.permissive | this.restrictive | this.descendents) }
- , get isleaf() { return !(this.permissive | this.restrictive | this.descendents) }
- , get iscomposite() { return this.list.length > 1 }
- };
-
- return _Rule.extend()
- })();
-
- utils_1.core = core_1;
- var bbhverse = utils_1;
-
- const { spawn: spawn$1, spawnSync } = childProcess__default['default'];
-
-
- function nodeShellExec$1() {
-
- var args = Array.from(arguments);
- var opts = args[2] = args[2] || {};
- opts.title ? null : opts.title = `${args[0]} ${args[1] }`;
- const child = spawn$1(...arguments);
-
- var p = new Promise(function(resolve, reject){
- if(!opts.detached) {
- var messages = [];
- var success = true;
-
- if(opts.stdio !== 'ignore') {
- child.stdout.setEncoding('utf8');
- child.stderr.setEncoding('utf8');
- child.stdout.on('data', (chunk) => { chunk.trim() === '' ? null : messages.push(chunk); });
- child.on('error', (chunk) => { success = false; messages.push(chunk); } );
- child.stderr.on('data', (chunk) => {
- if(messages.join('').indexOf('fatal: not a git repository') > -1) opts.haserrors = true;
- messages.push(chunk);
-
- });
- }
- child.on('close', (code) => {
- if(+code !== 0 || opts.haserrors) success = false;
- if(opts.stdio !== 'ignore') {
- var logEntry = { result: `${opts.title} exited with code ${code}`, messages };
- logEntry.success = success;
-
- if(opts.runas){
-
- fs__default['default'].writeFileSync('run.log', ', ' + JSON.stringify(logEntry), {'flag':'a+'} );
- }
- else {
-
- process.stdout.write( messages.join('') );
- }
- }
- if(code !== 0 || opts.haserrors) return reject(logEntry)
- resolve(logEntry);
- });
- }
- else {
- child.unref();
- resolve(true);
- }
- });
- p.process = child;
- return p;
- }
-
- var prompt = function(choices, label){
- return this.prompter.ask(
- `${label} \n ` + Object.keys(choices).map(choice => { return ` ${(+choice) + 1}) ${choices[choice]} `}).join('\n') + `\n default ( <= ${choices[0]} ) : `
- ).then(choice => {
- if(!choice) return choices[0];
- if(choice && isNaN(+choice)) return choice;
- return choices[choice + 1];
- })
- };
-
-
- var cli = {
- nodeShellExec: nodeShellExec$1
- , get prompter() {
- const clii = readline__default['default'].createInterface({ input: process.stdin, output: process.stdout });
- clii.ask = function(q){
- return new Promise((resolve, reject)=>{
- clii.question(q, (answer)=>{ resolve(answer); });
- })
- };
- return clii
- }
- , prompt
- };
-
- var cliverse = cli;
-
- var colorName = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
-
-
-
-
-
-
-
-
-
-
- const reverseKeywords = {};
- for (const key of Object.keys(colorName)) {
- reverseKeywords[colorName[key]] = key;
- }
-
- const convert$1 = {
- rgb: {channels: 3, labels: 'rgb'},
- hsl: {channels: 3, labels: 'hsl'},
- hsv: {channels: 3, labels: 'hsv'},
- hwb: {channels: 3, labels: 'hwb'},
- cmyk: {channels: 4, labels: 'cmyk'},
- xyz: {channels: 3, labels: 'xyz'},
- lab: {channels: 3, labels: 'lab'},
- lch: {channels: 3, labels: 'lch'},
- hex: {channels: 1, labels: ['hex']},
- keyword: {channels: 1, labels: ['keyword']},
- ansi16: {channels: 1, labels: ['ansi16']},
- ansi256: {channels: 1, labels: ['ansi256']},
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
- gray: {channels: 1, labels: ['gray']}
- };
-
- var conversions = convert$1;
-
-
- for (const model of Object.keys(convert$1)) {
- if (!('channels' in convert$1[model])) {
- throw new Error('missing channels property: ' + model);
- }
-
- if (!('labels' in convert$1[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
-
- if (convert$1[model].labels.length !== convert$1[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
-
- const {channels, labels} = convert$1[model];
- delete convert$1[model].channels;
- delete convert$1[model].labels;
- Object.defineProperty(convert$1[model], 'channels', {value: channels});
- Object.defineProperty(convert$1[model], 'labels', {value: labels});
- }
-
- convert$1.rgb.hsl = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const min = Math.min(r, g, b);
- const max = Math.max(r, g, b);
- const delta = max - min;
- let h;
- let s;
-
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
-
- h = Math.min(h * 60, 360);
-
- if (h < 0) {
- h += 360;
- }
-
- const l = (min + max) / 2;
-
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
-
- return [h, s * 100, l * 100];
- };
-
- convert$1.rgb.hsv = function (rgb) {
- let rdif;
- let gdif;
- let bdif;
- let h;
- let s;
-
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const v = Math.max(r, g, b);
- const diff = v - Math.min(r, g, b);
- const diffc = function (c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
-
- if (diff === 0) {
- h = 0;
- s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
-
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = (1 / 3) + rdif - bdif;
- } else if (b === v) {
- h = (2 / 3) + gdif - rdif;
- }
-
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
-
- return [
- h * 360,
- s * 100,
- v * 100
- ];
- };
-
- convert$1.rgb.hwb = function (rgb) {
- const r = rgb[0];
- const g = rgb[1];
- let b = rgb[2];
- const h = convert$1.rgb.hsl(rgb)[0];
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
-
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
-
- return [h, w * 100, b * 100];
- };
-
- convert$1.rgb.cmyk = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
-
- const k = Math.min(1 - r, 1 - g, 1 - b);
- const c = (1 - r - k) / (1 - k) || 0;
- const m = (1 - g - k) / (1 - k) || 0;
- const y = (1 - b - k) / (1 - k) || 0;
-
- return [c * 100, m * 100, y * 100, k * 100];
- };
-
- function comparativeDistance(x, y) {
-
-
- return (
- ((x[0] - y[0]) ** 2) +
- ((x[1] - y[1]) ** 2) +
- ((x[2] - y[2]) ** 2)
- );
- }
-
- convert$1.rgb.keyword = function (rgb) {
- const reversed = reverseKeywords[rgb];
- if (reversed) {
- return reversed;
- }
-
- let currentClosestDistance = Infinity;
- let currentClosestKeyword;
-
- for (const keyword of Object.keys(colorName)) {
- const value = colorName[keyword];
-
-
- const distance = comparativeDistance(rgb, value);
-
-
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
-
- return currentClosestKeyword;
- };
-
- convert$1.keyword.rgb = function (keyword) {
- return colorName[keyword];
- };
-
- convert$1.rgb.xyz = function (rgb) {
- let r = rgb[0] / 255;
- let g = rgb[1] / 255;
- let b = rgb[2] / 255;
-
-
- r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
- g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
- b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
-
- const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
- const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
- const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
-
- return [x * 100, y * 100, z * 100];
- };
-
- convert$1.rgb.lab = function (rgb) {
- const xyz = convert$1.rgb.xyz(rgb);
- let x = xyz[0];
- let y = xyz[1];
- let z = xyz[2];
-
- x /= 95.047;
- y /= 100;
- z /= 108.883;
-
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
-
- const l = (116 * y) - 16;
- const a = 500 * (x - y);
- const b = 200 * (y - z);
-
- return [l, a, b];
- };
-
- convert$1.hsl.rgb = function (hsl) {
- const h = hsl[0] / 360;
- const s = hsl[1] / 100;
- const l = hsl[2] / 100;
- let t2;
- let t3;
- let val;
-
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
-
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
-
- const t1 = 2 * l - t2;
-
- const rgb = [0, 0, 0];
- for (let i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
- if (t3 < 0) {
- t3++;
- }
-
- if (t3 > 1) {
- t3--;
- }
-
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
-
- rgb[i] = val * 255;
- }
-
- return rgb;
- };
-
- convert$1.hsl.hsv = function (hsl) {
- const h = hsl[0];
- let s = hsl[1] / 100;
- let l = hsl[2] / 100;
- let smin = s;
- const lmin = Math.max(l, 0.01);
-
- l *= 2;
- s *= (l <= 1) ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- const v = (l + s) / 2;
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
-
- return [h, sv * 100, v * 100];
- };
-
- convert$1.hsv.rgb = function (hsv) {
- const h = hsv[0] / 60;
- const s = hsv[1] / 100;
- let v = hsv[2] / 100;
- const hi = Math.floor(h) % 6;
-
- const f = h - Math.floor(h);
- const p = 255 * v * (1 - s);
- const q = 255 * v * (1 - (s * f));
- const t = 255 * v * (1 - (s * (1 - f)));
- v *= 255;
-
- switch (hi) {
- case 0:
- return [v, t, p];
- case 1:
- return [q, v, p];
- case 2:
- return [p, v, t];
- case 3:
- return [p, q, v];
- case 4:
- return [t, p, v];
- case 5:
- return [v, p, q];
- }
- };
-
- convert$1.hsv.hsl = function (hsv) {
- const h = hsv[0];
- const s = hsv[1] / 100;
- const v = hsv[2] / 100;
- const vmin = Math.max(v, 0.01);
- let sl;
- let l;
-
- l = (2 - s) * v;
- const lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
-
- return [h, sl * 100, l * 100];
- };
-
-
- convert$1.hwb.rgb = function (hwb) {
- const h = hwb[0] / 360;
- let wh = hwb[1] / 100;
- let bl = hwb[2] / 100;
- const ratio = wh + bl;
- let f;
-
-
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
-
- const i = Math.floor(6 * h);
- const v = 1 - bl;
- f = 6 * h - i;
-
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
-
- const n = wh + f * (v - wh);
-
- let r;
- let g;
- let b;
-
- switch (i) {
- default:
- case 6:
- case 0: r = v; g = n; b = wh; break;
- case 1: r = n; g = v; b = wh; break;
- case 2: r = wh; g = v; b = n; break;
- case 3: r = wh; g = n; b = v; break;
- case 4: r = n; g = wh; b = v; break;
- case 5: r = v; g = wh; b = n; break;
- }
-
-
- return [r * 255, g * 255, b * 255];
- };
-
- convert$1.cmyk.rgb = function (cmyk) {
- const c = cmyk[0] / 100;
- const m = cmyk[1] / 100;
- const y = cmyk[2] / 100;
- const k = cmyk[3] / 100;
-
- const r = 1 - Math.min(1, c * (1 - k) + k);
- const g = 1 - Math.min(1, m * (1 - k) + k);
- const b = 1 - Math.min(1, y * (1 - k) + k);
-
- return [r * 255, g * 255, b * 255];
- };
-
- convert$1.xyz.rgb = function (xyz) {
- const x = xyz[0] / 100;
- const y = xyz[1] / 100;
- const z = xyz[2] / 100;
- let r;
- let g;
- let b;
-
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
-
-
- r = r > 0.0031308
- ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
- : r * 12.92;
-
- g = g > 0.0031308
- ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
- : g * 12.92;
-
- b = b > 0.0031308
- ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
- : b * 12.92;
-
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
-
- return [r * 255, g * 255, b * 255];
- };
-
- convert$1.xyz.lab = function (xyz) {
- let x = xyz[0];
- let y = xyz[1];
- let z = xyz[2];
-
- x /= 95.047;
- y /= 100;
- z /= 108.883;
-
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
-
- const l = (116 * y) - 16;
- const a = 500 * (x - y);
- const b = 200 * (y - z);
-
- return [l, a, b];
- };
-
- convert$1.lab.xyz = function (lab) {
- const l = lab[0];
- const a = lab[1];
- const b = lab[2];
- let x;
- let y;
- let z;
-
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
-
- const y2 = y ** 3;
- const x2 = x ** 3;
- const z2 = z ** 3;
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
-
- x *= 95.047;
- y *= 100;
- z *= 108.883;
-
- return [x, y, z];
- };
-
- convert$1.lab.lch = function (lab) {
- const l = lab[0];
- const a = lab[1];
- const b = lab[2];
- let h;
-
- const hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
-
- if (h < 0) {
- h += 360;
- }
-
- const c = Math.sqrt(a * a + b * b);
-
- return [l, c, h];
- };
-
- convert$1.lch.lab = function (lch) {
- const l = lch[0];
- const c = lch[1];
- const h = lch[2];
-
- const hr = h / 360 * 2 * Math.PI;
- const a = c * Math.cos(hr);
- const b = c * Math.sin(hr);
-
- return [l, a, b];
- };
-
- convert$1.rgb.ansi16 = function (args, saturation = null) {
- const [r, g, b] = args;
- let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation;
-
- value = Math.round(value / 50);
-
- if (value === 0) {
- return 30;
- }
-
- let ansi = 30
- + ((Math.round(b / 255) << 2)
- | (Math.round(g / 255) << 1)
- | Math.round(r / 255));
-
- if (value === 2) {
- ansi += 60;
- }
-
- return ansi;
- };
-
- convert$1.hsv.ansi16 = function (args) {
-
-
- return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
- };
-
- convert$1.rgb.ansi256 = function (args) {
- const r = args[0];
- const g = args[1];
- const b = args[2];
-
-
-
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
-
- if (r > 248) {
- return 231;
- }
-
- return Math.round(((r - 8) / 247) * 24) + 232;
- }
-
- const ansi = 16
- + (36 * Math.round(r / 255 * 5))
- + (6 * Math.round(g / 255 * 5))
- + Math.round(b / 255 * 5);
-
- return ansi;
- };
-
- convert$1.ansi16.rgb = function (args) {
- let color = args % 10;
-
-
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
-
- color = color / 10.5 * 255;
-
- return [color, color, color];
- }
-
- const mult = (~~(args > 50) + 1) * 0.5;
- const r = ((color & 1) * mult) * 255;
- const g = (((color >> 1) & 1) * mult) * 255;
- const b = (((color >> 2) & 1) * mult) * 255;
-
- return [r, g, b];
- };
-
- convert$1.ansi256.rgb = function (args) {
-
- if (args >= 232) {
- const c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
-
- args -= 16;
-
- let rem;
- const r = Math.floor(args / 36) / 5 * 255;
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- const b = (rem % 6) / 5 * 255;
-
- return [r, g, b];
- };
-
- convert$1.rgb.hex = function (args) {
- const integer = ((Math.round(args[0]) & 0xFF) << 16)
- + ((Math.round(args[1]) & 0xFF) << 8)
- + (Math.round(args[2]) & 0xFF);
-
- const string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert$1.hex.rgb = function (args) {
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
- if (!match) {
- return [0, 0, 0];
- }
-
- let colorString = match[0];
-
- if (match[0].length === 3) {
- colorString = colorString.split('').map(char => {
- return char + char;
- }).join('');
- }
-
- const integer = parseInt(colorString, 16);
- const r = (integer >> 16) & 0xFF;
- const g = (integer >> 8) & 0xFF;
- const b = integer & 0xFF;
-
- return [r, g, b];
- };
-
- convert$1.rgb.hcg = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const max = Math.max(Math.max(r, g), b);
- const min = Math.min(Math.min(r, g), b);
- const chroma = (max - min);
- let grayscale;
- let hue;
-
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
-
- if (chroma <= 0) {
- hue = 0;
- } else
- if (max === r) {
- hue = ((g - b) / chroma) % 6;
- } else
- if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma;
- }
-
- hue /= 6;
- hue %= 1;
-
- return [hue * 360, chroma * 100, grayscale * 100];
- };
-
- convert$1.hsl.hcg = function (hsl) {
- const s = hsl[1] / 100;
- const l = hsl[2] / 100;
-
- const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
-
- let f = 0;
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
-
- return [hsl[0], c * 100, f * 100];
- };
-
- convert$1.hsv.hcg = function (hsv) {
- const s = hsv[1] / 100;
- const v = hsv[2] / 100;
-
- const c = s * v;
- let f = 0;
-
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
-
- return [hsv[0], c * 100, f * 100];
- };
-
- convert$1.hcg.rgb = function (hcg) {
- const h = hcg[0] / 360;
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
-
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
-
- const pure = [0, 0, 0];
- const hi = (h % 1) * 6;
- const v = hi % 1;
- const w = 1 - v;
- let mg = 0;
-
-
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
- case 1:
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
- case 2:
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
- case 3:
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
- case 4:
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
- default:
- pure[0] = 1; pure[1] = 0; pure[2] = w;
- }
-
-
- mg = (1.0 - c) * g;
-
- return [
- (c * pure[0] + mg) * 255,
- (c * pure[1] + mg) * 255,
- (c * pure[2] + mg) * 255
- ];
- };
-
- convert$1.hcg.hsv = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
-
- const v = c + g * (1.0 - c);
- let f = 0;
-
- if (v > 0.0) {
- f = c / v;
- }
-
- return [hcg[0], f * 100, v * 100];
- };
-
- convert$1.hcg.hsl = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
-
- const l = g * (1.0 - c) + 0.5 * c;
- let s = 0;
-
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else
- if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
-
- return [hcg[0], s * 100, l * 100];
- };
-
- convert$1.hcg.hwb = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
-
- convert$1.hwb.hcg = function (hwb) {
- const w = hwb[1] / 100;
- const b = hwb[2] / 100;
- const v = 1 - b;
- const c = v - w;
- let g = 0;
-
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
-
- return [hwb[0], c * 100, g * 100];
- };
-
- convert$1.apple.rgb = function (apple) {
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
- };
-
- convert$1.rgb.apple = function (rgb) {
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
- };
-
- convert$1.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
-
- convert$1.gray.hsl = function (args) {
- return [0, 0, args[0]];
- };
-
- convert$1.gray.hsv = convert$1.gray.hsl;
-
- convert$1.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
-
- convert$1.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
-
- convert$1.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
-
- convert$1.gray.hex = function (gray) {
- const val = Math.round(gray[0] / 100 * 255) & 0xFF;
- const integer = (val << 16) + (val << 8) + val;
-
- const string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
-
- convert$1.rgb.gray = function (rgb) {
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
-
-
-
- function buildGraph() {
- const graph = {};
-
- const models = Object.keys(conversions);
-
- for (let len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
-
-
- distance: -1,
- parent: null
- };
- }
-
- return graph;
- }
-
-
- function deriveBFS(fromModel) {
- const graph = buildGraph();
- const queue = [fromModel];
-
- graph[fromModel].distance = 0;
-
- while (queue.length) {
- const current = queue.pop();
- const adjacents = Object.keys(conversions[current]);
-
- for (let len = adjacents.length, i = 0; i < len; i++) {
- const adjacent = adjacents[i];
- const node = graph[adjacent];
-
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
-
- return graph;
- }
-
- function link(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
-
- function wrapConversion(toModel, graph) {
- const path = [graph[toModel].parent, toModel];
- let fn = conversions[graph[toModel].parent][toModel];
-
- let cur = graph[toModel].parent;
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link(conversions[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
-
- fn.conversion = path;
- return fn;
- }
-
- var route = function (fromModel) {
- const graph = deriveBFS(fromModel);
- const conversion = {};
-
- const models = Object.keys(graph);
- for (let len = models.length, i = 0; i < len; i++) {
- const toModel = models[i];
- const node = graph[toModel];
-
- if (node.parent === null) {
-
- continue;
- }
-
- conversion[toModel] = wrapConversion(toModel, graph);
- }
-
- return conversion;
- };
-
- const convert = {};
-
- const models = Object.keys(conversions);
-
- function wrapRaw(fn) {
- const wrappedFn = function (...args) {
- const arg0 = args[0];
- if (arg0 === undefined || arg0 === null) {
- return arg0;
- }
-
- if (arg0.length > 1) {
- args = arg0;
- }
-
- return fn(args);
- };
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- function wrapRounded(fn) {
- const wrappedFn = function (...args) {
- const arg0 = args[0];
-
- if (arg0 === undefined || arg0 === null) {
- return arg0;
- }
-
- if (arg0.length > 1) {
- args = arg0;
- }
-
- const result = fn(args);
-
-
-
-
- if (typeof result === 'object') {
- for (let len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
-
- return result;
- };
-
-
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
-
- return wrappedFn;
- }
-
- models.forEach(fromModel => {
- convert[fromModel] = {};
-
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
-
- const routes = route(fromModel);
- const routeModels = Object.keys(routes);
-
- routeModels.forEach(toModel => {
- const fn = routes[toModel];
-
- convert[fromModel][toModel] = wrapRounded(fn);
- convert[fromModel][toModel].raw = wrapRaw(fn);
- });
- });
-
- var colorConvert = convert;
-
- var ansiStyles = createCommonjsModule(function (module) {
-
- const wrapAnsi16 = (fn, offset) => (...args) => {
- const code = fn(...args);
- return `\u001B[${code + offset}m`;
- };
-
- const wrapAnsi256 = (fn, offset) => (...args) => {
- const code = fn(...args);
- return `\u001B[${38 + offset};5;${code}m`;
- };
-
- const wrapAnsi16m = (fn, offset) => (...args) => {
- const rgb = fn(...args);
- return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
- };
-
- const ansi2ansi = n => n;
- const rgb2rgb = (r, g, b) => [r, g, b];
-
- const setLazyProperty = (object, property, get) => {
- Object.defineProperty(object, property, {
- get: () => {
- const value = get();
-
- Object.defineProperty(object, property, {
- value,
- enumerable: true,
- configurable: true
- });
-
- return value;
- },
- enumerable: true,
- configurable: true
- });
- };
-
-
- let colorConvert$1;
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
- if (colorConvert$1 === undefined) {
- colorConvert$1 = colorConvert;
- }
-
- const offset = isBackground ? 10 : 0;
- const styles = {};
-
- for (const [sourceSpace, suite] of Object.entries(colorConvert$1)) {
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
- if (sourceSpace === targetSpace) {
- styles[name] = wrap(identity, offset);
- } else if (typeof suite === 'object') {
- styles[name] = wrap(suite[targetSpace], offset);
- }
- }
-
- return styles;
- };
-
- function assembleStyles() {
- const codes = new Map();
- const styles = {
- modifier: {
- reset: [0, 0],
-
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
-
-
- blackBright: [90, 39],
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
-
-
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- };
-
-
- styles.color.gray = styles.color.blackBright;
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
- styles.color.grey = styles.color.blackBright;
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
-
- for (const [groupName, group] of Object.entries(styles)) {
- for (const [styleName, style] of Object.entries(group)) {
- styles[styleName] = {
- open: `\u001B[${style[0]}m`,
- close: `\u001B[${style[1]}m`
- };
-
- group[styleName] = styles[styleName];
-
- codes.set(style[0], style[1]);
- }
-
- Object.defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
- }
-
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
-
- styles.color.close = '\u001B[39m';
- styles.bgColor.close = '\u001B[49m';
-
- setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
- setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
- setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
- setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
- setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
- setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
-
- return styles;
- }
-
-
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- }, "/$$rollup_base$$/node_modules/ansi-styles");
-
- var hasFlag = (flag, argv = process.argv) => {
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
- const position = argv.indexOf(prefix + flag);
- const terminatorPosition = argv.indexOf('--');
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
- };
-
- const {env: env$1} = process;
-
- let forceColor;
- if (hasFlag('no-color') ||
- hasFlag('no-colors') ||
- hasFlag('color=false') ||
- hasFlag('color=never')) {
- forceColor = 0;
- } else if (hasFlag('color') ||
- hasFlag('colors') ||
- hasFlag('color=true') ||
- hasFlag('color=always')) {
- forceColor = 1;
- }
-
- if ('FORCE_COLOR' in env$1) {
- if (env$1.FORCE_COLOR === 'true') {
- forceColor = 1;
- } else if (env$1.FORCE_COLOR === 'false') {
- forceColor = 0;
- } else {
- forceColor = env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$1.FORCE_COLOR, 10), 3);
- }
- }
-
- function translateLevel(level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
- }
-
- function supportsColor(haveStream, streamIsTTY) {
- if (forceColor === 0) {
- return 0;
- }
-
- if (hasFlag('color=16m') ||
- hasFlag('color=full') ||
- hasFlag('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag('color=256')) {
- return 2;
- }
-
- if (haveStream && !streamIsTTY && forceColor === undefined) {
- return 0;
- }
-
- const min = forceColor || 0;
-
- if (env$1.TERM === 'dumb') {
- return min;
- }
-
- if (process.platform === 'win32') {
-
-
- const osRelease = os__default['default'].release().split('.');
- if (
- Number(osRelease[0]) >= 10 &&
- Number(osRelease[2]) >= 10586
- ) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
-
- return 1;
- }
-
- if ('CI' in env$1) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
- return 1;
- }
-
- return min;
- }
-
- if ('TEAMCITY_VERSION' in env$1) {
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
- }
-
- if (env$1.COLORTERM === 'truecolor') {
- return 3;
- }
-
- if ('TERM_PROGRAM' in env$1) {
- const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
-
- switch (env$1.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
- case 'Apple_Terminal':
- return 2;
-
- }
- }
-
- if (/-256(color)?$/i.test(env$1.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
- return 1;
- }
-
- if ('COLORTERM' in env$1) {
- return 1;
- }
-
- return min;
- }
-
- function getSupportLevel(stream) {
- const level = supportsColor(stream, stream && stream.isTTY);
- return translateLevel(level);
- }
-
- var supportsColor_1 = {
- supportsColor: getSupportLevel,
- stdout: translateLevel(supportsColor(true, tty__default['default'].isatty(1))),
- stderr: translateLevel(supportsColor(true, tty__default['default'].isatty(2)))
- };
-
- const stringReplaceAll$1 = (string, substring, replacer) => {
- let index = string.indexOf(substring);
- if (index === -1) {
- return string;
- }
-
- const substringLength = substring.length;
- let endIndex = 0;
- let returnValue = '';
- do {
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
- endIndex = index + substringLength;
- index = string.indexOf(substring, endIndex);
- } while (index !== -1);
-
- returnValue += string.substr(endIndex);
- return returnValue;
- };
-
- const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
- let endIndex = 0;
- let returnValue = '';
- do {
- const gotCR = string[index - 1] === '\r';
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
- endIndex = index + 1;
- index = string.indexOf('\n', endIndex);
- } while (index !== -1);
-
- returnValue += string.substr(endIndex);
- return returnValue;
- };
-
- var util = {
- stringReplaceAll: stringReplaceAll$1,
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
- };
-
- const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
- const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
-
- const ESCAPES = new Map([
- ['n', '\n'],
- ['r', '\r'],
- ['t', '\t'],
- ['b', '\b'],
- ['f', '\f'],
- ['v', '\v'],
- ['0', '\0'],
- ['\\', '\\'],
- ['e', '\u001B'],
- ['a', '\u0007']
- ]);
-
- function unescape(c) {
- const u = c[0] === 'u';
- const bracket = c[1] === '{';
-
- if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
- return String.fromCharCode(parseInt(c.slice(1), 16));
- }
-
- if (u && bracket) {
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
- }
-
- return ESCAPES.get(c) || c;
- }
-
- function parseArguments(name, arguments_) {
- const results = [];
- const chunks = arguments_.trim().split(/\s*,\s*/g);
- let matches;
-
- for (const chunk of chunks) {
- const number = Number(chunk);
- if (!Number.isNaN(number)) {
- results.push(number);
- } else if ((matches = chunk.match(STRING_REGEX))) {
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
- } else {
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
- }
- }
-
- return results;
- }
-
- function parseStyle(style) {
- STYLE_REGEX.lastIndex = 0;
-
- const results = [];
- let matches;
-
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
- const name = matches[1];
-
- if (matches[2]) {
- const args = parseArguments(name, matches[2]);
- results.push([name].concat(args));
- } else {
- results.push([name]);
- }
- }
-
- return results;
- }
-
- function buildStyle(chalk, styles) {
- const enabled = {};
-
- for (const layer of styles) {
- for (const style of layer.styles) {
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
- }
- }
-
- let current = chalk;
- for (const [styleName, styles] of Object.entries(enabled)) {
- if (!Array.isArray(styles)) {
- continue;
- }
-
- if (!(styleName in current)) {
- throw new Error(`Unknown Chalk style: ${styleName}`);
- }
-
- current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
- }
-
- return current;
- }
-
- var templates = (chalk, temporary) => {
- const styles = [];
- const chunks = [];
- let chunk = [];
-
-
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
- if (escapeCharacter) {
- chunk.push(unescape(escapeCharacter));
- } else if (style) {
- const string = chunk.join('');
- chunk = [];
- chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
- styles.push({inverse, styles: parseStyle(style)});
- } else if (close) {
- if (styles.length === 0) {
- throw new Error('Found extraneous } in Chalk template literal');
- }
-
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
- chunk = [];
- styles.pop();
- } else {
- chunk.push(character);
- }
- });
-
- chunks.push(chunk.join(''));
-
- if (styles.length > 0) {
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
- throw new Error(errMessage);
- }
-
- return chunks.join('');
- };
-
- const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1;
- const {
- stringReplaceAll,
- stringEncaseCRLFWithFirstIndex
- } = util;
-
- const {isArray: isArray$2} = Array;
-
-
- const levelMapping = [
- 'ansi',
- 'ansi',
- 'ansi256',
- 'ansi16m'
- ];
-
- const styles = Object.create(null);
-
- const applyOptions = (object, options = {}) => {
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
- throw new Error('The `level` option should be an integer from 0 to 3');
- }
-
-
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
- object.level = options.level === undefined ? colorLevel : options.level;
- };
-
- class ChalkClass {
- constructor(options) {
-
- return chalkFactory(options);
- }
- }
-
- const chalkFactory = options => {
- const chalk = {};
- applyOptions(chalk, options);
-
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
-
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
-
- chalk.template.constructor = () => {
- throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
- };
-
- chalk.template.Instance = ChalkClass;
-
- return chalk.template;
- };
-
- function Chalk(options) {
- return chalkFactory(options);
- }
-
- for (const [styleName, style] of Object.entries(ansiStyles)) {
- styles[styleName] = {
- get() {
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
- Object.defineProperty(this, styleName, {value: builder});
- return builder;
- }
- };
- }
-
- styles.visible = {
- get() {
- const builder = createBuilder(this, this._styler, true);
- Object.defineProperty(this, 'visible', {value: builder});
- return builder;
- }
- };
-
- const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
-
- for (const model of usedModels) {
- styles[model] = {
- get() {
- const {level} = this;
- return function (...arguments_) {
- const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
- return createBuilder(this, styler, this._isEmpty);
- };
- }
- };
- }
-
- for (const model of usedModels) {
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const {level} = this;
- return function (...arguments_) {
- const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
- return createBuilder(this, styler, this._isEmpty);
- };
- }
- };
- }
-
- const proto = Object.defineProperties(() => {}, {
- ...styles,
- level: {
- enumerable: true,
- get() {
- return this._generator.level;
- },
- set(level) {
- this._generator.level = level;
- }
- }
- });
-
- const createStyler = (open, close, parent) => {
- let openAll;
- let closeAll;
- if (parent === undefined) {
- openAll = open;
- closeAll = close;
- } else {
- openAll = parent.openAll + open;
- closeAll = close + parent.closeAll;
- }
-
- return {
- open,
- close,
- openAll,
- closeAll,
- parent
- };
- };
-
- const createBuilder = (self, _styler, _isEmpty) => {
- const builder = (...arguments_) => {
- if (isArray$2(arguments_[0]) && isArray$2(arguments_[0].raw)) {
-
- return applyStyle(builder, chalkTag(builder, ...arguments_));
- }
-
-
-
- return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
- };
-
-
-
- Object.setPrototypeOf(builder, proto);
-
- builder._generator = self;
- builder._styler = _styler;
- builder._isEmpty = _isEmpty;
-
- return builder;
- };
-
- const applyStyle = (self, string) => {
- if (self.level <= 0 || !string) {
- return self._isEmpty ? '' : string;
- }
-
- let styler = self._styler;
-
- if (styler === undefined) {
- return string;
- }
-
- const {openAll, closeAll} = styler;
- if (string.indexOf('\u001B') !== -1) {
- while (styler !== undefined) {
-
-
-
- string = stringReplaceAll(string, styler.close, styler.open);
-
- styler = styler.parent;
- }
- }
-
-
-
-
- const lfIndex = string.indexOf('\n');
- if (lfIndex !== -1) {
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
- }
-
- return openAll + string + closeAll;
- };
-
- let template;
- const chalkTag = (chalk, ...strings) => {
- const [firstString] = strings;
-
- if (!isArray$2(firstString) || !isArray$2(firstString.raw)) {
-
-
- return strings.join(' ');
- }
-
- const arguments_ = strings.slice(1);
- const parts = [firstString.raw[0]];
-
- for (let i = 1; i < firstString.length; i++) {
- parts.push(
- String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
- String(firstString.raw[i])
- );
- }
-
- if (template === undefined) {
- template = templates;
- }
-
- return template(chalk, parts.join(''));
- };
-
- Object.defineProperties(Chalk.prototype, styles);
-
- const chalk = Chalk();
- chalk.supportsColor = stdoutColor;
- chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0});
- chalk.stderr.supportsColor = stderrColor;
-
- var source = chalk;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var isWindows = process.platform === 'win32';
-
-
-
-
- var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
-
- function rethrow() {
-
-
- var callback;
- if (DEBUG) {
- var backtrace = new Error;
- callback = debugCallback;
- } else
- callback = missingCallback;
-
- return callback;
-
- function debugCallback(err) {
- if (err) {
- backtrace.message = err.message;
- err = backtrace;
- missingCallback(err);
- }
- }
-
- function missingCallback(err) {
- if (err) {
- if (process.throwDeprecation)
- throw err;
- else if (!process.noDeprecation) {
- var msg = 'fs: missing callback ' + (err.stack || err.message);
- if (process.traceDeprecation)
- console.trace(msg);
- else
- console.error(msg);
- }
- }
- }
- }
-
- function maybeCallback(cb) {
- return typeof cb === 'function' ? cb : rethrow();
- }
-
- path__default['default'].normalize;
-
-
-
- if (isWindows) {
- var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
- } else {
- var nextPartRe = /(.*?)(?:[\/]+|$)/g;
- }
-
-
- if (isWindows) {
- var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
- } else {
- var splitRootRe = /^[\/]*/;
- }
-
- var realpathSync$1 = function realpathSync(p, cache) {
-
- p = path__default['default'].resolve(p);
-
- if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
- return cache[p];
- }
-
- var original = p,
- seenLinks = {},
- knownHard = {};
-
-
- var pos;
-
- var current;
-
- var base;
-
- var previous;
-
- start();
-
- function start() {
-
- var m = splitRootRe.exec(p);
- pos = m[0].length;
- current = m[0];
- base = m[0];
- previous = '';
-
-
- if (isWindows && !knownHard[base]) {
- fs__default['default'].lstatSync(base);
- knownHard[base] = true;
- }
- }
-
-
-
-
- while (pos < p.length) {
-
- nextPartRe.lastIndex = pos;
- var result = nextPartRe.exec(p);
- previous = current;
- current += result[0];
- base = previous + result[1];
- pos = nextPartRe.lastIndex;
-
-
- if (knownHard[base] || (cache && cache[base] === base)) {
- continue;
- }
-
- var resolvedLink;
- if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
-
- resolvedLink = cache[base];
- } else {
- var stat = fs__default['default'].lstatSync(base);
- if (!stat.isSymbolicLink()) {
- knownHard[base] = true;
- if (cache) cache[base] = base;
- continue;
- }
-
-
-
- var linkTarget = null;
- if (!isWindows) {
- var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
- if (seenLinks.hasOwnProperty(id)) {
- linkTarget = seenLinks[id];
- }
- }
- if (linkTarget === null) {
- fs__default['default'].statSync(base);
- linkTarget = fs__default['default'].readlinkSync(base);
- }
- resolvedLink = path__default['default'].resolve(previous, linkTarget);
-
- if (cache) cache[base] = resolvedLink;
- if (!isWindows) seenLinks[id] = linkTarget;
- }
-
-
- p = path__default['default'].resolve(resolvedLink, p.slice(pos));
- start();
- }
-
- if (cache) cache[original] = p;
-
- return p;
- };
-
-
- var realpath$1 = function realpath(p, cache, cb) {
- if (typeof cb !== 'function') {
- cb = maybeCallback(cache);
- cache = null;
- }
-
-
- p = path__default['default'].resolve(p);
-
- if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
- return process.nextTick(cb.bind(null, null, cache[p]));
- }
-
- var original = p,
- seenLinks = {},
- knownHard = {};
-
-
- var pos;
-
- var current;
-
- var base;
-
- var previous;
-
- start();
-
- function start() {
-
- var m = splitRootRe.exec(p);
- pos = m[0].length;
- current = m[0];
- base = m[0];
- previous = '';
-
-
- if (isWindows && !knownHard[base]) {
- fs__default['default'].lstat(base, function(err) {
- if (err) return cb(err);
- knownHard[base] = true;
- LOOP();
- });
- } else {
- process.nextTick(LOOP);
- }
- }
-
-
-
- function LOOP() {
-
- if (pos >= p.length) {
- if (cache) cache[original] = p;
- return cb(null, p);
- }
-
-
- nextPartRe.lastIndex = pos;
- var result = nextPartRe.exec(p);
- previous = current;
- current += result[0];
- base = previous + result[1];
- pos = nextPartRe.lastIndex;
-
-
- if (knownHard[base] || (cache && cache[base] === base)) {
- return process.nextTick(LOOP);
- }
-
- if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
-
- return gotResolvedLink(cache[base]);
- }
-
- return fs__default['default'].lstat(base, gotStat);
- }
-
- function gotStat(err, stat) {
- if (err) return cb(err);
-
-
- if (!stat.isSymbolicLink()) {
- knownHard[base] = true;
- if (cache) cache[base] = base;
- return process.nextTick(LOOP);
- }
-
-
-
-
- if (!isWindows) {
- var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
- if (seenLinks.hasOwnProperty(id)) {
- return gotTarget(null, seenLinks[id], base);
- }
- }
- fs__default['default'].stat(base, function(err) {
- if (err) return cb(err);
-
- fs__default['default'].readlink(base, function(err, target) {
- if (!isWindows) seenLinks[id] = target;
- gotTarget(err, target);
- });
- });
- }
-
- function gotTarget(err, target, base) {
- if (err) return cb(err);
-
- var resolvedLink = path__default['default'].resolve(previous, target);
- if (cache) cache[base] = resolvedLink;
- gotResolvedLink(resolvedLink);
- }
-
- function gotResolvedLink(resolvedLink) {
-
- p = path__default['default'].resolve(resolvedLink, p.slice(pos));
- start();
- }
- };
-
- var old = {
- realpathSync: realpathSync$1,
- realpath: realpath$1
- };
-
- var fs_realpath = realpath;
- realpath.realpath = realpath;
- realpath.sync = realpathSync;
- realpath.realpathSync = realpathSync;
- realpath.monkeypatch = monkeypatch;
- realpath.unmonkeypatch = unmonkeypatch;
-
-
- var origRealpath = fs__default['default'].realpath;
- var origRealpathSync = fs__default['default'].realpathSync;
-
- var version = process.version;
- var ok = /^v[0-5]\./.test(version);
-
-
- function newError (er) {
- return er && er.syscall === 'realpath' && (
- er.code === 'ELOOP' ||
- er.code === 'ENOMEM' ||
- er.code === 'ENAMETOOLONG'
- )
- }
-
- function realpath (p, cache, cb) {
- if (ok) {
- return origRealpath(p, cache, cb)
- }
-
- if (typeof cache === 'function') {
- cb = cache;
- cache = null;
- }
- origRealpath(p, cache, function (er, result) {
- if (newError(er)) {
- old.realpath(p, cache, cb);
- } else {
- cb(er, result);
- }
- });
- }
-
- function realpathSync (p, cache) {
- if (ok) {
- return origRealpathSync(p, cache)
- }
-
- try {
- return origRealpathSync(p, cache)
- } catch (er) {
- if (newError(er)) {
- return old.realpathSync(p, cache)
- } else {
- throw er
- }
- }
- }
-
- function monkeypatch () {
- fs__default['default'].realpath = realpath;
- fs__default['default'].realpathSync = realpathSync;
- }
-
- function unmonkeypatch () {
- fs__default['default'].realpath = origRealpath;
- fs__default['default'].realpathSync = origRealpathSync;
- }
-
- var concatMap = function (xs, fn) {
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- var x = fn(xs[i], i);
- if (isArray$1(x)) res.push.apply(res, x);
- else res.push(x);
- }
- return res;
- };
-
- var isArray$1 = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
- };
-
- var balancedMatch = balanced;
- function balanced(a, b, str) {
- if (a instanceof RegExp) a = maybeMatch(a, str);
- if (b instanceof RegExp) b = maybeMatch(b, str);
-
- var r = range(a, b, str);
-
- return r && {
- start: r[0],
- end: r[1],
- pre: str.slice(0, r[0]),
- body: str.slice(r[0] + a.length, r[1]),
- post: str.slice(r[1] + b.length)
- };
- }
-
- function maybeMatch(reg, str) {
- var m = str.match(reg);
- return m ? m[0] : null;
- }
-
- balanced.range = range;
- function range(a, b, str) {
- var begs, beg, left, right, result;
- var ai = str.indexOf(a);
- var bi = str.indexOf(b, ai + 1);
- var i = ai;
-
- if (ai >= 0 && bi > 0) {
- if(a===b) {
- return [ai, bi];
- }
- begs = [];
- left = str.length;
-
- while (i >= 0 && !result) {
- if (i == ai) {
- begs.push(i);
- ai = str.indexOf(a, i + 1);
- } else if (begs.length == 1) {
- result = [ begs.pop(), bi ];
- } else {
- beg = begs.pop();
- if (beg < left) {
- left = beg;
- right = bi;
- }
-
- bi = str.indexOf(b, i + 1);
- }
-
- i = ai < bi && ai >= 0 ? ai : bi;
- }
-
- if (begs.length) {
- result = [ left, right ];
- }
- }
-
- return result;
- }
-
- var braceExpansion = expandTop;
-
- var escSlash = '\0SLASH'+Math.random()+'\0';
- var escOpen = '\0OPEN'+Math.random()+'\0';
- var escClose = '\0CLOSE'+Math.random()+'\0';
- var escComma = '\0COMMA'+Math.random()+'\0';
- var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
- function numeric(str) {
- return parseInt(str, 10) == str
- ? parseInt(str, 10)
- : str.charCodeAt(0);
- }
-
- function escapeBraces(str) {
- return str.split('\\\\').join(escSlash)
- .split('\\{').join(escOpen)
- .split('\\}').join(escClose)
- .split('\\,').join(escComma)
- .split('\\.').join(escPeriod);
- }
-
- function unescapeBraces(str) {
- return str.split(escSlash).join('\\')
- .split(escOpen).join('{')
- .split(escClose).join('}')
- .split(escComma).join(',')
- .split(escPeriod).join('.');
- }
-
-
-
-
-
- function parseCommaParts(str) {
- if (!str)
- return [''];
-
- var parts = [];
- var m = balancedMatch('{', '}', str);
-
- if (!m)
- return str.split(',');
-
- var pre = m.pre;
- var body = m.body;
- var post = m.post;
- var p = pre.split(',');
-
- p[p.length-1] += '{' + body + '}';
- var postParts = parseCommaParts(post);
- if (post.length) {
- p[p.length-1] += postParts.shift();
- p.push.apply(p, postParts);
- }
-
- parts.push.apply(parts, p);
-
- return parts;
- }
-
- function expandTop(str) {
- if (!str)
- return [];
-
-
-
-
-
-
-
- if (str.substr(0, 2) === '{}') {
- str = '\\{\\}' + str.substr(2);
- }
-
- return expand(escapeBraces(str), true).map(unescapeBraces);
- }
-
- function embrace(str) {
- return '{' + str + '}';
- }
- function isPadded(el) {
- return /^-?0\d/.test(el);
- }
-
- function lte(i, y) {
- return i <= y;
- }
- function gte(i, y) {
- return i >= y;
- }
-
- function expand(str, isTop) {
- var expansions = [];
-
- var m = balancedMatch('{', '}', str);
- if (!m || /\$$/.test(m.pre)) return [str];
-
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
- var isSequence = isNumericSequence || isAlphaSequence;
- var isOptions = m.body.indexOf(',') >= 0;
- if (!isSequence && !isOptions) {
-
- if (m.post.match(/,.*\}/)) {
- str = m.pre + '{' + m.body + escClose + m.post;
- return expand(str);
- }
- return [str];
- }
-
- var n;
- if (isSequence) {
- n = m.body.split(/\.\./);
- } else {
- n = parseCommaParts(m.body);
- if (n.length === 1) {
-
- n = expand(n[0], false).map(embrace);
- if (n.length === 1) {
- var post = m.post.length
- ? expand(m.post, false)
- : [''];
- return post.map(function(p) {
- return m.pre + n[0] + p;
- });
- }
- }
- }
-
-
-
-
-
- var pre = m.pre;
- var post = m.post.length
- ? expand(m.post, false)
- : [''];
-
- var N;
-
- if (isSequence) {
- var x = numeric(n[0]);
- var y = numeric(n[1]);
- var width = Math.max(n[0].length, n[1].length);
- var incr = n.length == 3
- ? Math.abs(numeric(n[2]))
- : 1;
- var test = lte;
- var reverse = y < x;
- if (reverse) {
- incr *= -1;
- test = gte;
- }
- var pad = n.some(isPadded);
-
- N = [];
-
- for (var i = x; test(i, y); i += incr) {
- var c;
- if (isAlphaSequence) {
- c = String.fromCharCode(i);
- if (c === '\\')
- c = '';
- } else {
- c = String(i);
- if (pad) {
- var need = width - c.length;
- if (need > 0) {
- var z = new Array(need + 1).join('0');
- if (i < 0)
- c = '-' + z + c.slice(1);
- else
- c = z + c;
- }
- }
- }
- N.push(c);
- }
- } else {
- N = concatMap(n, function(el) { return expand(el, false) });
- }
-
- for (var j = 0; j < N.length; j++) {
- for (var k = 0; k < post.length; k++) {
- var expansion = pre + N[j] + post[k];
- if (!isTop || isSequence || expansion)
- expansions.push(expansion);
- }
- }
-
- return expansions;
- }
-
- var minimatch_1 = minimatch;
- minimatch.Minimatch = Minimatch$1;
-
- var path = { sep: '/' };
- try {
- path = path__default['default'];
- } catch (er) {}
-
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch$1.GLOBSTAR = {};
-
-
- var plTypes = {
- '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
- '?': { open: '(?:', close: ')?' },
- '+': { open: '(?:', close: ')+' },
- '*': { open: '(?:', close: ')*' },
- '@': { open: '(?:', close: ')' }
- };
-
-
-
- var qmark = '[^/]';
-
-
- var star = qmark + '*?';
-
-
-
-
- var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?';
-
-
-
- var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?';
-
-
- var reSpecials = charSet('().*{}+?[]^$\\!');
-
-
- function charSet (s) {
- return s.split('').reduce(function (set, c) {
- set[c] = true;
- return set
- }, {})
- }
-
-
- var slashSplit = /\/+/;
-
- minimatch.filter = filter;
- function filter (pattern, options) {
- options = options || {};
- return function (p, i, list) {
- return minimatch(p, pattern, options)
- }
- }
-
- function ext (a, b) {
- a = a || {};
- b = b || {};
- var t = {};
- Object.keys(b).forEach(function (k) {
- t[k] = b[k];
- });
- Object.keys(a).forEach(function (k) {
- t[k] = a[k];
- });
- return t
- }
-
- minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return minimatch
-
- var orig = minimatch;
-
- var m = function minimatch (p, pattern, options) {
- return orig.minimatch(p, pattern, ext(def, options))
- };
-
- m.Minimatch = function Minimatch (pattern, options) {
- return new orig.Minimatch(pattern, ext(def, options))
- };
-
- return m
- };
-
- Minimatch$1.defaults = function (def) {
- if (!def || !Object.keys(def).length) return Minimatch$1
- return minimatch.defaults(def).Minimatch
- };
-
- function minimatch (p, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {};
-
-
- if (!options.nocomment && pattern.charAt(0) === '#') {
- return false
- }
-
-
- if (pattern.trim() === '') return p === ''
-
- return new Minimatch$1(pattern, options).match(p)
- }
-
- function Minimatch$1 (pattern, options) {
- if (!(this instanceof Minimatch$1)) {
- return new Minimatch$1(pattern, options)
- }
-
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {};
- pattern = pattern.trim();
-
-
- if (path.sep !== '/') {
- pattern = pattern.split(path.sep).join('/');
- }
-
- this.options = options;
- this.set = [];
- this.pattern = pattern;
- this.regexp = null;
- this.negate = false;
- this.comment = false;
- this.empty = false;
-
-
- this.make();
- }
-
- Minimatch$1.prototype.debug = function () {};
-
- Minimatch$1.prototype.make = make;
- function make () {
-
- if (this._made) return
-
- var pattern = this.pattern;
- var options = this.options;
-
-
- if (!options.nocomment && pattern.charAt(0) === '#') {
- this.comment = true;
- return
- }
- if (!pattern) {
- this.empty = true;
- return
- }
-
-
- this.parseNegate();
-
-
- var set = this.globSet = this.braceExpand();
-
- if (options.debug) this.debug = console.error;
-
- this.debug(this.pattern, set);
-
- // step 3: now we have a set, so turn each one into a series of path-portion
- // matching patterns.
- // These will be regexps, except in the case of "**", which is
- // set to the GLOBSTAR object for globstar behavior,
- // and will not contain any / characters
- set = this.globParts = set.map(function (s) {
- return s.split(slashSplit)
- });
-
- this.debug(this.pattern, set);
-
- // glob --> regexps
- set = set.map(function (s, si, set) {
- return s.map(this.parse, this)
- }, this);
-
- this.debug(this.pattern, set);
-
- // filter out everything that didn't compile properly.
- set = set.filter(function (s) {
- return s.indexOf(false) === -1
- });
-
- this.debug(this.pattern, set);
-
- this.set = set;
- }
-
- Minimatch$1.prototype.parseNegate = parseNegate;
- function parseNegate () {
- var pattern = this.pattern;
- var negate = false;
- var options = this.options;
- var negateOffset = 0;
-
- if (options.nonegate) return
-
- for (var i = 0, l = pattern.length
- ; i < l && pattern.charAt(i) === '!'
- ; i++) {
- negate = !negate;
- negateOffset++;
- }
-
- if (negateOffset) this.pattern = pattern.substr(negateOffset);
- this.negate = negate;
- }
-
-
-
-
-
-
-
-
-
-
-
- minimatch.braceExpand = function (pattern, options) {
- return braceExpand(pattern, options)
- };
-
- Minimatch$1.prototype.braceExpand = braceExpand;
-
- function braceExpand (pattern, options) {
- if (!options) {
- if (this instanceof Minimatch$1) {
- options = this.options;
- } else {
- options = {};
- }
- }
-
- pattern = typeof pattern === 'undefined'
- ? this.pattern : pattern;
-
- if (typeof pattern === 'undefined') {
- throw new TypeError('undefined pattern')
- }
-
- if (options.nobrace ||
- !pattern.match(/\{.*\}/)) {
-
- return [pattern]
- }
-
- return braceExpansion(pattern)
- }
-
-
-
-
-
-
-
-
-
-
-
-
- Minimatch$1.prototype.parse = parse;
- var SUBPARSE = {};
- function parse (pattern, isSub) {
- if (pattern.length > 1024 * 64) {
- throw new TypeError('pattern is too long')
- }
-
- var options = this.options;
-
-
- if (!options.noglobstar && pattern === '**') return GLOBSTAR
- if (pattern === '') return ''
-
- var re = '';
- var hasMagic = !!options.nocase;
- var escaping = false;
-
- var patternListStack = [];
- var negativeLists = [];
- var stateChar;
- var inClass = false;
- var reClassStart = -1;
- var classStart = -1;
-
-
- var patternStart = pattern.charAt(0) === '.' ? ''
-
- : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
- : '(?!\\.)';
- var self = this;
-
- function clearStateChar () {
- if (stateChar) {
-
-
- switch (stateChar) {
- case '*':
- re += star;
- hasMagic = true;
- break
- case '?':
- re += qmark;
- hasMagic = true;
- break
- default:
- re += '\\' + stateChar;
- break
- }
- self.debug('clearStateChar %j %j', stateChar, re);
- stateChar = false;
- }
- }
-
- for (var i = 0, len = pattern.length, c
- ; (i < len) && (c = pattern.charAt(i))
- ; i++) {
- this.debug('%s\t%s %s %j', pattern, i, re, c);
-
-
- if (escaping && reSpecials[c]) {
- re += '\\' + c;
- escaping = false;
- continue
- }
-
- switch (c) {
- case '/':
-
-
- return false
-
- case '\\':
- clearStateChar();
- escaping = true;
- continue
-
-
-
- case '?':
- case '*':
- case '+':
- case '@':
- case '!':
- this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c);
-
-
-
- if (inClass) {
- this.debug(' in class');
- if (c === '!' && i === classStart + 1) c = '^';
- re += c;
- continue
- }
-
-
-
-
- self.debug('call clearStateChar %j', stateChar);
- clearStateChar();
- stateChar = c;
-
-
-
- if (options.noext) clearStateChar();
- continue
-
- case '(':
- if (inClass) {
- re += '(';
- continue
- }
-
- if (!stateChar) {
- re += '\\(';
- continue
- }
-
- patternListStack.push({
- type: stateChar,
- start: i - 1,
- reStart: re.length,
- open: plTypes[stateChar].open,
- close: plTypes[stateChar].close
- });
-
- re += stateChar === '!' ? '(?:(?!(?:' : '(?:';
- this.debug('plType %j %j', stateChar, re);
- stateChar = false;
- continue
-
- case ')':
- if (inClass || !patternListStack.length) {
- re += '\\)';
- continue
- }
-
- clearStateChar();
- hasMagic = true;
- var pl = patternListStack.pop();
-
-
- re += pl.close;
- if (pl.type === '!') {
- negativeLists.push(pl);
- }
- pl.reEnd = re.length;
- continue
-
- case '|':
- if (inClass || !patternListStack.length || escaping) {
- re += '\\|';
- escaping = false;
- continue
- }
-
- clearStateChar();
- re += '|';
- continue
-
-
- case '[':
-
- clearStateChar();
-
- if (inClass) {
- re += '\\' + c;
- continue
- }
-
- inClass = true;
- classStart = i;
- reClassStart = re.length;
- re += c;
- continue
-
- case ']':
-
-
-
-
- if (i === classStart + 1 || !inClass) {
- re += '\\' + c;
- escaping = false;
- continue
- }
-
-
-
- if (inClass) {
-
-
-
-
-
-
-
- var cs = pattern.substring(classStart + 1, i);
- try {
- RegExp('[' + cs + ']');
- } catch (er) {
-
- var sp = this.parse(cs, SUBPARSE);
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]';
- hasMagic = hasMagic || sp[1];
- inClass = false;
- continue
- }
- }
-
-
- hasMagic = true;
- inClass = false;
- re += c;
- continue
-
- default:
-
- clearStateChar();
-
- if (escaping) {
-
- escaping = false;
- } else if (reSpecials[c]
- && !(c === '^' && inClass)) {
- re += '\\';
- }
-
- re += c;
-
- }
- }
-
-
-
- if (inClass) {
-
-
-
-
- cs = pattern.substr(classStart + 1);
- sp = this.parse(cs, SUBPARSE);
- re = re.substr(0, reClassStart) + '\\[' + sp[0];
- hasMagic = hasMagic || sp[1];
- }
-
-
-
-
-
-
-
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + pl.open.length);
- this.debug('setting tail', re, pl);
-
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
- if (!$2) {
-
- $2 = '\\';
- }
-
-
-
-
-
-
-
- return $1 + $1 + $2 + '|'
- });
-
- this.debug('tail=%j\n %s', tail, tail, pl, re);
- var t = pl.type === '*' ? star
- : pl.type === '?' ? qmark
- : '\\' + pl.type;
-
- hasMagic = true;
- re = re.slice(0, pl.reStart) + t + '\\(' + tail;
- }
-
-
- clearStateChar();
- if (escaping) {
-
- re += '\\\\';
- }
-
-
-
- var addPatternStart = false;
- switch (re.charAt(0)) {
- case '.':
- case '[':
- case '(': addPatternStart = true;
- }
-
-
-
-
-
-
- for (var n = negativeLists.length - 1; n > -1; n--) {
- var nl = negativeLists[n];
-
- var nlBefore = re.slice(0, nl.reStart);
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
- var nlAfter = re.slice(nl.reEnd);
-
- nlLast += nlAfter;
-
-
-
-
- var openParensBefore = nlBefore.split('(').length - 1;
- var cleanAfter = nlAfter;
- for (i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
- }
- nlAfter = cleanAfter;
-
- var dollar = '';
- if (nlAfter === '' && isSub !== SUBPARSE) {
- dollar = '$';
- }
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
- re = newRe;
- }
-
-
-
-
- if (re !== '' && hasMagic) {
- re = '(?=.)' + re;
- }
-
- if (addPatternStart) {
- re = patternStart + re;
- }
-
-
- if (isSub === SUBPARSE) {
- return [re, hasMagic]
- }
-
-
-
-
- if (!hasMagic) {
- return globUnescape(pattern)
- }
-
- var flags = options.nocase ? 'i' : '';
- try {
- var regExp = new RegExp('^' + re + '$', flags);
- } catch (er) {
-
-
-
-
- return new RegExp('$.')
- }
-
- regExp._glob = pattern;
- regExp._src = re;
-
- return regExp
- }
-
- minimatch.makeRe = function (pattern, options) {
- return new Minimatch$1(pattern, options || {}).makeRe()
- };
-
- Minimatch$1.prototype.makeRe = makeRe;
- function makeRe () {
- if (this.regexp || this.regexp === false) return this.regexp
-
-
-
-
-
-
-
- var set = this.set;
-
- if (!set.length) {
- this.regexp = false;
- return this.regexp
- }
- var options = this.options;
-
- var twoStar = options.noglobstar ? star
- : options.dot ? twoStarDot
- : twoStarNoDot;
- var flags = options.nocase ? 'i' : '';
-
- var re = set.map(function (pattern) {
- return pattern.map(function (p) {
- return (p === GLOBSTAR) ? twoStar
- : (typeof p === 'string') ? regExpEscape(p)
- : p._src
- }).join('\\\/')
- }).join('|');
-
-
-
- re = '^(?:' + re + ')$';
-
-
- if (this.negate) re = '^(?!' + re + ').*$';
-
- try {
- this.regexp = new RegExp(re, flags);
- } catch (ex) {
- this.regexp = false;
- }
- return this.regexp
- }
-
- minimatch.match = function (list, pattern, options) {
- options = options || {};
- var mm = new Minimatch$1(pattern, options);
- list = list.filter(function (f) {
- return mm.match(f)
- });
- if (mm.options.nonull && !list.length) {
- list.push(pattern);
- }
- return list
- };
-
- Minimatch$1.prototype.match = match;
- function match (f, partial) {
- this.debug('match', f, this.pattern);
-
-
- if (this.comment) return false
- if (this.empty) return f === ''
-
- if (f === '/' && partial) return true
-
- var options = this.options;
-
-
- if (path.sep !== '/') {
- f = f.split(path.sep).join('/');
- }
-
-
- f = f.split(slashSplit);
- this.debug(this.pattern, 'split', f);
-
-
-
-
-
-
- var set = this.set;
- this.debug(this.pattern, 'set', set);
-
- // Find the basename of the path by looking for the last non-empty segment
- var filename;
- var i;
- for (i = f.length - 1; i >= 0; i--) {
- filename = f[i];
- if (filename) break
- }
-
- for (i = 0; i < set.length; i++) {
- var pattern = set[i];
- var file = f;
- if (options.matchBase && pattern.length === 1) {
- file = [filename];
- }
- var hit = this.matchOne(file, pattern, partial);
- if (hit) {
- if (options.flipNegate) return true
- return !this.negate
- }
- }
-
-
-
- if (options.flipNegate) return false
- return this.negate
- }
-
-
-
-
-
-
- Minimatch$1.prototype.matchOne = function (file, pattern, partial) {
- var options = this.options;
-
- this.debug('matchOne',
- { 'this': this, file: file, pattern: pattern });
-
- this.debug('matchOne', file.length, pattern.length);
-
- for (var fi = 0,
- pi = 0,
- fl = file.length,
- pl = pattern.length
- ; (fi < fl) && (pi < pl)
- ; fi++, pi++) {
- this.debug('matchOne loop');
- var p = pattern[pi];
- var f = file[fi];
-
- this.debug(pattern, p, f);
-
-
-
- if (p === false) return false
-
- if (p === GLOBSTAR) {
- this.debug('GLOBSTAR', [pattern, p, f]);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var fr = fi;
- var pr = pi + 1;
- if (pr === pl) {
- this.debug('** at the end');
-
-
-
-
-
-
- for (; fi < fl; fi++) {
- if (file[fi] === '.' || file[fi] === '..' ||
- (!options.dot && file[fi].charAt(0) === '.')) return false
- }
- return true
- }
-
-
- while (fr < fl) {
- var swallowee = file[fr];
-
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
-
-
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- this.debug('globstar found match!', fr, fl, swallowee);
-
- return true
- } else {
-
-
- if (swallowee === '.' || swallowee === '..' ||
- (!options.dot && swallowee.charAt(0) === '.')) {
- this.debug('dot detected!', file, fr, pattern, pr);
- break
- }
-
-
- this.debug('globstar swallow a segment, and continue');
- fr++;
- }
- }
-
-
-
-
- if (partial) {
-
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
- if (fr === fl) return true
- }
- return false
- }
-
-
-
-
- var hit;
- if (typeof p === 'string') {
- if (options.nocase) {
- hit = f.toLowerCase() === p.toLowerCase();
- } else {
- hit = f === p;
- }
- this.debug('string match', p, f, hit);
- } else {
- hit = f.match(p);
- this.debug('pattern match', p, f, hit);
- }
-
- if (!hit) return false
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (fi === fl && pi === pl) {
-
-
- return true
- } else if (fi === fl) {
-
-
-
- return partial
- } else if (pi === pl) {
-
-
-
-
- var emptyFileEnd = (fi === fl - 1) && (file[fi] === '');
- return emptyFileEnd
- }
-
-
- throw new Error('wtf?')
- };
-
-
- function globUnescape (s) {
- return s.replace(/\\(.)/g, '$1')
- }
-
- function regExpEscape (s) {
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
- }
-
- var inherits_browser = createCommonjsModule(function (module) {
- if (typeof Object.create === 'function') {
-
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor;
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- }
- };
- } else {
-
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor;
- var TempCtor = function () {};
- TempCtor.prototype = superCtor.prototype;
- ctor.prototype = new TempCtor();
- ctor.prototype.constructor = ctor;
- }
- };
- }
- }, "/$$rollup_base$$/node_modules/inherits");
-
- var inherits = createCommonjsModule(function (module) {
- try {
- var util = require$$0__default['default'];
-
- if (typeof util.inherits !== 'function') throw '';
- module.exports = util.inherits;
- } catch (e) {
-
- module.exports = inherits_browser;
- }
- }, "/$$rollup_base$$/node_modules/inherits");
-
- function posix(path) {
- return path.charAt(0) === '/';
- }
-
- function win32(path) {
-
- var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
- var result = splitDeviceRe.exec(path);
- var device = result[1] || '';
- var isUnc = Boolean(device && device.charAt(1) !== ':');
-
-
- return Boolean(result[2] || isUnc);
- }
-
- var pathIsAbsolute = process.platform === 'win32' ? win32 : posix;
- var posix_1 = posix;
- var win32_1 = win32;
- pathIsAbsolute.posix = posix_1;
- pathIsAbsolute.win32 = win32_1;
-
- var setopts_1 = setopts$2;
- var ownProp_1 = ownProp$2;
- var makeAbs_1 = makeAbs;
- var finish_1 = finish;
- var mark_1 = mark;
- var isIgnored_1 = isIgnored$2;
- var childrenIgnored_1 = childrenIgnored$2;
-
- function ownProp$2 (obj, field) {
- return Object.prototype.hasOwnProperty.call(obj, field)
- }
-
-
-
-
- var Minimatch = minimatch_1.Minimatch;
-
- function alphasort (a, b) {
- return a.localeCompare(b, 'en')
- }
-
- function setupIgnores (self, options) {
- self.ignore = options.ignore || [];
-
- if (!Array.isArray(self.ignore))
- self.ignore = [self.ignore];
-
- if (self.ignore.length) {
- self.ignore = self.ignore.map(ignoreMap);
- }
- }
-
-
- function ignoreMap (pattern) {
- var gmatcher = null;
- if (pattern.slice(-3) === '/**') {
- var gpattern = pattern.replace(/(\/\*\*)+$/, '');
- gmatcher = new Minimatch(gpattern, { dot: true });
- }
-
- return {
- matcher: new Minimatch(pattern, { dot: true }),
- gmatcher: gmatcher
- }
- }
-
- function setopts$2 (self, pattern, options) {
- if (!options)
- options = {};
-
-
- if (options.matchBase && -1 === pattern.indexOf("/")) {
- if (options.noglobstar) {
- throw new Error("base matching requires globstar")
- }
- pattern = "**/" + pattern;
- }
-
- self.silent = !!options.silent;
- self.pattern = pattern;
- self.strict = options.strict !== false;
- self.realpath = !!options.realpath;
- self.realpathCache = options.realpathCache || Object.create(null);
- self.follow = !!options.follow;
- self.dot = !!options.dot;
- self.mark = !!options.mark;
- self.nodir = !!options.nodir;
- if (self.nodir)
- self.mark = true;
- self.sync = !!options.sync;
- self.nounique = !!options.nounique;
- self.nonull = !!options.nonull;
- self.nosort = !!options.nosort;
- self.nocase = !!options.nocase;
- self.stat = !!options.stat;
- self.noprocess = !!options.noprocess;
- self.absolute = !!options.absolute;
-
- self.maxLength = options.maxLength || Infinity;
- self.cache = options.cache || Object.create(null);
- self.statCache = options.statCache || Object.create(null);
- self.symlinks = options.symlinks || Object.create(null);
-
- setupIgnores(self, options);
-
- self.changedCwd = false;
- var cwd = process.cwd();
- if (!ownProp$2(options, "cwd"))
- self.cwd = cwd;
- else {
- self.cwd = path__default['default'].resolve(options.cwd);
- self.changedCwd = self.cwd !== cwd;
- }
-
- self.root = options.root || path__default['default'].resolve(self.cwd, "/");
- self.root = path__default['default'].resolve(self.root);
- if (process.platform === "win32")
- self.root = self.root.replace(/\\/g, "/");
-
-
-
- self.cwdAbs = pathIsAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
- if (process.platform === "win32")
- self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
- self.nomount = !!options.nomount;
-
-
-
- options.nonegate = true;
- options.nocomment = true;
-
- self.minimatch = new Minimatch(pattern, options);
- self.options = self.minimatch.options;
- }
-
- function finish (self) {
- var nou = self.nounique;
- var all = nou ? [] : Object.create(null);
-
- for (var i = 0, l = self.matches.length; i < l; i ++) {
- var matches = self.matches[i];
- if (!matches || Object.keys(matches).length === 0) {
- if (self.nonull) {
-
- var literal = self.minimatch.globSet[i];
- if (nou)
- all.push(literal);
- else
- all[literal] = true;
- }
- } else {
-
- var m = Object.keys(matches);
- if (nou)
- all.push.apply(all, m);
- else
- m.forEach(function (m) {
- all[m] = true;
- });
- }
- }
-
- if (!nou)
- all = Object.keys(all);
-
- if (!self.nosort)
- all = all.sort(alphasort);
-
-
- if (self.mark) {
- for (var i = 0; i < all.length; i++) {
- all[i] = self._mark(all[i]);
- }
- if (self.nodir) {
- all = all.filter(function (e) {
- var notDir = !(/\/$/.test(e));
- var c = self.cache[e] || self.cache[makeAbs(self, e)];
- if (notDir && c)
- notDir = c !== 'DIR' && !Array.isArray(c);
- return notDir
- });
- }
- }
-
- if (self.ignore.length)
- all = all.filter(function(m) {
- return !isIgnored$2(self, m)
- });
-
- self.found = all;
- }
-
- function mark (self, p) {
- var abs = makeAbs(self, p);
- var c = self.cache[abs];
- var m = p;
- if (c) {
- var isDir = c === 'DIR' || Array.isArray(c);
- var slash = p.slice(-1) === '/';
-
- if (isDir && !slash)
- m += '/';
- else if (!isDir && slash)
- m = m.slice(0, -1);
-
- if (m !== p) {
- var mabs = makeAbs(self, m);
- self.statCache[mabs] = self.statCache[abs];
- self.cache[mabs] = self.cache[abs];
- }
- }
-
- return m
- }
-
-
- function makeAbs (self, f) {
- var abs = f;
- if (f.charAt(0) === '/') {
- abs = path__default['default'].join(self.root, f);
- } else if (pathIsAbsolute(f) || f === '') {
- abs = f;
- } else if (self.changedCwd) {
- abs = path__default['default'].resolve(self.cwd, f);
- } else {
- abs = path__default['default'].resolve(f);
- }
-
- if (process.platform === 'win32')
- abs = abs.replace(/\\/g, '/');
-
- return abs
- }
-
-
-
-
- function isIgnored$2 (self, path) {
- if (!self.ignore.length)
- return false
-
- return self.ignore.some(function(item) {
- return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
- })
- }
-
- function childrenIgnored$2 (self, path) {
- if (!self.ignore.length)
- return false
-
- return self.ignore.some(function(item) {
- return !!(item.gmatcher && item.gmatcher.match(path))
- })
- }
-
- var common = {
- setopts: setopts_1,
- ownProp: ownProp_1,
- makeAbs: makeAbs_1,
- finish: finish_1,
- mark: mark_1,
- isIgnored: isIgnored_1,
- childrenIgnored: childrenIgnored_1
- };
-
- var sync = globSync;
- globSync.GlobSync = GlobSync$1;
-
-
-
-
-
- var setopts$1 = common.setopts;
- var ownProp$1 = common.ownProp;
- var childrenIgnored$1 = common.childrenIgnored;
- var isIgnored$1 = common.isIgnored;
-
- function globSync (pattern, options) {
- if (typeof options === 'function' || arguments.length === 3)
- throw new TypeError('callback provided to sync glob\n'+
- 'See: https://github.com/isaacs/node-glob/issues/167')
-
- return new GlobSync$1(pattern, options).found
- }
-
- function GlobSync$1 (pattern, options) {
- if (!pattern)
- throw new Error('must provide pattern')
-
- if (typeof options === 'function' || arguments.length === 3)
- throw new TypeError('callback provided to sync glob\n'+
- 'See: https://github.com/isaacs/node-glob/issues/167')
-
- if (!(this instanceof GlobSync$1))
- return new GlobSync$1(pattern, options)
-
- setopts$1(this, pattern, options);
-
- if (this.noprocess)
- return this
-
- var n = this.minimatch.set.length;
- this.matches = new Array(n);
- for (var i = 0; i < n; i ++) {
- this._process(this.minimatch.set[i], i, false);
- }
- this._finish();
- }
-
- GlobSync$1.prototype._finish = function () {
- assert__default['default'](this instanceof GlobSync$1);
- if (this.realpath) {
- var self = this;
- this.matches.forEach(function (matchset, index) {
- var set = self.matches[index] = Object.create(null);
- for (var p in matchset) {
- try {
- p = self._makeAbs(p);
- var real = fs_realpath.realpathSync(p, self.realpathCache);
- set[real] = true;
- } catch (er) {
- if (er.syscall === 'stat')
- set[self._makeAbs(p)] = true;
- else
- throw er
- }
- }
- });
- }
- common.finish(this);
- };
-
-
- GlobSync$1.prototype._process = function (pattern, index, inGlobStar) {
- assert__default['default'](this instanceof GlobSync$1);
-
-
- var n = 0;
- while (typeof pattern[n] === 'string') {
- n ++;
- }
-
-
-
- var prefix;
- switch (n) {
-
- case pattern.length:
- this._processSimple(pattern.join('/'), index);
- return
-
- case 0:
-
-
- prefix = null;
- break
-
- default:
-
-
-
- prefix = pattern.slice(0, n).join('/');
- break
- }
-
- var remain = pattern.slice(n);
-
-
- var read;
- if (prefix === null)
- read = '.';
- else if (pathIsAbsolute(prefix) || pathIsAbsolute(pattern.join('/'))) {
- if (!prefix || !pathIsAbsolute(prefix))
- prefix = '/' + prefix;
- read = prefix;
- } else
- read = prefix;
-
- var abs = this._makeAbs(read);
-
-
- if (childrenIgnored$1(this, read))
- return
-
- var isGlobStar = remain[0] === minimatch_1.GLOBSTAR;
- if (isGlobStar)
- this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
- else
- this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
- };
-
-
- GlobSync$1.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
- var entries = this._readdir(abs, inGlobStar);
-
-
- if (!entries)
- return
-
-
-
- var pn = remain[0];
- var negate = !!this.minimatch.negate;
- var rawGlob = pn._glob;
- var dotOk = this.dot || rawGlob.charAt(0) === '.';
-
- var matchedEntries = [];
- for (var i = 0; i < entries.length; i++) {
- var e = entries[i];
- if (e.charAt(0) !== '.' || dotOk) {
- var m;
- if (negate && !prefix) {
- m = !e.match(pn);
- } else {
- m = e.match(pn);
- }
- if (m)
- matchedEntries.push(e);
- }
- }
-
- var len = matchedEntries.length;
-
- if (len === 0)
- return
-
-
-
-
-
-
- if (remain.length === 1 && !this.mark && !this.stat) {
- if (!this.matches[index])
- this.matches[index] = Object.create(null);
-
- for (var i = 0; i < len; i ++) {
- var e = matchedEntries[i];
- if (prefix) {
- if (prefix.slice(-1) !== '/')
- e = prefix + '/' + e;
- else
- e = prefix + e;
- }
-
- if (e.charAt(0) === '/' && !this.nomount) {
- e = path__default['default'].join(this.root, e);
- }
- this._emitMatch(index, e);
- }
-
- return
- }
-
-
-
- remain.shift();
- for (var i = 0; i < len; i ++) {
- var e = matchedEntries[i];
- var newPattern;
- if (prefix)
- newPattern = [prefix, e];
- else
- newPattern = [e];
- this._process(newPattern.concat(remain), index, inGlobStar);
- }
- };
-
-
- GlobSync$1.prototype._emitMatch = function (index, e) {
- if (isIgnored$1(this, e))
- return
-
- var abs = this._makeAbs(e);
-
- if (this.mark)
- e = this._mark(e);
-
- if (this.absolute) {
- e = abs;
- }
-
- if (this.matches[index][e])
- return
-
- if (this.nodir) {
- var c = this.cache[abs];
- if (c === 'DIR' || Array.isArray(c))
- return
- }
-
- this.matches[index][e] = true;
-
- if (this.stat)
- this._stat(e);
- };
-
-
- GlobSync$1.prototype._readdirInGlobStar = function (abs) {
-
-
- if (this.follow)
- return this._readdir(abs, false)
-
- var entries;
- var lstat;
- try {
- lstat = fs__default['default'].lstatSync(abs);
- } catch (er) {
- if (er.code === 'ENOENT') {
-
- return null
- }
- }
-
- var isSym = lstat && lstat.isSymbolicLink();
- this.symlinks[abs] = isSym;
-
-
-
- if (!isSym && lstat && !lstat.isDirectory())
- this.cache[abs] = 'FILE';
- else
- entries = this._readdir(abs, false);
-
- return entries
- };
-
- GlobSync$1.prototype._readdir = function (abs, inGlobStar) {
-
- if (inGlobStar && !ownProp$1(this.symlinks, abs))
- return this._readdirInGlobStar(abs)
-
- if (ownProp$1(this.cache, abs)) {
- var c = this.cache[abs];
- if (!c || c === 'FILE')
- return null
-
- if (Array.isArray(c))
- return c
- }
-
- try {
- return this._readdirEntries(abs, fs__default['default'].readdirSync(abs))
- } catch (er) {
- this._readdirError(abs, er);
- return null
- }
- };
-
- GlobSync$1.prototype._readdirEntries = function (abs, entries) {
-
-
-
- if (!this.mark && !this.stat) {
- for (var i = 0; i < entries.length; i ++) {
- var e = entries[i];
- if (abs === '/')
- e = abs + e;
- else
- e = abs + '/' + e;
- this.cache[e] = true;
- }
- }
-
- this.cache[abs] = entries;
-
-
- return entries
- };
-
- GlobSync$1.prototype._readdirError = function (f, er) {
-
- switch (er.code) {
- case 'ENOTSUP':
- case 'ENOTDIR':
- var abs = this._makeAbs(f);
- this.cache[abs] = 'FILE';
- if (abs === this.cwdAbs) {
- var error = new Error(er.code + ' invalid cwd ' + this.cwd);
- error.path = this.cwd;
- error.code = er.code;
- throw error
- }
- break
-
- case 'ENOENT':
- case 'ELOOP':
- case 'ENAMETOOLONG':
- case 'UNKNOWN':
- this.cache[this._makeAbs(f)] = false;
- break
-
- default:
- this.cache[this._makeAbs(f)] = false;
- if (this.strict)
- throw er
- if (!this.silent)
- console.error('glob error', er);
- break
- }
- };
-
- GlobSync$1.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
-
- var entries = this._readdir(abs, inGlobStar);
-
-
-
- if (!entries)
- return
-
-
-
- var remainWithoutGlobStar = remain.slice(1);
- var gspref = prefix ? [ prefix ] : [];
- var noGlobStar = gspref.concat(remainWithoutGlobStar);
-
-
- this._process(noGlobStar, index, false);
-
- var len = entries.length;
- var isSym = this.symlinks[abs];
-
-
- if (isSym && inGlobStar)
- return
-
- for (var i = 0; i < len; i++) {
- var e = entries[i];
- if (e.charAt(0) === '.' && !this.dot)
- continue
-
-
- var instead = gspref.concat(entries[i], remainWithoutGlobStar);
- this._process(instead, index, true);
-
- var below = gspref.concat(entries[i], remain);
- this._process(below, index, true);
- }
- };
-
- GlobSync$1.prototype._processSimple = function (prefix, index) {
-
-
- var exists = this._stat(prefix);
-
- if (!this.matches[index])
- this.matches[index] = Object.create(null);
-
-
- if (!exists)
- return
-
- if (prefix && pathIsAbsolute(prefix) && !this.nomount) {
- var trail = /[\/\\]$/.test(prefix);
- if (prefix.charAt(0) === '/') {
- prefix = path__default['default'].join(this.root, prefix);
- } else {
- prefix = path__default['default'].resolve(this.root, prefix);
- if (trail)
- prefix += '/';
- }
- }
-
- if (process.platform === 'win32')
- prefix = prefix.replace(/\\/g, '/');
-
-
- this._emitMatch(index, prefix);
- };
-
-
- GlobSync$1.prototype._stat = function (f) {
- var abs = this._makeAbs(f);
- var needDir = f.slice(-1) === '/';
-
- if (f.length > this.maxLength)
- return false
-
- if (!this.stat && ownProp$1(this.cache, abs)) {
- var c = this.cache[abs];
-
- if (Array.isArray(c))
- c = 'DIR';
-
-
- if (!needDir || c === 'DIR')
- return c
-
- if (needDir && c === 'FILE')
- return false
-
-
-
- }
- var stat = this.statCache[abs];
- if (!stat) {
- var lstat;
- try {
- lstat = fs__default['default'].lstatSync(abs);
- } catch (er) {
- if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
- this.statCache[abs] = false;
- return false
- }
- }
-
- if (lstat && lstat.isSymbolicLink()) {
- try {
- stat = fs__default['default'].statSync(abs);
- } catch (er) {
- stat = lstat;
- }
- } else {
- stat = lstat;
- }
- }
-
- this.statCache[abs] = stat;
-
- var c = true;
- if (stat)
- c = stat.isDirectory() ? 'DIR' : 'FILE';
-
- this.cache[abs] = this.cache[abs] || c;
-
- if (needDir && c === 'FILE')
- return false
-
- return c
- };
-
- GlobSync$1.prototype._mark = function (p) {
- return common.mark(this, p)
- };
-
- GlobSync$1.prototype._makeAbs = function (f) {
- return common.makeAbs(this, f)
- };
-
-
-
-
-
-
- var wrappy_1 = wrappy;
- function wrappy (fn, cb) {
- if (fn && cb) return wrappy(fn)(cb)
-
- if (typeof fn !== 'function')
- throw new TypeError('need wrapper function')
-
- Object.keys(fn).forEach(function (k) {
- wrapper[k] = fn[k];
- });
-
- return wrapper
-
- function wrapper() {
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
- var ret = fn.apply(this, args);
- var cb = args[args.length-1];
- if (typeof ret === 'function' && ret !== cb) {
- Object.keys(cb).forEach(function (k) {
- ret[k] = cb[k];
- });
- }
- return ret
- }
- }
-
- var once_1 = wrappy_1(once);
- var strict = wrappy_1(onceStrict);
-
- once.proto = once(function () {
- Object.defineProperty(Function.prototype, 'once', {
- value: function () {
- return once(this)
- },
- configurable: true
- });
-
- Object.defineProperty(Function.prototype, 'onceStrict', {
- value: function () {
- return onceStrict(this)
- },
- configurable: true
- });
- });
-
- function once (fn) {
- var f = function () {
- if (f.called) return f.value
- f.called = true;
- return f.value = fn.apply(this, arguments)
- };
- f.called = false;
- return f
- }
-
- function onceStrict (fn) {
- var f = function () {
- if (f.called)
- throw new Error(f.onceError)
- f.called = true;
- return f.value = fn.apply(this, arguments)
- };
- var name = fn.name || 'Function wrapped with `once`';
- f.onceError = name + " shouldn't be called more than once";
- f.called = false;
- return f
- }
- once_1.strict = strict;
-
- var reqs = Object.create(null);
-
-
- var inflight_1 = wrappy_1(inflight);
-
- function inflight (key, cb) {
- if (reqs[key]) {
- reqs[key].push(cb);
- return null
- } else {
- reqs[key] = [cb];
- return makeres(key)
- }
- }
-
- function makeres (key) {
- return once_1(function RES () {
- var cbs = reqs[key];
- var len = cbs.length;
- var args = slice(arguments);
-
-
-
-
-
-
-
- try {
- for (var i = 0; i < len; i++) {
- cbs[i].apply(null, args);
- }
- } finally {
- if (cbs.length > len) {
-
-
- cbs.splice(0, len);
- process.nextTick(function () {
- RES.apply(null, args);
- });
- } else {
- delete reqs[key];
- }
- }
- })
- }
-
- function slice (args) {
- var length = args.length;
- var array = [];
-
- for (var i = 0; i < length; i++) array[i] = args[i];
- return array
- }
-
- var EE = require$$0__default$1['default'].EventEmitter;
-
-
-
-
-
- var setopts = common.setopts;
- var ownProp = common.ownProp;
-
-
- var childrenIgnored = common.childrenIgnored;
- var isIgnored = common.isIgnored;
- var GlobSync = sync.GlobSync;
- inherits(Glob, EE);
- function Glob (pattern, options, cb) {
- if (typeof options === 'function') {
- cb = options;
- options = null;
- }
-
- if (options && options.sync) {
- if (cb)
- throw new TypeError('callback provided to sync glob')
- return new GlobSync(pattern, options)
- }
-
- if (!(this instanceof Glob))
- return new Glob(pattern, options, cb)
-
- setopts(this, pattern, options);
- this._didRealPath = false;
-
-
- var n = this.minimatch.set.length;
-
-
-
-
-
- this.matches = new Array(n);
-
- if (typeof cb === 'function') {
- cb = once_1(cb);
- this.on('error', cb);
- this.on('end', function (matches) {
- cb(null, matches);
- });
- }
-
- var self = this;
- this._processing = 0;
-
- this._emitQueue = [];
- this._processQueue = [];
- this.paused = false;
-
- if (this.noprocess)
- return this
-
- if (n === 0)
- return done()
-
- var sync = true;
- for (var i = 0; i < n; i ++) {
- this._process(this.minimatch.set[i], i, false, done);
- }
- sync = false;
-
- function done () {
- --self._processing;
- if (self._processing <= 0) {
- if (sync) {
- process.nextTick(function () {
- self._finish();
- });
- } else {
- self._finish();
- }
- }
- }
- }
-
- Glob.prototype._finish = function () {
- assert__default['default'](this instanceof Glob);
- if (this.aborted)
- return
-
- if (this.realpath && !this._didRealpath)
- return this._realpath()
-
- common.finish(this);
- this.emit('end', this.found);
- };
-
- Glob.prototype._realpath = function () {
- if (this._didRealpath)
- return
-
- this._didRealpath = true;
-
- var n = this.matches.length;
- if (n === 0)
- return this._finish()
-
- var self = this;
- for (var i = 0; i < this.matches.length; i++)
- this._realpathSet(i, next);
-
- function next () {
- if (--n === 0)
- self._finish();
- }
- };
-
- Glob.prototype._realpathSet = function (index, cb) {
- var matchset = this.matches[index];
- if (!matchset)
- return cb()
-
- var found = Object.keys(matchset);
- var self = this;
- var n = found.length;
-
- if (n === 0)
- return cb()
-
- var set = this.matches[index] = Object.create(null);
- found.forEach(function (p, i) {
-
-
-
- p = self._makeAbs(p);
- fs_realpath.realpath(p, self.realpathCache, function (er, real) {
- if (!er)
- set[real] = true;
- else if (er.syscall === 'stat')
- set[p] = true;
- else
- self.emit('error', er); // srsly wtf right here
-
- if (--n === 0) {
- self.matches[index] = set;
- cb();
- }
- });
- });
- };
-
- Glob.prototype._mark = function (p) {
- return common.mark(this, p)
- };
-
- Glob.prototype._makeAbs = function (f) {
- return common.makeAbs(this, f)
- };
-
- Glob.prototype.abort = function () {
- this.aborted = true;
- this.emit('abort');
- };
-
- Glob.prototype.pause = function () {
- if (!this.paused) {
- this.paused = true;
- this.emit('pause');
- }
- };
-
- Glob.prototype.resume = function () {
- if (this.paused) {
- this.emit('resume');
- this.paused = false;
- if (this._emitQueue.length) {
- var eq = this._emitQueue.slice(0);
- this._emitQueue.length = 0;
- for (var i = 0; i < eq.length; i ++) {
- var e = eq[i];
- this._emitMatch(e[0], e[1]);
- }
- }
- if (this._processQueue.length) {
- var pq = this._processQueue.slice(0);
- this._processQueue.length = 0;
- for (var i = 0; i < pq.length; i ++) {
- var p = pq[i];
- this._processing--;
- this._process(p[0], p[1], p[2], p[3]);
- }
- }
- }
- };
-
- Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
- assert__default['default'](this instanceof Glob);
- assert__default['default'](typeof cb === 'function');
-
- if (this.aborted)
- return
-
- this._processing++;
- if (this.paused) {
- this._processQueue.push([pattern, index, inGlobStar, cb]);
- return
- }
-
-
-
-
- var n = 0;
- while (typeof pattern[n] === 'string') {
- n ++;
- }
-
-
-
- var prefix;
- switch (n) {
-
- case pattern.length:
- this._processSimple(pattern.join('/'), index, cb);
- return
-
- case 0:
-
-
- prefix = null;
- break
-
- default:
-
-
-
- prefix = pattern.slice(0, n).join('/');
- break
- }
-
- var remain = pattern.slice(n);
-
-
- var read;
- if (prefix === null)
- read = '.';
- else if (pathIsAbsolute(prefix) || pathIsAbsolute(pattern.join('/'))) {
- if (!prefix || !pathIsAbsolute(prefix))
- prefix = '/' + prefix;
- read = prefix;
- } else
- read = prefix;
-
- var abs = this._makeAbs(read);
-
-
- if (childrenIgnored(this, read))
- return cb()
-
- var isGlobStar = remain[0] === minimatch_1.GLOBSTAR;
- if (isGlobStar)
- this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
- else
- this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
- };
-
- Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
- var self = this;
- this._readdir(abs, inGlobStar, function (er, entries) {
- return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
- });
- };
-
- Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-
-
- if (!entries)
- return cb()
-
-
-
- var pn = remain[0];
- var negate = !!this.minimatch.negate;
- var rawGlob = pn._glob;
- var dotOk = this.dot || rawGlob.charAt(0) === '.';
-
- var matchedEntries = [];
- for (var i = 0; i < entries.length; i++) {
- var e = entries[i];
- if (e.charAt(0) !== '.' || dotOk) {
- var m;
- if (negate && !prefix) {
- m = !e.match(pn);
- } else {
- m = e.match(pn);
- }
- if (m)
- matchedEntries.push(e);
- }
- }
-
-
-
- var len = matchedEntries.length;
-
- if (len === 0)
- return cb()
-
-
-
-
-
-
- if (remain.length === 1 && !this.mark && !this.stat) {
- if (!this.matches[index])
- this.matches[index] = Object.create(null);
-
- for (var i = 0; i < len; i ++) {
- var e = matchedEntries[i];
- if (prefix) {
- if (prefix !== '/')
- e = prefix + '/' + e;
- else
- e = prefix + e;
- }
-
- if (e.charAt(0) === '/' && !this.nomount) {
- e = path__default['default'].join(this.root, e);
- }
- this._emitMatch(index, e);
- }
-
- return cb()
- }
-
-
-
- remain.shift();
- for (var i = 0; i < len; i ++) {
- var e = matchedEntries[i];
- if (prefix) {
- if (prefix !== '/')
- e = prefix + '/' + e;
- else
- e = prefix + e;
- }
- this._process([e].concat(remain), index, inGlobStar, cb);
- }
- cb();
- };
-
- Glob.prototype._emitMatch = function (index, e) {
- if (this.aborted)
- return
-
- if (isIgnored(this, e))
- return
-
- if (this.paused) {
- this._emitQueue.push([index, e]);
- return
- }
-
- var abs = pathIsAbsolute(e) ? e : this._makeAbs(e);
-
- if (this.mark)
- e = this._mark(e);
-
- if (this.absolute)
- e = abs;
-
- if (this.matches[index][e])
- return
-
- if (this.nodir) {
- var c = this.cache[abs];
- if (c === 'DIR' || Array.isArray(c))
- return
- }
-
- this.matches[index][e] = true;
-
- var st = this.statCache[abs];
- if (st)
- this.emit('stat', e, st);
-
- this.emit('match', e);
- };
-
- Glob.prototype._readdirInGlobStar = function (abs, cb) {
- if (this.aborted)
- return
-
-
-
- if (this.follow)
- return this._readdir(abs, false, cb)
-
- var lstatkey = 'lstat\0' + abs;
- var self = this;
- var lstatcb = inflight_1(lstatkey, lstatcb_);
-
- if (lstatcb)
- fs__default['default'].lstat(abs, lstatcb);
-
- function lstatcb_ (er, lstat) {
- if (er && er.code === 'ENOENT')
- return cb()
-
- var isSym = lstat && lstat.isSymbolicLink();
- self.symlinks[abs] = isSym;
-
-
-
- if (!isSym && lstat && !lstat.isDirectory()) {
- self.cache[abs] = 'FILE';
- cb();
- } else
- self._readdir(abs, false, cb);
- }
- };
-
- Glob.prototype._readdir = function (abs, inGlobStar, cb) {
- if (this.aborted)
- return
-
- cb = inflight_1('readdir\0'+abs+'\0'+inGlobStar, cb);
- if (!cb)
- return
-
-
- if (inGlobStar && !ownProp(this.symlinks, abs))
- return this._readdirInGlobStar(abs, cb)
-
- if (ownProp(this.cache, abs)) {
- var c = this.cache[abs];
- if (!c || c === 'FILE')
- return cb()
-
- if (Array.isArray(c))
- return cb(null, c)
- }
- fs__default['default'].readdir(abs, readdirCb(this, abs, cb));
- };
-
- function readdirCb (self, abs, cb) {
- return function (er, entries) {
- if (er)
- self._readdirError(abs, er, cb);
- else
- self._readdirEntries(abs, entries, cb);
- }
- }
-
- Glob.prototype._readdirEntries = function (abs, entries, cb) {
- if (this.aborted)
- return
-
-
-
-
- if (!this.mark && !this.stat) {
- for (var i = 0; i < entries.length; i ++) {
- var e = entries[i];
- if (abs === '/')
- e = abs + e;
- else
- e = abs + '/' + e;
- this.cache[e] = true;
- }
- }
-
- this.cache[abs] = entries;
- return cb(null, entries)
- };
-
- Glob.prototype._readdirError = function (f, er, cb) {
- if (this.aborted)
- return
-
-
- switch (er.code) {
- case 'ENOTSUP':
- case 'ENOTDIR':
- var abs = this._makeAbs(f);
- this.cache[abs] = 'FILE';
- if (abs === this.cwdAbs) {
- var error = new Error(er.code + ' invalid cwd ' + this.cwd);
- error.path = this.cwd;
- error.code = er.code;
- this.emit('error', error);
- this.abort();
- }
- break
-
- case 'ENOENT':
- case 'ELOOP':
- case 'ENAMETOOLONG':
- case 'UNKNOWN':
- this.cache[this._makeAbs(f)] = false;
- break
-
- default:
- this.cache[this._makeAbs(f)] = false;
- if (this.strict) {
- this.emit('error', er);
-
-
- this.abort();
- }
- if (!this.silent)
- console.error('glob error', er);
- break
- }
-
- return cb()
- };
-
- Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
- var self = this;
- this._readdir(abs, inGlobStar, function (er, entries) {
- self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
- });
- };
-
-
- Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-
-
-
-
- if (!entries)
- return cb()
-
-
-
- var remainWithoutGlobStar = remain.slice(1);
- var gspref = prefix ? [ prefix ] : [];
- var noGlobStar = gspref.concat(remainWithoutGlobStar);
-
-
- this._process(noGlobStar, index, false, cb);
-
- var isSym = this.symlinks[abs];
- var len = entries.length;
-
-
- if (isSym && inGlobStar)
- return cb()
-
- for (var i = 0; i < len; i++) {
- var e = entries[i];
- if (e.charAt(0) === '.' && !this.dot)
- continue
-
-
- var instead = gspref.concat(entries[i], remainWithoutGlobStar);
- this._process(instead, index, true, cb);
-
- var below = gspref.concat(entries[i], remain);
- this._process(below, index, true, cb);
- }
-
- cb();
- };
-
- Glob.prototype._processSimple = function (prefix, index, cb) {
-
-
- var self = this;
- this._stat(prefix, function (er, exists) {
- self._processSimple2(prefix, index, er, exists, cb);
- });
- };
- Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
-
-
-
- if (!this.matches[index])
- this.matches[index] = Object.create(null);
-
-
- if (!exists)
- return cb()
-
- if (prefix && pathIsAbsolute(prefix) && !this.nomount) {
- var trail = /[\/\\]$/.test(prefix);
- if (prefix.charAt(0) === '/') {
- prefix = path__default['default'].join(this.root, prefix);
- } else {
- prefix = path__default['default'].resolve(this.root, prefix);
- if (trail)
- prefix += '/';
- }
- }
-
- if (process.platform === 'win32')
- prefix = prefix.replace(/\\/g, '/');
-
-
- this._emitMatch(index, prefix);
- cb();
- };
-
-
- Glob.prototype._stat = function (f, cb) {
- var abs = this._makeAbs(f);
- var needDir = f.slice(-1) === '/';
-
- if (f.length > this.maxLength)
- return cb()
-
- if (!this.stat && ownProp(this.cache, abs)) {
- var c = this.cache[abs];
-
- if (Array.isArray(c))
- c = 'DIR';
-
-
- if (!needDir || c === 'DIR')
- return cb(null, c)
-
- if (needDir && c === 'FILE')
- return cb()
-
-
-
- }
- var stat = this.statCache[abs];
- if (stat !== undefined) {
- if (stat === false)
- return cb(null, stat)
- else {
- var type = stat.isDirectory() ? 'DIR' : 'FILE';
- if (needDir && type === 'FILE')
- return cb()
- else
- return cb(null, type, stat)
- }
- }
-
- var self = this;
- var statcb = inflight_1('stat\0' + abs, lstatcb_);
- if (statcb)
- fs__default['default'].lstat(abs, statcb);
-
- function lstatcb_ (er, lstat) {
- if (lstat && lstat.isSymbolicLink()) {
-
-
- return fs__default['default'].stat(abs, function (er, stat) {
- if (er)
- self._stat2(f, abs, null, lstat, cb);
- else
- self._stat2(f, abs, er, stat, cb);
- })
- } else {
- self._stat2(f, abs, er, lstat, cb);
- }
- }
- };
-
- Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
- if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
- this.statCache[abs] = false;
- return cb()
- }
-
- var needDir = f.slice(-1) === '/';
- this.statCache[abs] = stat;
-
- if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
- return cb(null, false, stat)
-
- var c = true;
- if (stat)
- c = stat.isDirectory() ? 'DIR' : 'FILE';
- this.cache[abs] = this.cache[abs] || c;
-
- if (needDir && c === 'FILE')
- return cb()
-
- return cb(null, c, stat)
- };
-
- var spawn = childProcess__default['default'].spawn;
- var exec = childProcess__default['default'].exec;
-
- var treeKill = function (pid, signal, callback) {
- if (typeof signal === 'function' && callback === undefined) {
- callback = signal;
- signal = undefined;
- }
-
- pid = parseInt(pid);
- if (Number.isNaN(pid)) {
- if (callback) {
- return callback(new Error("pid must be a number"));
- } else {
- throw new Error("pid must be a number");
- }
- }
-
- var tree = {};
- var pidsToProcess = {};
- tree[pid] = [];
- pidsToProcess[pid] = 1;
-
- switch (process.platform) {
- case 'win32':
- exec('taskkill /pid ' + pid + ' /T /F', callback);
- break;
- case 'darwin':
- buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
- return spawn('pgrep', ['-P', parentPid]);
- }, function () {
- killAll(tree, signal, callback);
- });
- break;
-
-
-
-
-
- default:
- buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
- return spawn('ps', ['-o', 'pid', '--no-headers', '--ppid', parentPid]);
- }, function () {
- killAll(tree, signal, callback);
- });
- break;
- }
- };
-
- function killAll (tree, signal, callback) {
- var killed = {};
- try {
- Object.keys(tree).forEach(function (pid) {
- tree[pid].forEach(function (pidpid) {
- if (!killed[pidpid]) {
- killPid(pidpid, signal);
- killed[pidpid] = 1;
- }
- });
- if (!killed[pid]) {
- killPid(pid, signal);
- killed[pid] = 1;
- }
- });
- } catch (err) {
- if (callback) {
- return callback(err);
- } else {
- throw err;
- }
- }
- if (callback) {
- return callback();
- }
- }
-
- function killPid(pid, signal) {
- try {
- process.kill(parseInt(pid, 10), signal);
- }
- catch (err) {
- if (err.code !== 'ESRCH') throw err;
- }
- }
-
- function buildProcessTree (parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
- var ps = spawnChildProcessesList(parentPid);
- var allData = '';
- ps.stdout.on('data', function (data) {
- var data = data.toString('ascii');
- allData += data;
- });
-
- var onClose = function (code) {
- delete pidsToProcess[parentPid];
-
- if (code != 0) {
-
- if (Object.keys(pidsToProcess).length == 0) {
- cb();
- }
- return;
- }
-
- allData.match(/\d+/g).forEach(function (pid) {
- pid = parseInt(pid, 10);
- tree[parentPid].push(pid);
- tree[pid] = [];
- pidsToProcess[pid] = 1;
- buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
- });
- };
-
- ps.on('close', onClose);
- }
-
- var any = bbhverse.any;
- var Tasq = bbhverse.Tasq;
- var statuslog = bbhverse.Traq;
- var Traq = bbhverse.Traq;
- Tasq.addlistener(statuslog.statuslog);
-
- var nodeShellExec = cliverse.nodeShellExec;
-
-
-
- const BUILD_VERSION = 'Version: 1.0.0 - built on May 14, 2021 00:18:25';
- const runtimestamp = (new Date()).getTime();
- function getVersion() { return BUILD_VERSION; }
- console.log(getVersion());
-
-
-
-
-
-
-
-
-
-
-
-
-
- const { existsSync } = fs__default['default'];
- const fs = fs__default['default'];
-
- const cliargs = bbhverse.cliargs;
- const processedArgs = cliargs(process.argv.slice(2));
- console.dir(processedArgs);
-
- var ENV = Object.assign({}, process.env);
-
- const { readdir } = fs__default['default'].promises;
-
-
- const dirs = async (perform, path) => {
- for (const dir of await readdir(path || process.cwd(), { withFileTypes: true })) {
- if (dir.isDirectory()) perform(dir);
- }
- };
-
- var getShellTask = (command, args, options) => {
- options = options || {};
- return () => {
- var p = nodeShellExec.apply(null, [command, args, Object.assign({
- inherit: true, shell: true, env: ENV, title: `${command} ${args}`
- }, options)
- ]);
- if (options.ignorefailures) {
- return p.catch(e => {
-
- })
- }
- else return p;
- }
- };
-
- var callsheltask = (args) => { return () => { return nodeShellExec.apply(null, args) } };
-
- var getTaskCheckExists = (command, options) => {
- options = options || {};
- return () => {
- var p = nodeShellExec.apply(null, ['where', [command]]);
- if (options.ignorefailures) {
- return p.then(() => { return true }).catch(e => {
- return false;
- })
- }
- else return p.then(() => { return true });
- }
- };
-
- var getTaskWithElevation = function(tasdef){
- return ()=>{
- if (__isElevated) {
- return tasdef.elevatedpulltasks();
- }
- else {
-
- return op['runas']().then(() => { return true; })
- .catch((e) => {
- console.error(e);
- })
- .finally(() => {
- if (!processedArgs.runas) { return tasdef.regularpulltasks(); }
- })
- }
- }
- };
-
- var getTaskWithoutElevation = function(tasdef){
- return ()=>{
- if(!processedArgs.runas) { return tasdef.regularpulltasks(); }
- }
- };
-
- var gitops = {
-
- getdiscoverbranchcmd : function(repo){
-
- var parameters = ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;'];
- var cmd = [gitbash
- , ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
- , { cwd: instanceroot + '/' + repo, title: 'pull all origins for ' + repo + ' ' + parameters.join(' ') }];
- return cmd
- }
- };
-
- var getPullCmd = (repo, branch) => {
-
-
-
- if(branch) {
- var parameters = ['-c', 'for i in `git remote`; do git pull $i ' + branch + '; done;'];
- var pullCmd = [ gitbash
- , ['-c', 'for i in `git remote`; do git pull $i ' + branch + '; done;']
- , { cwd: instanceroot + '/' + repo, title : 'pull all origins for ' + branch + ' ' + repo + ' ' + parameters.join(' ') }];
- }
- else {
- console.warn('No branch was specified detecting from working client.');
- var pullCmd = gitops.getdiscoverbranchcmd(repo);
- }
-
- if (useGitPull) pullCmd = ['git', ['pull'], {
- inherit: true, shell: true,
- cwd: instanceroot + '/' + repo
-
- , runas: processedArgs.runas
- , title: `git pull ${repo}`
- }];
- return pullCmd
- };
-
- var performPull = (repo, branch) => {
-
-
-
- if (existsSync(instanceroot + '/' + repo)) {
- var branchprint = branch ? ' branch :' + branch : '';
- console.log('pulling ' + instanceroot + '/' + repo + branchprint );
- return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => {
- if (__isElevated) {
- fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' });
- }
- else statuslog.statuslog(null, repo);
- return true;
- })
- .catch((e) => {
- e.repo = repo;
- if (__isElevated) {
- fs.writeFileSync('run.log', ', ' + JSON.stringify(e), { 'flag': 'a+' });
- }
- else statuslog.statuslog(e); console.error(e);
- })
- }
- else {
- console.log('cloning ' + repo);
-
- return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', selectedinstance.reposerver + `/${defaultRepoOwner}/` + repo + '.git'],
- {
- inherit: true, shell: true,
- env: process.env
- , cwd : instanceroot
- , runas: processedArgs.runas
- }).catch((e) => {
- throw e;
- }).then(() => {
-
- return nodeShellExec('git', ['config', '--replace-all', 'core.symlinks', true],
- {
- inherit: true, shell: true,
- env: process.env
- , cwd: instanceroot + '/' + repo
- , runas: processedArgs.runas
- , title: `git core.symlinks --replace-all true for ${selectedinstance.reposerver + `/${defaultRepoOwner}/` + repo + '.git'}`
- })
- .then(() => {
- if (__isElevated) {
- fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' });
- }
- else statuslog.statuslog(null, repo);
- })
- .catch((e) => {
- e.repo = repo;
- if (__isElevated) {
- fs.writeFileSync('run.log', ', ' + JSON.stringify(e), { 'flag': 'a+' });
- }
- else statuslog.statuslog(e);
- })
- })
- .catch(e => {
- e.repo = repo;
- if (__isElevated) {
- fs.writeFileSync('run.log', ', ' + JSON.stringify(e), { 'flag': 'a+' });
- }
- else statuslog.statuslog(e);
- })
- }
- };
-
-
-
- var __isElevated = null;
- var acquireElevationState = () => {
- if (__isElevated === null) {
- return nodeShellExec("fsutil", ["dirty", "query", "C:"], {
- inherit: true
-
- , stdio: 'ignore'
- , env: process.env
- , title: `check privileged execution mode using "fsutil dirty query C:"`
- }).then((exitcode) => {
- console.log('Elevated');
- __isElevated = true;
- return true;
- }).catch(() => {
- __isElevated = false;
- console.log('Not Elevated');
- return false;
- });
- }
- else return Promise.resolve(__isElevated);
- };
-
-
- var repomanifest = null;
- var defaultRepoOwner = 'chess';
- var elevatedRunasRepos = null;
- var gitRepos = null;
-
-
-
-
-
-
- var dbForLabel = function (label) {
- var dbsForLabel = {
- devmysql: 'mysql'
- , development: 'mssql'
- , production: 'mssql'
- };
- return dbsForLabel[label] || 'mysql'
- };
-
-
- var gitbash = "C:\\Program Files\\Git\\bin\\sh.exe";
-
-
-
- var exludeMergeRepos = [];
- var useGitPull = processedArgs.useGitPull || false;
-
-
- var op = {
- 'h': () => { console.log(elxr.help()); return '-h' }
- , 'clean' : () => {
-
- var tasklist = [];
- dirs( (repodir)=> tasklist.push(getShellTask('rm',['-rf', 'node_modules'], { cwd : instanceroot + '/' + repodir.name })()), instanceroot );
- return Promise.all(tasklist)
- }
- , 'undefined': () => { return op.h(); }
- , 'reset': () => {
-
-
-
- const fs = fs__default['default'];
- const wipeDependencies = (__package) => {
- const file = fs.readFileSync(__package + '/package.json');
- const content = JSON.parse(file);
- for (var devDep in content.devDependencies) {
- if (content.devDependencies[devDep].match(/\W+\d+.\d+.\d+-?((alpha|beta|rc)?.\d+)?/g)) {
- content.devDependencies[devDep] = '*';
- }
- }
- for (var dep in content.dependencies) {
- if (content.dependencies[dep].match(/\W+\d+.\d+.\d+-?((alpha|beta|rc)?.\d+)?/g)) {
- content.dependencies[dep] = '*';
- }
- }
- fs.writeFileSync(__package + '/package.json', JSON.stringify(content));
- };
-
- var repos = ['client'];
-
- repos.forEach(wipeDependencies);
-
-
-
-
-
- }
- , 'upgrade': () => {
- console.log('upgrade.......');
- var tasks = [
- () => {
- var p = nodeShellExec('npm', ['i', '-g', 'npm-upgrade'], {
- inherit: true, shell: true
- , env: process.env
- }).catch((e) => { console.error(e); });
- p.position = 1;
- console.log('One');
- return p;
- }
- , () => {
- var p = nodeShellExec('npm', ['cache', 'clean', '-f'], {
- inherit: true, shell: true
- , env: process.env
- }).catch((e) => { console.error(e); });
-
- p.position = 2;
- console.log('Two');
- return p;
- }
- , () => {
- var p = nodeShellExec('npm', ['install', '-g', 'n'], {
- inherit: true, shell: true
- , env: process.env
- }).catch((e) => { console.error(e); });
- p.position = 3;
- console.log('Three');
- return p;
- }
- , () => {
- var p = nodeShellExec('n', ['latest'], {
- inherit: true, shell: true
- , env: process.env
- }).catch((e) => { console.error(e); });
- p.position = 4;
- console.log('Four');
- return p;
- }
- ];
- any(tasks);
- console.log('.......done');
- console.log('Running exlr upgrade in : ' + path__default['default'].dirname(__dirname));
- console.log('Currently only upgrades ember : ' + path__default['default'].dirname(__dirname));
- console.info('Uninstalling existing ember globally');
- var step1 = nodeShellExec('cmd', ['/c', 'npm', 'uninstall', '-g', 'ember-cli'], {
- stdio: ['pipe', process.stdout, process.stderr],
- inherit: true,
- shell: true,
- cwd: path__default['default'].dirname(__dirname),
- env: env
- });
- step1.on('close', () => {
- console.info('Installing ember globally');
- var step2 = nodeShellExec('cmd', ['/c', 'npm', 'install', '-g', 'ember-cli'], {
- stdio: ['pipe', process.stdout, process.stderr],
- inherit: true,
- shell: true,
- cwd: path__default['default'].dirname(__dirname),
- env: env
- });
-
- step2.on('close', () => {
- nodeShellExec('cmd', ['/c', 'ember', '--version'], {
- stdio: ['pipe', process.stdout, process.stderr],
- inherit: true,
- shell: true,
- cwd: path__default['default'].dirname(__dirname),
- env: env
- });
- });
- });
- }
- , 'runas': () => {
- console.log('Testing Elevation');
-
- if (__isElevated) {
- try {
- op[processedArgs.label || processedArgs._[0] || 'h']();
- }
- catch (e) {
- console.error('Error Invalid command : ' + e);
- fs.writeFileSync('run.done', 'error');
- }
- finally {
- }
- }
- else {
- console.log('Requesting Elevated Privileges');
-
- try {
- fs.unlinkSync('run.done');
- fs.unlinkSync('run.log');
- }
- catch (e) { }
-
-
- return nodeShellExec('where', ['node']).then(r => {
- var namedArgs = [];
- console.log('result : ' + JSON.stringify(r));
- Object.keys(processedArgs).forEach((v) => { v != '_' ? namedArgs.push('--' + v + '=' + processedArgs[v]) : null; });
-
- var args = [`${selectedinstance.root}/.elxr/run-${runtimestamp}/windowselevate.hta`].concat(processedArgs._).concat(namedArgs.join(' ')); args.push('--runas=self');
- args.push('--nodepath=' + r[r.length - 1]);
- if (!processedArgs.node_env) args.push('--node_env=' + ENV.NODE_ENV);
- if (processedArgs.debug) args.push('--debug=true');
-
- return nodeShellExec('MSHTA', [`"${args.join('" "')}"`]
- , {
- inherit: true
- , shell: true
- , env: ENV
- , runas: 'self'
- , title: `runas`
- }
- ).then(() => {
-
- try {
-
- var runaslog = JSON.parse('[ { "success" : true, "result" : "started"}' + fs.readFileSync('run.log', { flags: 'a+' }) + ']');
- runaslog.forEach((logEntry) => {
- statuslog.statuslog(logEntry.success ? null : logEntry, logEntry);
- logEntry.success ? (console.log(['success :' + logEntry.result]), console.log((logEntry.messages || []).join(' '))) : (console.error(['error :' + logEntry.result]), console.error((logEntry.messages || []).join(' ')));
- });
- }
- catch (e) {
-
- statuslog.statuslog(e);
- console.error('Run log error probably was not created by runas : ' + e);
- }
- })
- .catch(err => console.error('Elevation failed : ' + err));
- })
-
- }
- }
- , 'push': () => {
- if (!processedArgs._[1]) { console.error('push all not supported. Specify repo name'); return }
-
-
-
-
-
-
-
-
-
-
-
-
-
- var repo = processedArgs._[1];
-
- var sequentialTaskShellCommands = [];
- if (!existsSync(`Z:/${repo}.git`)) {
- sequentialTaskShellCommands = [
-
-
-
-
- ['pwd', { cwd: 'Z:', inherit: true }]
- , ['mkdir', [`${repo}.git`], {
- cwd: `Z:`
- , inherit: true, shell: true
- , env: process.env
- }]
- , ['pwd', { cwd: `Z:/${repo}.git`, inherit: true }]
- , ['git', ['init', '--bare'], {
- cwd: `Z:/${repo}.git`
- , inherit: true, shell: true
- , env: process.env
- }]
-
- , ['git', ['remote', 'rename', 'origin', 'githubclone'], { cwd: `${instanceroot + '/' + repo}` }, (err) => {
- console.log('Ignoring origin rename error : ' + err); return true;
- }]
- , ['git', ['remote', 'add', 'origin', `${selectedinstance.reposerver}/${repo}.git`], { cwd: `${instanceroot + '/' + repo}` }]
-
-
- ];
- if (!existsSync(`Z:`)) {
- sequentialTaskShellCommands.splice(0, 0, ['net', ['use', 'Z:', selectedinstance.reposerver.replace(/\//gm, '\\')], {
- inherit: true, shell: true
- , env: process.env
- }]);
- console.warn('Adding network drive z: for repo server. ' + sequentialTaskShellCommands[0]);
-
- }
- }
-
- sequentialTaskShellCommands.push(['git', ['push', 'origin', 'master'], { cwd: `${instanceroot + '/' + repo}` }]);
-
-
- var tasks = [];
- sequentialTaskShellCommands.forEach(shellcmd => {
-
- tasks.push(() => {
-
- var p = nodeShellExec.apply(null, shellcmd.slice(0, 3)).catch((e) => { if (shellcmd[3]) { return shellcmd[3]() } else { console.error(e); } });
- return p;
- });
- });
- any(tasks);
-
- }
- , 'is-git-repo': (dir) => {
- return nodeShellExec('git', ['-C', dir.name, 'rev-parse'], { stdio: 'ignore' })
- }
- , 'set-url': (remotename, url) => {
- var pushable = processedArgs.pushable || false;
- remotename = remotename || processedArgs._[1];
- url = url || processedArgs._[2];
- var serial_perform_git_seturl = (repo) => {
-
- if (pushable) {
- return [
- ['git', ['remote', 'set-url', remotename, url + '/' + repo], { cwd: instanceroot + '/' + repo }]
- ]
- }
- else {
- console.error('not supported for non-pushable');
- }
-
- };
-
- var perform_git_seturl = (dir) => {
- op['is-git-repo'](dir).then((code) => {
- any(serial_perform_git_seturl(dir.name).map(x));
- }).catch((e) => {
-
- });
- };
-
- dirs(perform_git_seturl);
- }
- , 'add': (remotename, url, branch) => {
- var pushable = processedArgs.pushable || false;
- remotename = remotename || processedArgs._[1];
- url = url || processedArgs._[2];
- branch = branch || processedArgs._[3];
- var serial_perform_git_add = (repo) => {
-
- if (pushable) {
- return [
- ['git', ['remote', 'add', remotename, url + '/' + repo], { cwd: instanceroot + '/' + repo }]
- , ['git', ['pull', remotename, branch], { cwd: instanceroot + '/' + repo }]
- , ['git', ['branch', `--set-upstream-to=${remotename}/${branch}`, branch], { cwd: instanceroot + '/' + repo }]
- ]
- }
- else {
-
- return [
- ['git', ['remote', 'add', remotename, url + '/' + repo], { cwd: instanceroot + '/' + repo }]
- , ['git', ['remote', `set-url`, '--push', remotename, 'no-pushing'], { cwd: instanceroot + '/' + repo }]
- , ['git', ['pull', remotename, branch], { cwd: instanceroot + '/' + repo }]
- , ['git', ['branch', `--set-upstream-to=${remotename}/${branch}`, branch], { cwd: instanceroot + '/' + repo }]
- ]
- }
-
- };
- var x = (args) => {
- return () => {
-
- return nodeShellExec.apply(null, args)
- }
-
- };
- var perform_git_add = (dir) => {
- op['is-git-repo'](dir).then((code) => {
-
- if (code) {
- nodeShellExec('git', ['remote', 'get-url', remotename], { cwd: dir.name, stdio: 'ignore' }).then(() => {
- console.log('skipped : ' + dir.name + ', reason : A remote with same name already exists.');
- })
- .catch((e) => {
- any(serial_perform_git_add(dir.name).map(x));
- });
- }
-
- }).catch((e) => {
-
- });
- };
-
- fs__default['default'].promises;
-
- dirs(perform_git_add);
- }
- , 'remove': (remotename) => {
- remotename = remotename || processedArgs._[1];
- var serial_perform_git_remove = (repo) => {
-
- return [
- ['git', ['remote', 'remove', remotename], { cwd: instanceroot + '/' + repo }]
- ]
- };
- var x = (args) => {
- return () => {
-
- return nodeShellExec.apply(null, args)
- }
-
- };
- var perform_git_remove = (dir) => {
- op['is-git-repo'](dir).then((code) => {
-
- if (code) {
- nodeShellExec('git', ['remote', 'get-url', remotename], { cwd: dir.name, stdio: 'ignore' }).then(() => {
- any(serial_perform_git_remove(dir.name).map(x));
- })
- .catch((e) => {
- console.log('skipped : ' + dir.name + ', reason : No remote named origin');
- });
- }
-
- }).catch((e) => {
-
- });
- };
-
- fs__default['default'].promises;
-
- dirs(perform_git_remove);
- }
- , 'init-gitea': (user) => {
- user = user || processedArgs._[1];
- if (!user) throw 'User name required'
- var serial_perform_init_gitea = (repo) => {
-
- return [
- ['git', ['remote', 'add', 'chess', `${selectedinstance.reposerver}/${user}/${repo}.git`], { cwd: instanceroot + '/' + repo }]
- , ['git', ['remote', 'set-url', '--push', 'chess', 'no-pushing'], { cwd: instanceroot + '/' + repo }]
- , ['git', ['remote', 'set-url', 'origin', `${selectedinstance.reposerver}/${user}/${repo}.git`], { cwd: instanceroot + '/' + repo }]
- ]
- };
- var x = (args) => {
- return () => {
-
- return nodeShellExec.apply(null, args)
- }
-
- };
- var perform_init_gitea = (dir) => {
- op['is-git-repo'](dir).then((code) => {
-
- if (code) {
- nodeShellExec('git', ['remote', 'get-url', 'chess'], { cwd: dir.name, stdio: 'ignore' }).then(() => {
- console.log('skipped : ' + dir.name + ', reason : Already has remote chess ');
- })
- .catch((e) => {
- any(serial_perform_init_gitea(dir.name).map(x));
- });
- }
-
- }).catch((e) => {
-
- });
- };
-
- fs__default['default'].promises;
-
- dirs(perform_init_gitea);
- }
- , 'syncmaster': (label) => {
-
-
-
- Object.assign({}, process.env);
-
- console.log('Running exlr pull : ' + path__default['default'].dirname(__dirname));
-
- if (!processedArgs.runas) gitRepos.map((def) => performPull(def.repo, def.branch || 'master'));
- if (__isElevated) {
- return any(elevatedRunasRepos.map((def) => performPull(def.repo, def.branch || 'master'))).then(() => {
- fs.writeFileSync('run.done', 'success');
- }).catch(() => {
- fs.writeFileSync('run.done', 'error');
- })
- }
- else return op['runas']()
- }
-
- , 'pull' : (label) => {
-
-
-
- return elxr.getpulltask()()
- }
- , 'isInstalled': () => {
- return nodeShellExec('where', [processedArgs._[1]], { inherit: true }).then(() => {
- console.log(processedArgs._[1] + ' exists.');
- return true;
- });
- }
- , 'i' : () => {
-
- var tasks = [];
-
- tasks.push(getShellTask.apply(null, ['rm', [instanceroot + '/run.js'], { ignorefailures: true }]));
- tasks.push(op['use']);
- if (!__isElevated) {
- tasks.push(op['npmi']);
- }
-
-
-
-
-
-
-
-
-
-
-
-
- return any(tasks);
-
- }
- , 'npmi': () => {
- var tasks = [];
-
-
- tasks.push(getShellTask(
- 'npm',[ 'i', '-g', 'babel-cli' ]
- ) );
-
- var npmbuildrepos = ['loopback-jsonapi-model-serializer'];
- npmbuildrepos = [];
- npmbuildrepos.forEach(repo => {
- tasks.push(() => {
- return nodeShellExec('npm', ['i --force'], {
- inherit: true, shell: true
- , cwd: instanceroot + '/' + repo
- , env: process.env
- , title: `npm i for ${repo}`
- }).catch((e) => {
- console.error('Ignoring Benign Error'); console.error(e);
- }).then(() => {
- console.log(`--npm run build for ${repo}--------------------`);
- return nodeShellExec('npm', ['run build'], {
- inherit: true, shell: true
- , cwd: instanceroot + '/' + repo
- , env: process.env
- , title: `npm run build for ${repo}`
- }).then(Tasq.then).catch(Tasq.catch)
- })
- });
- });
-
- any(tasks).then(() => {
-
- gitRepos.push('client/server');
- gitRepos = gitRepos.concat(elevatedRunasRepos);
-
-
-
-
-
-
- var rmtasks = [];
- var repotasks = [];
- var env = Object.assign({}, process.env);
- delete env.NODE_ENV;
- gitRepos.forEach(repodef => {
-
- rmtasks.push(
-
-
-
- nodeShellExec('rm', ['package-lock.json'], {
- inherit: true, shell: true
- , cwd: instanceroot + '/' + repodef.repo
- , env: process.env
- , title: `rm 'package-lock.json' for ${repodef.repo}`
- })
- .then(()=>{
- console.log(`--rm package-lock.json for ${repodef.repo}--------------------`);
- }).catch((e) => { console.error(e); })
-
- );
-
- if (npmbuildrepos.indexOf(repodef.repo) < 0) {
- repotasks.push(
- () => {
- console.log(`--npm i for ${repodef.repo}--------------------`);
- var p = nodeShellExec('npm', ['i', '--force'], {
- inherit: true, shell: true
- , cwd: instanceroot + '/' + repodef.repo
- , env
- , title: `npm i for ${repodef.repo}`
- }).then(Tasq.then).catch(Tasq.catch);
- return p;
- });
- }
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var bowerRepos = [{ repo : 'client'}];
- bowerRepos.forEach(repodef => {
- repotasks.push(() => {
- console.log(instanceroot + '/' + repodef.repo + '/node_modules/bower/bin/bower');
-
- var p = nodeShellExec(`"${gitbash}"`, ['-c', '"node_modules/bower/bin/bower i"'], {
-
- inherit: true, shell: true
- , cwd: instanceroot + '/' + repodef.repo
- , env: process.env
- , title: `bower i for ${repodef.repo}`
- }).then(Tasq.then).catch(Tasq.catch);
- return p;
- });
- });
-
- return Promise.all(rmtasks).then(() => any(repotasks));
- }).catch(e => {
-
- }).finally(statuslog.finally);
-
- }
- , 'start': (label) => {
- console.log('Starting Elixir Server.');
- var env = Object.assign({}, process.env);
-
- env.NODE_ENV = process.env.NODE_ENV || 'development';
- env.DEBUG = 'loopback:connector:' + dbForLabel(label);
- var cmd = env.NODE_ENV === 'development' ? 'nodemon' : 'node';
-
- cmd = [cmd, ['--inspect=9228', 'elixir/server.js']];
- var childPromise = nodeShellExec(...cmd, {
-
- shell: true,
- detached: true,
- stdio: 'ignore',
- cwd: instanceroot + '/' + 'elixir-server'
- , env: env
- });
-
- var child = childPromise.process;
- if (typeof child.pid !== 'undefined') {
- console.log(`started Elixir Server PID(${child.pid}) : NODE_ENV=${process.NODE_ENV} ${cmd}`);
- fs.writeFileSync('.elixir-server.elixir.server.pid', child.pid, {
- encoding: 'utf8'
- });
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- console.log('Starting Elixir Client Host.');
- var cmd = ['ember', ['s']];
- var childPromise = nodeShellExec(...cmd, {
-
-
-
- shell: true,
- detached: true,
- stdio: 'ignore',
- cwd: instanceroot + '/' + 'client'
- , env: env
- });
-
-
- child = childPromise.process;
- if (typeof child.pid !== 'undefined') {
- console.log(`started Elixir Client Host PID(${child.pid}) : NODE_ENV=${process.NODE_ENV} ${cmd}`);
- fs.writeFileSync('.client.server.pid', child.pid, {
- encoding: 'utf8'
- });
- }
-
- }
- , 'stop': (label) => {
- const kill = treeKill;
-
- var serverPid = fs.readFileSync('.elixir-server.elixir.server.pid', {
- encoding: 'utf8'
- });
- fs.unlinkSync('.elixir-server.elixir.server.pid');
- console.log(serverPid);
- kill(serverPid);
-
- serverPid = fs.readFileSync('.client.server.pid', {
- encoding: 'utf8'
- });
- fs.unlinkSync('.client.server.pid');
- console.log(serverPid);
- kill(serverPid);
- }
- , 'model' : () => {
- if (__isElevated) {
- var tasks = [
- () => {
- var p = nodeShellExec('mklink', [ `${processedArgs._[2]}.json`
- , `..\\..\\node_modules\\chess-server-lib\\common\\models\\${processedArgs._[2]}.json`], {
- inherit: true, shell: true
- , cwd : instanceroot + `/${selectedinstance.instanceName}-server/${selectedinstance.instanceName}/models`
- , title: `mklink ${processedArgs._[2]}.json ..\\..\\node_modules\\chess-server-lib\\common\\models\\${processedArgs._[2]}.json`
- , env: process.env
- }).catch((e) => { console.error(e); });
- return p;
- }
- ];
- return any(tasks).then(() => {
- fs.writeFileSync('run.done', 'success');
- }).catch(() => {
- fs.writeFileSync('run.done', 'error');
- })
- }
- else return op['runas']()
- }
- , 'use' : () => {
-
-
-
-
-
-
-
-
-
- var runconfig = { NODE_ENV: repomanifest.node_env };
- try { runconfig = Object.assign(runconfig, commonjsRequire(instanceroot + '/run.js',"/$$rollup_base$$")); } catch (e) { }
-
- if (( !processedArgs.force) &&
- runconfig.NODE_ENV && runconfig.NODE_ENV === (repomanifest.node_env || runconfig.NODE_ENV) &&
- repomanifest.instanceName && runconfig.use === repomanifest.instanceName) {
-
- console.log(`No change detected. Already using requested specs : ${runconfig.NODE_ENV} ${runconfig.use}`);
- if (processedArgs.runas) { fs.writeFileSync('run.done', 'success'); }
- return
- }
-
- var tasks = [
- () => {
- if (existsSync('config')) {
- var p = nodeShellExec('rmdir', ['config'], { inherit: true, shell: true, env: process.env }
- ).catch((err) => { console.log('Ignoring benign error : ' + err); return true; });
- return p;
- }
- else return Promise.resolve(true);
- },
- () => {
- if (existsSync('data')) {
- var p = nodeShellExec('rmdir', ['data'], { inherit: true, shell: true, env: process.env }
- ).catch((err) => { console.log('Ignoring benign error : ' + err); return true; });
- return p;
- }
- else return Promise.resolve(true);
- },
- ];
- runconfig.NODE_ENV = process.env.NODE_ENV = process.env.NODE_ENV || runconfig.NODE_ENV || 'development';
- if (processedArgs._[1] && runconfig.use !== processedArgs._[1]) runconfig.use = processedArgs._[1];
- if (!runconfig.use) { throw 'unspecifed use not allowed. Please specify chess instance name.' }
-
- fs.writeFileSync(instanceroot + '/run.js', 'module.exports = ' + JSON.stringify(runconfig));
-
-
- var checkoutMap = { 'development': 'master' };
-
- var branch = checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV;
-
- var performPullOrCloneForBranch = (def)=>{
- var promise = Promise.resolve(true);
- if (!branch) {
- var dscoverbranchcmd = gitops.getdiscoverbranchcmd(repo);
-
- promise = nodeShellExec.apply(null, dscoverbranchcmd(repo)).then(__branch=>{ branch = __branch;})
- .catch((e) => { console.error(e); return { error: true, message: repo } });
-
- }
-
- return promise = promise.then(()=>{ return elxr.getpulltask(def)() }).catch(e => { console.error( 'performPullOrCloneForBranch : Failed ' + e );})
- };
-
- var performCloneAndCheckout = null;
-
- var performCheckout = performCloneAndCheckout = (def) => {
- if (excludeCheckouts[def.repo]) return Promise.resolve({ 'skipped': true })
-
- return performPullOrCloneForBranch(def).then(()=>{
- nodeShellExec('git', ['checkout', def.branch || checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], {
-
-
- cwd: instanceroot + '/' + def.repo
-
- , runas: processedArgs.runas
- , title: `git checkout ${def.branch || checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${def.repo}`
- }).then(()=>{ console.log( `SUCCESS : git checkout ${def.branch || checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${def.repo}` ); }).catch((e) => { console.error(e); return { error: true, message: def.repo } });
- })
- };
-
- var mergeSources = {
- 'development': null,
- 'test': 'master',
- 'production': 'master'
- };
- var mergesource = mergeSources[checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV];
-
-
- if(branch === mergesource) performCheckout = (def) => {
- var dscoverbranchcmd = gitops.getdiscoverbranchcmd(repo);
- return nodeShellExec.apply(null, dscoverbranchcmd(repo)).then(__branch=>{
-
- if(branch === __branch) return performCloneAndCheckout(def)
- return performPullOrCloneForBranch(def)
- })
- .catch((e) => { console.error(e); return { error: true, message: repo } })
- };
-
-
- var performPullAll = (def) => {
- if (excludeCheckouts[def.repo]) return Promise.resolve({ 'skipped': true })
- return nodeShellExec('git', ['pull', '--all'], {
-
- cwd: instanceroot + '/' + def.repo
- , runas: processedArgs.runas
- , title: `git pull -all for ${checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} ${def.repo}`
- }).catch((e) => { console.error(e); return { error: true, message: def.repo } })
- };
-
- var excludeCheckouts = Object.assign(exludeMergeRepos);
- delete excludeCheckouts[`elixir-config-${runconfig.NODE_ENV}`];
- delete excludeCheckouts[`cihsr-config-${runconfig.NODE_ENV}`];
-
- var performMerge = (def) => {
- if (exludeMergeRepos[def.repo]) return Promise.resolve({ 'skipped': true })
- return nodeShellExec('git', ['merge', mergesource], {
- inherit: true, shell: true,
- cwd: instanceroot + '/' + def.repo
- , runas: processedArgs.runas
- }).catch((e) => { console.error(e); })
- };
- if(!mergesource || branch === mergesource) performMerge = () => { return Promise.resolve(true) };
-
-
-
-
-
-
- return any(tasks).then(() => {
- var pr = Promise.resolve(true);
- if (!__isElevated) {
- pr = op['runas']();
- return pr.then(()=>{
-
-
-
- return any(gitRepos.map((repodef) => { return performCheckout({ repo : repodef.repo, branch}).catch(e=>{ console.log(e); }) } ))
-
- .then(() => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(gitRepos.map((repo) => performPullAll(repo)))
- })
-
- .then( () => {
- if(!mergesource || branch === mergesource ) return Promise.resolve(true)
- return any(gitRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch: mergesource})))
- })
-
- .then( () => {
- if(!mergesource || branch === mergesource ) return Promise.resolve(true)
- return any(gitRepos.map((repo) => performPullAll(repo)))
- })
-
- .then( () => {
- if(!mergesource || branch === mergesource ) return Promise.resolve(true)
- return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch})))
- })
- .then(
- () => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(gitRepos.map((repo) => performMerge( repo ))).catch(err => { console.error('error in performMerge ' + err); })
- })
- })
- }
- else {
- tasks = [
- () => {
-
- var p = nodeShellExec('mklink', ['/J', 'config', runconfig.use + '-config' + '-' + process.env.NODE_ENV], {
- inherit: true, shell: true
- , cwd : instanceroot
- , env: process.env
- }).catch((e) => { console.error(e); });
- return p;
- }
- ];
- if (processedArgs._[1]) {
- tasks = tasks.concat(
- [
- () => {
- var p = nodeShellExec('mklink', ['/J', 'data', runconfig.use + '-data'], {
- inherit: true, shell: true
- , cwd : instanceroot
- , env: process.env
- }).catch((e) => { console.error(e); });
- return p;
- }
- ]
- );
- }
-
- return any(tasks).then(()=>{
-
- return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch, requiresElevation : true})))
-
- .then(() => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(elevatedRunasRepos.map((repo) => performPullAll(repo)))
- })
-
- .then( () => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch: mergesource, requiresElevation : true})))
- })
-
- .then( () => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(elevatedRunasRepos.map((repodef) => performPullAll({repo : repodef.repo, requiresElevation : true })))
- })
-
- .then( () => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch, requiresElevation : true})))
- })
- .then(
- () => {
- if(!mergesource || branch === mergesource) return Promise.resolve(true)
- return any(elevatedRunasRepos.map((repodef) => performMerge({ repo : repodef.repo, requiresElevation : true }))).catch(err => { console.error('error in performMerge ' + err); })
- })
- .then(() => {
- fs.writeFileSync('run.done', 'success');
- }).catch(() => {
- fs.writeFileSync('run.done', 'error');
- })
- })
- }
-
- }).catch(() => {
- fs.writeFileSync('run.done', 'error');
- })
-
-
-
-
-
-
- }
- , 'g': () => {
- if (processedArgs.h) {
-
- console.log('elxr g [modelname] => generate a model named [modelname]');
- console.log('elxr g => regenerate all known models');
- return
- }
-
-
-
-
- var g = {
- 'client': () => {
- console.info('Creating new ember client named : ' + processedArgs._[2]);
- nodeShellExec('cmd', ['/c', 'ember', 'new', processedArgs._[2]], {
- stdio: ['pipe', process.stdout, process.stderr],
- inherit: true,
- shell: true,
- cwd: path__default['default'].dirname(__dirname),
- env: env
- });
- },
-
- 'modelr': () => {
- var tasks = [
- () => {
- var p = nodeShellExec('"ember"', [
- 'g'
- , 'modelr'
- , processedArgs._[2]], {
- inherit: true, shell: true, env: process.env
- }).then(() => {
- console.log('Blueprint generation complete for : ' + processedArgs._[2]);
- return true;
- }).catch((e) => { console.error(e); });
- return p;
- },
- () => {
- var chromePrefsFile = "C:\\chess\\instances\\elixir_01\\data\\Google\\Chrome\\User Data\\chess\\Preferences";
- var chromeprefs = fs.readFileSync(chromePrefsFile, { encoding: 'utf8' });
- chromeprefs = JSON.parse(chromeprefs);
- var previous = chromeprefs.download.default_directory;
- var parentDir = path__default['default'].dirname(__dirname);
- chromeprefs.download.default_directory = parentDir + "\\client\\app\\templates\\components\\resource";
- fs.writeFileSync(chromePrefsFile, JSON.stringify(chromeprefs));
-
-
- var p = nodeShellExec('"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"', [
- '--user-data-dir="C:\\chess\\instances\\elixir_01\\data\\Google\\Chrome\\User Data"'
- , '--profile-directory="chess"'
- , 'http://localhost:4200/admin/crud/create/' + processedArgs._[2]], {
- inherit: true, shell: true
- , env: process.env
- }).then(() => {
- chromeprefs.download.default_directory = previous;
- fs.writeFileSync(chromePrefsFile, JSON.stringify(chromeprefs));
- return true;
- }).catch((e) => { console.error(e); });
- return p;
- }
- ,
- () => {
- console.log('Browser process should have closed here....');
- return true;
- }
- ];
- any(tasks);
-
- }
-
- };
-
- g[processedArgs._[1]]();
- }
- };
-
-
- var cliname = 'elxr';
- var ver = '1.1';
- var help = `# list of commands... please refer dveloper documentation for ${cliname}
- ${
- // util.inspect(
- [Object.keys(op)]
- // )
- }
- `;
-
- var elxr = {
- help() {
- return source.cyanBright(`
- -------------------------------------------------------------------------------
- *** BBH Elixir ***
- -------------------------------------------------------------------------------
- elxr ${ver}
- A cli tool for chess
- ${help}
- -------------------------------------------------------------------------------
- `)
- }
- , info() {
- return source.cyanBright(`
- -------------------------------------------------------------------------------
- *** BBH Elixir ***
- -------------------------------------------------------------------------------
- elxr ${ver}
- A cli tool for chess
- -------------------------------------------------------------------------------
- `)
- }
- , getpulltask(def){
-
- def = def || {
- requiresElevation : true,
- reqularRepos : gitRepos,
- elevatedRepos : elevatedRunasRepos
- };
- console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`);
- console.dir(def);
-
- Object.assign({}, process.env);
- console.log('Running exlr pull : ' + path__default['default'].dirname(__dirname));
-
- processedArgs.useGitPull || false;
-
- if(def.elevatedRepos || def.reqularRepos) {
- if(def.elevatedRepos) def.requiresElevation = true;
- else delete def.requiresElevation;
- }
- else {
- if(def.requiresElevation) def.elevatedRepos = [def];
- else def.reqularRepos = [def];
- }
-
- var elevatedpulltasks = null;
- var regularpulltasks = function(){ return Promise.resolve(true) };
- if(def.elevatedRepos){
- elevatedpulltasks = function() {
- return any(def.elevatedRepos.map((def) => performPull(def.repo))).then(() => {
-
- return true;
- }).catch((e) => {
- console.error(e);
- fs.writeFileSync('run.done', 'error');
- })
- };
- }
- if(def.reqularRepos) {
- var regularpulltasks = function(){
- var pendingpulls = [];
- def.reqularRepos.forEach((def) => { pendingpulls.push(performPull(def.repo)); });
- return Promise.all(pendingpulls).finally(Traq.finally)
- };
- }
- if(elevatedpulltasks) return getTaskWithElevation( { elevatedpulltasks, regularpulltasks} )
- else return getTaskWithoutElevation({ regularpulltasks})
- }
- };
-
-
- function elxrworker() {
-
- gitRepos = repomanifest.repos;
-
-
-
- elevatedRunasRepos = repomanifest.elevated;
-
- exludeMergeRepos = repomanifest.exludeMergeRepos;
-
- Object.assign({}, process.env);
- var __runcmd = function (label) {
- return op[label] ? op[label]() : null;
- };
-
-
- if (processedArgs.runas) {
-
- return __runcmd('runas')
- }
- else return __runcmd(processedArgs.label || processedArgs._[0] || 'h');
- }
-
- var getManifest = function () {
-
-
-
-
- return repomanifest = selectedinstance;
- };
-
- function acquireChoices(selectedinstance) {
- console.warn(source.yellow(`
- -------------------------------------------------------------------------------
- Warning : Cannot locate your preferred configuration since it was not specified
- You should fork the default chess configuration to customize and make it
- your own instance with a named config as
- {{yourowninstancename}}-config-{{yourcurrentenvironment}}
- And then run this tool as follows
- NODE_ENV={{yourenvironment}} elxr i {{yourowninstancename}}
- OR
- Run this tool with the following command to use a quick start default.
- node elxr --default
- OR
- Choose the the option to create a new instance for you interactively.
-
- We will run your choice of default or create your own at the next prompt.
- -------------------------------------------------------------------------------
- `));
- var prompt = cliverse.prompter;
- return prompt.ask(`Choose an option :
- d) Install the default chess instance.
- => elxr i chess node_env=development --default
- n) Create your custom new instance interactively
- => elxr i {{instanceName}} node_env={{environment}}
- i) Choose an instance and environment to install
- => elxr i {{instanceName}} node_env={{environment}}
- c) Choose a command to run ( pull, use, i, npmi ... ) <= pull
- => elxr {{cmd}} {{instanceName}} node_env={{environment}}
- h) Help
- q) Quit
- Default <= d
- : `).then((choice) => {
- prompt.close();
- if (choice && choice === 'd' || !choice) {
- processedArgs._[0] = 'i';
- selectedinstance.instanceName = processedArgs._[1] = processedArgs._[1] || 'chess';
- selectedinstance.node_env = processedArgs.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env || 'development';
- selectedinstance.reposerver = 'https://git.bbh.org.in';
- getManifest();
-
- }
- else if (choice === 'h') {
- processedArgs._[0] = 'h';
- fs.writeFileSync('run.done', 'noop help');
- console.log(elxr.help()); process.exit();
- }
- else if (choice === 'n' || choice === 'i') {
- var p1 = cliverse.prompter;
- return p1.ask(`Enter Instance Name ( <= ${selectedinstance.instanceName} ) : `).then(function (instanceName) {
- processedArgs._[0] = 'i';
- selectedinstance.instanceName = processedArgs._[1] = instanceName || selectedinstance.instanceName;
- return p1.ask(`Enter Environment ( <= ${selectedinstance.node_env} ) : `).then(function (node_env) {
- selectedinstance.node_env = processedArgs.node_env = node_env || selectedinstance.node_env;
- if (choice === 'n') {
- selectedinstance.reposerver = 'https://git.bbh.org.in';
- console.warn(
- source.magenta('No Option Available. Your account may not have privileges. You can request here http://git.bbh.org.in/chess'));
- process.exit();
- }
-
- return p1.ask(`Enter preferred repo server ( <= ${selectedinstance.reposerver || selectedinstance.reposervers[0]} ) : `).then(function (reposerver) {
- p1.close();
- selectedinstance.reposerver = reposerver || selectedinstance.reposervers[0] || 'https://git.bbh.org.in';
- })
- })
- })
- } else if (choice === 'c') {
- var p1 = cliverse.prompter;
- return p1.ask(`Enter Instance Name ( <= ${selectedinstance.instanceName} ) : `).then(function (instanceName) {
- selectedinstance.instanceName = processedArgs._[1] = instanceName || selectedinstance.instanceName;
- return p1.ask(`Enter Environment ( <= ${selectedinstance.node_env} ) : `).then(function (node_env) {
- selectedinstance.node_env = processedArgs.node_env = node_env || selectedinstance.node_env;
- return p1.ask(`Enter cmd :
- p) pull
- Default <= p
- : `).then(function (cmd) {
- if (!cmd || cmd === 'p') {
- processedArgs._[0] = 'pull';
- }
- else processedArgs._[0] = cmd;
- return p1.ask(`Enter preferred repo server ( <= ${selectedinstance.reposerver || selectedinstance.reposervers[0]} ) : `).then(function (reposerver) {
- selectedinstance.reposerver = reposerver || selectedinstance.reposervers[0] || 'https://git.bbh.org.in';
- p1.close();
- })
- })
- })
- })
- } else {
- console.log(source.gray(`Default option not exercised. Please follow manual instructions to customize your instance here http://git.bbh.org.in/chess and try again.`));
- fs.writeFileSync('run.log', ', ' + JSON.stringify({ success: 'quit without execution' }), { 'flag': 'a+' });
- fs.writeFileSync('run.done', 'noop quit');
- process.exit();
- }
- })
- }
-
- var acquireConfig = function (selected, chessinstances) {
-
- var configrepo = selected.instanceName + '-config-' + selected.node_env;
-
- return performPull(configrepo).then(() => {
- var manifestpath = path__default['default'].normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest');
- repomanifest = commonjsRequire(manifestpath,"/$$rollup_base$$")();
- chessinstances = chessinstances || {};
- chessinstances[selected.instanceName] = chessinstances[selected.instanceName] || {};
- chessinstances[selected.instanceName][selected.node_env] = chessinstances[selected.instanceName][selected.node_env] || {};
- chessinstances['current_run'] = { instanceName: selected.instanceName, node_env: selected.node_env };
-
- selectedinstance = bbhverse.assign(chessinstances[selected.instanceName][selected.node_env], selected, repomanifest);
- fs.writeFileSync(instanceroot + '/chessinstances.js', 'module.exports = ' + JSON.stringify(chessinstances, null, 2) + '', { 'flag': 'w' });
-
- selectedinstance.reposerver = selectedinstance.reposerver || selectedinstance.reposervers[0];
- ENV.NODE_ENV = selectedinstance.node_env;
- })
- .catch((e) => {
- console.error(e);
- console.error('Config acquisition failed.');
- })
- };
-
- var launchpath = process.cwd().replace(/\\/, '/');
- var thisscriptdir = __dirname;
- var instanceroot = launchpath;
- var detectInstance = function () {
- console.log(`launchpath = ${launchpath}`);
- console.log(`thisscriptdir = ${thisscriptdir}`);
-
- var root = launchpath;
-
-
- if ((launchpath + path__default['default'].normalize('/elxr')) === thisscriptdir) {
-
- console.log(`Instance Path : ${root}`);
- }
- else {
- if (launchpath === thisscriptdir) {
-
-
- if (BUILD_VERSION.indexOf('Version: {version} - built on {date}') > -1) {
-
- root = path__default['default'].normalize(launchpath + '/..');
- }
- else {
-
-
- if (fs.existsSync(launchpath + '/..' + path__default['default'].normalize('/elxr'))) {
-
- root = path__default['default'].normalize(launchpath + '/..');
- }
- else {
-
-
- root = path__default['default'].normalize(launchpath + '/' + processedArgs._[1] + '/' + processedArgs.node_env);
- }
- }
- }
- }
- instanceroot = root.replace(/\\/, '/');
- __default.root = root;
- return Promise.resolve(__default);
- };
-
-
- var __default = {
-
-
-
- reposervers: ['https://git.bbh.org.in']
- , repos: [
- 'setup'
- , 'elxr'
- , 'loopback-connector-mysql'
- , 'loopback-jsonapi-model-serializer'
- , 'loopback-component-jsonapi'
- , 'ember-service-worker'
- , 'ember-service-worker-asset-cache'
- , 'ember-service-worker-cache-fallback'
- , 'ember-service-worker-index'
- , 'ember-sw-client-route'
- ]
-
- , elevated: []
- , exludeMergeRepos: {}
- , instanceName: 'chess'
-
- , node_env: 'development'
- };
-
- var __interactve_promts = {
- get reposerver(){
- return cliverse.prompt(this.reposervers, 'git default repo').then(reposerver => {
- Object.defineProperty(this, 'reposerver', {
- value: reposerver,
- writable: false,
- configurable : true
- });
- return reposerver
- })
- }
- , set reposerver(reposerver){
- Object.defineProperty(this, 'reposerver', {
- value: reposerver,
- writable: false,
- configurable : true
- });
- return reposerver
- }
- };
-
- var downloadsdir = '../Downloads';
- var prerequisites = [
- {
- shellcmd: 'git',
- url: 'https://github.com/git-for-windows/git/releases/download/v2.31.0.windows.1/Git-2.31.0-64-bit.exe'
- , installer: 'Git-2.31.0-64-bit.exe'
- , installcmd: ['cmd', ['/c', 'start',
- '/WAIT', path__default['default'].resolve(downloadsdir + '/' + 'Git-2.31.0-64-bit.exe')
- , '/VERYSILENT'
-
- ]]
- , preinstallsteps: function() {
- var prompt = cliverse.prompter;
- var steps = [
- () => {
- if (!existsSync(downloadsdir + '/' + this.installer)) {
- return nodeShellExec(`${selectedinstance.root}/.elxr/run-${runtimestamp}/download.bat`, [this.url, downloadsdir + '/' + this.installer])
- }
- else return Promise.resolve(true)
- }
- ];
- var prompts = [
- () => prompt.ask(`git user name : ( <= ${gitUser} )`).then((user) => { gitUser = user; })
- , () => prompt.ask(`git email : ( <= ${gitEmail} )`).then((email) => { gitEmail = email; })
- ];
- return any([any(steps), any(prompts)]).then(() => { prompt.close(); })
- }
- , installsteps: function () {
- return any([this.installcmd].map(callsheltask))
- }
- , postinstallsteps: function(){
-
- cliverse.prompter;
-
- var gitUser = 'guest';
- var gitEmail = 'guest@bbh.org.in';
- var prompts = [];
- prompts.push(
- ()=>{
- var choices = { 0 : 'guest', 1 : 'chessdemo' };
- return cliverse.prompt(choices, 'git user name').then(gituser => gitUser = gituser)
- }
- );
-
- prompts.push(
- ()=>{
- var choices = { 0 : 'guest@bbh.org.in', 1 : 'chessdemo@bbh.org.in' };
- return cliverse.prompt(choices, 'git user email').then(gitemail => gitEmail = gitemail)
- }
- );
-
- return any(prompts).then(()=>{
- var steps = [
- ['git', ['config', '--global', '--add', 'user.name', `${gitUser}`]]
- , ['git', ['config', '--global', '--add', 'user.email', `${gitEmail}`]]
- ];
- return any(steps.map(callsheltask)).then(() => {
-
- })
- });
- }
- , install: function () {
- return any([ this.installsteps.bind(this), this.postinstallsteps.bind(this)])
- }
- , verifyAndInstall : function(){
- return getTaskCheckExists(this.shellcmd, { ignorefailures: true })().then((exists) => {
- if(exists) {
-
- return this.getUser(null, this.postinstallsteps.bind(this))
- }
- return this.install();
- });
- }
- , getUser : function(repo, onNoResult){
-
-
- onNoResult = onNoResult || function(){return false};
- var globalOrLocal = '--global';
- if(!repo) globalOrLocal = '--global';
- else globalOrLocal = '--local';
-
- return any([['git', ['config', globalOrLocal, '--get-all', 'user.name']]].map(callsheltask)).then((result)=>{
-
- if(!result.success) return onNoResult()
- else {
- var users = result.messages[0].trim().split('\n');
- if(users.length === 0 ||
- users.length === 1 && users[0] === 'guest') {
-
- return onNoResult()
- }
- else return users[0];
- }
- })
- .catch((e)=>{
- console.log(e);
- return onNoResult()
- })
- }
- }
- ,
- {
- shellcmd: 'node',
- url: 'https://nodejs.org/dist/v14.16.0/node-v14.16.0-x64.msi'
- , installer: 'node-v14.16.0-x64.msi'
- , installcmd: ['MSIEXEC.exe', ['/i'
- , path__default['default'].resolve(downloadsdir + '/' + 'node-v14.16.0-x64.msi')
- , 'ACCEPT=YES', '/passive']]
- , install : function() { return any([this.installcmd].map(callsheltask)).then(() => { }) }
- }
- ];
-
- prerequisites.forEach(p=>{ prerequisites[p.shellcmd] = p; });
-
- function ensureDirectoryExistence(filePath) {
- var dirname = path__default['default'].dirname(filePath);
- if (fs.existsSync(dirname)) {
- return filePath;
- }
- ensureDirectoryExistence(dirname);
- fs.mkdirSync(dirname);
- return filePath;
- }
-
- var mainTasks = [];
- function verifyAndInstallPrerequisites() {
- fs.writeFileSync(ensureDirectoryExistence(path__default['default'].normalize(`${selectedinstance.root}/${downloadsdir}/readme.txt`)), `${getVersion()} Your local downloads for this instance`);
-
-
- var downloadbatch =
- `::**************************************************************************
- :Download_ <url> <File>
- Powershell.exe ^
- $AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'; ^
- [System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols; ^
- (New-Object System.Net.WebClient).DownloadFile('%1','%2')
- exit /b
- ::**************************************************************************`;
- fs.writeFileSync(`${selectedinstance.root}/.elxr/run-${runtimestamp}/download.bat`, downloadbatch);
-
-
- var windowselevate =
- `
- <html><HTA:APPLICATION ID="windowselevate" icon="#"/>
- <script language="vbscript">
- document.title = "elxr control panel"
- self.ResizeTo 200,600
-
- Sub Window_Onload
- self.MoveTo (screen.availWidth - (document.body.clientWidth + 40)),10
- End Sub
-
- Set objShell = CreateObject("WScript.Shell")
- Set objENV = objShell.Environment("Process")
- dim NODE_ENV
- NODE_ENV = objENV("NODE_ENV")
- </script>
-
- <script language="javascript">
- //WINDOWSTATE="minimize" SHOWINTASKBAR="no" SYSMENU="no" CAPTION="no"
- // https://devblogs.microsoft.com/scripting/how-can-i-pass-command-line-variables-to-an-hta-when-it-starts/
- // alert(windowselevate.commandLine)
- var args = windowselevate.commandLine.split('"').slice(3);
- // alert(args)
- var processedArgs = { _ : [] }
- var namedArgs = [];
- for(var item in args){
- if(args[item].charAt(0) === '-'){
- namedArgs.push(args[item])
- var split = args[item].split('=');
- processedArgs[split[0].slice(2)] = split[1] || true;
- }
- else processedArgs._.push(args[item]);
- }
- // args = args.forEach(function(item){ })
- // alert('processedArgs._ : ' + processedArgs._);
- // alert(processedArgs.runas);
-
- // PB : TODO -- Convert all the cli args back to string.
- var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' elxr ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' ');
- // alert(cargs)
- var shell = new ActiveXObject('shell.application');
- // alert('launching node privilged. ' + processedArgs['nodepath'])
- // shell.ShellExecute('where', 'node', '', '', 10);
- shell.ShellExecute('node', cargs, '', 'runas', 1);
- // shell.ShellExecute(processedArgs['nodepath'], cargs, '', 'runas', 1);
- var fso = new ActiveXObject('Scripting.FileSystemObject');
-
- window.onload = function() {
- document.body.style.backgroundColor = 'black';
- document.body.style.fontFamily = 'arial';
- var log = document.createElement('div');
- log.innerHTML='Please Wait';
- function l(msg){ log.innerHTML+= msg; };
- log.style.color = 'blue';
- log.style.width = '95%';
- log.id = 'log';
- document.body.appendChild(log);
-
- l('<Br/>Current config : ')
- l('<Br/>NODE_ENV = ' + NODE_ENV)
- l('<Br/>cmd = ' + processedArgs._[0])
- processedArgs._[1] === 'use' ? l('<Br/>using = ' + processedArgs._[2]) : null;
- l('<Br/><Br/>')
-
- var timer = function(){
- l('.');
- if(fso.FileExists("run.done")) close();
- else window.setTimeout(timer, 1000);
- };
- window.setTimeout(timer, 3000);
- };
-
- </script>
- </html>
-
- `;
- fs.writeFileSync(`${selectedinstance.root}/.elxr/run-${runtimestamp}/windowselevate.hta`, windowselevate);
-
- var downloadtasks = [];
- var installtasks = [];
- prerequisites.forEach(preq => {
- downloadtasks.push(getTaskCheckExists(preq.shellcmd, { ignorefailures: true })().then((exists) => {
- if (exists) console.log(`${preq.shellcmd} exists`);
- else {
- console.log(`${preq.shellcmd} is not installed`);
- return preq.preinstallsteps.call(preq).then(() => {
- installtasks.push(preq.install.bind(preq));
- })
- }
- }));
- });
- return Promise.all(downloadtasks).then(() => { return any(installtasks) })
- }
-
-
-
- var selectedinstance = null;
- var chessinstances = { current_run : {} };
- acquireElevationState().then(() => {
- var clioverrides = { };
- function initinstances(chessinstances, selected) {
- chessinstances.current_run.instanceName = processedArgs._[1] = processedArgs._[1] || chessinstances.current_run.instanceName || selected.instanceName;
- chessinstances.current_run.node_env = processedArgs.node_env = processedArgs.node_env || chessinstances.current_run.node_env || selected.node_env;
- chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {};
-
-
-
- selectedinstance = Object.assign(
- selected
- , chessinstances[chessinstances.current_run.instanceName][chessinstances.current_run.node_env]
- , clioverrides
-
- );
- repomanifest = selectedinstance;
- return chessinstances
- }
- function acquirelocalinstances(selected){
- var chessinstances = bbhverse.assign(commonjsRequire(path__default['default'].normalize(selected.root + '/chessinstances.js'),"/$$rollup_base$$"));
- return chessinstances
- }
-
- var maintask = () => {
-
-
- processedArgs._[0] === processedArgs._[0] || 'pull';
-
-
- return prerequisites.git.verifyAndInstall().then(()=>{
- return acquireConfig(selectedinstance, chessinstances).catch((err) => {
- console.error('Chosen cofiguraton failed or not found. Fix config and rerun or chose another.');
- console.error(err);
- }).then(() => { return elxrworker() })
-
-
-
-
-
- })
- };
-
- const retaincount = 2;
- var min = runtimestamp;
- var collect = [];
-
-
- return detectInstance().then((detectedInstance)=>{
-
- processedArgs._[1] ? clioverrides.instanceName = processedArgs._[1]: null;
- processedArgs.node_env ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env
- : (process.env.NODE_ENV && process.env.NODE_ENV.trim()) ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()): null;
-
- selectedinstance = Object.assign(detectedInstance, clioverrides);
- var todo = Promise.resolve(true);
- try {
- chessinstances = acquirelocalinstances(selectedinstance);
- initinstances(chessinstances, selectedinstance);
- }
- catch (e) {
- console.error(e);
-
- initinstances(chessinstances, selectedinstance);
-
- var prompts = [];
- Object.keys(__interactve_promts).forEach(k => {
- if(!selectedinstance[k]) {
- prompts.push(async ()=>{
- Object.defineProperty(selectedinstance, k, Object.getOwnPropertyDescriptor(__interactve_promts, k));
- return await selectedinstance[k]
- });
- }
- });
-
- todo = any(prompts).then(()=>{ return selectedinstance });
-
- if(!processedArgs._[0] || !selectedinstance.node_env || !selectedinstance.instanceName){
-
- todo = acquireChoices(selectedinstance);
- }
-
- todo = todo.then(() => {
- try {
- chessinstances = acquirelocalinstances(selectedinstance);
- initinstances(chessinstances, selectedinstance);
- }
- catch (e) {
- console.error(e);
- console.log('No local instances config found in current root = ' + selectedinstance.root);
- console.log('A config will be createed with the instance and environment chosen...');
-
-
-
-
- return selectedinstance
- }
- });
- }
-
- return todo
- })
- .then(()=>{
-
- if(!__isElevated) {
- ensureDirectoryExistence(`${selectedinstance.root}/.elxr/readme.txt`);
-
- return dirs( (dir)=>{
- var matches = /run-(.*)/gm.exec(dir.name);
- if(matches) {
- if(+(matches[1]) < min) {
- min = matches[1];
- collect.splice( 0, 0, matches[1] );
- }
- else collect.push(matches[1]);
- }
-
- }, `${selectedinstance.root}/.elxr` ).then(()=>{
-
- if(collect.length > retaincount) {
-
- var asyncs = [];
- while((collect.length - asyncs.length) > retaincount) {
- asyncs.push(getShellTask('rm',['-rf', `run-${collect[asyncs.length]}`], { cwd : `${selectedinstance.root}/.elxr` })());
- }
- return Promise.all(asyncs)
- }
- else return true
- })
- }
- else return true;
- })
- .then(()=>{
-
-
- ensureDirectoryExistence(`${selectedinstance.root}/.elxr/run-${runtimestamp}/download.bat`);
-
- if (!__isElevated) mainTasks.push(verifyAndInstallPrerequisites);
- mainTasks.push(maintask);
- return any(mainTasks);
- })
- });
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var elxr_1 = {
-
- };
-
- module.exports = elxr_1;
|